androidx.compose.animation.core
Transition
Sealed class · from org.jetbrains.compose.animation:animation-core:1.12.2
No hand-written docs yet.
Transition manages all the child animations on a state level. Child animations can be created in a declarative way using Transition.animateFloat, Transition.animateValue, animateColor``androidx.compose.animation.animateColor etc. When the targetState changes, Transition will automatically start or adjust course for all its child animations to animate to the new target values defined for each animation.
sealed class Transition<S>
Kinds of Transition
Anywhere a Transition is expected, you can pass any of these.
DeferredTransitionanimation-core
How to get one
Ready-made values and functions that return it
Properties
currentState
val currentState: S
Current state of the transition. This will always be the initialState of the transition until the transition is finished. Once the transition is finished, currentState will be set to targetState. currentState is backed by a MutableState.
targetState
val targetState: S
Target state of the transition. This will be read by all child animations to determine their most up-to-date target values.
pendingTargetStateExperimental
val pendingTargetState: S?
Pending target state of the transition. This is the state that the transition is waiting to animate to. It is non-null only when a deferred update is in progress.
segment
val segment: Segment<S>
segment contains the initial state and the target state of the currently on-going transition.
isRunning
val isRunning: Boolean
Indicates whether there is any animation running in the transition.
playTimeNanos
val playTimeNanos: Long
Play time in nano-seconds. playTimeNanos is always non-negative. It starts from 0L at the beginning of the transition and increment until all child animations have finished.
transitions
val transitions: List<Transition<*>>
List of child transitions in a Transition.
animations
val animations: List<TransitionAnimationState<*, *>>
List of TransitionAnimationStates that are in a Transition.
isSeeking
val isSeeking: Boolean
totalDurationNanos
val totalDurationNanos: Long
Total duration of the Transition, accounting for all the animations and child transitions defined on the Transition.
parentTransition
val parentTransition: Transition<*>?
label
val label: String?
Functions
setPlaytimeAfterInitialAndTargetStateEstablished
fun setPlaytimeAfterInitialAndTargetStateEstablished(
initialState: S,
targetState: S,
playTimeNanos: Long,
)
This allows tools to set the transition (between initial and target state) to a specific playTimeNanos.
Nested types
TransitionAnimationStateSegmentDeferredAnimation
Library docs
Transition manages all the child animations on a state level. Child animations can be created
in a declarative way using Transition.animateFloat, Transition.animateValue,
animateColor``androidx.compose.animation.animateColor etc. When the targetState changes,
Transition will automatically start or adjust course for all its child animations to animate to
the new target values defined for each animation.
After arriving at targetState, Transition will be triggered to run if any child animation
changes its target value (due to their dynamic target calculation logic, such as theme-dependent
values).