public class ValueAnimator
extends Animator

   ↳ androidx.core.animation.Animator
     ↳ androidx.core.animation.ValueAnimator

This class provides a simple timing engine for running animations which calculate animated values and set them on target objects.

There is a single timing pulse that all animations use. It runs in a custom handler to ensure that property changes happen on the UI thread.

By default, ValueAnimator uses non-linear time interpolation, via the AccelerateDecelerateInterpolator class, which accelerates into and decelerates out of an animation. This behavior can be changed by calling setInterpolator(Interpolator).

Animators can be created from either code or resource files. Here is an example of a ValueAnimator resource file:

ValueAnimator also supports the use of a combination of PropertyValuesHolder and Keyframe resource tags to create a multi-step animation. Note that you can specify explicit fractional values (from 0 to 1) for each keyframe to determine when, in the overall duration, the animation should arrive at that value. Alternatively, you can leave the fractions off and the keyframes will be equally distributed within the total duration:

Developer Guides

For more information about animating with ValueAnimator, read the Property Animation developer guide.




This value used used with the setRepeatCount(int) property to repeat the animation indefinitely.


When the animation reaches the end and repeatCount is INFINITE or a positive value, the animation restarts from the beginning.


When the animation reaches the end and repeatCount is INFINITE or a positive value, the animation reverses direction on every iteration.

Inherited constants

Public constructors


Creates a new ValueAnimator object.

Public methods

static boolean areAnimatorsEnabled()

Returns whether animators are currently enabled, system-wide.

void cancel()

Cancels the animation.