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

Animations goToFrame: Fix breaking change introduced in #15126 #15818

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/dev/core/src/Animations/animatable.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,9 @@ export class Animatable {
/**
* Jump directly to a given frame
* @param frame defines the frame to jump to
* @param useWeight defines whether the animation weight should be applied to the image to be jumped to (false by default)
*/
public goToFrame(frame: number): void {
public goToFrame(frame: number, useWeight = false): void {
const runtimeAnimations = this._runtimeAnimations;

if (runtimeAnimations[0]) {
Expand All @@ -295,7 +296,7 @@ export class Animatable {
}

for (let index = 0; index < runtimeAnimations.length; index++) {
runtimeAnimations[index].goToFrame(frame, this._weight);
runtimeAnimations[index].goToFrame(frame, useWeight ? this._weight : -1);
}

this._goToFrame = frame;
Expand Down
5 changes: 3 additions & 2 deletions packages/dev/core/src/Animations/animationGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,16 +850,17 @@ export class AnimationGroup implements IDisposable {
/**
* Goes to a specific frame in this animation group. Note that the animation group must be in playing or paused status
* @param frame the frame number to go to
* @param useWeight defines whether the animation weight should be applied to the image to be jumped to (false by default)
* @returns the animationGroup
*/
public goToFrame(frame: number): AnimationGroup {
public goToFrame(frame: number, useWeight = false): AnimationGroup {
if (!this._isStarted) {
return this;
}

for (let index = 0; index < this._animatables.length; index++) {
const animatable = this._animatables[index];
animatable.goToFrame(frame);
animatable.goToFrame(frame, useWeight);
}

return this;
Expand Down