# FloatExponentialDecaySpec

# FloatExponentialDecaySpec

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.FloatExponentialDecaySpec)  
Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)
Common/All
  - Cmn  

  ```
  class FloatExponentialDecaySpec : FloatDecayAnimationSpec
  ```

*** ** * ** ***

This is a decay animation where the friction/deceleration is always proportional to the velocity. As a result, the velocity goes under an exponential decay. The constructor parameter, `frictionMultiplier`, can be tuned to adjust the amount of friction applied in the decay. The higher the multiplier, the higher the friction, the sooner the animation will stop, and the shorter distance the animation will travel with the same starting condition.

## Summary

|                                                                                                                                                                                                                                                                                                                                 ### Public constructors                                                                                                                                                                                                                                                                                                                                  |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [FloatExponentialDecaySpec](https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatExponentialDecaySpec#FloatExponentialDecaySpec(kotlin.Float,kotlin.Float))`(` ` frictionMultiplier: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` absVelocityThreshold: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) `)` | Cmn |

|                                  ### Public functions                                  |
|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| `open `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)   | [getDurationNanos](https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatExponentialDecaySpec#getDurationNanos(kotlin.Float,kotlin.Float))`(initialValue: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, initialVelocity: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Returns the duration of the decay animation, in nanoseconds.                                                                                                                            | Cmn |
| `open `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [getTargetValue](https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatExponentialDecaySpec#getTargetValue(kotlin.Float,kotlin.Float))`(initialValue: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, initialVelocity: `[Float](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 |
| `open `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [getValueFromNanos](https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatExponentialDecaySpec#getValueFromNanos(kotlin.Long,kotlin.Float,kotlin.Float))`(` ` playTimeNanos: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` initialValue: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` initialVelocity: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) `)` Returns the value of the animation at the given time.          | Cmn |
| `open `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [getVelocityFromNanos](https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FloatExponentialDecaySpec#getVelocityFromNanos(kotlin.Long,kotlin.Float,kotlin.Float))`(` ` playTimeNanos: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` initialValue: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`,` ` initialVelocity: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) `)` Returns the velocity of the animation at the given time. | Cmn |

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

## Public constructors

### FloatExponentialDecaySpec

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

```
FloatExponentialDecaySpec(
    frictionMultiplier: @FloatRange(from = 0.0, fromInclusive = false) Float = 1.0f,
    absVelocityThreshold: @FloatRange(from = 0.0, fromInclusive = false) Float = 0.1f
)
```  

|                                                                                                                     Parameters                                                                                                                     |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| `frictionMultiplier: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` = 1.0f`   | The friction multiplier, indicating how quickly the animation should stop. This should be greater than `0`, with a default value of `1.0`. |
| `absVelocityThreshold: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, fromInclusive = false) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` = 0.1f` | The speed at which the animation is considered close enough to rest for the animation to finish.                                           |

## Public functions

### getDurationNanos

Cmn  

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

Returns the duration of the decay animation, in nanoseconds.  

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

### getTargetValue

Cmn  

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

### getValueFromNanos

Cmn  

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

Returns the value of the animation at the given time.  

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

### getVelocityFromNanos

Cmn  

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

Returns the velocity of the animation at the given time.  

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

## Public properties

### absVelocityThreshold

Cmn  

```
open val absVelocityThreshold: Float
```

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