The second Android 11 Developer Preview is now available, test it out and share your feedback.

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 Long
getDurationMillis(start: Float, startVelocity: Float)

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.

Properties

abstract Float

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

Public methods

getDurationMillis

abstract fun getDurationMillis(
    start: Float,
    startVelocity: Float
): Long

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

Properties

absVelocityThreshold

abstract val absVelocityThreshold: Float

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