# AnimationSet

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Inherited XML Attrs](https://developer.android.com/reference/android/view/animation/AnimationSet#inhattrs)\|[Inherited Constants](https://developer.android.com/reference/android/view/animation/AnimationSet#inhconstants)\|[Ctors](https://developer.android.com/reference/android/view/animation/AnimationSet#pubctors)\|[Methods](https://developer.android.com/reference/android/view/animation/AnimationSet#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/view/animation/AnimationSet#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/view/animation/AnimationSet#inhmethods)  

# AnimationSet

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/view/animation/AnimationSet "View this page in Kotlin")\|Java

`
public


class
AnimationSet
`  
`


``

extends `[Animation](https://developer.android.com/reference/android/view/animation/Animation)`


``


`

|---|---|-------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.view.animation.Animation](https://developer.android.com/reference/android/view/animation/Animation) ||
|   | ↳ | android.view.animation.AnimationSet |

<br />

*** ** * ** ***

Represents a group of Animations that should be played together. The transformation of each individual animation are composed together into a single transform. If AnimationSet sets any properties that its children also set (for example, duration or fillBefore), the values of AnimationSet override the child values.

The way that AnimationSet inherits behavior from Animation is important to understand. Some of the Animation attributes applied to AnimationSet affect the AnimationSet itself, some are pushed down to the children, and some are ignored, as follows:

- duration, repeatMode, fillBefore, fillAfter: These properties, when set on an AnimationSet object, will be pushed down to all child animations.
- repeatCount, fillEnabled: These properties are ignored for AnimationSet.
- startOffset, shareInterpolator: These properties apply to the AnimationSet itself.

Starting with[Build.VERSION_CODES.ICE_CREAM_SANDWICH](https://developer.android.com/reference/android/os/Build.VERSION_CODES#ICE_CREAM_SANDWICH), the behavior of these properties is the same in XML resources and at runtime (prior to that release, the values set in XML were ignored for AnimationSet). That is, calling`setDuration(500)`on an AnimationSet has the same effect as declaring`android:duration="500"`in an XML resource for an AnimationSet object.

<br />

<br />

## Summary

| ### Inherited XML attributes |
|------------------------------|---|
| From class[android.view.animation.Animation](https://developer.android.com/reference/android/view/animation/Animation) |------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------| | [`android:backdropColor`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:backdropColor)     | Special option for window animations: whether the window's background should be used as a background to the animation.             | | [`android:detachWallpaper`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:detachWallpaper) | Special option for window animations: if this window is on top of a wallpaper, don't animate the wallpaper with it.                | | [`android:duration`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:duration)               | Amount of time (in milliseconds) for the animation to run.                                                                         | | [`android:fillAfter`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:fillAfter)             | When set to true, the animation transformation is applied after the animation is over.                                             | | [`android:fillBefore`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:fillBefore)           | When set to true or when fillEnabled is not set to true, the animation transformation is applied before the animation has started. | | [`android:fillEnabled`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:fillEnabled)         | When set to true, the value of fillBefore is taken into account.                                                                   | | [`android:interpolator`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:interpolator)       | Defines the interpolator used to smooth the animation movement in time.                                                            | | [`android:repeatCount`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:repeatCount)         | Defines how many times the animation should repeat.                                                                                | | [`android:repeatMode`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:repeatMode)           | Defines the animation behavior when it reaches the end and the repeat count is greater than 0 or infinite.                         | | [`android:showBackdrop`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:showBackdrop)       | Special option for window animations: whether to show a background behind the animating windows.                                   | | [`android:startOffset`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:startOffset)         | Delay in milliseconds before the animation runs, once start time is reached.                                                       | | [`android:zAdjustment`](https://developer.android.com/reference/android/view/animation/Animation#attr_android:zAdjustment)         | Allows for an adjustment of the Z ordering of the content being animated for the duration of the animation.                        | ||

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From class[android.view.animation.Animation](https://developer.android.com/reference/android/view/animation/Animation) |-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [ABSOLUTE](https://developer.android.com/reference/android/view/animation/Animation#ABSOLUTE) The specified dimension is an absolute number of pixels.                                                                                                                                                                                                                                                                                                             | | `int` | [INFINITE](https://developer.android.com/reference/android/view/animation/Animation#INFINITE) Repeat the animation indefinitely.                                                                                                                                                                                                                                                                                                                                   | | `int` | [RELATIVE_TO_PARENT](https://developer.android.com/reference/android/view/animation/Animation#RELATIVE_TO_PARENT) The specified dimension holds a float and should be multiplied by the height or width of the parent of the object being animated.                                                                                                                                                                                                                | | `int` | [RELATIVE_TO_SELF](https://developer.android.com/reference/android/view/animation/Animation#RELATIVE_TO_SELF) The specified dimension holds a float and should be multiplied by the height or width of the object being animated.                                                                                                                                                                                                                                  | | `int` | [RESTART](https://developer.android.com/reference/android/view/animation/Animation#RESTART) When the animation reaches the end and the repeat count is INFINTE_REPEAT or a positive value, the animation restarts from the beginning.                                                                                                                                                                                                                              | | `int` | [REVERSE](https://developer.android.com/reference/android/view/animation/Animation#REVERSE) When the animation reaches the end and the repeat count is INFINTE_REPEAT or a positive value, the animation plays backward (and then forward again).                                                                                                                                                                                                                  | | `int` | [START_ON_FIRST_FRAME](https://developer.android.com/reference/android/view/animation/Animation#START_ON_FIRST_FRAME) Can be used as the start time to indicate the start time should be the current time when[getTransformation(long, android.view.animation.Transformation)](https://developer.android.com/reference/android/view/animation/Animation#getTransformation(long,%20android.view.animation.Transformation))is invoked for the first animation frame. | | `int` | [ZORDER_BOTTOM](https://developer.android.com/reference/android/view/animation/Animation#ZORDER_BOTTOM) Requests that the content being animated be forced under all other content for the duration of the animation.                                                                                                                                                                                                                                              | | `int` | [ZORDER_NORMAL](https://developer.android.com/reference/android/view/animation/Animation#ZORDER_NORMAL) Requests that the content being animated be kept in its current Z order.                                                                                                                                                                                                                                                                                   | | `int` | [ZORDER_TOP](https://developer.android.com/reference/android/view/animation/Animation#ZORDER_TOP) Requests that the content being animated be forced on top of all other content for the duration of the animation.                                                                                                                                                                                                                                                | |

|                                                                                                                                                                                                  ### Public constructors                                                                                                                                                                                                  ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[AnimationSet](https://developer.android.com/reference/android/view/animation/AnimationSet#AnimationSet(android.content.Context,%20android.util.AttributeSet))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet)` attrs) ` Constructor used when an AnimationSet is loaded from a resource. |
| ` `[AnimationSet](https://developer.android.com/reference/android/view/animation/AnimationSet#AnimationSet(boolean))`(boolean shareInterpolator) ` Constructor to use when building an AnimationSet from code                                                                                                                                                                                                          |

|                                                                                                                                                                                                                                                                      ### Public methods                                                                                                                                                                                                                                                                      ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                                                                                                      | ` `[addAnimation](https://developer.android.com/reference/android/view/animation/AnimationSet#addAnimation(android.view.animation.Animation))`(`[Animation](https://developer.android.com/reference/android/view/animation/Animation)` a) ` Add a child animation to this animation set.                                                                                                       |
| ` long`                                                                                                                                                      | ` `[computeDurationHint](https://developer.android.com/reference/android/view/animation/AnimationSet#computeDurationHint())`() ` The duration hint of an animation set is the maximum of the duration hints of all of its component animations.                                                                                                                                                |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[Animation](https://developer.android.com/reference/android/view/animation/Animation)`>` | ` `[getAnimations](https://developer.android.com/reference/android/view/animation/AnimationSet#getAnimations())`() `                                                                                                                                                                                                                                                                           |
| ` long`                                                                                                                                                      | ` `[getDuration](https://developer.android.com/reference/android/view/animation/AnimationSet#getDuration())`() ` The duration of an AnimationSet is defined to be the duration of the longest child animation.                                                                                                                                                                                 |
| ` long`                                                                                                                                                      | ` `[getStartTime](https://developer.android.com/reference/android/view/animation/AnimationSet#getStartTime())`() ` When this animation should start.                                                                                                                                                                                                                                           |
| ` boolean`                                                                                                                                                   | ` `[getTransformation](https://developer.android.com/reference/android/view/animation/AnimationSet#getTransformation(long,%20android.view.animation.Transformation))`(long currentTime, `[Transformation](https://developer.android.com/reference/android/view/animation/Transformation)` t) ` The transformation of an animation set is the concatenation of all of its component animations. |
| ` void`                                                                                                                                                      | ` `[initialize](https://developer.android.com/reference/android/view/animation/AnimationSet#initialize(int,%20int,%20int,%20int))`(int width, int height, int parentWidth, int parentHeight) ` Initialize this animation with the dimensions of the object being animated as well as the objects parents.                                                                                      |
| ` void`                                                                                                                                                      | ` `[reset](https://developer.android.com/reference/android/view/animation/AnimationSet#reset())`() ` Reset the initialization state of this animation.                                                                                                                                                                                                                                         |
| ` void`                                                                                                                                                      | ` `[restrictDuration](https://developer.android.com/reference/android/view/animation/AnimationSet#restrictDuration(long))`(long durationMillis) ` Ensure that the duration that this animation will run is not longer than<var translate="no">durationMillis</var>.                                                                                                                            |
| ` void`                                                                                                                                                      | ` `[scaleCurrentDuration](https://developer.android.com/reference/android/view/animation/AnimationSet#scaleCurrentDuration(float))`(float scale) ` How much to scale the duration by.                                                                                                                                                                                                          |
| ` void`                                                                                                                                                      | ` `[setDuration](https://developer.android.com/reference/android/view/animation/AnimationSet#setDuration(long))`(long durationMillis) ` <br /> Sets the duration of every child animation.                                                                                                                                                                                                     |
| ` void`                                                                                                                                                      | ` `[setFillAfter](https://developer.android.com/reference/android/view/animation/AnimationSet#setFillAfter(boolean))`(boolean fillAfter) ` If fillAfter is true, the transformation that this animation performed will persist when it is finished.                                                                                                                                            |
| ` void`                                                                                                                                                      | ` `[setFillBefore](https://developer.android.com/reference/android/view/animation/AnimationSet#setFillBefore(boolean))`(boolean fillBefore) ` If fillBefore is true, this animation will apply its transformation before the start time of the animation.                                                                                                                                      |
| ` void`                                                                                                                                                      | ` `[setRepeatMode](https://developer.android.com/reference/android/view/animation/AnimationSet#setRepeatMode(int))`(int repeatMode) ` Defines what this animation should do when it reaches the end.                                                                                                                                                                                           |
| ` void`                                                                                                                                                      | ` `[setStartOffset](https://developer.android.com/reference/android/view/animation/AnimationSet#setStartOffset(long))`(long startOffset) ` When this animation should start relative to the start time.                                                                                                                                                                                        |
| ` void`                                                                                                                                                      | ` `[setStartTime](https://developer.android.com/reference/android/view/animation/AnimationSet#setStartTime(long))`(long startTimeMillis) ` Sets the start time of this animation and all child animations                                                                                                                                                                                      |
| ` boolean`                                                                                                                                                   | ` `[willChangeBounds](https://developer.android.com/reference/android/view/animation/AnimationSet#willChangeBounds())`() ` <br /> Indicates whether or not this animation will affect the bounds of the animated view.                                                                                                                                                                         |
| ` boolean`                                                                                                                                                   | ` `[willChangeTransformationMatrix](https://developer.android.com/reference/android/view/animation/AnimationSet#willChangeTransformationMatrix())`() ` <br /> Indicates whether or not this animation will affect the transformation matrix.                                                                                                                                                   |

|                                                                                                              ### Protected methods                                                                                                              ||
|------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[AnimationSet](https://developer.android.com/reference/android/view/animation/AnimationSet) | ` `[clone](https://developer.android.com/reference/android/view/animation/AnimationSet#clone())`() ` Creates and returns a copy of this object. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.view.animation.Animation](https://developer.android.com/reference/android/view/animation/Animation)` ` |------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                                                        | ` `[applyTransformation](https://developer.android.com/reference/android/view/animation/Animation#applyTransformation(float,%20android.view.animation.Transformation))`(float interpolatedTime, `[Transformation](https://developer.android.com/reference/android/view/animation/Transformation)` t) ` Helper for getTransformation.                                                             | | ` void`                                                                                        | ` `[cancel](https://developer.android.com/reference/android/view/animation/Animation#cancel())`() ` Cancel the animation.                                                                                                                                                                                                                                                                        | | ` `[Animation](https://developer.android.com/reference/android/view/animation/Animation)       | ` `[clone](https://developer.android.com/reference/android/view/animation/Animation#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                                                                                                                     | | ` long`                                                                                        | ` `[computeDurationHint](https://developer.android.com/reference/android/view/animation/Animation#computeDurationHint())`() ` Compute a hint at how long the entire animation may last, in milliseconds.                                                                                                                                                                                         | | ` void`                                                                                        | ` `[ensureInterpolator](https://developer.android.com/reference/android/view/animation/Animation#ensureInterpolator())`() ` Gurantees that this animation has an interpolator.                                                                                                                                                                                                                   | | ` void`                                                                                        | ` `[finalize](https://developer.android.com/reference/android/view/animation/Animation#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                                                                                                                         | | ` int`                                                                                         | ` `[getBackdropColor](https://developer.android.com/reference/android/view/animation/Animation#getBackdropColor())`() ` Returns the background color to show behind the animating windows.                                                                                                                                                                                                       | | ` int`                                                                                         | ` `[getBackgroundColor](https://developer.android.com/reference/android/view/animation/Animation#getBackgroundColor())`() ` *This method was deprecated in API level 30. None of window animations are running with background color.*                                                                                                                                                           | | ` boolean`                                                                                     | ` `[getDetachWallpaper](https://developer.android.com/reference/android/view/animation/Animation#getDetachWallpaper())`() ` *This method was deprecated in API level 29. All window animations are running with detached wallpaper.*                                                                                                                                                             | | ` long`                                                                                        | ` `[getDuration](https://developer.android.com/reference/android/view/animation/Animation#getDuration())`() ` How long this animation should last                                                                                                                                                                                                                                                | | ` boolean`                                                                                     | ` `[getFillAfter](https://developer.android.com/reference/android/view/animation/Animation#getFillAfter())`() ` If fillAfter is true, this animation will apply its transformation after the end time of the animation.                                                                                                                                                                          | | ` boolean`                                                                                     | ` `[getFillBefore](https://developer.android.com/reference/android/view/animation/Animation#getFillBefore())`() ` If fillBefore is true, this animation will apply its transformation before the start time of the animation.                                                                                                                                                                    | | ` `[Interpolator](https://developer.android.com/reference/android/view/animation/Interpolator) | ` `[getInterpolator](https://developer.android.com/reference/android/view/animation/Animation#getInterpolator())`() ` Gets the acceleration curve type for this animation.                                                                                                                                                                                                                       | | ` int`                                                                                         | ` `[getRepeatCount](https://developer.android.com/reference/android/view/animation/Animation#getRepeatCount())`() ` Defines how many times the animation should repeat.                                                                                                                                                                                                                          | | ` int`                                                                                         | ` `[getRepeatMode](https://developer.android.com/reference/android/view/animation/Animation#getRepeatMode())`() ` Defines what this animation should do when it reaches the end.                                                                                                                                                                                                                 | | ` float`                                                                                       | ` `[getScaleFactor](https://developer.android.com/reference/android/view/animation/Animation#getScaleFactor())`() ` The scale factor is set by the call to`getTransformation`.                                                                                                                                                                                                                   | | ` boolean`                                                                                     | ` `[getShowBackdrop](https://developer.android.com/reference/android/view/animation/Animation#getShowBackdrop())`() ` If showBackdrop is`true`and this animation is applied on a window, then the windows in the animation will animate with the background associated with this window behind them.                                                                                             | | ` long`                                                                                        | ` `[getStartOffset](https://developer.android.com/reference/android/view/animation/Animation#getStartOffset())`() ` When this animation should start, relative to StartTime                                                                                                                                                                                                                      | | ` long`                                                                                        | ` `[getStartTime](https://developer.android.com/reference/android/view/animation/Animation#getStartTime())`() ` When this animation should start.                                                                                                                                                                                                                                                | | ` boolean`                                                                                     | ` `[getTransformation](https://developer.android.com/reference/android/view/animation/Animation#getTransformation(long,%20android.view.animation.Transformation,%20float))`(long currentTime, `[Transformation](https://developer.android.com/reference/android/view/animation/Transformation)` outTransformation, float scale) ` Gets the transformation to apply at a specified point in time. | | ` boolean`                                                                                     | ` `[getTransformation](https://developer.android.com/reference/android/view/animation/Animation#getTransformation(long,%20android.view.animation.Transformation))`(long currentTime, `[Transformation](https://developer.android.com/reference/android/view/animation/Transformation)` outTransformation) ` Gets the transformation to apply at a specified point in time.                       | | ` int`                                                                                         | ` `[getZAdjustment](https://developer.android.com/reference/android/view/animation/Animation#getZAdjustment())`() ` Returns the Z ordering mode to use while running the animation as previously set by[setZAdjustment(int)](https://developer.android.com/reference/android/view/animation/Animation#setZAdjustment(int)).                                                                      | | ` boolean`                                                                                     | ` `[hasEnded](https://developer.android.com/reference/android/view/animation/Animation#hasEnded())`() ` <br /> Indicates whether this animation has ended or not.                                                                                                                                                                                                                                | | ` boolean`                                                                                     | ` `[hasStarted](https://developer.android.com/reference/android/view/animation/Animation#hasStarted())`() ` <br /> Indicates whether this animation has started or not.                                                                                                                                                                                                                          | | ` void`                                                                                        | ` `[initialize](https://developer.android.com/reference/android/view/animation/Animation#initialize(int,%20int,%20int,%20int))`(int width, int height, int parentWidth, int parentHeight) ` Initialize this animation with the dimensions of the object being animated as well as the objects parents.                                                                                           | | ` boolean`                                                                                     | ` `[isFillEnabled](https://developer.android.com/reference/android/view/animation/Animation#isFillEnabled())`() ` If fillEnabled is true, this animation will apply the value of fillBefore.                                                                                                                                                                                                     | | ` boolean`                                                                                     | ` `[isInitialized](https://developer.android.com/reference/android/view/animation/Animation#isInitialized())`() ` Whether or not the animation has been initialized.                                                                                                                                                                                                                             | | ` void`                                                                                        | ` `[reset](https://developer.android.com/reference/android/view/animation/Animation#reset())`() ` Reset the initialization state of this animation.                                                                                                                                                                                                                                              | | ` float`                                                                                       | ` `[resolveSize](https://developer.android.com/reference/android/view/animation/Animation#resolveSize(int,%20float,%20int,%20int))`(int type, float value, int size, int parentSize) ` Convert the information in the description of a size to an actual dimension                                                                                                                               | | ` void`                                                                                        | ` `[restrictDuration](https://developer.android.com/reference/android/view/animation/Animation#restrictDuration(long))`(long durationMillis) ` Ensure that the duration that this animation will run is not longer than<var translate="no">durationMillis</var>.                                                                                                                                 | | ` void`                                                                                        | ` `[scaleCurrentDuration](https://developer.android.com/reference/android/view/animation/Animation#scaleCurrentDuration(float))`(float scale) ` How much to scale the duration by.                                                                                                                                                                                                               | | ` void`                                                                                        | ` `[setAnimationListener](https://developer.android.com/reference/android/view/animation/Animation#setAnimationListener(android.view.animation.Animation.AnimationListener))`(`[Animation.AnimationListener](https://developer.android.com/reference/android/view/animation/Animation.AnimationListener)` listener) ` <br /> Binds an animation listener to this animation.                      | | ` void`                                                                                        | ` `[setBackdropColor](https://developer.android.com/reference/android/view/animation/Animation#setBackdropColor(int))`(int backdropColor) ` Set the color to use for the backdrop shown behind the animating windows.                                                                                                                                                                            | | ` void`                                                                                        | ` `[setBackgroundColor](https://developer.android.com/reference/android/view/animation/Animation#setBackgroundColor(int))`(int bg) ` *This method was deprecated in API level 30. None of window animations are running with background color.*                                                                                                                                                  | | ` void`                                                                                        | ` `[setDetachWallpaper](https://developer.android.com/reference/android/view/animation/Animation#setDetachWallpaper(boolean))`(boolean detachWallpaper) ` *This method was deprecated in API level 29. All window animations are running with detached wallpaper.*                                                                                                                               | | ` void`                                                                                        | ` `[setDuration](https://developer.android.com/reference/android/view/animation/Animation#setDuration(long))`(long durationMillis) ` How long this animation should last.                                                                                                                                                                                                                        | | ` void`                                                                                        | ` `[setFillAfter](https://developer.android.com/reference/android/view/animation/Animation#setFillAfter(boolean))`(boolean fillAfter) ` If fillAfter is true, the transformation that this animation performed will persist when it is finished.                                                                                                                                                 | | ` void`                                                                                        | ` `[setFillBefore](https://developer.android.com/reference/android/view/animation/Animation#setFillBefore(boolean))`(boolean fillBefore) ` If fillBefore is true, this animation will apply its transformation before the start time of the animation.                                                                                                                                           | | ` void`                                                                                        | ` `[setFillEnabled](https://developer.android.com/reference/android/view/animation/Animation#setFillEnabled(boolean))`(boolean fillEnabled) ` If fillEnabled is true, the animation will apply the value of fillBefore.                                                                                                                                                                          | | ` void`                                                                                        | ` `[setInterpolator](https://developer.android.com/reference/android/view/animation/Animation#setInterpolator(android.view.animation.Interpolator))`(`[Interpolator](https://developer.android.com/reference/android/view/animation/Interpolator)` i) ` Sets the acceleration curve for this animation.                                                                                          | | ` void`                                                                                        | ` `[setInterpolator](https://developer.android.com/reference/android/view/animation/Animation#setInterpolator(android.content.Context,%20int))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, int resID) ` Sets the acceleration curve for this animation.                                                                                               | | ` void`                                                                                        | ` `[setRepeatCount](https://developer.android.com/reference/android/view/animation/Animation#setRepeatCount(int))`(int repeatCount) ` Sets how many times the animation should be repeated.                                                                                                                                                                                                      | | ` void`                                                                                        | ` `[setRepeatMode](https://developer.android.com/reference/android/view/animation/Animation#setRepeatMode(int))`(int repeatMode) ` Defines what this animation should do when it reaches the end.                                                                                                                                                                                                | | ` void`                                                                                        | ` `[setShowBackdrop](https://developer.android.com/reference/android/view/animation/Animation#setShowBackdrop(boolean))`(boolean showBackdrop) ` If showBackdrop is`true`and this animation is applied on a window, then the windows in the animation will animate with the background associated with this window behind them.                                                                  | | ` void`                                                                                        | ` `[setStartOffset](https://developer.android.com/reference/android/view/animation/Animation#setStartOffset(long))`(long startOffset) ` When this animation should start relative to the start time.                                                                                                                                                                                             | | ` void`                                                                                        | ` `[setStartTime](https://developer.android.com/reference/android/view/animation/Animation#setStartTime(long))`(long startTimeMillis) ` When this animation should start.                                                                                                                                                                                                                        | | ` void`                                                                                        | ` `[setZAdjustment](https://developer.android.com/reference/android/view/animation/Animation#setZAdjustment(int))`(int zAdjustment) ` Set the Z ordering mode to use while running the animation.                                                                                                                                                                                                | | ` void`                                                                                        | ` `[start](https://developer.android.com/reference/android/view/animation/Animation#start())`() ` Convenience method to start the animation the first time[getTransformation(long, android.view.animation.Transformation)](https://developer.android.com/reference/android/view/animation/Animation#getTransformation(long,%20android.view.animation.Transformation))is invoked.                 | | ` void`                                                                                        | ` `[startNow](https://developer.android.com/reference/android/view/animation/Animation#startNow())`() ` Convenience method to start the animation at the current time in milliseconds.                                                                                                                                                                                                           | | ` boolean`                                                                                     | ` `[willChangeBounds](https://developer.android.com/reference/android/view/animation/Animation#willChangeBounds())`() ` <br /> Indicates whether or not this animation will affect the bounds of the animated view.                                                                                                                                                                              | | ` boolean`                                                                                     | ` `[willChangeTransformationMatrix](https://developer.android.com/reference/android/view/animation/Animation#willChangeTransformationMatrix())`() ` <br /> Indicates whether or not this animation will affect the transformation matrix.                                                                                                                                                        | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### AnimationSet

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public AnimationSet (Context context, 
                AttributeSet attrs)
```

Constructor used when an AnimationSet is loaded from a resource.

<br />

|                                Parameters                                 ||
|-----------|----------------------------------------------------------------|
| `context` | `Context`: Application context to use <br />                   |
| `attrs`   | `AttributeSet`: Attribute set from which to read values <br /> |

### AnimationSet

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public AnimationSet (boolean shareInterpolator)
```

Constructor to use when building an AnimationSet from code

<br />

|                                                                                                     Parameters                                                                                                     ||
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `shareInterpolator` | `boolean`: Pass true if all of the animations in this set should use the interpolator associated with this AnimationSet. Pass false if each animation should use its own interpolator. <br /> |

## Public methods

### addAnimation

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void addAnimation (Animation a)
```

Add a child animation to this animation set. The transforms of the child animations are applied in the order that they were added

<br />

|                 Parameters                 ||
|-----|---------------------------------------|
| `a` | `Animation`: Animation to add. <br /> |

### computeDurationHint

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long computeDurationHint ()
```

The duration hint of an animation set is the maximum of the duration hints of all of its component animations.

<br />

|    Returns     ||
|--------|--------|
| `long` | <br /> |

**See also:**

- [Animation.computeDurationHint()](https://developer.android.com/reference/android/view/animation/Animation#computeDurationHint())  

### getAnimations

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public List<Animation> getAnimations ()
```

<br />

<br />

|                                                                                                                                         Returns                                                                                                                                          ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[Animation](https://developer.android.com/reference/android/view/animation/Animation)`>` | All the child animations in this AnimationSet. Note that this may include other AnimationSets, which are not expanded. <br /> |

### getDuration

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long getDuration ()
```

The duration of an AnimationSet is defined to be the duration of the longest child animation.

<br />

|                           Returns                            ||
|--------|------------------------------------------------------|
| `long` | the duration in milliseconds of the animation <br /> |

**See also:**

- [Animation.getDuration()](https://developer.android.com/reference/android/view/animation/Animation#getDuration())  

### getStartTime

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long getStartTime ()
```

When this animation should start. If the animation has not startet yet, this method might return[START_ON_FIRST_FRAME](https://developer.android.com/reference/android/view/animation/Animation#START_ON_FIRST_FRAME).

<br />

|                                                                                             Returns                                                                                             ||
|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `long` | the time in milliseconds when the animation should start or[START_ON_FIRST_FRAME](https://developer.android.com/reference/android/view/animation/Animation#START_ON_FIRST_FRAME) <br /> |

### getTransformation

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean getTransformation (long currentTime, 
                Transformation t)
```

The transformation of an animation set is the concatenation of all of its component animations.

<br />

|                                                               Parameters                                                               ||
|---------------|-------------------------------------------------------------------------------------------------------------------------|
| `currentTime` | `long`: Where we are in the animation. This is wall clock time. <br />                                                  |
| `t`           | `Transformation`: A transformation object that is provided by the caller and will be filled in by the animation. <br /> |

|                         Returns                          ||
|-----------|-----------------------------------------------|
| `boolean` | True if the animation is still running <br /> |

**See also:**

- [Animation.getTransformation(long, Transformation)](https://developer.android.com/reference/android/view/animation/Animation#getTransformation(long,%20android.view.animation.Transformation))  

### initialize

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void initialize (int width, 
                int height, 
                int parentWidth, 
                int parentHeight)
```

Initialize this animation with the dimensions of the object being animated as well as the objects parents. (This is to support animation sizes being specified relative to these dimensions.)

Objects that interpret Animations should call this method when the sizes of the object being animated and its parent are known, and before calling[getTransformation(long, Transformation)](https://developer.android.com/reference/android/view/animation/Animation#getTransformation(long,%20android.view.animation.Transformation)).

<br />

|                              Parameters                              ||
|----------------|------------------------------------------------------|
| `width`        | `int`: Width of the object being animated <br />     |
| `height`       | `int`: Height of the object being animated <br />    |
| `parentWidth`  | `int`: Width of the animated object's parent <br />  |
| `parentHeight` | `int`: Height of the animated object's parent <br /> |

**See also:**

- [Animation.initialize(int, int, int, int)](https://developer.android.com/reference/android/view/animation/Animation#initialize(int,%20int,%20int,%20int))  

### reset

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void reset ()
```

Reset the initialization state of this animation.

<br />

### restrictDuration

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void restrictDuration (long durationMillis)
```

Ensure that the duration that this animation will run is not longer than<var translate="no">durationMillis</var>. In addition to adjusting the duration itself, this ensures that the repeat count also will not make it run longer than the given time.

<br />

|                                       Parameters                                       ||
|------------------|----------------------------------------------------------------------|
| `durationMillis` | `long`: The maximum duration the animation is allowed to run. <br /> |

### scaleCurrentDuration

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void scaleCurrentDuration (float scale)
```

How much to scale the duration by.

<br />

|                         Parameters                         ||
|---------|---------------------------------------------------|
| `scale` | `float`: The amount to scale the duration. <br /> |

**See also:**

- [Animation.scaleCurrentDuration(float)](https://developer.android.com/reference/android/view/animation/Animation#scaleCurrentDuration(float))  

### setDuration

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setDuration (long durationMillis)
```

<br />

Sets the duration of every child animation.

<br />

<br />

|                                                  Parameters                                                  ||
|------------------|--------------------------------------------------------------------------------------------|
| `durationMillis` | `long`: the duration of the animation, in milliseconds, for every child in this set <br /> |

### setFillAfter

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setFillAfter (boolean fillAfter)
```

If fillAfter is true, the transformation that this animation performed will persist when it is finished. Defaults to false if not set. Note that this applies to individual animations and when using an[AnimationSet](https://developer.android.com/reference/android/view/animation/AnimationSet)to chain animations.

<br />

|                                             Parameters                                             ||
|-------------|---------------------------------------------------------------------------------------|
| `fillAfter` | `boolean`: true if the animation should apply its transformation after it ends <br /> |

### setFillBefore

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setFillBefore (boolean fillBefore)
```

If fillBefore is true, this animation will apply its transformation before the start time of the animation. Defaults to true if[setFillEnabled(boolean)](https://developer.android.com/reference/android/view/animation/Animation#setFillEnabled(boolean))is not set to true. Note that this applies when using an[AnimationSet](https://developer.android.com/reference/android/view/animation/AnimationSet)to chain animations. The transformation is not applied before the AnimationSet itself starts.

<br />

|                                               Parameters                                               ||
|--------------|------------------------------------------------------------------------------------------|
| `fillBefore` | `boolean`: true if the animation should apply its transformation before it starts <br /> |

### setRepeatMode

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setRepeatMode (int repeatMode)
```

Defines what this animation should do when it reaches the end. This setting is applied only when the repeat count is either greater than 0 or[INFINITE](https://developer.android.com/reference/android/view/animation/Animation#INFINITE). Defaults to[RESTART](https://developer.android.com/reference/android/view/animation/Animation#RESTART).

<br />

|                                                                                                               Parameters                                                                                                                ||
|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `repeatMode` | `int`:[Animation.RESTART](https://developer.android.com/reference/android/view/animation/Animation#RESTART)or[Animation.REVERSE](https://developer.android.com/reference/android/view/animation/Animation#REVERSE) <br /> |

### setStartOffset

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setStartOffset (long startOffset)
```

When this animation should start relative to the start time. This is most useful when composing complex animations using an[AnimationSet](https://developer.android.com/reference/android/view/animation/AnimationSet)where some of the animations components start at different times.

<br />

|                                                          Parameters                                                           ||
|---------------|----------------------------------------------------------------------------------------------------------------|
| `startOffset` | `long`: When this Animation should start, in milliseconds from the start time of the root AnimationSet. <br /> |

### setStartTime

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void setStartTime (long startTimeMillis)
```

Sets the start time of this animation and all child animations

<br />

|                            Parameters                            ||
|-------------------|-----------------------------------------------|
| `startTimeMillis` | `long`: the start time in milliseconds <br /> |

**See also:**

- [Animation.setStartTime(long)](https://developer.android.com/reference/android/view/animation/Animation#setStartTime(long))  

### willChangeBounds

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean willChangeBounds ()
```

<br />

Indicates whether or not this animation will affect the bounds of the animated view. For instance, a fade animation will not affect the bounds whereas a 200% scale animation will.

<br />

<br />

|                                Returns                                 ||
|-----------|-------------------------------------------------------------|
| `boolean` | true if this animation will change the view's bounds <br /> |

### willChangeTransformationMatrix

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean willChangeTransformationMatrix ()
```

<br />

Indicates whether or not this animation will affect the transformation matrix. For instance, a fade animation will not affect the matrix whereas a scale animation will.

<br />

<br />

|                                    Returns                                     ||
|-----------|---------------------------------------------------------------------|
| `boolean` | true if this animation will change the transformation matrix <br /> |

## Protected methods

### clone

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
protected AnimationSet clone ()
```

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object`x`, the expression:
>
> ```
>  x.clone() != x
> ```
will be true, and that the expression:
>
> ```
>  x.clone().getClass() == x.getClass()
> ```
will be`true`, but these are not absolute requirements. While it is typically the case that:
>
> ```
>  x.clone().equals(x)
> ```
will be`true`, this is not an absolute requirement.

By convention, the returned object should be obtained by calling`super.clone`. If a class and all of its superclasses (except`Object`) obey this convention, it will be the case that`x.clone().getClass() == x.getClass()`.

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by`super.clone`before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by`super.clone`need to be modified.

<br />

|                                                            Returns                                                            ||
|---------------------------------------------------------------------------------------------|----------------------------------|
| [AnimationSet](https://developer.android.com/reference/android/view/animation/AnimationSet) | a clone of this instance. <br /> |

|                                                    Throws                                                     ||
|------------------------------------------------------------------------------------------------------------|---|
| [CloneNotSupportedException](https://developer.android.com/reference/java/lang/CloneNotSupportedException) |   |