Skip to content

Commit 52fcf7e

Browse files
authored
Merge pull request phaserjs#3557 from Antriel/master
Fix Animation component update()
2 parents 8000f92 + b52707f commit 52fcf7e

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

src/gameobjects/components/Animation.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -817,25 +817,27 @@ var Animation = new Class({
817817
*/
818818
update: function (timestamp, delta)
819819
{
820-
if (this.currentAnim && (this.isPlaying || !this.currentAnim.paused))
820+
if (!this.currentAnim || !this.isPlaying || this.currentAnim.paused)
821821
{
822-
this.accumulator += delta * this._timeScale;
822+
return;
823+
}
823824

824-
if (this._pendingStop === 1)
825-
{
826-
this._pendingStopValue -= delta;
825+
this.accumulator += delta * this._timeScale;
827826

828-
if (this._pendingStopValue <= 0)
829-
{
830-
return this.currentAnim.completeAnimation(this);
831-
}
832-
}
827+
if (this._pendingStop === 1)
828+
{
829+
this._pendingStopValue -= delta;
833830

834-
if (this.accumulator >= this.nextTick)
831+
if (this._pendingStopValue <= 0)
835832
{
836-
this.currentAnim.setFrame(this);
833+
return this.currentAnim.completeAnimation(this);
837834
}
838835
}
836+
837+
if (this.accumulator >= this.nextTick)
838+
{
839+
this.currentAnim.setFrame(this);
840+
}
839841
},
840842

841843
/**

0 commit comments

Comments
 (0)