AnimationState

Function

Common
public fun AnimationState(
    initialValue: Float,
    initialVelocity: Float = 0f,
    lastFrameTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    finishedTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    isRunning: Boolean = false,
): AnimationState<Float, AnimationVector1D>

Factory method for creating an AnimationState for Float initialValue.

Parameters

initialValueinitial value of the AnimationState
initialVelocityinitial velocity of the AnimationState, 0 (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 by default.
isRunningwhether the AnimationState is currently being updated by an animation. False by default

Returns

A new AnimationState instance
Common
public fun <T, V : AnimationVector> AnimationState(
    typeConverter: TwoWayConverter<T, V>,
    initialValue: T,
    initialVelocity: T,
    lastFrameTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    finishedTimeNanos: Long = AnimationConstants.UnspecifiedTime,
    isRunning: Boolean = false,
): AnimationState<T, V>

Factory method for creating an AnimationState with an initialValue and an initialVelocity.

Parameters

typeConverterTwoWayConverter to convert type T from and to AnimationVector
initialValueinitial value of the AnimationState
initialVelocityinitial velocity of the AnimationState
lastFrameTimeNanoslast frame time of the animation, AnimationConstants.UnspecifiedTime by default
finishedTimeNanosthe time that the animation finished successfully, AnimationConstants.UnspecifiedTime by default.
isRunningwhether the AnimationState is currently being updated by an animation. False by default

Returns

A new AnimationState instance