# androidx.dynamicanimation.animation

*** ** * ** ***

## Interfaces

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationEndListener` | An animation listener that receives end notifications from an animation. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationUpdateListener` | Implementors of this interface can add themselves as update listeners to an `DynamicAnimation` instance to receive callbacks on every animation frame, after the current frame's values have been calculated for that `DynamicAnimation`. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler` | A scheduler that runs the given Runnable on the next frame. |

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/AnimationHandler` | This custom handler handles the timing pulse that is shared by all active ValueAnimators. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation` | This class is the base class of physics-based animations. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty` | ViewProperty holds the access of a property of a `https://developer.android.com/reference/android/view/View.html`. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FlingAnimation` | Fling animation is an animation that continues an initial momentum (most often from gesture velocity) and gradually slows down. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FloatPropertyCompat` | FloatPropertyCompat is an abstraction that can be used to represent a mutable float value that is held in a host object. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FloatValueHolder` | FloatValueHolder holds a float value. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` | SpringAnimation is an animation that is driven by a `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce`. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce` | Spring Force defines the characteristics of the spring being used in the animation. |

## Top-level functions summary

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FlingAnimation` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/package-summary#flingAnimationOf(kotlin.Function1,kotlin.Function0)(setter: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, getter: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Creates `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FlingAnimation` for a property that can be accessed via the provided setter and getter. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/package-summary#springAnimationOf(kotlin.Function1,kotlin.Function0,kotlin.Float)( setter: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, getter: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, finalPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Creates `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` for a property that can be accessed via the provided setter and getter. |

## Extension functions summary

|---|---|
| `inline https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation.https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/package-summary#(androidx.dynamicanimation.animation.SpringAnimation).withSpringForceProperties(kotlin.Function1)(func: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Updates or applies spring force properties like `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce#mDampingRatio()`, `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce#mFinalPosition()` and stiffness on SpringAnimation. |

## Top-level functions

### flingAnimationOf

Artifact: [androidx.dynamicanimation:dynamicanimation-ktx](https://developer.android.com/jetpack/androidx/releases/dynamicanimation) [View Source](https://cs.android.com/search?q=file:androidx/dynamicanimation/animation/DynamicAnimation.kt+function:flingAnimationOf) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun flingAnimationOf(setter: (Float) -> Unit, getter: () -> Float): FlingAnimation
```

Creates `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FlingAnimation` for a property that can be accessed via the provided setter and getter. For example, the following sample code creates a `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FlingAnimation` for the alpha property of a View object named `view`: `flingAnimationOf(view::setAlpha, view::getAlpha)`

| Parameters |
|---|---|
| `setter: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The function that mutates the property being animated |
| `getter: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The function that returns the value of the property |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FlingAnimation` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FlingAnimation` |

### springAnimationOf

Artifact: [androidx.dynamicanimation:dynamicanimation-ktx](https://developer.android.com/jetpack/androidx/releases/dynamicanimation) [View Source](https://cs.android.com/search?q=file:androidx/dynamicanimation/animation/DynamicAnimation.kt+function:springAnimationOf) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun springAnimationOf(
    setter: (Float) -> Unit,
    getter: () -> Float,
    finalPosition: Float = Float.NaN
): SpringAnimation
```

Creates `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` for a property that can be accessed via the provided setter and getter. If finalPosition is not `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/-companion/-na-n.html` then create `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` with `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce#mFinalPosition()`.

| Parameters |
|---|---|
| `setter: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The function that mutates the property being animated |
| `getter: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The function that returns the value of the property |
| `finalPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = Float.NaN` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce#mFinalPosition()` Final position of spring. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` |

## Extension functions

### SpringAnimation.withSpringForceProperties

Artifact: [androidx.dynamicanimation:dynamicanimation-ktx](https://developer.android.com/jetpack/androidx/releases/dynamicanimation) [View Source](https://cs.android.com/search?q=file:androidx/dynamicanimation/animation/DynamicAnimation.kt+function:withSpringForceProperties) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
inline fun SpringAnimation.withSpringForceProperties(func: SpringForce.() -> Unit): SpringAnimation
```

Updates or applies spring force properties like `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce#mDampingRatio()`, `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce#mFinalPosition()` and stiffness on SpringAnimation.

If `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation#mSpring()` is null in case `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` is created without final position it will be created and attached to `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation`

| Parameters |
|---|---|
| `func: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | lambda with receiver on `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce` |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation` |