- override
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.
Source
@override bool advanceTime(num time) { if (_play == false) return true; if (_frameTime == null) { _frameTime = 0.0; this.dispatchEvent(_progressEvent); } else { _frameTime += time; while (_play) { var frameDuration = _frameDurations[_currentFrame]; if (frameDuration > _frameTime) break; var lastFrame = this.totalFrames - 1; var prevFrame = _currentFrame; var nextFrame = _currentFrame + 1; if (nextFrame > lastFrame) nextFrame = loop ? 0 : lastFrame; _currentFrame = nextFrame; _frameTime -= frameDuration; // dispatch progress event on every new frame if (nextFrame != prevFrame) { this.dispatchEvent(_progressEvent); if (_currentFrame != nextFrame) return true; } // dispatch complete event only on last frame if (!loop && nextFrame == lastFrame && nextFrame != prevFrame) { this.dispatchEvent(_completeEvent); if (_currentFrame != nextFrame) return true; } } } return true; }