diff --git a/packages/f-engine/src/canvas/timeline.ts b/packages/f-engine/src/canvas/timeline.ts index ae9cace..32a575f 100644 --- a/packages/f-engine/src/canvas/timeline.ts +++ b/packages/f-engine/src/canvas/timeline.ts @@ -18,7 +18,7 @@ class Timeline extends EE { constructor(props) { super(); - const { animUnits, playState, root, speed = 1, goto } = props; + const { animUnits, playState, root, speed = 1, time } = props; this.animator = new Animator(); const rootShape = new Group(); this.animator.reset(rootShape); @@ -28,7 +28,7 @@ class Timeline extends EE { this.playState = playState; this.endFrame = animUnits.length - 1; this.speed = speed; - this.time = goto; + this.time = time; } start() { diff --git "a/packages/f-engine/test/timeline/__image_snapshots__/player-test-tsx-clip-animation-\346\232\202\345\201\234-1-snap.png" "b/packages/f-engine/test/timeline/__image_snapshots__/player-test-tsx-clip-animation-\346\232\202\345\201\234-1-snap.png" new file mode 100644 index 0000000..8cb050e Binary files /dev/null and "b/packages/f-engine/test/timeline/__image_snapshots__/player-test-tsx-clip-animation-\346\232\202\345\201\234-1-snap.png" differ diff --git a/packages/f-engine/test/timeline/player.test.tsx b/packages/f-engine/test/timeline/player.test.tsx index be86ca0..3301f2b 100644 --- a/packages/f-engine/test/timeline/player.test.tsx +++ b/packages/f-engine/test/timeline/player.test.tsx @@ -372,4 +372,89 @@ describe('clip animation', () => { expect(context).toMatchImageSnapshot(); }); + + it('跳转超出总时长', async () => { + const context = createContext('跳转超出总时长'); + + //结束后重播 + const { props } = ( + + + + + + ); + + const canvas = new Canvas(props); + await canvas.render(); + await delay(100); + + const { props: newProps } = ( + + + + + + ); + + await canvas.update(newProps); + await delay(100); + expect(context).toMatchImageSnapshot(); + }); + + it('暂停', async () => { + const context = createContext('暂停'); + + const { props } = ( + + + + + + ); + + const canvas = new Canvas(props); + await canvas.render(); + await delay(100); + + expect(context).toMatchImageSnapshot(); + }); });