---
title: "DecayAnimation"
description: "[DecayAnimation] is an animation that slows down from [initialVelocity] as time goes on.
[DecayAnimation] is stateless, and it does not have any concept of lifecycle. It serves as an
animation calculation engine that supports convenient query of value/velocity given a play time.
To achieve that, [DecayAnimation] stores all the animation related information: [initialValue],
[initialVelocity], decay animation spec.

__Note__: Unless there's a need to control the timing manually, it's generally recommended to use
higher level animation APIs that build on top [DecayAnimation], such as
[Animatable.animateDecay], [animateDecay], etc."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
public fun DecayAnimation(
    animationSpec: FloatDecayAnimationSpec,
    initialValue: Float,
    initialVelocity: Float = 0f,
): DecayAnimation<Float, AnimationVector1D>
```


`DecayAnimation` is an animation that slows down from `initialVelocity` as time goes on.
`DecayAnimation` is stateless, and it does not have any concept of lifecycle. It serves as an
animation calculation engine that supports convenient query of value/velocity given a play time.
To achieve that, `DecayAnimation` stores all the animation related information: `initialValue`,
`initialVelocity`, decay animation spec.

__Note__: Unless there's a need to control the timing manually, it's generally recommended to use
higher level animation APIs that build on top `DecayAnimation`, such as
`Animatable.animateDecay`, `animateDecay`, etc.

#### Parameters

| | |
| --- | --- |
| animationSpec | decay animation that will be used |
| initialValue | starting value that will be passed to the decay animation |
| initialVelocity | starting velocity for the decay animation, 0f by default |




