# DynamicAnimation

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

*** ** * ** ***


```
abstract class DynamicAnimation<T : DynamicAnimation<T!>?>
```

<br />

Known direct subclasses [FlingAnimation](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FlingAnimation), [SpringAnimation](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringAnimation)

|---|---|
| `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/SpringAnimation` | SpringAnimation is an animation that is driven by a `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/SpringForce`. |

*** ** * ** ***

This class is the base class of physics-based animations. It manages the animation's lifecycle such as `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#start()` and `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#cancel()`. This base class also handles the common setup for all the subclass animations. For example, DynamicAnimation supports adding `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationEndListener` and `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationUpdateListener` so that the important animation events can be observed through the callbacks. The start conditions for any subclass of DynamicAnimation can be set using `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setStartValue(float)` and `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setStartVelocity(float)`.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation<T!>?>` | subclass of DynamicAnimation |

## Summary

| ### Nested types |
|---|
| `interface https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationEndListener` An animation listener that receives end notifications from an animation. |
| `interface 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`. |
| `abstract class https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty : https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FloatPropertyCompat<https://developer.android.com/reference/android/view/View.html!>` ViewProperty holds the access of a property of a `https://developer.android.com/reference/android/view/View.html`. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#ALPHA()` View's alpha property. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_ALPHA() = 0.00390625f` The minimum visible change in alpha that can be visible to users. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_PIXELS() = 1.0f` The minimum visible change in pixels that can be visible to users. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_ROTATION_DEGREES() = 0.1f` The minimum visible change in degrees that can be visible to users. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_SCALE() = 0.002f` The minimum visible change in scale that can be visible to users. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#ROTATION()` View's rotation property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#ROTATION_X()` View's rotationX property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#ROTATION_Y()` View's rotationY property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#SCALE_X()` View's scaleX property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#SCALE_Y()` View's scaleY property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#SCROLL_X()` View's scrollX property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#SCROLL_Y()` View's scrollY property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#TRANSLATION_X()` View's translationX property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#TRANSLATION_Y()` View's translationY property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#TRANSLATION_Z()` View's translationZ property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#X()` View's x property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#Y()` View's y property. |
| `const https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#Z()` View's z property. |

| ### Public functions |
|---|---|
| `T!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#addEndListener(androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationEndListener)(listener: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationEndListener!)` Adds an end listener to the animation for receiving onAnimationEnd callbacks. |
| `T!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#addUpdateListener(androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationUpdateListener)(listener: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationUpdateListener!)` Adds an update listener to the animation for receiving per-frame animation update callbacks. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#cancel()()` Cancels the on-going animation. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/AnimationHandler` | `@https://developer.android.com/reference/kotlin/androidx/annotation/VisibleForTesting https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#getAnimationHandler()()` Returns the `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/AnimationHandler` used to schedule updates for this animator. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#getMinimumVisibleChange()()` Returns the minimum change in the animation property that could be visibly different to users. |
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#getScheduler()()` Returns the `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler` used to schedule updates for this animator. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#isRunning()()` Returns whether the animation is currently running. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#removeEndListener(androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationEndListener)(listener: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationEndListener!)` Removes the end listener from the animation, so as to stop receiving animation end callbacks. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#removeUpdateListener(androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationUpdateListener)( listener: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationUpdateListener! )` Removes the update listener from the animation, so as to stop receiving animation update callbacks. |
| `T!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setMaxValue(float)(max: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the max value of the animation. |
| `T!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setMinValue(float)(min: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the min value of the animation. |
| `T!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setMinimumVisibleChange(float)( minimumVisibleChange: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` This method sets the minimal change of animation value that is visible to users, which helps determine a reasonable threshold for the animation's termination condition. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setScheduler(androidx.dynamicanimation.animation.FrameCallbackScheduler)(scheduler: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler)` Sets the frame scheduler used to schedule updates for this animator. |
| `T!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setStartValue(float)(startValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the start value of the animation. |
| `T!` | `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setStartVelocity(float)(startVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Start velocity of the animation. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#start()()` Starts an animation. |

## Constants

### ALPHA

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val ALPHA: DynamicAnimation.ViewProperty!
```

View's alpha property.

### MIN_VISIBLE_CHANGE_ALPHA

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val MIN_VISIBLE_CHANGE_ALPHA = 0.00390625f: Float
```

The minimum visible change in alpha that can be visible to users.

### MIN_VISIBLE_CHANGE_PIXELS

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val MIN_VISIBLE_CHANGE_PIXELS = 1.0f: Float
```

The minimum visible change in pixels that can be visible to users.

### MIN_VISIBLE_CHANGE_ROTATION_DEGREES

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val MIN_VISIBLE_CHANGE_ROTATION_DEGREES = 0.1f: Float
```

The minimum visible change in degrees that can be visible to users.

### MIN_VISIBLE_CHANGE_SCALE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val MIN_VISIBLE_CHANGE_SCALE = 0.002f: Float
```

The minimum visible change in scale that can be visible to users.

### ROTATION

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val ROTATION: DynamicAnimation.ViewProperty!
```

View's rotation property.

### ROTATION_X

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val ROTATION_X: DynamicAnimation.ViewProperty!
```

View's rotationX property.

### ROTATION_Y

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val ROTATION_Y: DynamicAnimation.ViewProperty!
```

View's rotationY property.

### SCALE_X

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val SCALE_X: DynamicAnimation.ViewProperty!
```

View's scaleX property.

### SCALE_Y

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val SCALE_Y: DynamicAnimation.ViewProperty!
```

View's scaleY property.

### SCROLL_X

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val SCROLL_X: DynamicAnimation.ViewProperty!
```

View's scrollX property.

### SCROLL_Y

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val SCROLL_Y: DynamicAnimation.ViewProperty!
```

View's scrollY property.

### TRANSLATION_X

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val TRANSLATION_X: DynamicAnimation.ViewProperty!
```

View's translationX property.

### TRANSLATION_Y

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val TRANSLATION_Y: DynamicAnimation.ViewProperty!
```

View's translationY property.

### TRANSLATION_Z

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val TRANSLATION_Z: DynamicAnimation.ViewProperty!
```

View's translationZ property.

### X

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val X: DynamicAnimation.ViewProperty!
```

View's x property.

### Y

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val Y: DynamicAnimation.ViewProperty!
```

View's y property.

### Z

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
const val Z: DynamicAnimation.ViewProperty!
```

View's z property.

## Public functions

### addEndListener

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun addEndListener(listener: DynamicAnimation.OnAnimationEndListener!): T!
```

Adds an end listener to the animation for receiving onAnimationEnd callbacks. If the listener is `null` or has already been added to the list of listeners for the animation, no op.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationEndListener!` | the listener to be added |

| Returns |
|---|---|
| `T!` | the animation to which the listener is added |

### addUpdateListener

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun addUpdateListener(listener: DynamicAnimation.OnAnimationUpdateListener!): T!
```

Adds an update listener to the animation for receiving per-frame animation update callbacks. If the listener is `null` or has already been added to the list of listeners for the animation, no op.

Note that update listener should only be added before the start of the animation.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationUpdateListener!` | the listener to be added |

| Returns |
|---|---|
| `T!` | the animation to which the listener is added |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the update listener is added after the animation has started |

### cancel

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
@MainThread
fun cancel(): Unit
```

Cancels the on-going animation. If the animation hasn't started, no op. Unless a AnimationHandler is provided via setAnimationHandler, a default AnimationHandler is created on the same thread as the first call to start/cancel an animation. All the subsequent animation lifecycle manipulations need to be on that same thread, until the AnimationHandler is reset (using \[setAnimationHandler\]).

| Throws |
|---|---|
| `https://developer.android.com/reference/android/util/AndroidRuntimeException.html` | if this method is not called on the same thread as the animation handler |

### getAnimationHandler

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.1.0)

```
@VisibleForTesting
fun getAnimationHandler(): AnimationHandler
```

Returns the `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/AnimationHandler` used to schedule updates for this animator.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/AnimationHandler` | the `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/AnimationHandler` for this animator. |

### getMinimumVisibleChange

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun getMinimumVisibleChange(): Float
```

Returns the minimum change in the animation property that could be visibly different to users.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | minimum change in property value that is visible to users |

### getScheduler

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.1.0)

```
fun getScheduler(): FrameCallbackScheduler
```

Returns the `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler` used to schedule updates for this animator. If not already set using `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setScheduler(androidx.dynamicanimation.animation.FrameCallbackScheduler)`, this is initialized to an `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler` that uses the caller thread's `https://developer.android.com/reference/android/view/Choreographer.html`. Otherwise, return the scheduler set via the previous `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#setScheduler(androidx.dynamicanimation.animation.FrameCallbackScheduler)` call.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler` | the `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler` for this animator. |

### isRunning

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun isRunning(): Boolean
```

Returns whether the animation is currently running.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the animation is currently running, `false` otherwise |

### removeEndListener

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun removeEndListener(listener: DynamicAnimation.OnAnimationEndListener!): Unit
```

Removes the end listener from the animation, so as to stop receiving animation end callbacks.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationEndListener!` | the listener to be removed |

### removeUpdateListener

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun removeUpdateListener(
    listener: DynamicAnimation.OnAnimationUpdateListener!
): Unit
```

Removes the update listener from the animation, so as to stop receiving animation update callbacks.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.OnAnimationUpdateListener!` | the listener to be removed |

### setMaxValue

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun setMaxValue(max: Float): T!
```

Sets the max value of the animation. Animations will not animate beyond their max value. Whether or not animation will come to an end when max value is reached is dependent on the child animation's implementation.

| Parameters |
|---|---|
| `max: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | maximum value of the property to be animated |

| Returns |
|---|---|
| `T!` | the Animation whose max value is being set |

### setMinValue

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun setMinValue(min: Float): T!
```

Sets the min value of the animation. Animations will not animate beyond their min value. Whether or not animation will come to an end when min value is reached is dependent on the child animation's implementation.

| Parameters |
|---|---|
| `min: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | minimum value of the property to be animated |

| Returns |
|---|---|
| `T!` | the Animation whose min value is being set |

### setMinimumVisibleChange

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun setMinimumVisibleChange(
    minimumVisibleChange: @FloatRange(from = 0.0, fromInclusive = false) Float
): T!
```

This method sets the minimal change of animation value that is visible to users, which helps determine a reasonable threshold for the animation's termination condition. It is critical to set the minimal visible change for custom properties (i.e. non-`ViewProperty`s) unless the custom property is in pixels.

For custom properties, this minimum visible change defaults to change in pixel (i.e. `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_PIXELS()`. It is recommended to adjust this value that is reasonable for the property to be animated. A general rule of thumb to calculate such a value is: minimum visible change = range of custom property value / corresponding pixel range. For example, if the property to be animated is a progress (from 0 to 100) that corresponds to a 200-pixel change. Then the min visible change should be 100 / 200. (i.e. 0.5).

It's not necessary to call this method when animating `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation.ViewProperty`s, as the minimum visible change will be derived from the property. For example, if the property to be animated is in pixels (i.e. `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#TRANSLATION_X()`, `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#TRANSLATION_Y()`, `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#TRANSLATION_Z()`, @`https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#SCROLL_X()` or `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#SCROLL_Y()`), the default minimum visible change is 1 (pixel). For `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#ROTATION()`, `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#ROTATION_X()` or `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#ROTATION_Y()`, the animation will use `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_ROTATION_DEGREES()` as the min visible change, which is 1/10. Similarly, the minimum visible change for alpha ( i.e. `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#MIN_VISIBLE_CHANGE_ALPHA()` is defined as 1 / 256.

| Parameters |
|---|---|
| `minimumVisibleChange: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | minimum change in property value that is visible to users |

| Returns |
|---|---|
| `T!` | the animation whose min visible change is being set |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the given threshold is not positive |

### setScheduler

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.1.0)

```
fun setScheduler(scheduler: FrameCallbackScheduler): Unit
```

Sets the frame scheduler used to schedule updates for this animator. Note this should be called before animation running, as it would lead to discontinuity in animations.

| Parameters |
|---|---|
| `scheduler: https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler` | The `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler` that will be used to schedule updates for this animator. |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/util/AndroidRuntimeException.html` | if this method called when animation running |

### setStartValue

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun setStartValue(startValue: Float): T!
```

Sets the start value of the animation. If start value is not set, the animation will get the current value for the view's property, and use that as the start value.

| Parameters |
|---|---|
| `startValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | start value for the animation |

| Returns |
|---|---|
| `T!` | the Animation whose start value is being set |

### setStartVelocity

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
fun setStartVelocity(startVelocity: Float): T!
```

Start velocity of the animation. Default velocity is 0. Unit: change in property per second (e.g. pixels per second, scale/alpha value change per second).

Note when using a fixed value as the start velocity (as opposed to getting the velocity through touch events), it is recommended to define such a value in dp/second and convert it to pixel/second based on the density of the screen to achieve a consistent look across different screens.

To convert from dp/second to pixel/second:

```kotlin
float pixelPerSecond = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpPerSecond,
        getResources().getDisplayMetrics());
```

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

| Returns |
|---|---|
| `T!` | the Animation whose start velocity is being set |

### start

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/dynamicanimation#1.0.0)

```
@MainThread
fun start(): Unit
```

Starts an animation. If the animation has already been started, no op. Note that calling `https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/DynamicAnimation#start()` will not immediately set the property value to start value of the animation. The property values will be changed at each animation pulse, which happens before the draw pass. As a result, the changes will be reflected in the next frame, the same as if the values were set immediately. This method should only be called on main thread. Unless a AnimationHandler is provided via setAnimationHandler, a default AnimationHandler is created on the same thread as the first call to start/cancel an animation. All the subsequent animation lifecycle manipulations need to be on that same thread, until the AnimationHandler is reset (using \[setAnimationHandler\]).

| Throws |
|---|---|
| `https://developer.android.com/reference/android/util/AndroidRuntimeException.html` | if this method is not called on the same thread as the animation handler |