Skip to content

Commit

Permalink
chore: 竞速动画添加数字变化动画示例 (#1926)
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Feb 21, 2024
1 parent dbfb0ed commit 4d17404
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/f2/test/timeline/interval.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ describe('Chart', () => {
textAlign: 'start',
textBaseline: 'middle',
}}
animation={{
update: {
easing: 'linear',
duration: 450,
property: ['x', 'y'],
onFrame(t, animationContext) {
const { start, end } = animationContext;
const startText = parseInt(start.text);
const endText = parseInt(end.text);
return {
text: `${(startText + (endText - startText) * t).toFixed(0)}`,
};
},
},
}}
/>
);
})}
Expand Down

0 comments on commit 4d17404

Please sign in to comment.