Skip to content

Commit 80e80dd

Browse files
Make animation looping robust when skipping frames.
1 parent 29dbbca commit 80e80dd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/animation/Animation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ Phaser.Animation.prototype = {
208208
{
209209
if (this.looped)
210210
{
211-
this._frameIndex = this._frameIndex - this._frames.length;
211+
this._frameIndex = this._frameIndex %= this._frames.length;
212212
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
213213
this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);
214214
this._parent.events.onAnimationLoop.dispatch(this._parent, this);

0 commit comments

Comments
 (0)