# FloatDecayAnimationSpec

Artifact: [androidx.compose.animation:animation-core](https://developer.android.com/jetpack/androidx/releases/compose-animation) [View Source](https://cs.android.com/search?q=file:androidx/compose/animation/core/FloatDecayAnimationSpec.kt+class:androidx.compose.animation.core.FloatDecayAnimationSpec) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0) Common/All
- Cmn

  ```
  interface FloatDecayAnimationSpec
  ```
Known direct subclasses [FloatExponentialDecaySpec](https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatExponentialDecaySpec), [SplineBasedFloatDecayAnimationSpec](https://developer.android.com/reference/kotlin/androidx/compose/animation/SplineBasedFloatDecayAnimationSpec)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatExponentialDecaySpec` | This is a decay animation where the friction/deceleration is always proportional to the velocity. |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/SplineBasedFloatDecayAnimationSpec` | A native Android fling curve decay. |

*** ** * ** ***

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 functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec#getDurationNanos(kotlin.Float,kotlin.Float)(initialValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, initialVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Returns the duration of the decay animation, in nanoseconds. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec#getTargetValue(kotlin.Float,kotlin.Float)(initialValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, initialVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Returns the target value of the animation based on the starting condition of the animation ( i.e. start value and start velocity). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec#getValueFromNanos(kotlin.Long,kotlin.Float,kotlin.Float)( playTimeNanos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, initialValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, initialVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Returns the value of the animation at the given time. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec#getVelocityFromNanos(kotlin.Long,kotlin.Float,kotlin.Float)( playTimeNanos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, initialValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, initialVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Returns the velocity of the animation at the given time. | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec#absVelocityThreshold()` This is the absolute value of a velocity threshold, below which the animation is considered finished. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DecayAnimationSpec<T>` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec.https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec#(androidx.compose.animation.core.FloatDecayAnimationSpec).generateDecayAnimationSpec()()` Creates a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DecayAnimationSpec` from a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec` by applying the given `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec` on every dimension of the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector` that `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#(androidx.compose.animation.core.FloatDecayAnimationSpec).generateDecayAnimationSpec()` converts to. | Cmn |

## Public functions

### getDurationNanos

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

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

Returns the duration of the decay animation, in nanoseconds.

| Parameters |
|---|---|
| `initialValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | start value of the animation |
| `initialVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | start velocity of the animation |

### getTargetValue

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

```
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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The start value of the animation |
| `initialVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The start velocity of the animation |

### getValueFromNanos

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

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

Returns the value of the animation at the given time.

| Parameters |
|---|---|
| `playTimeNanos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time elapsed in milliseconds since the start of the animation |
| `initialValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The start value of the animation |
| `initialVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The start velocity of the animation |

### getVelocityFromNanos

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

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

Returns the velocity of the animation at the given time.

| Parameters |
|---|---|
| `playTimeNanos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time elapsed in milliseconds since the start of the animation |
| `initialValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The start value of the animation |
| `initialVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The start velocity of the animation |

## Public properties

### absVelocityThreshold

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

```
val absVelocityThreshold: Float
```

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

## Extension functions

### FloatDecayAnimationSpec.generateDecayAnimationSpec

Cmn Artifact: [androidx.compose.animation:animation-core](https://developer.android.com/jetpack/androidx/releases/compose-animation) [View Source](https://cs.android.com/search?q=file:androidx/compose/animation/core/DecayAnimationSpec.kt+function:generateDecayAnimationSpec)

```
fun <T : Any?> FloatDecayAnimationSpec.generateDecayAnimationSpec(): DecayAnimationSpec<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DecayAnimationSpec` from a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec` by applying the given `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatDecayAnimationSpec` on every dimension of the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector` that `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#(androidx.compose.animation.core.FloatDecayAnimationSpec).generateDecayAnimationSpec()` converts to.