In <https://developer.android.com/jetpack/compose/...
# compose
e
In https://developer.android.com/jetpack/compose/animation, I find all the guide per the provided table diagram (as shown below, linking to each of the topic provided by the doc). But I cannot find two of them 1. Animation 2. AnimationState & animate Did I miss anything? Just for completeness, I can find the others except the two. • AnimatedVisibility (experimental) https://developer.android.com/jetpack/compose/animation#animatedvisibility • AnimatedContent (experimental) https://developer.android.com/jetpack/compose/animation#animatedcontent • animateContentSize https://developer.android.com/jetpack/compose/animation#animateContentSize • Crossfade https://developer.android.com/jetpack/compose/animation#crossfade Low-level Animation APIs • animate*AsState https://developer.android.com/jetpack/compose/animation#animate-as-state • Animatable https://developer.android.com/jetpack/compose/animation#animatable • updateTransition https://developer.android.com/jetpack/compose/animation#updateTransition • rememberInfiniteTransition https://developer.android.com/jetpack/compose/animation#rememberinfinitetransition Missing (in Pink box shown below) • Animation (where’s the doc?) • AnimationState & animate (where’s the doc?)
@Doris Liu, sorry to bother you once more, can you aid? Thanks 🙏
d
Thanks for the illustration @elye. I'm very flattered to see our animation doc work getting this thorough of a read and interest! 😁👍 The doc covered the more common type of
Animation
-
TargetBasedAnimation
. Now that I look at the doc, even though
TargetBasedAnimation
is mentioned, the connection between the two could be made more clear.
AnimationState
and
animate
weren't covered in the doc because we decided to leave them out to avoid confusing developers new to Compose. They are for one-shot use cases - when you build coroutine animations and don't care about the continuity (or manage the continuity yourself) between animation runs.
Animatable
uses
AnimationState
under the hood for each animation run. On top of that, it also manages the lifecycle, ensures mutual exclusiveness of the animations started via
animateTo
/`animateDecay` , and maintains continuity of the animation value (and velocity if possible) when interrupted. If you only know
Animatable
, you could use that powerful API to achieve anything that
AnimationState
and
animate
could do, although it might not always be the most ergonomic choice. Since there's interest in learning about
animate
and
AnimationState
, we could include them in this doc for completeness. Could you file a bug for this? Thanks again for the interest! 🙏
e
Thanks so much @Doris Liu! 🙏 Ya, it’s great doc, and I got lots of detail from there. The gap I have, you have covered them very well. Thank you! 🙇 Someone in the stackoverflow point me to
AnimationState
at https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationState. I think that will be a great start. I have also file an issue https://issuetracker.google.com/issues/218645216 as per requested. Thanks for providing all the great code examples 🙏