AnimationGroup
The per-render handle returned by useAnimationGroup and the public surface for declaring a group's animations (animateFloat, animateDimen, …).
Each call to useAnimationGroup creates a fresh AnimationGroup for that render, isolating per-render bookkeeping (slot counter, pending descriptions) from the shared, persistent AnimationGroupState — so concurrent resolves never race. Declaring a slot allocates no AnimatedValue and mutates nothing here; it records a AnimationDescriptor (committed as an AnimationGroupRecord) and returns a Value handle. It deliberately exposes no animation runtime — settled state (currentState, isRunning) lives on AnimationGroupState and is read from the main thread / effects, never during render().
val transition = useAnimationGroup(expanded)
val height = transition.animateDimen(
transitionSpec = {
when {
false.isTransitioningTo(true) -> spring(stiffness = Stiffness.Low)
else -> tween(200.ms)
}
},
) { state -> if (state) 200.dp else 56.dp }
val alpha = transition.animateFloat { state -> if (state) 1f else 0f }Parameters
The type of the state that drives the transition.
See also
Properties
Optional callback invoked once when all animations in this group finish and the group settles. Runs on the main thread from within the frame loop. Register it from an effect and clear it (set to null) on cleanup. Writes through to the shared AnimationGroupState, so setting it is stable across renders.
The state that the transition is animating toward in this render (the render prop).
Functions
Animates a Color property with per-channel interpolation.
Animates a Dimen property as part of this transition.
Animates a value of type T as part of this transition using a custom TypeConverter.