advance method
Advances this controller's internal clock by dt
seconds.
If the controller is still running, the return value will be 0. If it
already finished, then the return value will be the "leftover" part of
the dt
. That is, the amount of time dt
that remains after the
controller has finished. In all cases, the return value can be positive
only when completed == true
.
Normally, this method will be called by the owner of the controller class. For example, if the controller is passed to an Effect class, then that class will take care of calling this method as necessary.
Implementation
@override
double advance(double dt) {
var t = child.advance(dt);
while (t > 0 && _remainingCount > 0) {
assert(child.completed);
_remainingCount--;
if (_remainingCount != 0) {
child.setToStart();
t = child.advance(t);
}
}
if (_remainingCount == 1 && child.completed) {
_remainingCount--;
}
return t;
}