DeferredTransition
A Transition that supports a deferred phase, created via rememberTransition.
DeferredTransition extends the standard Transition to allow manual manipulation of transformation properties before the automatic transition begins. This is particularly useful for coordinating multi-stage animations like predictive back gestures.
Properties
List of TransitionAnimationStates that are in a Transition.
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.
Used internally to know when a SeekableTransitionState is animating initial values after SeekableTransitionState.animateTo or SeekableTransitionState.seekTo has redirected a transition prior to it completing. This is important for knowing when child transitions must be maintained after a parent target state has changed, but the child target state hasn't changed.
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.
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.
segment contains the initial state and the target state of the currently on-going transition.
Target state of the transition. This will be read by all child animations to determine their most up-to-date target values.
Total duration of the Transition, accounting for all the animations and child transitions defined on the Transition.
List of child transitions in a Transition.
Functions
Creates a Float animation as a part of the given Transition. This means the states of this animation will be managed by the Transition.
Creates a Int animation as a part of the given Transition. This means the states of this animation will be managed by the Transition.
Creates an animation of type T as a part of the given Transition. This means the states of this animation will be managed by the Transition. typeConverter will be used to convert between type T and AnimationVector so that the animation system knows how to animate it.
createChildTransition creates a child Transition based on the mapping between parent state to child state provided in transformToChildState. This serves the following purposes:
This creates a Transition.DeferredAnimation, which will not animate until it is set up using Transition.DeferredAnimation.animate. Once the animation is set up, it will animate from the currentState to targetState. If the Transition has already arrived at its target state at the time when the animation added, there will be no animation.
This allows tools to set the transition (between initial and target state) to a specific playTimeNanos.