advanceTime method
This method is called by the Juggler with the time
past since the last
call.
Returns true as long as this Animatable is not completed; false if it is completed.
Implementation
@override
bool advanceTime(num time) {
_elapsedTime += time;
_elapsedTimeChangedEvent.add(_elapsedTime);
// Call advanceTime of current animatables.
// Do not call advanceTime of newly added animatables.
_AnimatableLink? link = _firstAnimatableLink;
_AnimatableLink? lastLink = _lastAnimatableLink;
while (identical(link, lastLink) == false) {
final animatable = link?.animatable;
if (animatable == null) {
final nextLink = link?.nextAnimatableLink;
link?.animatable = nextLink?.animatable;
link?.nextAnimatableLink = nextLink?.nextAnimatableLink;
if (identical(nextLink, lastLink)) lastLink = link;
if (identical(nextLink, _lastAnimatableLink)) {
_lastAnimatableLink = link!;
}
} else if (animatable.advanceTime(time) == false) {
link?.animatable = null;
} else {
link = link?.nextAnimatableLink;
}
}
return true;
}