FloatDecayAnimationSpec

Interface
Common
public interface FloatDecayAnimationSpec

This animation interface is intended to be stateless, just like Animation. But unlike Animation, DecayAnimation does not have an end value defined. The end value is a result of the animation rather than an input.

Functions

public fun getValueFromNanos(
        playTimeNanos: Long,
        initialValue: Float,
        initialVelocity: Float,
    ): Float

Returns the value of the animation at the given time.

Parameters

playTimeNanos The time elapsed in milliseconds since the start of the animation
initialValue The start value of the animation
initialVelocity The start velocity of the animation
public fun getDurationNanos(initialValue: Float, initialVelocity: Float): Long

Returns the duration of the decay animation, in nanoseconds.

Parameters

initialValue start value of the animation
initialVelocity start velocity of the animation
public fun getVelocityFromNanos(
        playTimeNanos: Long,
        initialValue: Float,
        initialVelocity: Float,
    ): Float

Returns the velocity of the animation at the given time.

Parameters

playTimeNanos The time elapsed in milliseconds since the start of the animation
initialValue The start value of the animation
initialVelocity The start velocity of the animation
public fun getTargetValue(initialValue: Float, initialVelocity: Float): Float

Returns the target value of the animation based on the starting condition of the animation ( i.e. start value and start velocity).

Parameters

initialValue The start value of the animation
initialVelocity The start velocity of the animation