Google is committed to advancing racial equity for Black communities. See how.

TransitionAnimation

class TransitionAnimation<T> : TransitionState
kotlin.Any
   ↳ androidx.animation.TransitionAnimation

TransitionAnimation is the underlying animation used in androidx.ui.animation.transition for animating from one set of property values (i.e. one TransitionState) to another. In compose, it is recommended to create such an animation using androidx.ui.animation.transition, instead of instantiating TransitionAnimation directly.

TransitionAnimation reads the property values out of the start and end state, as well as the animations defined for each state pair for each property, and run these animations until all properties have reached their pre-defined values in the new state. When no animation is specified for a property, a default FloatSpringSpec animation will be used.

TransitionAnimation may be interrupted while the animation is on-going by a request to go to another state. TransitionAnimation ensures that all the animating properties preserve their current value and velocity as they createAnimation to the new state.

Once a TransitionDefinition is instantiated, a TransitionAnimation can be created via TransitionDefinition.createAnimation.

Summary

Public constructors
<init>(def: TransitionDefinition<T>, clock: AnimationClockObservable, initState: T? = null)

TransitionAnimation is the underlying animation used in androidx.ui.animation.transition for animating from one set of property values (i.

Public methods
operator T
get(propKey: PropKey<T, V>)

Gets the value of a property with a given property key.

Unit
toState(name: T)

Starts the animation to go to a new state with the given state name.

Properties
Boolean

(T) -> Unit

() -> Unit

Public constructors

<init>

TransitionAnimation(
    def: TransitionDefinition<T>,
    clock: AnimationClockObservable,
    initState: T? = null)

TransitionAnimation is the underlying animation used in androidx.ui.animation.transition for animating from one set of property values (i.e. one TransitionState) to another. In compose, it is recommended to create such an animation using androidx.ui.animation.transition, instead of instantiating TransitionAnimation directly.

TransitionAnimation reads the property values out of the start and end state, as well as the animations defined for each state pair for each property, and run these animations until all properties have reached their pre-defined values in the new state. When no animation is specified for a property, a default FloatSpringSpec animation will be used.

TransitionAnimation may be interrupted while the animation is on-going by a request to go to another state. TransitionAnimation ensures that all the animating properties preserve their current value and velocity as they createAnimation to the new state.

Once a TransitionDefinition is instantiated, a TransitionAnimation can be created via TransitionDefinition.createAnimation.

Public methods

get

operator fun <T, V : AnimationVector> get(propKey: PropKey<T, V>): T

Gets the value of a property with a given property key.

Parameters
propKey: PropKey<T, V> Property key (defined in TransitionDefinition) for a specific property

toState

fun toState(name: T): Unit

Starts the animation to go to a new state with the given state name.

Parameters
name: T Name of the TransitionState that is defined in the TransitionDefinition.

Properties

isRunning

var isRunning: Boolean

onStateChangeFinished

var onStateChangeFinished: (T) -> Unit

onUpdate

var onUpdate: () -> Unit