# 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)

*** ** * ** ***


```
public 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 |
|---|
| `https://developer.android.com/reference/androidx/dynamicanimation/animation/AnimationHandler#AnimationHandler(androidx.dynamicanimation.animation.FrameCallbackScheduler)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/dynamicanimation/animation/FrameCallbackScheduler scheduler)` The constructor of the AnimationHandler with `https://developer.android.com/reference/androidx/dynamicanimation/animation/FrameCallbackScheduler` which is handle running the given Runnable on the next frame. |

| ### Public methods |
|---|---|
| `float` | `@https://developer.android.com/reference/androidx/annotation/VisibleForTesting https://developer.android.com/reference/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)

```
public AnimationHandler(@NonNull FrameCallbackScheduler scheduler)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/dynamicanimation/animation/FrameCallbackScheduler scheduler` | The scheduler for this handler to run the given runnable. |

## Public methods

### getDurationScale

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

```
@VisibleForTesting
public float getDurationScale()
```

Returns the system-wide scaling factor for animations.