advance method
void
advance(
- double deltaTime
)
Implementation
void advance(double deltaTime) {
if (!playing || deltaTime <= 0) {
return;
}
deltaTime *= playbackTimeScale;
_playbackTime += deltaTime;
// Handle looping behavior.
if (_animation.endTime == 0) {
_playbackTime = 0;
return;
}
if (!loop && (_playbackTime < 0 || _playbackTime > _animation.endTime)) {
// If looping is disabled, clamp to the end (or beginning, if playing in
// reverse) and pause.
pause();
_playbackTime = clampDouble(_playbackTime, 0, _animation.endTime);
} else if ( /* loop && */ _playbackTime > _animation.endTime) {
// If looping is enabled and we ran off the end, loop to the beginning.
_playbackTime = _playbackTime.abs() % _animation.endTime;
} else if ( /* loop && */ _playbackTime < 0) {
// If looping is enabled and we ran off the beginning, loop to the end.
_playbackTime =
_animation.endTime - (_playbackTime.abs() % _animation.endTime);
}
}