Skip to content

Commit

Permalink
Merge pull request #13196 from sebavan/master
Browse files Browse the repository at this point in the history
Fix animatable loop
  • Loading branch information
sebavan authored Nov 3, 2022
2 parents 8e0e555 + 11b185c commit eebb704
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/dev/core/src/Animations/animatable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class Animatable {
private _weight = -1.0;
private _syncRoot: Nullable<Animatable> = null;
private _frameToSyncFromJump: Nullable<number> = null;
private _goToFrame: Nullable<number> = null;

/**
* Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.
Expand Down Expand Up @@ -96,6 +97,11 @@ export class Animatable {
animation._prepareForSpeedRatioChange(value);
}
this._speedRatio = value;

// Resync _manualJumpDelay in case goToFrame was called before speedRatio was set.
if (this._goToFrame !== null) {
this.goToFrame(this._goToFrame);
}
}

/**
Expand Down Expand Up @@ -281,6 +287,8 @@ export class Animatable {
for (let index = 0; index < runtimeAnimations.length; index++) {
runtimeAnimations[index].goToFrame(frame);
}

this._goToFrame = frame;
}

/**
Expand Down Expand Up @@ -398,6 +406,8 @@ export class Animatable {
this._frameToSyncFromJump = null;
}

this._goToFrame = null;

if (this._weight === 0) {
// We consider that an animation with a weight === 0 is "actively" paused
return true;
Expand Down

0 comments on commit eebb704

Please sign in to comment.