Skip to content

Commit

Permalink
fix: animation set time 0
Browse files Browse the repository at this point in the history
  • Loading branch information
xuying.xu committed Jun 20, 2024
1 parent 69c2ba2 commit b3f2add
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/f-engine/src/canvas/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ class Timeline extends EE {
return this.playState;
}

updateState(nextProps) {
updateState(state) {
// 播放状态不同
const { state } = nextProps;
if (state === 'finish') {
this.frame = this.endFrame;
this.drawFrame();
this.animator.run();
}

this.playState = state;
this.setPlayState(state);
}
Expand Down
7 changes: 6 additions & 1 deletion packages/f-engine/src/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Player extends Component<PlayerProps> {

// state 更新
if (!isEqual(state, timeline.getPlayState())) {
timeline.updateState({ state });
timeline.updateState(state);
}

if (!isEqual(nextTime, lastTime)) {
Expand All @@ -118,6 +118,11 @@ class Player extends Component<PlayerProps> {
}
}

setPlayState(state) {
const { timeline } = this;
timeline.updateState(state);
}

goTo(time) {
const { timeline } = this;
timeline.goTo(time);
Expand Down

0 comments on commit b3f2add

Please sign in to comment.