-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Lottie Compose: playing compositions in a sequence is buggy #2491
Comments
Your first example renders LottieAnimation twice which is probably not expected. In your second example, you have nested composable which you never want to do. Each composable is an anonymous function that will be different each time your outer composable recomposes. Also, in the second example, you're going to flip dir every time the outer composable renders when progress == 1f which will cause it to flip back and forth as each time you flip the state, it will recompose. I would recommend something more like this. I think you'll find a lot more flexibility for use cases like this with
|
I rushed to mark it as complete, but there is still a glitch. Once the "state == 1" blocking actions are complete the animation jumps ahead from the first frame of the next composition, so the sequence is not smooth. In Android View, the next iteration of animation is initiated in code after the completion of the blocking action. With @gpeal solution compositions continue while the main thread is blocked resulting in jumpy animation.
|
What are your "blocking actions"? That doesn't sound like something that should be happening in the body of a composable. |
The command increases value of an observable in ViewModel, which triggers database queries:
Here's how it works in View:
|
This comment was marked as duplicate.
This comment was marked as duplicate.
I don't think there is an issue with Lottie here. If you'd like support with your specific compose code and how to structure your code, StackOverflow may be a better fit. But I suspect you lightly want to trigger whatever state/external update you want from the LaunchedEffect at the appropriate time not in the body of your composable. |
Describe the bug
The task is to achieve what works flawlessly in LottieAnimationView, playing compositions sequentially.
I have two samples of code, both of which produce buggy results.
One: the last frame of composition doesn't disappear the animation leaves a trail of frames from compositions that stopped playing.
Two: leaves no trailing but the animation sequence flickers upon starting the next composition.
Possibly related issue:
https://stackoverflow.com/questions/73633216/update-lottie-animations-with-jetpack-compose-leads-to-glitch
What version of Lottie did you test this on?
com.airbnb.android:lottie-compose:6.1.0
What version of Android did you test this on?
Android Studio Jellyfish AGP 8.3.1
Steps To Reproduce
Steps to reproduce the behavior:
Create a project with two sequences, eg an object moving back and forth.
Screenshots
The text was updated successfully, but these errors were encountered: