Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix animatable loop #13196

Merged
merged 9 commits into from
Nov 3, 2022
8 changes: 8 additions & 0 deletions packages/dev/core/src/Animations/animatable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ export class Animatable {
animation._prepareForSpeedRatioChange(value);
}
this._speedRatio = value;

// Resync _manualJumpDelay in case goToFrame was called before speedRatio was set.
const runtimeAnimations = this._runtimeAnimations;
if (runtimeAnimations[0] && this._frameToSyncFromJump !== null) {
const fps = runtimeAnimations[0].animation.framePerSecond;
const delay = this.speedRatio === 0 ? 0 : (((runtimeAnimations[0].currentFrame - this._frameToSyncFromJump) / fps) * 1000) / this.speedRatio;
sebavan marked this conversation as resolved.
Show resolved Hide resolved
this._manualJumpDelay = -delay;
}
}

/**
Expand Down