SplineBasedFloatDecayAnimationSpec


A native Android fling curve decay.

Summary

Public constructors

Cmn

Public functions

open Long
getDurationNanos(initialValue: Float, initialVelocity: Float)

Returns the duration of the decay animation, in nanoseconds.

Cmn
open Float
getTargetValue(initialValue: Float, initialVelocity: Float)

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

Cmn
open Float
getValueFromNanos(
    playTimeNanos: Long,
    initialValue: Float,
    initialVelocity: Float
)

Returns the value of the animation at the given time.

Cmn
open Float
getVelocityFromNanos(
    playTimeNanos: Long,
    initialValue: Float,
    initialVelocity: Float
)

Returns the velocity of the animation at the given time.

Cmn

Public properties

open Float

This is the absolute value of a velocity threshold, below which the animation is considered finished.

Cmn

Public constructors

SplineBasedFloatDecayAnimationSpec

SplineBasedFloatDecayAnimationSpec(density: Density)
Parameters
density: Density

density of the display

Public functions

getDurationNanos

open fun getDurationNanos(initialValue: Float, initialVelocity: Float): Long

Returns the duration of the decay animation, in nanoseconds.

Parameters
initialValue: Float

start value of the animation

initialVelocity: Float

start velocity of the animation

getTargetValue

open 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: Float

The start value of the animation

initialVelocity: Float

The start velocity of the animation

getValueFromNanos

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

Returns the value of the animation at the given time.

Parameters
playTimeNanos: Long

The time elapsed in milliseconds since the start of the animation

initialValue: Float

The start value of the animation

initialVelocity: Float

The start velocity of the animation

getVelocityFromNanos

open fun getVelocityFromNanos(
    playTimeNanos: Long,
    initialValue: Float,
    initialVelocity: Float
): Float

Returns the velocity of the animation at the given time.

Parameters
playTimeNanos: Long

The time elapsed in milliseconds since the start of the animation

initialValue: Float

The start value of the animation

initialVelocity: Float

The start velocity of the animation

Public properties

absVelocityThreshold

open val absVelocityThresholdFloat

This is the absolute value of a velocity threshold, below which the animation is considered finished.