Most visited

Recently visited

Added in API level 21

ViewAnimationUtils

public final class ViewAnimationUtils
extends Object

java.lang.Object
   ↳ android.view.ViewAnimationUtils


定义View的动画的常用工具。

Summary

Public methods

static Animator createCircularReveal(View view, int centerX, int centerY, float startRadius, float endRadius)

返回可以动画剪辑圈的Animator。

Inherited methods

From class java.lang.Object

Public methods

createCircularReveal

Added in API level 21
Animator createCircularReveal (View view, 
                int centerX, 
                int centerY, 
                float startRadius, 
                float endRadius)

返回可以动画剪辑圈的Animator。

视图投射的任何阴影都会尊重来自此动画制作者的圆形剪辑。

任何时候只能将一个非矩形剪辑应用于视图。 由圆形显示动画剪辑的视图优先于View Outline clipping

请注意,这里返回的动画是一次性动画。 它不能被重新使用,并且一旦启动,它就不能被暂停或恢复。 它也是一个自动从UI线程运行的异步动画。 结果onAnimationEnd(Animator)将在动画结束后发生,但可能会因线程响应性而延迟。

请注意,如果在显示动画设置上设置了启动延迟,则在启动延迟结束之前,启动半径将不会应用到显示圆圈。 如果希望在启动延迟期间在展示圆上设置起始半径,则一种解决方法可能是添加具有相同开始和结束半径的动画制作工具。 例如:


 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.
Returns
Animator

Hooray!