- override
Sets the action to a specific point in time. The t
value that is passed
in is a normalized value 0.0 to 1.0 of the duration of the action. Every
action will always recieve a callback with the end time point (1.0),
unless it is cancelled.
Source
@override void update(double t) { dynamic newVal; if (startVal is Point) { // Point double xStart = startVal.x; double yStart = startVal.y; double xDelta = _delta.x; double yDelta = _delta.y; newVal = new Point(xStart + xDelta * t, yStart + yDelta * t); } else if (startVal is Size) { // Size double wStart = startVal.width; double hStart = startVal.height; double wDelta = _delta.width; double hDelta = _delta.height; newVal = new Size(wStart + wDelta * t, hStart + hDelta * t); } else if (startVal is Rect) { // Rect double lStart = startVal.left; double tStart = startVal.top; double rStart = startVal.right; double bStart = startVal.bottom; double lDelta = _delta.left; double tDelta = _delta.top; double rDelta = _delta.right; double bDelta = _delta.bottom; newVal = new Rect.fromLTRB(lStart + lDelta * t, tStart + tDelta * t, rStart + rDelta * t, bStart + bDelta * t); } else if (startVal is double) { // Doubles newVal = startVal + _delta * t; } else if (startVal is Color) { // Colors int aNew = (startVal.alpha + (_delta.alpha * t).toInt()).clamp(0, 255); int rNew = (startVal.red + (_delta.red * t).toInt()).clamp(0, 255); int gNew = (startVal.green + (_delta.green * t).toInt()).clamp(0, 255); int bNew = (startVal.blue + (_delta.blue * t).toInt()).clamp(0, 255); newVal = new Color.fromARGB(aNew, rNew, gNew, bNew); } else { // Oopses assert(false); } setter(newVal); }