AnimationState

Class

Common
public class AnimationState<T, V : AnimationVector>(
    public val typeConverter: TwoWayConverter<T, V>,
    initialValue: T,
    initialVelocityVector: V? = null,
    lastFrameTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    finishedTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    isRunning: Boolean = false,
) : State<T>

AnimationState contains the necessary information to indicate the state of an animation. Once an AnimationState is constructed, it can only be updated/mutated by animations. If there's a need to mutate some of the fields of an AnimationState, consider using copy functions.

Parameters

typeConverterTwoWayConverter to convert type T from and to AnimationVector
initialValueinitial value of the AnimationState
initialVelocityVectorinitial velocity of the AnimationState, null (i.e. no velocity) by default.
lastFrameTimeNanoslast frame time of the animation, AnimationConstants.UnspecifiedTime by default
finishedTimeNanosthe time that the animation finished successfully, AnimationConstants.UnspecifiedTime until then
isRunningwhether the AnimationState is currently being updated by an animation. False by default