/chrisbanes-skills:compose-animationsfrom chrisbanes-skills
Guides choosing the right Jetpack Compose animation API for visibility, property, state, content, and size transitions. Covers AnimatedVisibility, animate*AsState, updateTransition, rememberTransition, AnimatedContent, Crossfade, and Animatable.
Ships in chrisbanes-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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. In a
swap between distinct items, keep the target value as the identity (the
default) or key by a stable item ID; do not collapse different items to a
shared presence or branch key. In a review, name any rendered expression that
captures outer target state and
recommend using the lambda target there. If a test must prove transition
identity, check outgoing and incoming content during the overlap; checking
only the settled destination misses a shared-identity bug. 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 target value | updateTransition plus child animations |
Several values follow an explicit TransitionState | 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.
val width by animateDpAsState(
targetValue = if (expanded) 200.dp else 56.dp,
animationSpec = spring(dampingRatio = 0.7f),
label = "fabWidth",
)
For values that must remain synchronized, define them on one transition rather than several independent animate*AsState calls:
val transition = updateTransition(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
}
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.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub chrisbanes/skills --plugin chrisbanes-skills23 skills in this plugin
/android-benchmark-comparisonUse when comparing physical Android benchmark configurations, investigating inconsistent rankings, or selecting an Android default from measured results. Do not use for code-level Compose performance diagnosis without a configuration comparison./changelogUse when updating or reviewing Unreleased changelog entries, reconciling a changelog against Git history and issue or PR evidence, or preparing changelog notes for a specified release./compose-component-designUse when designing or reviewing reusable Jetpack Compose component APIs with modifier parameters, root layout placement, caller-provided variable content, primitive content parameters, optional content, or boolean shape flags./compose-focus-navigationUse when writing or reviewing Jetpack Compose UI for TV, keyboard, desktop, accessibility focus, D-pad navigation, FocusRequester, focusProperties, key events, or initial focus behavior./compose-performanceUse when investigating Jetpack Compose recomposition cost, compiler stability reports, skippability, unstable parameters, frame-rate State reads, cross-phase snapshot back-writing, or @ReadOnlyComposable contracts./compose-state-and-effectsUse when writing or reviewing Jetpack Compose state ownership, remember state, state hoisting, screen state holders, LaunchedEffect, DisposableEffect, SideEffect, Flow collection, navigation, snackbar, analytics, or focus requests.Other plugins' skills for the same job