What's the main different, and use case, for `Anim...
# compose
a
What's the main different, and use case, for
Animatable
and
AnimationState
. I see the view pager in accompanist is using
AnimationState
and the docs say the advantage
Animatable
has over
AnimationState
is mutable exclusiveness of animation. Does anyone have any other insights?
c
The guide has a flow chart for exactly this: https://developer.android.com/jetpack/compose/animation
a
Ah yes. I forgot about this. Thanks
v
Here's a more "readable" version of the same flow chart by @theapache64: https://twitter.com/theapache64/status/1439206337167061000
d
The biggest difference is whether starting another animation cancels the previous animation, i.e. mutual exclusiveness between animations.
Animatable
cancels any on-going animations when
animateTo
/`snapTo` is called, whereas
AnimationState
is designed for one-shot animation use cases.
Animatable
uses
AnimationState
under the hood with additional animation lifecycle management and interruption handling.
🙌 1