npx skills add ...
npx skills add chrisbanes/skills --skill compose-animations
Use when writing or reviewing Jetpack Compose motion: visibility enter/exit, animating one property toward a target, color or size transitions, multiple properties from one state, switching composable content, or choosing between AnimatedVisibility, animate*AsState, rememberTransition, AnimatedContent, and Crossfade.
npx skills add chrisbanes/skills --skill compose-animations
Pick the smallest API that expresses the motion and its lifecycle.
Animatable only when gestures, interruption, or imperative control require it.AnimatedVisibility removes it after exit. Do not use a fade when unmounting is required.AnimatedContent, render from the content lambda target and choose a contentKey only when visual identity differs from payload equality. Read AnimatedContent identity for state-holder details.State in layout or draw block modifiers when it changes at frame rate; route deeper diagnosis to Compose performance.| Need | Prefer |
|---|---|
| Show/hide a subtree with enter/exit semantics | AnimatedVisibility |
| One value follows state | animate*AsState |
| Several values follow one boolean, enum, or sealed state | rememberTransition plus child animations |
| Child size changes | Modifier.animateContentSize() |
| Different composable trees fill one region | AnimatedContent, or Crossfade for the simple case |
| Drag, fling, interruption, or imperative control | Animatable |
Use an AnimationSpec when the default motion is wrong and a distinct label when multiple animations need tooling visibility.
For values that must remain synchronized, define them on one transition rather than several independent animate*AsState calls:
For animated fills, prefer drawBehind { drawRect(color.value) } over a value-form background when the color updates every frame. For an API ambiguity, start with the official Choose an animation API guide; use rememberInfiniteTransition for repeating cycles and SeekableTransitionState for seekable or test-controlled progress.
val transition = rememberTransition(targetState = phase, label = "phase")
val alpha by transition.animateFloat(label = "alpha") { target ->
if (target == Phase.Visible) 1f else 0f
}
val offset by transition.animateDp(label = "offset") { target ->
if (target == Phase.Visible) 0.dp else 24.dp
}