Google is committed to advancing racial equity for Black communities. See how.

DecayAnimation

class DecayAnimation : Animation<Float, AnimationVector1D>
kotlin.Any
   ↳ androidx.compose.animation.core.DecayAnimation

Fixed Decay animation wraps around a FloatDecayAnimationSpec and assumes its starting value and velocity never change throughout the animation.

Summary

Public constructors
<init>(anim: FloatDecayAnimationSpec, startValue: Float, startVelocity: Float = 0f)

Fixed Decay animation wraps around a FloatDecayAnimationSpec and assumes its starting value and velocity never change throughout the animation.

Public methods
Float
getValue(playTime: Long)

Returns the value of the animation at the given play time.

AnimationVector1D

Returns the velocity (in AnimationVector form) of the animation at the given play time.

Properties
TwoWayConverter<Float, AnimationVector1D>

The TwoWayConverter that will be used to convert value/velocity from any arbitrary data type to AnimationVector.

Long

This amount of time in milliseconds that the animation will run before it finishes

Public constructors

<init>

DecayAnimation(
    anim: FloatDecayAnimationSpec,
    startValue: Float,
    startVelocity: Float = 0f)

Fixed Decay animation wraps around a FloatDecayAnimationSpec and assumes its starting value and velocity never change throughout the animation.

Parameters
anim: FloatDecayAnimationSpec decay animation that will be used
startValue: Float starting value that will be passed to the decay animation
startVelocity: Float = 0f starting velocity for the decay animation

Public methods

getValue

fun getValue(playTime: Long): Float

Returns the value of the animation at the given play time.

Parameters
playTime: Long the play time that is used to determine the value of the animation.

getVelocityVector

fun getVelocityVector(playTime: Long): AnimationVector1D

Returns the velocity (in AnimationVector form) of the animation at the given play time.

Parameters
playTime: Long the play time that is used to calculate the velocity of the animation.

Properties

converter

val converter: TwoWayConverter<Float, AnimationVector1D>

The TwoWayConverter that will be used to convert value/velocity from any arbitrary data type to AnimationVector. This makes it possible to animate different dimensions of the data object independently (e.g. x/y dimensions of the position data).

durationMillis

val durationMillis: Long

This amount of time in milliseconds that the animation will run before it finishes