public final class ObjectAnimator
extends ValueAnimator

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

This subclass of ValueAnimator provides support for animating properties on target objects. The constructors of this class take parameters to define the target object that will be animated as well as the name of the property that will be animated. Appropriate set/get functions are then determined internally and the animation will call these functions as necessary to animate the property.

ObjectAnimator supports the use of PropertyValuesHolder and Keyframe in resource files to create more complex animations. Using PropertyValuesHolders allows animators to animate several properties in parallel.

Using Keyframes allows animations to follow more complex paths from the start to the end values. 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. Also, a keyframe with no value will derive its value from the target object when the animator starts, just like animators with only one value specified. In addition, an optional interpolator can be specified. The interpolator will be applied on the interval between the keyframe that the interpolator is set on and the previous keyframe. When no interpolator is supplied, the default AccelerateDecelerateInterpolator will be used.

Developer Guides

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


Inherited constants

Public constructors


Creates a new ObjectAnimator object.

Public methods

ObjectAnimator clone()
String getNameForTrace()

Returns the name of this animator for debugging purposes.