I’m studying animation with compose and we have in...
# compose
e
I’m studying animation with compose and we have in our design system a custom view with a loading animation and I want to migrate it into composable. The behavior: when the view is clicked, it shows an animation. The animation is basically to rotate and move some drawables in a cyclic way. This custom view has a
fun stop(lambda)
. The animation continues until someone call stop(). When it happens, the animation continues until it reaches the initial drawable positions and then it executes the lambda function. In my opinion, the issue is how to continue the animation after a recomposition when the composable state changes. I tried to follow the chart in the docs but I’m no sure which API should I use.
d
you should think declaratively, like composable fun is just a function of state. That means your button has to have state "loading", which switches content with
CircularProgressIndicator
For example, in our design system there is enum class ButtonState { Default, Progress, Disabled } for it
👍 2
c
Do you have a video of this animation? Also sidenote: wouldn’t you want the animation to stop when the user tells it to stop?
e
Sure. Here is the video. I want to stop the animation in the initial position of the animation to have a sweet user experience