Skip to content

Commit 66f4ab6

Browse files
committed
When playing an animation in reverse, if it reached the first frame and had to repeat, it would then jump to the frame before the final frame and carry on, skipping out the final frame.
1 parent cebd1d0 commit 66f4ab6

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/animations/Animation.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,11 @@ var Animation = new Class({
197197

198198
this.calculateDuration(this, this.getTotalFrames(), this.duration, this.frameRate);
199199

200-
this.manager.on(Events.PAUSE_ALL, this.pause, this);
201-
this.manager.on(Events.RESUME_ALL, this.resume, this);
200+
if (this.manager.on)
201+
{
202+
this.manager.on(Events.PAUSE_ALL, this.pause, this);
203+
this.manager.on(Events.RESUME_ALL, this.resume, this);
204+
}
202205
},
203206

204207
/**
@@ -619,7 +622,6 @@ var Animation = new Class({
619622
if (frame.isFirst)
620623
{
621624
// We're at the start of the animation
622-
623625
if (component.yoyo)
624626
{
625627
this.handleYoyoFrame(component, true);
@@ -628,8 +630,6 @@ var Animation = new Class({
628630
{
629631
if (component.inReverse && !component.forward)
630632
{
631-
component.currentFrame = this.getLastFrame();
632-
633633
this.repeatAnimation(component);
634634
}
635635
else
@@ -896,8 +896,11 @@ var Animation = new Class({
896896
{
897897
this.removeAllListeners();
898898

899-
this.manager.off(Events.PAUSE_ALL, this.pause, this);
900-
this.manager.off(Events.RESUME_ALL, this.resume, this);
899+
if (this.manager.off)
900+
{
901+
this.manager.off(Events.PAUSE_ALL, this.pause, this);
902+
this.manager.off(Events.RESUME_ALL, this.resume, this);
903+
}
901904

902905
this.manager.remove(this.key);
903906

0 commit comments

Comments
 (0)