# AnimationHandler

# AnimationHandler

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/dynamicanimation/animation/AnimationHandler "View this page in Java")

<br />

```
class AnimationHandler
```

<br />

*** ** * ** ***

This custom handler handles the timing pulse that is shared by all active ValueAnimators. This approach ensures that the setting of animation values will happen on the same thread that animations start on, and that all animations will share the same times for calculating their values, which makes synchronizing animations possible. The handler uses the Choreographer by default for doing periodic callbacks. A custom AnimationFrameCallbackProvider can be set on the handler to provide timing pulse that may be independent of UI frame update. This could be useful in testing.

## Summary

|                                                                                                                                                                                                                                                                                        ### Public constructors                                                                                                                                                                                                                                                                                        |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [AnimationHandler](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/AnimationHandler#AnimationHandler(androidx.dynamicanimation.animation.FrameCallbackScheduler))`(scheduler: `[FrameCallbackScheduler](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler)`)` The constructor of the AnimationHandler with[FrameCallbackScheduler](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler)which is handle running the given Runnable on the next frame. |

|                              ### Public functions                               |
|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | `@`[VisibleForTesting](https://developer.android.com/reference/kotlin/androidx/annotation/VisibleForTesting) [getDurationScale](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/AnimationHandler#getDurationScale())`()` Returns the system-wide scaling factor for animations. |

## Public constructors

### AnimationHandler

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

```
AnimationHandler(scheduler: FrameCallbackScheduler)
```

The constructor of the AnimationHandler with[FrameCallbackScheduler](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler)which is handle running the given Runnable on the next frame.  

|                                                                    Parameters                                                                    |
|--------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| `scheduler: `[FrameCallbackScheduler](https://developer.android.com/reference/kotlin/androidx/dynamicanimation/animation/FrameCallbackScheduler) | The scheduler for this handler to run the given runnable. |

## Public functions

### getDurationScale

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

```
@VisibleForTesting
fun getDurationScale(): Float
```

Returns the system-wide scaling factor for animations.