Google is committed to advancing racial equity for Black communities. See how.

ObjectAnimator

class ObjectAnimator : ValueAnimator
kotlin.Any
   ↳ 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.

Summary

Inherited constants

Public constructors

Creates a new ObjectAnimator object.

Public methods

ObjectAnimator

String

String

Gets the name of the property that will be animated.

Any?

The target object whose property will be animated by this animation

static ObjectAnimator
ofArgb(@NonNull target: Any, @NonNull propertyName: String, @NonNull vararg values: Int)

Constructs and returns an ObjectAnimator that animates between color values.

static ObjectAnimator
ofArgb(@NonNull target: T, @NonNull property: Property<T, Int!>, @NonNull vararg values: Int)

Constructs and returns an ObjectAnimator that animates between color values.

static ObjectAnimator
ofFloat(@NonNull target: Any, @NonNull propertyName: String, @NonNull vararg values: Float)

Constructs and returns an ObjectAnimator that animates between float values.

static ObjectAnimator
ofFloat(@NonNull target: Any, @Nullable xPropertyName: String?, @Nullable yPropertyName: String?, @NonNull path: Path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

static ObjectAnimator
ofFloat(@NonNull target: T, @NonNull property: Property<T, Float!>, @NonNull vararg values: Float)

Constructs and returns an ObjectAnimator that animates between float values.

static ObjectAnimator
ofFloat(@NonNull target: T, @Nullable xProperty: Property<T, Float!>?, @Nullable yProperty: Property<T, Float!>?, @NonNull path: Path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

static ObjectAnimator
ofInt(@NonNull target: Any, @NonNull propertyName: String, @NonNull vararg values: Int)

Constructs and returns an ObjectAnimator that animates between int values.

static ObjectAnimator
ofInt(@NonNull target: Any, @NonNull xPropertyName: String, @NonNull yPropertyName: String, @NonNull path: Path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

static ObjectAnimator
ofInt(@NonNull target: T, @NonNull property: Property<T, Int!>, @NonNull vararg values: Int)

Constructs and returns an ObjectAnimator that animates between int values.

static ObjectAnimator
ofInt(@NonNull target: T, @Nullable xProperty: Property<T, Int!>?, @Nullable yProperty: Property<T, Int!>?, @NonNull path: Path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

static ObjectAnimator
ofMultiFloat(@NonNull target: Any, @NonNull propertyName: String, @NonNull values: Array<FloatArray!>)

Constructs and returns an ObjectAnimator that animates over float values for a multiple parameters setter.

static ObjectAnimator
ofMultiFloat(@NonNull target: Any, @NonNull propertyName: String, @NonNull path: Path)

Constructs and returns an ObjectAnimator that animates the target using a multi-float setter along the given Path.

static ObjectAnimator
ofMultiFloat(@NonNull target: Any, @NonNull propertyName: String, @NonNull converter: TypeConverter<T, FloatArray!>, @NonNull evaluator: TypeEvaluator<T>, @NonNull vararg values: T)

Constructs and returns an ObjectAnimator that animates over values for a multiple float parameters setter.

static ObjectAnimator
ofMultiInt(@NonNull target: Any, @NonNull propertyName: String, @NonNull values: Array<IntArray!>)

Constructs and returns an ObjectAnimator that animates over int values for a multiple parameters setter.

static ObjectAnimator
ofMultiInt(@NonNull target: Any, @NonNull propertyName: String, @NonNull path: Path)

Constructs and returns an ObjectAnimator that animates the target using a multi-int setter along the given Path.

static ObjectAnimator
ofMultiInt(@NonNull target: Any, @NonNull propertyName: String, @NonNull converter: TypeConverter<T, IntArray!>, @NonNull evaluator: TypeEvaluator<T>, @NonNull vararg values: T)

Constructs and returns an ObjectAnimator that animates over values for a multiple int parameters setter.

static ObjectAnimator
ofObject(@NonNull target: Any, @NonNull propertyName: String, @NonNull evaluator: TypeEvaluator<Any!>, @NonNull vararg values: Any!)

Constructs and returns an ObjectAnimator that animates between Object values.

static ObjectAnimator
ofObject(@NonNull target: Any, @NonNull propertyName: String, @Nullable converter: TypeConverter<PointF!, *>?, @NonNull path: Path)

Constructs and returns an ObjectAnimator that animates a property along a Path.

static ObjectAnimator
ofObject(@NonNull target: T, @NonNull property: Property<T, V>, @NonNull evaluator: TypeEvaluator<V>, @NonNull vararg values: V)

Constructs and returns an ObjectAnimator that animates between Object values.

static ObjectAnimator
ofObject(@NonNull target: T, @NonNull property: Property<T, P>, @NonNull converter: TypeConverter<V, P>, @NonNull evaluator: TypeEvaluator<V>, @NonNull vararg values: V)

Constructs and returns an ObjectAnimator that animates between Object values.

static ObjectAnimator
ofObject(@NonNull target: T, @NonNull property: Property<T, V>, @Nullable converter: TypeConverter<PointF!, V>?, @NonNull path: Path)

Constructs and returns an ObjectAnimator that animates a property along a Path.

static ObjectAnimator
ofPropertyValuesHolder(@NonNull target: Any, @NonNull vararg values: PropertyValuesHolder!)

Constructs and returns an ObjectAnimator that animates between the sets of values specified in PropertyValueHolder objects.

Unit

autoCancel controls whether an ObjectAnimator will be canceled automatically when any other ObjectAnimator with the same target and properties is started.

ObjectAnimator
setDuration(duration: Long)

Sets the length of the animation.

Unit
setFloatValues(@NonNull vararg values: Float)

Unit
setIntValues(@NonNull vararg values: Int)

Unit
setObjectValues(@NonNull vararg values: Any!)

Unit
setProperty(@NonNull property: Property<Any!, Any!>)

Sets the property that will be animated.

Unit
setPropertyName(@NonNull propertyName: String)

Sets the name of the property that will be animated.

Unit
setTarget(@Nullable target: Any?)

Unit

Unit

Unit

String

Inherited functions

Public constructors

<init>

ObjectAnimator()

Creates a new ObjectAnimator object. This default constructor is primarily for use internally; the other constructors which take parameters are more generally useful.

Public methods

clone

@NonNull fun clone(): ObjectAnimator

getNameForTrace

@NonNull fun getNameForTrace(): String

getPropertyName

@NonNull fun getPropertyName(): String

Gets the name of the property that will be animated. This name will be used to derive a setter function that will be called to set animated values. For example, a property name of foo will result in a call to the function setFoo() on the target object. If either valueFrom or valueTo is null, then a getter function will also be derived and called.

If this animator was created with a Property object instead of the string name of a property, then this method will return the of that Property object instead. If this animator was created with one or more PropertyValuesHolder objects, then this method will return the name of that object (if there was just one) or a comma-separated list of all of the names (if there are more than one).

getTarget

@Nullable fun getTarget(): Any?

The target object whose property will be animated by this animation

Return
Any? The object being animated

ofArgb

@NonNull static fun ofArgb(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull vararg values: Int
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between color values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target Any: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName String: The name of the property being animated.
values Int: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofArgb

@NonNull static fun <T : Any!> ofArgb(
    @NonNull target: T,
    @NonNull property: Property<T, Int!>,
    @NonNull vararg values: Int
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between color values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target T: The object whose property is to be animated.
property Property<T, Int!>: The property being animated.
values Int: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofFloat

@NonNull static fun ofFloat(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull vararg values: Float
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between float values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target Any: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName String: The name of the property being animated.
values Float: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofFloat

@NonNull static fun ofFloat(
    @NonNull target: Any,
    @Nullable xPropertyName: String?,
    @Nullable yPropertyName: String?,
    @NonNull path: Path
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are floats that are set to separate properties designated by xPropertyName and yPropertyName.

Parameters
target Any: The object whose properties are to be animated. This object should have public methods on it called setNameX() and setNameY, where nameX and nameY are the value of the xPropertyName and yPropertyName parameters, respectively.
xPropertyName String?: The name of the property for the x coordinate being animated.
yPropertyName String?: The name of the property for the y coordinate being animated.
path Path: The Path to animate values along.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate along path.

ofFloat

@NonNull static fun <T : Any!> ofFloat(
    @NonNull target: T,
    @NonNull property: Property<T, Float!>,
    @NonNull vararg values: Float
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between float values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target T: The object whose property is to be animated.
property Property<T, Float!>: The property being animated.
values Float: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofFloat

@NonNull static fun <T : Any!> ofFloat(
    @NonNull target: T,
    @Nullable xProperty: Property<T, Float!>?,
    @Nullable yProperty: Property<T, Float!>?,
    @NonNull path: Path
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are floats that are set to separate properties, xProperty and yProperty.

Parameters
target T: The object whose properties are to be animated.
xProperty Property<T, Float!>?: The property for the x coordinate being animated.
yProperty Property<T, Float!>?: The property for the y coordinate being animated.
path Path: The Path to animate values along.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate along path.

ofInt

@NonNull static fun ofInt(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull vararg values: Int
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between int values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target Any: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName String: The name of the property being animated.
values Int: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofInt

@NonNull static fun ofInt(
    @NonNull target: Any,
    @NonNull xPropertyName: String,
    @NonNull yPropertyName: String,
    @NonNull path: Path
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are integers that are set to separate properties designated by xPropertyName and yPropertyName.

Parameters
target Any: The object whose properties are to be animated. This object should have public methods on it called setNameX() and setNameY, where nameX and nameY are the value of xPropertyName and yPropertyName parameters, respectively.
xPropertyName String: The name of the property for the x coordinate being animated.
yPropertyName String: The name of the property for the y coordinate being animated.
path Path: The Path to animate values along.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate along path.

ofInt

@NonNull static fun <T : Any!> ofInt(
    @NonNull target: T,
    @NonNull property: Property<T, Int!>,
    @NonNull vararg values: Int
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between int values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target T: The object whose property is to be animated.
property Property<T, Int!>: The property being animated.
values Int: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofInt

@NonNull static fun <T : Any!> ofInt(
    @NonNull target: T,
    @Nullable xProperty: Property<T, Int!>?,
    @Nullable yProperty: Property<T, Int!>?,
    @NonNull path: Path
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are integers that are set to separate properties, xProperty and yProperty.

Parameters
target T: The object whose properties are to be animated.
xProperty Property<T, Int!>?: The property for the x coordinate being animated.
yProperty Property<T, Int!>?: The property for the y coordinate being animated.
path Path: The Path to animate values along.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate along path.

ofMultiFloat

@NonNull static fun ofMultiFloat(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull values: Array<FloatArray!>
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates over float values for a multiple parameters setter. Only public methods that take only float parameters are supported. Each float[] contains a complete set of parameters to the setter method. At least two float[] values must be provided, a start and end. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target Any: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName String: The name of the property being animated or the name of the setter method.
values Array<FloatArray!>: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofMultiFloat

@NonNull static fun ofMultiFloat(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull path: Path
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates the target using a multi-float setter along the given Path. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are float x and y coordinates used in the first and second parameter of the setter, respectively.

Parameters
target Any: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName String: The name of the property being animated or the name of the setter method.
path Path: The Path to animate values along.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate along path.

ofMultiFloat

@SafeVarargs @NonNull static fun <T : Any!> ofMultiFloat(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull converter: TypeConverter<T, FloatArray!>,
    @NonNull evaluator: TypeEvaluator<T>,
    @NonNull vararg values: T
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates over values for a multiple float parameters setter. Only public methods that take only float parameters are supported.

At least two values must be provided, a start and end. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target Any: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName String: The name of the property being animated or the name of the setter method.
converter TypeConverter<T, FloatArray!>: Converts T objects into float parameters for the multi-value setter.
evaluator TypeEvaluator<T>: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values T: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofMultiInt

@NonNull static fun ofMultiInt(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull values: Array<IntArray!>
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates over int values for a multiple parameters setter. Only public methods that take only int parameters are supported. Each int[] contains a complete set of parameters to the setter method. At least two int[] values must be provided, a start and end. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target Any: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName String: The name of the property being animated or the name of the setter method.
values Array<IntArray!>: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofMultiInt

@NonNull static fun ofMultiInt(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull path: Path
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates the target using a multi-int setter along the given Path. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are integer x and y coordinates used in the first and second parameter of the setter, respectively.

Parameters
target Any: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName String: The name of the property being animated or the name of the setter method.
path Path: The Path to animate values along.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate along path.

ofMultiInt

@SafeVarargs @NonNull static fun <T : Any!> ofMultiInt(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull converter: TypeConverter<T, IntArray!>,
    @NonNull evaluator: TypeEvaluator<T>,
    @NonNull vararg values: T
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates over values for a multiple int parameters setter. Only public methods that take only int parameters are supported.

At least two values must be provided, a start and end. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters
target Any: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName String: The name of the property being animated or the name of the setter method.
converter TypeConverter<T, IntArray!>: Converts T objects into int parameters for the multi-value setter.
evaluator TypeEvaluator<T>: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values T: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofObject

@NonNull static fun ofObject(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @NonNull evaluator: TypeEvaluator<Any!>,
    @NonNull vararg values: Any!
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between Object values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Note: The values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the animator. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters
target Any: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName String: The name of the property being animated.
evaluator TypeEvaluator<Any!>: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values Any!: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofObject

@NonNull static fun ofObject(
    @NonNull target: Any,
    @NonNull propertyName: String,
    @Nullable converter: TypeConverter<PointF!, *>?,
    @NonNull path: Path
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates a property along a Path. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. This variant animates the coordinates in a PointF to follow the Path. If the Property associated with propertyName uses a type other than PointF, converter can be used to change from PointF to the type associated with the Property.

Parameters
target Any: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName String: The name of the property being animated.
converter TypeConverter<PointF!, *>?: Converts a PointF to the type associated with the setter. May be null if conversion is unnecessary.
path Path: The Path to animate values along.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate along path.

ofObject

@NonNull @SafeVarargs static fun <T : Any!, V : Any!> ofObject(
    @NonNull target: T,
    @NonNull property: Property<T, V>,
    @NonNull evaluator: TypeEvaluator<V>,
    @NonNull vararg values: V
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between Object values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Note: The values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the animator. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters
target T: The object whose property is to be animated.
property Property<T, V>: The property being animated.
evaluator TypeEvaluator<V>: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values V: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofObject

@NonNull @SafeVarargs static fun <T : Any!, V : Any!, P : Any!> ofObject(
    @NonNull target: T,
    @NonNull property: Property<T, P>,
    @NonNull converter: TypeConverter<V, P>,
    @NonNull evaluator: TypeEvaluator<V>,
    @NonNull vararg values: V
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between Object values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation). This variant supplies a TypeConverter to convert from the animated values to the type of the property. If only one value is supplied, the TypeConverter must be a BidirectionalTypeConverter to retrieve the current value.

Note: The values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the animator. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters
target T: The object whose property is to be animated.
property Property<T, P>: The property being animated.
converter TypeConverter<V, P>: Converts the animated object to the Property type.
evaluator TypeEvaluator<V>: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values V: A set of values that the animation will animate between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

ofObject

@NonNull static fun <T : Any!, V : Any!> ofObject(
    @NonNull target: T,
    @NonNull property: Property<T, V>,
    @Nullable converter: TypeConverter<PointF!, V>?,
    @NonNull path: Path
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates a property along a Path. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. This variant animates the coordinates in a PointF to follow the Path. If property uses a type other than PointF, converter can be used to change from PointF to the type associated with the Property.

The PointF passed to converter or property, if converter is null, is reused on each animation frame and should not be stored by the setter or TypeConverter.

Parameters
target T: The object whose property is to be animated.
property Property<T, V>: The property being animated. Should not be null.
converter TypeConverter<PointF!, V>?: Converts a PointF to the type associated with the setter. May be null if conversion is unnecessary.
path Path: The Path to animate values along.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate along path.

ofPropertyValuesHolder

@NonNull static fun ofPropertyValuesHolder(
    @NonNull target: Any,
    @NonNull vararg values: PropertyValuesHolder!
): ObjectAnimator

Constructs and returns an ObjectAnimator that animates between the sets of values specified in PropertyValueHolder objects. This variant should be used when animating several properties at once with the same ObjectAnimator, since PropertyValuesHolder allows you to associate a set of animation values with a property name.

Parameters
target Any: The object whose property is to be animated. Depending on how the PropertyValuesObjects were constructed, the target object should either have the objects used to construct the PropertyValuesHolder objects or (if the PropertyValuesHOlder objects were created with property names) the target object should have public methods on it called setName(), where name is the name of the property passed in as the propertyName parameter for each of the PropertyValuesHolder objects.
values PropertyValuesHolder!: A set of PropertyValuesHolder objects whose values will be animated between over time.
Return
ObjectAnimator An ObjectAnimator object that is set up to animate between the given values.

setAutoCancel

fun setAutoCancel(cancel: Boolean): Unit

autoCancel controls whether an ObjectAnimator will be canceled automatically when any other ObjectAnimator with the same target and properties is started. Setting this flag may make it easier to run different animators on the same target object without having to keep track of whether there are conflicting animators that need to be manually canceled. Canceling animators must have the same exact set of target properties, in the same order.

Parameters
cancel Boolean: Whether future ObjectAnimators with the same target and properties as this ObjectAnimator will cause this ObjectAnimator to be canceled.

setDuration

@NonNull fun setDuration(duration: Long): ObjectAnimator

Sets the length of the animation. The default duration is 300 milliseconds.

Parameters
duration Long: The length of the animation, in milliseconds.
Return
ObjectAnimator ObjectAnimator The object called with setDuration(). This return value makes it easier to compose statements together that construct and then set the duration, as in ObjectAnimator.ofInt(target, propertyName, 0, 10).setDuration(500).start().

setFloatValues

fun setFloatValues(@NonNull vararg values: Float): Unit

setIntValues

fun setIntValues(@NonNull vararg values: Int): Unit

setObjectValues

fun setObjectValues(@NonNull vararg values: Any!): Unit

setProperty

fun setProperty(@NonNull property: Property<Any!, Any!>): Unit

Sets the property that will be animated. Property objects will take precedence over properties specified by the setPropertyName(String) method. Animations should be set up to use one or the other, not both.

Parameters
property Property<Any!, Any!>: The property being animated. Should not be null.

setPropertyName

fun setPropertyName(@NonNull propertyName: String): Unit

Sets the name of the property that will be animated. This name is used to derive a setter function that will be called to set animated values. For example, a property name of foo will result in a call to the function setFoo() on the target object. If either valueFrom or valueTo is null, then a getter function will also be derived and called.

For best performance of the mechanism that calls the setter function determined by the name of the property being animated, use float or int typed values, and make the setter function for those properties have a void return value. This will cause the code to take an optimized path for these constrained circumstances. Other property types and return types will work, but will have more overhead in processing the requests due to normal reflection mechanisms.

Note that the setter function derived from this property name must take the same parameter type as the valueFrom and valueTo properties, otherwise the call to the setter function will fail.

If this ObjectAnimator has been set up to animate several properties together, using more than one PropertyValuesHolder objects, then setting the propertyName simply sets the propertyName in the first of those PropertyValuesHolder objects.

Parameters
propertyName String: The name of the property being animated. Should not be null.

setTarget

fun setTarget(@Nullable target: Any?): Unit

setupEndValues

fun setupEndValues(): Unit

setupStartValues

fun setupStartValues(): Unit

start

fun start(): Unit

toString

@NonNull fun toString(): String