animate

fun animate(transitionSpec: Transition.Segment<S>.() -> FiniteAnimationSpec<T>, targetValueByState: (state: S) -> T): State<T>

DeferredAnimation allows the animation setup to be deferred until a later time after composition. animate can be used to set up a DeferredAnimation. Like other Transition animations such as Transition.animateFloat, DeferredAnimation also expects transitionSpec and targetValueByState for the mapping from target state to animation spec and target value, respectively.


fun animate(transitionSpec: Transition.Segment<S>.() -> FiniteAnimationSpec<T>, forcedInitialValue: T? = null, forcedInitialVelocity: V? = null, targetValueByState: (state: S) -> T): State<T>

DeferredAnimation allows the animation setup to be deferred until a later time after composition. animate can be used to set up a DeferredAnimation. Like other Transition animations such as Transition.animateFloat, DeferredAnimation also expects transitionSpec and targetValueByState for the mapping from target state to animation spec and target value, respectively.

This overload of animate also allows forcing an initial value and/or velocity for the animation, which is useful for handoff from a manual deferred phase to the automatic transition phase.

Parameters

transitionSpec

mapping from segment to animation spec

forcedInitialValue

optional initial value to use for the animation, instead of the current value

forcedInitialVelocity

optional initial velocity to use for the animation

targetValueByState

mapping from target state to target value