The diagram below helps you decide what API to use to implement your animation.
Follow the decision tree questions below to choose which animation API is most appropriate for your use case:
- Is my animation more like art, consisting of many visual elements? i.e. SVGs or images
- Yes: Does it have simple SVGs? i.e. an icon with micro-animations
- Yes:
AnimatedVectorDrawable
- No: Third-party animation framework, i.e.
Lottie
- Yes:
- No: Does it need to repeat forever?
- Yes:
rememberInfiniteTransition
- No: Is this a layout animation?
- Yes: Changing between multiple composables that have different content?
- Yes: With navigation-compose?
- Yes:
composable()
withenterTransition
andexitTransition
set - No:
AnimatedContent
,Crossfade
orPager
- Yes:
- No: Animating appearance / disappearance?
- Yes:
AnimatedVisibility
oranimateFloatAsState
withModifier.alpha()
- No: Animating size?
- Yes:
Modifier.animateContentSize
- No: Other layout property? ie offset, padding etc
- Yes: See "Are the properties completely independent of each other?"
- No: List item animations?
- Yes:
animateItemPlacement()
(reorder and delete coming soon)
- Yes:
- Yes:
- Yes:
- Yes: With navigation-compose?
- No: Do you need to animate multiple properties?
- Yes: Are the properties completely independent of each other?
- Yes:
animate*AsState
, for Text, useTextMotion.Animated
- No: Start at the same time?
- Yes: Yes:
updateTransition
withAnimatedVisibility
,animateFloat
,animateInt
etc - No:
Animatable
withanimateTo
called with different timings (using suspend functions)
- Yes: Yes:
- Yes:
- No: Does the animation have a set of predefined target values?
- Yes:
animate*AsState
, for Text, useTextMotion.Animated
- No: Gesture driven animation? Your animation is the only source of truth?
- Yes:
Animatable
withanimateTo
/snapTo
- No: One shot animation without state management?
- Yes:
AnimationState
oranimate
- No: Answer not here? File a feature request
- Yes:
- Yes:
- Yes:
- Yes: Are the properties completely independent of each other?
- Yes: Changing between multiple composables that have different content?
- Yes:
- Yes: Does it have simple SVGs? i.e. an icon with micro-animations
Download the PDF version of the diagram.