copy

Function

Common
public fun <T, V : AnimationVector> AnimationState<T, V>.copy(
    value: T = this.value,
    velocityVector: V? = this.velocityVector.copy(),
    lastFrameTimeNanos: Long = this.lastFrameTimeNanos,
    finishedTimeNanos: Long = this.finishedTimeNanos,
    isRunning: Boolean = this.isRunning,
): AnimationState<T, V>

Creates a new AnimationState from a given AnimationState. This function allows some of the fields to be different in the new AnimationState.

Parameters

valuevalue of the AnimationState, using the value of the given AnimationState by default
velocityVectorvelocity of the AnimationState, using the velocity of the given AnimationState by default.
lastFrameTimeNanoslast frame time of the animation, same as the given AnimationState by default
finishedTimeNanosthe time that the animation finished successfully, AnimationConstants.UnspecifiedTime until then. Default value is the same as the given AnimationState.
isRunningwhether the AnimationState is currently being updated by an animation. Same as the given AnimationState by default

Returns

A new AnimationState instance copied from the given instance, with some fields optionally altered
Common
public fun AnimationState<Float, AnimationVector1D>.copy(
    value: Float = this.value,
    velocity: Float = this.velocityVector.value,
    lastFrameTimeNanos: Long = this.lastFrameTimeNanos,
    finishedTimeNanos: Long = this.finishedTimeNanos,
    isRunning: Boolean = this.isRunning,
): AnimationState<Float, AnimationVector1D>

Creates a new AnimationState of Float value type from a given AnimationState of the same type. This function allows some of the fields to be different in the new AnimationState.

Parameters

valuevalue of the AnimationState, using the value of the given AnimationState by default
velocityvelocity of the AnimationState, using the velocity of the given AnimationState by default.
lastFrameTimeNanoslast frame time of the animation, same as the given AnimationState by default
finishedTimeNanosthe time that the animation finished successfully, same as the given AnimationState by default.
isRunningwhether the AnimationState is currently being updated by an animation. Same as the given AnimationState by default

Returns

A new AnimationState instance copied from the given instance, with some fields optionally altered