Skip to content

Commit

Permalink
fix: rename options of setAnimation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kmkzt committed Jun 23, 2020
1 parent 1f9cf34 commit 30ca1f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ export class SvgAnimation extends Renderer {
*/
public setAnimation(
fn: FrameAnimation,
{ frame, repeat }: { frame?: number; repeat?: number } = {}
{
frames,
repeatCount
}: { frames?: number; repeatCount?: number | string } = {}
): void {
this._anim = fn
this._framesNumber = frame
this._repeatCount = repeat ? `${repeat}` : 'indefinite'
this._framesNumber = frames
this._repeatCount = repeatCount ? `${repeatCount}` : 'indefinite'
}

public stop(): boolean {
Expand Down
6 changes: 3 additions & 3 deletions src/example/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ const Example = () => {
if (!animationRef.current) return
if (!drawingRef.current) return
animationRef.current.setAnimation(shake, {
frame: 3,
repeat: 100
frames: 3,
repeatCount: 100
})
animationRef.current.copy(drawingRef.current)
animationRef.current.start()
Expand All @@ -275,7 +275,7 @@ const Example = () => {
if (!animationRef.current) return
if (!drawingRef.current) return
animationRef.current.setAnimation(drawingAnimation, {
repeat: 1
repeatCount: 1
})
animationRef.current.copy(drawingRef.current)
animationRef.current.start()
Expand Down

0 comments on commit 30ca1f7

Please sign in to comment.