mifi / react-lottie-player

Fully declarative React Lottie player
MIT License
495 stars 52 forks source link

Is there a way to play a number of animations one after the other? #56

Open husamrahman opened 2 years ago

husamrahman commented 2 years ago

Great work on this library! I was wondering if there was already a built in option to go through a list of animations one after the other? Thank you!

mifi commented 2 years ago

Hi! Nothing built in for that. I don't think it belongs as a part of this library as I like to keep it simple.

I would think something like <Lottie animationData={animations[index]} onComplete={() => {setIndex(i => i+1)}} />

husamrahman commented 2 years ago

Got it thank you! I didn't know we had access to OnComplete.

deshario9 commented 2 years ago

I'm implementing around 25 animations through index, but it seems lagging sometimes

Any proper way to handle huge amount of animations?

Note: All animations was fetched from rest api and stored in redux store

mifi commented 2 years ago

@deshario9 are you loading the 25 animations simultaneously (all at once) or in sequence (one by one, unloading the previous one when it's done), care to share some codesandbox?

deshario9 commented 2 years ago

@mifi yeah, I'm loading all of it simultaneously (for now)

Sandbox: https://codesandbox.io/s/lottie-animations-7mqpnx?file=/src/App.js