Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/animation/TimeAnimator#nestedclasses) \| [Inherited Constants](https://developer.android.com/reference/android/animation/TimeAnimator#inhconstants) \| [Ctors](https://developer.android.com/reference/android/animation/TimeAnimator#pubctors) \| [Methods](https://developer.android.com/reference/android/animation/TimeAnimator#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/animation/TimeAnimator#inhmethods)

# TimeAnimator

*** ** * ** ***

` public class TimeAnimator `   
` ` ` ` ` extends https://developer.android.com/reference/android/animation/ValueAnimator ` ` `

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||||
| ↳ | [android.animation.Animator](https://developer.android.com/reference/android/animation/Animator) |||
|   | ↳ | [android.animation.ValueAnimator](https://developer.android.com/reference/android/animation/ValueAnimator) ||
|   |   | ↳ | android.animation.TimeAnimator |

<br />

*** ** * ** ***

This class provides a simple callback mechanism to listeners that is synchronized with all other animators in the system. There is no duration, interpolation, or object value-setting with this Animator. Instead, it is simply started, after which it proceeds to send out events on every animation frame to its TimeListener (if set), with information about this animator, the total elapsed time, and the elapsed time since the previous animation frame.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/animation/TimeAnimator.TimeListener` Implementors of this interface can set themselves as update listeners to a `TimeAnimator` instance to receive callbacks on every animation frame to receive the total time since the animator started and the delta time since the last frame. |

### Inherited constants

From class `https://developer.android.com/reference/android/animation/ValueAnimator` `int` `https://developer.android.com/reference/android/animation/ValueAnimator#INFINITE`

This value used used with the `https://developer.android.com/reference/android/animation/ValueAnimator#setRepeatCount(int)` property to repeat the animation indefinitely.
`int` `https://developer.android.com/reference/android/animation/ValueAnimator#RESTART`

When the animation reaches the end and `repeatCount` is INFINITE or a positive value, the animation restarts from the beginning.
`int` `https://developer.android.com/reference/android/animation/ValueAnimator#REVERSE`

When the animation reaches the end and `repeatCount` is INFINITE or a positive value, the animation reverses direction on every iteration.
From class `https://developer.android.com/reference/android/animation/Animator` `long` `https://developer.android.com/reference/android/animation/Animator#DURATION_INFINITE`

The value used to indicate infinite duration (e.g. when Animators repeat infinitely).

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/animation/TimeAnimator#TimeAnimator()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/animation/TimeAnimator#setCurrentPlayTime(long)(long playTime) ` Sets the position of the animation to the specified point in time. |
| ` void` | ` https://developer.android.com/reference/android/animation/TimeAnimator#setTimeListener(android.animation.TimeAnimator.TimeListener)(https://developer.android.com/reference/android/animation/TimeAnimator.TimeListener listener) ` Sets a listener that is sent update events throughout the life of an animation. |
| ` void` | ` https://developer.android.com/reference/android/animation/TimeAnimator#start()() ` Starts this animation. |

### Inherited methods

From class ` https://developer.android.com/reference/android/animation/ValueAnimator ` ` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#addUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener)(https://developer.android.com/reference/android/animation/ValueAnimator.AnimatorUpdateListener listener) `

Adds a listener to the set of listeners that are sent update events through the life of an animation.
` static boolean` ` https://developer.android.com/reference/android/animation/ValueAnimator#areAnimatorsEnabled()() `

Returns whether animators are currently enabled, system-wide.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#cancel()() `

Cancels the animation.
` https://developer.android.com/reference/android/animation/ValueAnimator` ` https://developer.android.com/reference/android/animation/ValueAnimator#clone()() `

Creates and returns a copy of this object.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#end()() `

Ends the animation.
` float` ` https://developer.android.com/reference/android/animation/ValueAnimator#getAnimatedFraction()() `

Returns the current animation fraction, which is the elapsed/interpolated fraction used in the most recent frame update on the animation.
` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/android/animation/ValueAnimator#getAnimatedValue()() `

The most recent value calculated by this `ValueAnimator` when there is just one property being animated.
` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/android/animation/ValueAnimator#getAnimatedValue(java.lang.String)(https://developer.android.com/reference/java/lang/String propertyName) `

The most recent value calculated by this `ValueAnimator` for `propertyName`.
` long` ` https://developer.android.com/reference/android/animation/ValueAnimator#getCurrentPlayTime()() `

Gets the current position of the animation in time, which is equal to the current time minus the time that the animation started.
` long` ` https://developer.android.com/reference/android/animation/ValueAnimator#getDuration()() `

Gets the length of the animation.
` static float` ` https://developer.android.com/reference/android/animation/ValueAnimator#getDurationScale()() `

Returns the system-wide scaling factor for Animator-based animations.
` static long` ` https://developer.android.com/reference/android/animation/ValueAnimator#getFrameDelay()() `

The amount of time, in milliseconds, between each frame of the animation.
` https://developer.android.com/reference/android/animation/TimeInterpolator` ` https://developer.android.com/reference/android/animation/ValueAnimator#getInterpolator()() `

Returns the timing interpolator that this ValueAnimator uses.
` int` ` https://developer.android.com/reference/android/animation/ValueAnimator#getRepeatCount()() `

Defines how many times the animation should repeat.
` int` ` https://developer.android.com/reference/android/animation/ValueAnimator#getRepeatMode()() `

Defines what this animation should do when it reaches the end.
` long` ` https://developer.android.com/reference/android/animation/ValueAnimator#getStartDelay()() `

The amount of time, in milliseconds, to delay starting the animation after `https://developer.android.com/reference/android/animation/ValueAnimator#start()` is called.
` long` ` https://developer.android.com/reference/android/animation/ValueAnimator#getTotalDuration()() `

Gets the total duration of the animation, accounting for animation sequences, start delay, and repeating.
` https://developer.android.com/reference/android/animation/PropertyValuesHolder` ` https://developer.android.com/reference/android/animation/ValueAnimator#getValues()() `

Returns the values that this ValueAnimator animates between.
` boolean` ` https://developer.android.com/reference/android/animation/ValueAnimator#isRunning()() `

Returns whether this Animator is currently running (having been started and gone past any initial startDelay period and not yet ended).
` boolean` ` https://developer.android.com/reference/android/animation/ValueAnimator#isStarted()() `

Returns whether this Animator has been started and not yet ended.
` static https://developer.android.com/reference/android/animation/ValueAnimator` ` https://developer.android.com/reference/android/animation/ValueAnimator#ofArgb(int[])(int... values) `

Constructs and returns a ValueAnimator that animates between color values.
` static https://developer.android.com/reference/android/animation/ValueAnimator` ` https://developer.android.com/reference/android/animation/ValueAnimator#ofFloat(float[])(float... values) `

Constructs and returns a ValueAnimator that animates between float values.
` static https://developer.android.com/reference/android/animation/ValueAnimator` ` https://developer.android.com/reference/android/animation/ValueAnimator#ofInt(int[])(int... values) `

Constructs and returns a ValueAnimator that animates between int values.
` static https://developer.android.com/reference/android/animation/ValueAnimator` ` https://developer.android.com/reference/android/animation/ValueAnimator#ofObject(android.animation.TypeEvaluator,%20java.lang.Object[])(https://developer.android.com/reference/android/animation/TypeEvaluator<T> evaluator, https://developer.android.com/reference/java/lang/Object values) `

Constructs and returns a ValueAnimator that animates between Object values.
` static https://developer.android.com/reference/android/animation/ValueAnimator` ` https://developer.android.com/reference/android/animation/ValueAnimator#ofPropertyValuesHolder(android.animation.PropertyValuesHolder[])(https://developer.android.com/reference/android/animation/PropertyValuesHolder values) `

Constructs and returns a ValueAnimator that animates between the values specified in the PropertyValuesHolder objects.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#pause()() `

Pauses a running animation.
` static boolean` ` https://developer.android.com/reference/android/animation/ValueAnimator#registerDurationScaleChangeListener(android.animation.ValueAnimator.DurationScaleChangeListener)(https://developer.android.com/reference/android/animation/ValueAnimator.DurationScaleChangeListener listener) `

Registers a `https://developer.android.com/reference/android/animation/ValueAnimator.DurationScaleChangeListener` This listens for changes to the system-wide scaling factor for Animator-based animations.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#removeAllUpdateListeners()() `

Removes all listeners from the set listening to frame updates for this animation.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#removeUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener)(https://developer.android.com/reference/android/animation/ValueAnimator.AnimatorUpdateListener listener) `

Removes a listener from the set listening to frame updates for this animation.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#resume()() `

Resumes a paused animation, causing the animator to pick up where it left off when it was paused.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#reverse()() `

Plays the ValueAnimator in reverse.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setCurrentFraction(float)(float fraction) `

Sets the position of the animation to the specified fraction.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setCurrentPlayTime(long)(long playTime) `

Sets the position of the animation to the specified point in time.
` https://developer.android.com/reference/android/animation/ValueAnimator` ` https://developer.android.com/reference/android/animation/ValueAnimator#setDuration(long)(long duration) `

Sets the length of the animation.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setEvaluator(android.animation.TypeEvaluator)(https://developer.android.com/reference/android/animation/TypeEvaluator<T> value) `

The type evaluator to be used when calculating the animated values of this animation.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setFloatValues(float[])(float... values) `

Sets float values that will be animated between.
` static void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setFrameDelay(long)(long frameDelay) `

The amount of time, in milliseconds, between each frame of the animation.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setIntValues(int[])(int... values) `

Sets int values that will be animated between.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setInterpolator(android.animation.TimeInterpolator)(https://developer.android.com/reference/android/animation/TimeInterpolator value) `

The time interpolator used in calculating the elapsed fraction of this animation.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setObjectValues(java.lang.Object[])(https://developer.android.com/reference/java/lang/Object values) `

Sets the values to animate between for this animation.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setRepeatCount(int)(int value) `

Sets how many times the animation should be repeated.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setRepeatMode(int)(int value) `

Defines what this animation should do when it reaches the end.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setStartDelay(long)(long startDelay) `

The amount of time, in milliseconds, to delay starting the animation after `https://developer.android.com/reference/android/animation/ValueAnimator#start()` is called.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#setValues(android.animation.PropertyValuesHolder[])(https://developer.android.com/reference/android/animation/PropertyValuesHolder values) `

Sets the values, per property, being animated between.
` void` ` https://developer.android.com/reference/android/animation/ValueAnimator#start()() `

Starts this animation.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/android/animation/ValueAnimator#toString()() `

Returns a string representation of the object.
` static boolean` ` https://developer.android.com/reference/android/animation/ValueAnimator#unregisterDurationScaleChangeListener(android.animation.ValueAnimator.DurationScaleChangeListener)(https://developer.android.com/reference/android/animation/ValueAnimator.DurationScaleChangeListener listener) `

Unregisters a DurationScaleChangeListener.
From class ` https://developer.android.com/reference/android/animation/Animator ` ` void` ` https://developer.android.com/reference/android/animation/Animator#addListener(android.animation.Animator.AnimatorListener)(https://developer.android.com/reference/android/animation/Animator.AnimatorListener listener) `

Adds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end.
` void` ` https://developer.android.com/reference/android/animation/Animator#addPauseListener(android.animation.Animator.AnimatorPauseListener)(https://developer.android.com/reference/android/animation/Animator.AnimatorPauseListener listener) `

Adds a pause listener to this animator.
` void` ` https://developer.android.com/reference/android/animation/Animator#cancel()() `

Cancels the animation.
` https://developer.android.com/reference/android/animation/Animator` ` https://developer.android.com/reference/android/animation/Animator#clone()() `

Creates and returns a copy of this object.
` void` ` https://developer.android.com/reference/android/animation/Animator#end()() `

Ends the animation.
` abstract long` ` https://developer.android.com/reference/android/animation/Animator#getDuration()() `

Gets the duration of the animation.
` https://developer.android.com/reference/android/animation/TimeInterpolator` ` https://developer.android.com/reference/android/animation/Animator#getInterpolator()() `

Returns the timing interpolator that this animation uses.
` https://developer.android.com/reference/java/util/ArrayList<https://developer.android.com/reference/android/animation/Animator.AnimatorListener>` ` https://developer.android.com/reference/android/animation/Animator#getListeners()() `

Gets the set of `https://developer.android.com/reference/android/animation/Animator.AnimatorListener` objects that are currently listening for events on this `Animator` object.
` abstract long` ` https://developer.android.com/reference/android/animation/Animator#getStartDelay()() `

The amount of time, in milliseconds, to delay processing the animation after `https://developer.android.com/reference/android/animation/Animator#start()` is called.
` long` ` https://developer.android.com/reference/android/animation/Animator#getTotalDuration()() `

Gets the total duration of the animation, accounting for animation sequences, start delay, and repeating.
` boolean` ` https://developer.android.com/reference/android/animation/Animator#isPaused()() `

Returns whether this animator is currently in a paused state.
` abstract boolean` ` https://developer.android.com/reference/android/animation/Animator#isRunning()() `

Returns whether this Animator is currently running (having been started and gone past any initial startDelay period and not yet ended).
` boolean` ` https://developer.android.com/reference/android/animation/Animator#isStarted()() `

Returns whether this Animator has been started and not yet ended.
` void` ` https://developer.android.com/reference/android/animation/Animator#pause()() `

Pauses a running animation.
` void` ` https://developer.android.com/reference/android/animation/Animator#removeAllListeners()() `

Removes all `https://developer.android.com/reference/android/animation/Animator#addListener(android.animation.Animator.AnimatorListener)` and `https://developer.android.com/reference/android/animation/Animator#addPauseListener(android.animation.Animator.AnimatorPauseListener)` from this object.
` void` ` https://developer.android.com/reference/android/animation/Animator#removeListener(android.animation.Animator.AnimatorListener)(https://developer.android.com/reference/android/animation/Animator.AnimatorListener listener) `

Removes a listener from the set listening to this animation.
` void` ` https://developer.android.com/reference/android/animation/Animator#removePauseListener(android.animation.Animator.AnimatorPauseListener)(https://developer.android.com/reference/android/animation/Animator.AnimatorPauseListener listener) `

Removes a pause listener from the set listening to this animation.
` void` ` https://developer.android.com/reference/android/animation/Animator#resume()() `

Resumes a paused animation, causing the animator to pick up where it left off when it was paused.
` abstract https://developer.android.com/reference/android/animation/Animator` ` https://developer.android.com/reference/android/animation/Animator#setDuration(long)(long duration) `

Sets the duration of the animation.
` abstract void` ` https://developer.android.com/reference/android/animation/Animator#setInterpolator(android.animation.TimeInterpolator)(https://developer.android.com/reference/android/animation/TimeInterpolator value) `

The time interpolator used in calculating the elapsed fraction of the animation.
` abstract void` ` https://developer.android.com/reference/android/animation/Animator#setStartDelay(long)(long startDelay) `

The amount of time, in milliseconds, to delay processing the animation after `https://developer.android.com/reference/android/animation/Animator#start()` is called.
` void` ` https://developer.android.com/reference/android/animation/Animator#setTarget(java.lang.Object)(https://developer.android.com/reference/java/lang/Object target) `

Sets the target object whose property will be animated by this animation.
` void` ` https://developer.android.com/reference/android/animation/Animator#setupEndValues()() `

This method tells the object to use appropriate information to extract ending values for the animation.
` void` ` https://developer.android.com/reference/android/animation/Animator#setupStartValues()() `

This method tells the object to use appropriate information to extract starting values for the animation.
` void` ` https://developer.android.com/reference/android/animation/Animator#start()() `

Starts this animation.
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` 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 https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` 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` ` 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` ` 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

### TimeAnimator

```
public TimeAnimator ()
```

<br />

<br />

## Public methods

### setCurrentPlayTime

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

```
public void setCurrentPlayTime (long playTime)
```

Sets the position of the animation to the specified point in time. This time should be between 0 and the total duration of the animation, including any repetition. If the animation has not yet been started, then it will not advance forward after it is set to this time; it will simply set the time to this value and perform any appropriate actions based on that time. If the animation is already running, then setCurrentPlayTime() will set the current playing time to this value and continue playing from that point.

<br />

| Parameters ||
|---|---|
| `playTime` | `long`: The time, in milliseconds, to which the animation is advanced or rewound. <br /> |

### setTimeListener

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

```
public void setTimeListener (TimeAnimator.TimeListener listener)
```

Sets a listener that is sent update events throughout the life of an animation.

<br />

| Parameters ||
|---|---|
| `listener` | `TimeAnimator.TimeListener`: the listener to be set. <br /> |

### start

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

```
public void start ()
```

Starts this animation. If the animation has a nonzero startDelay, the animation will start running after that delay elapses. A non-delayed animation will have its initial value(s) set immediately, followed by calls to `https://developer.android.com/reference/android/animation/Animator.AnimatorListener#onAnimationStart(android.animation.Animator)` for any listeners of this animator.

The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.

<br />

<br />