-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Help with playSegments #67
Comments
@Gamote Any ideas? |
@michax @mattvague @PatrickDesign Sorry for the pings, but this is pretty mission-critical for me |
In what way is it not working? I'm assuming the fact that you're defining a react component within another react component and using dynamic imports doesn't cause the issue. |
@PatrickDesign Ha, I probably need to separate those components o.O The animation will play just fine. Everything works with no errors. The only issue is the segments part. It simply does not listen to the input and plays the whole animation straight through each loop. |
Could you use the onLoopComplete method to update your segment array to be the shortened one after the first loop? And use the Something like: // Defined statically outside of any functions (to keep a stable reference https://lottiereact.com/#initialsegment)
const firstLoopSegment = [0, 23]
const secondLoopSegment = [24, 95]
...
const [activeSegment, setActiveSegment] = useState(firstLoopSegment)
const onLoopComplete = () => {
setActiveSegment(secondLoopSegment)
}
...
<Lottie onLoopComplete={onLoopComplete} initialSegment={activeSegment} ... /> |
Like this? Because no dice if so =/
|
AHA! I got it!
|
I'm trying to have my lottie animation play the first 23 frames, and then skip them when it loops back and restarts and play frames 24-95 indefinitely. I'm dumb and can't seem to figure out how to make this work. Example here of it implemented with react-lottie-player (I'm switching over because you're more active and cool)
Here's my code that isn't working:
The text was updated successfully, but these errors were encountered: