DecayAnimation

interface DecayAnimation
androidx.animation.DecayAnimation

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.

Summary

Public methods

abstract Float
getTarget(start: Float, startVelocity: Float)

Returns the target value of the animation based on the starting condition of the animation ( i.

abstract Float
getValue(playTime: Long, start: Float, startVelocity: Float)

Returns the value of the animation at the given time.

abstract Float
getVelocity(playTime: Long, start: Float, startVelocity: Float)

Returns the velocity of the animation at the given time.

abstract Boolean
isFinished(playTime: Long, start: Float, startVelocity: Float)

Returns whether the animation is finished at the given time.

Properties

abstract Float

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

Public methods

getTarget

abstract fun getTarget(
    start: Float,
    startVelocity: 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
start: Float The start value of the animation
startVelocity: Float The start velocity of the animation

getValue

abstract fun getValue(
    playTime: Long,
    start: Float,
    startVelocity: Float
): Float

Returns the value of the animation at the given time.

Parameters
playTime: Long The time elapsed in milliseconds since the start of the animation
start: Float The start value of the animation
startVelocity: Float The start velocity of the animation

getVelocity

abstract fun getVelocity(
    playTime: Long,
    start: Float,
    startVelocity: Float
): Float

Returns the velocity of the animation at the given time.

Parameters
playTime: Long The time elapsed in milliseconds since the start of the animation
start: Float The start value of the animation
startVelocity: Float The start velocity of the animation

isFinished

abstract fun isFinished(
    playTime: Long,
    start: Float,
    startVelocity: Float
): Boolean

Returns whether the animation is finished at the given time.

Parameters
playTime: Long The time elapsed in milliseconds since the start of the animation
start: Float The start value of the animation
startVelocity: Float The start velocity of the animation

Properties

absVelocityThreshold

abstract val absVelocityThreshold: Float

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