ObjectAnimator
public
final
class
ObjectAnimator
extends ValueAnimator
| java.lang.Object | |||
| ↳ | 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.
See also:
Summary
Inherited constants |
|---|
Public constructors | |
|---|---|
ObjectAnimator()
Creates a new ObjectAnimator object. |
|
Public methods | |
|---|---|
ObjectAnimator
|
clone()
|
String
|
getNameForTrace()
Returns the name of this animator for debugging purposes. |
String
|
getPropertyName()
Gets the name of the property that will be animated. |
Object
|
getTarget()
The target object whose property will be animated by this animation |
static
ObjectAnimator
|
ofArgb(Object target, String propertyName, int... values)
Constructs and returns an ObjectAnimator that animates between color values. |
static
<T>
ObjectAnimator
|
ofArgb(T target, Property<T, Integer> property, int... values)
Constructs and returns an ObjectAnimator that animates between color values. |
static
ObjectAnimator
|
ofFloat(Object target, String xPropertyName, String yPropertyName, Path path)
Constructs and returns an ObjectAnimator that animates coordinates along a |
static
<T>
ObjectAnimator
|
ofFloat(T target, Property<T, Float> property, float... values)
Constructs and returns an ObjectAnimator that animates between float values. |
static
<T>
ObjectAnimator
|
ofFloat(T target, Property<T, Float> xProperty, Property<T, Float> yProperty, Path path)
Constructs and returns an ObjectAnimator that animates coordinates along a |
static
ObjectAnimator
|
ofFloat(Object target, String propertyName, float... values)
Constructs and returns an ObjectAnimator that animates between float values. |
static
<T>
ObjectAnimator
|
ofInt(T target, Property<T, Integer> xProperty, Property<T, Integer> yProperty, Path path)
Constructs and returns an ObjectAnimator that animates coordinates along a |
static
<T>
ObjectAnimator
|
ofInt(T target, Property<T, Integer> property, int... values)
Constructs and returns an ObjectAnimator that animates between int values. |
static
ObjectAnimator
|
ofInt(Object target, String propertyName, int... values)
Constructs and returns an ObjectAnimator that animates between int values. |
static
ObjectAnimator
|
ofInt(Object target, String xPropertyName, String yPropertyName, Path path)
Constructs and returns an ObjectAnimator that animates coordinates along a |
static
ObjectAnimator
|
ofMultiFloat(Object target, String propertyName, float[][] values)
Constructs and returns an ObjectAnimator that animates over float values for a multiple parameters setter. |
static
ObjectAnimator
|
ofMultiFloat(Object target, String propertyName, Path path)
Constructs and returns an ObjectAnimator that animates the target using a multi-float setter
along the given |
static
<T>
ObjectAnimator
|
ofMultiFloat(Object target, String propertyName, TypeConverter<T, float[]> converter, TypeEvaluator<T> evaluator, T... values)
Constructs and returns an ObjectAnimator that animates over values for a multiple float parameters setter. |
static
ObjectAnimator
|
ofMultiInt(Object target, String propertyName, int[][] values)
Constructs and returns an ObjectAnimator that animates over int values for a multiple parameters setter. |
static
<T>
ObjectAnimator
|
ofMultiInt(Object target, String propertyName, TypeConverter<T, int[]> converter, TypeEvaluator<T> evaluator, T... values)
Constructs and returns an ObjectAnimator that animates over values for a multiple int parameters setter. |
static
ObjectAnimator
|
ofMultiInt(Object target, String propertyName, Path path)
Constructs and returns |