animateTo
suspend fun animateTo(targetState: S = this.targetState, animationSpec: FiniteAnimationSpec<Float>? = null)
Updates the current targetState
to targetState and begins an animation to the new state. If the current targetState
is the same as targetState then the current transition animation is continued. If a previous transition was interrupted, currentState is changed to the former targetState
and the start values are animated toward the former targetState
.
Upon completion of the animation, currentState will be changed to targetState.
Parameters
targetState
The state to animate towards.
animationSpec
If provided, is used to animate the animation fraction. If null
, the transition is linearly traversed based on the duration of the transition.