Skip to content

Commit

Permalink
fix: 初始time不生效 (#273)
Browse files Browse the repository at this point in the history
Co-authored-by: xuying.xu <[email protected]>
  • Loading branch information
tangying1027 and xuying.xu authored Jun 28, 2024
1 parent 9128cfa commit 6d6484f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 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 @@ -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);
Expand All @@ -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() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions packages/f-engine/test/timeline/player.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,35 @@ describe('clip animation', () => {
await delay(100);
expect(context).toMatchImageSnapshot();
});

it('暂停', async () => {
const context = createContext('暂停');

const { props } = (
<Canvas context={context}>
<Player
state="pause"
goTo={200}
keyFrames={[
{
view: {
to: {
visible: true,
},
duration: 1000,
},
},
]}
>
<View key={'view'} visible={false} />
</Player>
</Canvas>
);

const canvas = new Canvas(props);
await canvas.render();
await delay(100);

expect(context).toMatchImageSnapshot();
});
});

0 comments on commit 6d6484f

Please sign in to comment.