Stay organized with collections
Save and categorize content based on your preferences.
ViewAnimationUtils
public
final
class
ViewAnimationUtils
extends Object
Defines common utilities for working with View's animations.
Summary
Public methods |
static
Animator
|
createCircularReveal(View view, int centerX, int centerY, float startRadius, float endRadius)
Returns an Animator which can animate a clipping circle.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(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(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()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public methods
createCircularReveal
public static Animator createCircularReveal (View view,
int centerX,
int centerY,
float startRadius,
float endRadius)
Returns an Animator which can animate a clipping circle.
Any shadow cast by the View will respect the circular clip from this animator.
Only a single non-rectangular clip can be applied on a View at any time.
Views clipped by a circular reveal animation take priority over
View Outline clipping
.
Note that the animation returned here is a one-shot animation. It cannot
be re-used, and once started it cannot be paused or resumed. It is also
an asynchronous animation that automatically runs off of the UI thread.
As a result AnimatorListener.onAnimationEnd(Animator)
will occur after the animation has ended, but it may be delayed depending
on thread responsiveness.
Note that if any start delay is set on the reveal animator, the start radius
will not be applied to the reveal circle until the start delay has passed.
If it's desired to set a start radius on the reveal circle during the start
delay, one workaround could be adding an animator with the same start and
end radius. For example:
public static Animator createRevealWithDelay(View view, int centerX, int centerY, float startRadius, float endRadius) {
Animator delayAnimator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, startRadius);
delayAnimator.setDuration(delayTimeMS);
Animator revealAnimator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius);
AnimatorSet set = new AnimatorSet();
set.playSequentially(delayAnimator, revealAnimator);
return set;
}
Parameters |
view |
View : The View will be clipped to the animating circle. |
centerX |
int : The x coordinate of the center of the animating circle, relative to
view . |
centerY |
int : The y coordinate of the center of the animating circle, relative to
view . |
startRadius |
float : The starting radius of the animating circle. |
endRadius |
float : The ending radius of the animating circle. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# ViewAnimationUtils\n\nAdded in [API level 21](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nViewAnimationUtils\n==================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/ViewAnimationUtils \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\nfinal\n\nclass\nViewAnimationUtils\n`\n\n\n`\n\nextends `[Object](/reference/java/lang/Object)`\n\n\n`\n\n`\n\n\n`\n\n|---|---------------------------------|\n| [java.lang.Object](/reference/java/lang/Object) ||\n| ↳ | android.view.ViewAnimationUtils |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nDefines common utilities for working with View's animations.\n\nSummary\n-------\n\n| ### Public methods ||\n|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static `[Animator](/reference/android/animation/Animator) | ` `[createCircularReveal](/reference/android/view/ViewAnimationUtils#createCircularReveal(android.view.View,%20int,%20int,%20float,%20float))`(`[View](/reference/android/view/View)` view, int centerX, int centerY, float startRadius, float endRadius) ` Returns an Animator which can animate a clipping circle. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` `[java.lang.Object](/reference/java/lang/Object)` ` |---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](/reference/java/lang/Object) | ` `[clone](/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object. | | ` boolean` | ` `[equals](/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Indicates whether some other object is \"equal to\" this one. | | ` void` | ` `[finalize](/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](/reference/java/lang/Class)`\u003c?\u003e` | ` `[getClass](/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`. | | ` int` | ` `[hashCode](/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object. | | ` final void` | ` `[notify](/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` `[notifyAll](/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor. | | ` `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/Object#toString())`() ` Returns a string representation of the object. | | ` final void` | ` `[wait](/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](/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](/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||\n\nPublic methods\n--------------\n\n### createCircularReveal\n\nAdded in [API level 21](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic static Animator createCircularReveal (View view, \n int centerX, \n int centerY, \n float startRadius, \n float endRadius)\n```\n\nReturns an Animator which can animate a clipping circle.\n\n\nAny shadow cast by the View will respect the circular clip from this animator.\n\n\nOnly a single non-rectangular clip can be applied on a View at any time.\nViews clipped by a circular reveal animation take priority over\n[View Outline clipping](/reference/android/view/View#setClipToOutline(boolean)).\n\n\nNote that the animation returned here is a one-shot animation. It cannot\nbe re-used, and once started it cannot be paused or resumed. It is also\nan asynchronous animation that automatically runs off of the UI thread.\nAs a result [AnimatorListener.onAnimationEnd(Animator)](/reference/android/animation/Animator.AnimatorListener#onAnimationEnd(android.animation.Animator))\nwill occur after the animation has ended, but it may be delayed depending\non thread responsiveness.\n\n\nNote that if any start delay is set on the reveal animator, the start radius\nwill not be applied to the reveal circle until the start delay has passed.\nIf it's desired to set a start radius on the reveal circle during the start\ndelay, one workaround could be adding an animator with the same start and\nend radius. For example: \n\n\n public static Animator createRevealWithDelay(View view, int centerX, int centerY, float startRadius, float endRadius) {\n Animator delayAnimator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, startRadius);\n delayAnimator.setDuration(delayTimeMS);\n Animator revealAnimator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius);\n AnimatorSet set = new AnimatorSet();\n set.playSequentially(delayAnimator, revealAnimator);\n return set;\n }\n \n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------|-------------------------------------------------------------------------------------------|\n| `view` | `View`: The View will be clipped to the animating circle. \u003cbr /\u003e |\n| `centerX` | `int`: The x coordinate of the center of the animating circle, relative to `view`. \u003cbr /\u003e |\n| `centerY` | `int`: The y coordinate of the center of the animating circle, relative to `view`. \u003cbr /\u003e |\n| `startRadius` | `float`: The starting radius of the animating circle. \u003cbr /\u003e |\n| `endRadius` | `float`: The ending radius of the animating circle. \u003cbr /\u003e |\n\n| Returns ||\n|---------------------------------------------------|--------|\n| [Animator](/reference/android/animation/Animator) | \u003cbr /\u003e |"]]