Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set a Speed for the Lottie ? #73

Open
Hamdysaad20 opened this issue Sep 18, 2022 · 6 comments
Open

How to set a Speed for the Lottie ? #73

Hamdysaad20 opened this issue Sep 18, 2022 · 6 comments

Comments

@Hamdysaad20
Copy link

hi ,
thank you for the amazing library . can you help me with this issue , i can't find a way to set the speed for this library

@GhostyJade
Copy link

I think you can try to get the lottieRef ref object from the component and call the setSpeed from there.

@DaphneChang
Copy link

I have the same question. How can I set the default speed of it instead of using the "setSpeed" function ? The function makes the config become complicated.

@GhostyJade
Copy link

@DaphneChang Currently (for what I've seen in the source code), is not possible to pass the speed value as a prop to the Lottie component...
What do u mean with "makes the config become complicated"?

@bfaulk96
Copy link

bfaulk96 commented Feb 14, 2023

I'm using the onDOMLoaded attribute to essentially do what you're asking (except in my example I was trying to set the direction to reverse):

const lottieRef = useRef(null)

return <Lottie animationData={someLottie} autoplay loop lottieRef={lottieRef}
  onDOMLoaded={() => lottieRef.current?.setDirection(-1)} 
/>

@Keyvan-RezaeiF
Copy link

Hi everyone, this package had an update 4 months ago. I want to know if this issue is fixed or not.

@GhostyJade
Copy link

GhostyJade commented Jun 19, 2023

@Keyvan-RezaeiF it was a dependency update, not a feature update.

Edit: it also fixes #77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants