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.

This commit is contained in:
Richard Davey 2020-09-04 13:06:00 +01:00
parent cebd1d0101
commit 66f4ab69e7

View file

@ -197,8 +197,11 @@ var Animation = new Class({
this.calculateDuration(this, this.getTotalFrames(), this.duration, this.frameRate);
this.manager.on(Events.PAUSE_ALL, this.pause, this);
this.manager.on(Events.RESUME_ALL, this.resume, this);
if (this.manager.on)
{
this.manager.on(Events.PAUSE_ALL, this.pause, this);
this.manager.on(Events.RESUME_ALL, this.resume, this);
}
},
/**
@ -619,7 +622,6 @@ var Animation = new Class({
if (frame.isFirst)
{
// We're at the start of the animation
if (component.yoyo)
{
this.handleYoyoFrame(component, true);
@ -628,8 +630,6 @@ var Animation = new Class({
{
if (component.inReverse && !component.forward)
{
component.currentFrame = this.getLastFrame();
this.repeatAnimation(component);
}
else
@ -896,8 +896,11 @@ var Animation = new Class({
{
this.removeAllListeners();
this.manager.off(Events.PAUSE_ALL, this.pause, this);
this.manager.off(Events.RESUME_ALL, this.resume, this);
if (this.manager.off)
{
this.manager.off(Events.PAUSE_ALL, this.pause, this);
this.manager.off(Events.RESUME_ALL, this.resume, this);
}
this.manager.remove(this.key);