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) {
if (t < _split) {
// Play first motion
double ta;
if (_split > 0.0) {
ta = (t / _split).clamp(0.0, 1.0);
} else {
ta = 1.0;
}
_updateWithCurve(_a, ta);
} else if (t >= 1.0) {
// Make sure everything is finished
if (!_a._finished) _finish(_a);
if (!_b._finished) _finish(_b);
} else {
// Play second motion, but first make sure the first has finished
if (!_a._finished) _finish(_a);
double tb;
if (_split < 1.0) {
tb = (1.0 - (1.0 - t) / (1.0 - _split)).clamp(0.0, 1.0);
} else {
tb = 1.0;
}
_updateWithCurve(_b, tb);
}
}