Android 12 Developer Preview is here! Try it out, and give us your feedback!

AnimatorSet

class AnimatorSet : Animator, AnimationFrameCallback
kotlin.Any
   ↳ androidx.core.animation.Animator
   ↳ androidx.core.animation.AnimatorSet

This class plays a set of Animator objects in the specified order. Animations can be set up to play together, in sequence, or after a specified delay.

There are two different approaches to adding animations to a AnimatorSet: either the playTogether() or playSequentially() methods can be called to add a set of animations all at once, or the AnimatorSet#play(Animator) can be used in conjunction with methods in the Builder class to add animations one by one.

It is possible to set up a AnimatorSet with circular dependencies between its animations. For example, an animation a1 could be set up to start before animation a2, a2 before a3, and a3 before a1. The results of this configuration are undefined, but will typically result in none of the affected animations being played. Because of this (and because circular dependencies do not make logical sense anyway), circular dependencies should be avoided, and the dependency flow of animations should only be in one direction.

Summary

Nested classes

The Builder object is a utility class to facilitate adding animations to a AnimatorSet along with the relationships between the various animations.

Inherited constants
Public constructors

Public methods
Boolean

AnimatorSet is only reversible when the set contains no infinitely-repeating animation (e.g. a child animation with repeatCount =

Unit

Cancels the animation.

AnimatorSet

Unit
end()

Ends the animation.

ArrayList<Animator!>

Returns the current list of child Animator objects controlled by this AnimatorSet.

Long

Returns the milliseconds elapsed since the start of the animation.

Long

Gets the length of each of the child animations of this AnimatorSet.

Interpolator?

Long

The amount of time, in milliseconds, to delay starting the animation after start() is called.

Long

Gets the total duration of the animation, accounting for animation sequences, start delay, and repeating.

Boolean

Returns true if any of the child animations of this AnimatorSet have been started and have not yet ended.

Boolean

Unit

AnimatorSet.Builder
play(@NonNull anim: Animator)

This method creates a Builder object, which is used to set up playing constraints.

Unit
playSequentially(@NonNull vararg items: Animator!)

Sets up this AnimatorSet to play each of the supplied animations when the previous animation ends.

Unit

Sets up this AnimatorSet to play each of the supplied animations when the previous animation ends.

Unit
playTogether(@NonNull vararg items: Animator!)

Sets up this AnimatorSet to play all of the supplied animations at the same time.

Unit

Sets up this AnimatorSet to play all of the supplied animations at the same time.

Unit

Unit

Plays the AnimatorSet in reverse.

Unit

Sets the position of the animation to the specified point in time.

AnimatorSet
setDuration(duration: Long)

Sets the length of each of the current child animations of this AnimatorSet.

Unit
setInterpolator(@Nullable interpolator: Interpolator?)

Sets the Interpolator for all current child animations of this AnimatorSet.

Unit
setStartDelay(startDelay: Long)

The amount of time, in milliseconds, to delay starting the animation after start() is called.

Unit
setTarget(@Nullable target: Any?)

Sets the target object for all current child animations of this AnimatorSet that take targets (ObjectAnimator and AnimatorSet).

Unit

Unit

Unit

Starts this animation.

String

Inherited functions