From 0b1c60b3e3a24d19175fa891667c789c868887e3 Mon Sep 17 00:00:00 2001 From: "xuying.xu" Date: Thu, 27 Jun 2024 21:10:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=9D=E5=A7=8Btime=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/f-engine/src/canvas/timeline.ts | 4 +- ...ation-\346\232\202\345\201\234-1-snap.png" | Bin 0 -> 2036 bytes .../f-engine/test/timeline/player.test.tsx | 85 ++++++++++++++++++ 3 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 "packages/f-engine/test/timeline/__image_snapshots__/player-test-tsx-clip-animation-\346\232\202\345\201\234-1-snap.png" 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 0000000000000000000000000000000000000000..8cb050ee59036ac6477c87e3bfeea363a3f04554 GIT binary patch literal 2036 zcmeAS@N?(olHy`uVBq!ia0y~yVAKJ!A9An($)cK$)eH>myFFbTLn`9lUfIaWU?{-s zxcmR2|IrZz3sPiGb3AkSZvEVv|NXpT`F+2=8W@g zao1}SL*vGVgHrMiwv0@%2NFuPJ(*aJF|lRWFnndki#K!RIh%}2&7!U`8y zdBV0&8Z`tQCU*+=S23}0q%by5UCF{J5CIINudH8$6(#@!X&ES_brUvR6TbiqX)%L{ znO+kZ8n-qajEZ-#XJm>zkdUh7$i#9D7}B+je@6`&4U^GyGMaZri-HkSJT}U&GYxoT U7kR}KSer9=y85}Sb4q9e0P^LdX#fBK literal 0 HcmV?d00001 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(); + }); });