recede method
Similar to advance()
, but makes the effect controller move back in time.
If the supplied amount of time dt
would push the effect past its
starting point, then the effect stops at the start and the "leftover"
portion of dt
is returned.
Implementation
@override
double recede(double dt) {
if (_remainingCount == 0 && dt > 0) {
// When advancing, we do not reset the child on last iteration. Hence,
// if we recede from the end position the remaining count must be
// adjusted.
_remainingCount = 1;
assert(child.completed);
}
var t = child.recede(dt);
while (t > 0 && _remainingCount < repeatCount) {
_remainingCount++;
child.setToEnd();
t = child.recede(t);
}
return t;
}