update method
Sets the motion 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 motion. Every
motion will always recieve a callback with the end time point (1.0),
unless it is cancelled.
Implementation
@override
void update(double t) {
int currentRepeat =
math.min((t * numRepeats.toDouble()).toInt(), numRepeats - 1);
for (int i = math.max(_lastFinishedRepeat, 0); i < currentRepeat; i++) {
if (!motion._finished) motion.update(1.0);
motion._reset();
}
_lastFinishedRepeat = currentRepeat;
double ta = (t * numRepeats.toDouble()) % 1.0;
motion.update(ta);
if (t >= 1.0) {
motion.update(1.0);
motion._finished = true;
}
}