Java 类android.view.ViewAnimationUtils 实例源码

项目:SunmiUI    文件:ImageSharedTransitionActivity.java   
private void performCircularReveal(View show) {
    show.setBackgroundColor(0xffff0000);
    ViewCompat.setTranslationY(show, 0);
    ViewCompat.setTranslationX(show, 0);
    show.getLayoutParams().height = 500;
    show.getLayoutParams().width = 1920;
    show.requestLayout();
    int centerX = (show.getLeft() + show.getRight()) / 2;
    int centerY = (show.getTop() + show.getBottom()) / 2;
    float finalRadius = (float) Math.hypot((double) centerX, (double) centerY);
    Animator mCircularReveal = ViewAnimationUtils.createCircularReveal(
            show, centerX, centerY, 0, finalRadius);
    mCircularReveal.setInterpolator(new AccelerateDecelerateInterpolator());
    mCircularReveal.setDuration(500);
    mCircularReveal.start();
}
项目:FancyShowCaseView    文件:FancyShowCaseView.java   
/**
 * Circular reveal exit animation
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void doCircularExitAnimation() {
    final int revealRadius = (int) Math.hypot(getWidth(), getHeight());
    Animator exitAnimator = ViewAnimationUtils.createCircularReveal(this,
            mCenterX, mCenterY, revealRadius, 0f);
    exitAnimator.setDuration(mAnimationDuration);
    exitAnimator.setInterpolator(AnimationUtils.loadInterpolator(mActivity,
            android.R.interpolator.decelerate_cubic));
    exitAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            removeView();
            if (mAnimationListener != null) {
                mAnimationListener.onExitAnimationEnd();
            }
        }
    });
    exitAnimator.start();


}
项目:OpenEyesReading-android    文件:BaseLoginLayout1.java   
public void roundLoad(View myView) {
    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    // get the final radius for the clipping circle
    int finalRadius = Math.max(myView.getWidth(), myView.getHeight());
    AnimatorSet animatorSet = new AnimatorSet();
    // create the animator for this view (the start radius is zero)
    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
    anim.setDuration(1000);
    anim.setInterpolator(new AccelerateInterpolator());

    Animator anim1 = ObjectAnimator.ofFloat(myView, "translationZ", 0f, 50f);
    anim1.setDuration(1500);
    anim1.setInterpolator(new AccelerateInterpolator());

    animatorSet.play(anim).with(anim1);
    // make the view visible and start the animation
    myView.setVisibility(View.VISIBLE);
    animatorSet.start();
}
项目:GitHub    文件:CircularAnimUtil.java   
/**
 * 向四周伸张,直到完成显示。
 */
@SuppressLint("NewApi")
public static void show(View myView, float startRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.VISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int finalRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius);
    myView.setVisibility(View.VISIBLE);
    anim.setDuration(durationMills);
    anim.start();
}
项目:GitHub    文件:Utils.java   
/**
 * Create the reveal effect animation
 * @param view the View to reveal
 * @param cx coordinate X
 * @param cy coordinate Y
 */
@TargetApi(VERSION_CODES.LOLLIPOP)
public static void reveal(final View view, int cx, int cy) {
    if (!hasLollipop()) {
        view.setVisibility(View.VISIBLE);
        return;
    }

    //Get the final radius for the clipping circle
    int finalRadius = Math.max(view.getWidth(), view.getHeight());

    //Create the animator for this view (the start radius is zero)
    Animator animator =
            ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);

    //Make the view visible and start the animation
    view.setVisibility(View.VISIBLE);
    animator.start();
}
项目:GitHub    文件:ExampleCardPopup.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void circularReveal(@NonNull final View anchor) {
    final View contentView = getContentView();
    contentView.post(new Runnable() {
        @Override
        public void run() {
            final int[] myLocation = new int[2];
            final int[] anchorLocation = new int[2];
            contentView.getLocationOnScreen(myLocation);
            anchor.getLocationOnScreen(anchorLocation);
            final int cx = anchorLocation[0] - myLocation[0] + anchor.getWidth()/2;
            final int cy = anchorLocation[1] - myLocation[1] + anchor.getHeight()/2;

            contentView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
            final int dx = Math.max(cx, contentView.getMeasuredWidth() - cx);
            final int dy = Math.max(cy, contentView.getMeasuredHeight() - cy);
            final float finalRadius = (float) Math.hypot(dx, dy);
            Animator animator = ViewAnimationUtils.createCircularReveal(contentView, cx, cy, 0f, finalRadius);
            animator.setDuration(500);
            animator.start();
        }
    });
}
项目:GitHub    文件:CircularAnimUtil.java   
/**
 * 向四周伸张,直到完成显示。
 */
@SuppressLint("NewApi")
public static void show(View myView, float startRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.VISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int finalRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius);
    myView.setVisibility(View.VISIBLE);
    anim.setDuration(durationMills);
    anim.start();
}
项目:Rxjava2.0Demo    文件:ToolTitleActivity.java   
@OnClick({R.id.iv_pic1, R.id.iv_pic2})
public void onViewClicked(View view) {
    switch (view.getId()) {
        case R.id.iv_pic1:

            if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
                Animator animator = ViewAnimationUtils.createCircularReveal(ivPic1, ivPic1.getWidth() / 2, ivPic1.getHeight() / 2,
                        ivPic1.getHeight() / 2, 0);

                animator.setDuration(2000);
                animator.start();
            }
            break;
        case R.id.iv_pic2:
            if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
                Animator animator1 = ViewAnimationUtils.createCircularReveal(ivPic2, 0, 0, 0,
                        (float) Math.hypot(ivPic2.getWidth(), ivPic2.getHeight()));
                animator1.setDuration(2000);
                animator1.start();
            }
            break;
    }
}
项目:AndroidOpen    文件:RevealActivity.java   
private void animateRevealHide(final View viewRoot) {
    int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
    int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
    int initialRadius = viewRoot.getWidth();

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, initialRadius, 0);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            viewRoot.setVisibility(View.INVISIBLE);
        }
    });
    anim.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
    anim.start();
}
项目:SunmiUI    文件:CustomSharedTransitionActivity.java   
private void performCircularReveal() {
    show.setBackgroundColor(0xffff0000);
    ViewCompat.setTranslationY(show, 0);
    ViewCompat.setTranslationX(show, 0);
    show.getLayoutParams().height = 500;
    show.getLayoutParams().width = 1920;
    show.requestLayout();
    int centerX = (show.getLeft() + show.getRight()) / 2;
    int centerY = (show.getTop() + show.getBottom()) / 2;
    float finalRadius = (float) Math.hypot((double) centerX, (double) centerY);
    Animator mCircularReveal = ViewAnimationUtils.createCircularReveal(
            show, centerX, centerY, 0, finalRadius);
    mCircularReveal.setInterpolator(new AccelerateDecelerateInterpolator());
    mCircularReveal.setDuration(500);
    mCircularReveal.start();
}
项目:LiteReader    文件:RevealUtil.java   
/**
 * Conceal the view from the given centerX and centerY.
 *
 * @param view        the target view.
 * @param duration    animation duration.
 * @param centerX     the pivotX
 * @param centerY     the pivotY
 * @param startRadius the radius of the end of the animation, which is generally the maximum of the view's height and width.
 * @param endRadius   the radius of the beginning of the animation, which is generally zero.
 */
private static void conceal(final View view, final int duration, final int centerX, final int centerY, final float startRadius, final float endRadius) {
    versionCheck(new Runnable() {
        @Override
        public void run() {
            Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius);
            animator.setDuration(duration);
            animator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    view.setVisibility(View.GONE);
                }
            });
            animator.start();
        }
    }, REVEAL_WARNING);
}
项目:LiteReader    文件:RevealUtil.java   
public static void concealActivity(final Activity activity, final int duration, final int centerX, int centerY) {
    if (takeEffect) {
        final View rootView = activity.findViewById(android.R.id.content);
        Animator animator = ViewAnimationUtils.createCircularReveal(rootView, centerX, centerY, getMaxRadius(rootView) * 2, 0);
        animator.setDuration(duration);
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                rootView.setVisibility(View.GONE);
                activity.finish();
                activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            }
        });
        animator.start();
    } else {
        activity.finish();
    }
}
项目:MovieApp    文件:MovieDetailFragment.java   
private void doCircularReveal() {

        int centerX = (movieBackdrop.getLeft() + movieBackdrop.getRight()) / 2;
        int centerY = movieBackdrop.getTop();
        int startRadius = 0;
        int endRadius = Math.max(movieBackdrop.getWidth(), movieBackdrop.getHeight());

        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
            Animator animator = ViewAnimationUtils
                    .createCircularReveal(movieBackdrop, centerX, centerY, startRadius, endRadius);
            animator.setDuration(500);
            movieBackdrop.setVisibility(View.VISIBLE);
            animator.start();
        } else {
            movieBackdrop.setVisibility(View.VISIBLE);
        }
    }
项目:Android-Code-Demos    文件:CircularAnimUtil.java   
/**
 * 向四周伸张,直到完成显示。
 */
@SuppressLint("NewApi")
public static void show(View myView, float startRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.VISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int finalRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius);
    myView.setVisibility(View.VISIBLE);
    anim.setDuration(durationMills);
    anim.start();
}
项目:hypertrack-live-android    文件:Home.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void circularRevealActivity() {

    int cx = (rootLayout.getLeft() + rootLayout.getRight()) - getResources().getDimensionPixelSize(R.dimen.margin_xxxhigh);
    int cy = (rootLayout.getTop() + rootLayout.getBottom()) - getResources().getDimensionPixelSize(R.dimen.margin_xxxhigh);

    int finalRadius = (int) Math.hypot(rootLayout.getRight(), rootLayout.getBottom());
    int initialRadius = getResources().getDimensionPixelSize(R.dimen.margin_xxhigh);
    // create the animator for this view (the start radius is zero)
    Animator circularReveal = ViewAnimationUtils.createCircularReveal(rootLayout, cx, cy, initialRadius, finalRadius);
    circularReveal.setDuration(600);

    // make the view visible and start the animation
    rootLayout.setVisibility(View.VISIBLE);
    circularReveal.start();
}
项目:GracefulMovies    文件:SideFragment.java   
protected Animator createCheckoutRevealAnimator(final ClipRevealFrame view, int x, int y, float startRadius, float endRadius) {
    setMenuVisibility(false);
    Animator retAnimator;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        retAnimator = ViewAnimationUtils.createCircularReveal(view, x, y, startRadius, endRadius);
    } else {
        view.setClipOutLines(true);
        view.setClipCenter(x, y);
        view.setClipRadius(startRadius);

        retAnimator = ObjectAnimator.ofFloat(view, "clipRadius", startRadius, endRadius);
    }
    retAnimator.setDuration(ANIM_DURATION);
    retAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            view.setClipOutLines(false);
            removeOldSideFragment();
            isAnimRunning = false;
        }
    });

    retAnimator.setInterpolator(new AccelerateInterpolator(2.0f));
    return retAnimator;
}
项目:LQRBiliBlili    文件:VideoDetailActivity.java   
private void showVideoStartTip() {
    mRlVideoTip.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Animator circularReveal = ViewAnimationUtils.createCircularReveal(mRlVideoTip,
                mIvCover.getWidth() - ArmsUtils.dip2px(VideoDetailActivity.this, mAnchorX),
                mIvCover.getHeight() - ArmsUtils.dip2px(VideoDetailActivity.this, mAnchorY),
                0,
                ((float) Math.hypot(mIvCover.getWidth(), mIvCover.getHeight())));
        circularReveal.setDuration(800);
        circularReveal.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                mIvCover.setVisibility(View.GONE);
                mPresenter.loadPlayUrl(aid);
            }
        });
        circularReveal.start();
    } else {
        mPresenter.loadPlayUrl(aid);
    }
    // 锁定AppBarLayout
    AppBarLayout.LayoutParams layoutParams = (AppBarLayout.LayoutParams) mAppbar.getChildAt(0).getLayoutParams();
    layoutParams.setScrollFlags(0);
    mAppbar.getChildAt(0).setLayoutParams(layoutParams);
}
项目:Phial    文件:AnimatorFactory.java   
private Animator createAnimator(View targetView, boolean isAppearing) {
    final int[] relativeLocation = getRelativeLocation(targetView);
    final int width = targetView.getWidth();
    final int height = targetView.getHeight();

    final int relX = relativeLocation[0];
    final int relY = relativeLocation[1];
    int dx = Math.max(relX, width - relX);
    int dy = Math.max(relY, height - relY);
    int radius = calcRadius(dx, dy);

    return ViewAnimationUtils.createCircularReveal(
            targetView,
            relX,
            relY,
            isAppearing ? startRadius : radius,
            isAppearing ? radius : startRadius
    );
}
项目:mvvm-template    文件:AnimHelper.java   
@UiThread public static void revealPopupWindow(@NonNull PopupWindow popupWindow, @NonNull View from) {
    Rect rect = ViewHelper.getLayoutPosition(from);
    int x = (int) rect.exactCenterX();
    int y = (int) rect.exactCenterY();
    if (popupWindow.getContentView() != null) {
        View view = popupWindow.getContentView();
        if (view != null) {
            popupWindow.showAsDropDown(from);
            view.post(() -> {
                if (ViewCompat.isAttachedToWindow(view)) {
                    Animator animator = ViewAnimationUtils.createCircularReveal(view, x, y, 0,
                            (float) Math.hypot(rect.width(), rect.height()));
                    animator.setDuration(view.getResources().getInteger(android.R.integer.config_shortAnimTime));
                    animator.start();
                }
            });
        }
    }
}
项目:mvvm-template    文件:AnimHelper.java   
@UiThread public static void revealDialog(@NonNull Dialog dialog, int animDuration) {
    if (dialog.getWindow() != null) {
        View view = dialog.getWindow().getDecorView();
        if (view != null) {
            view.post(() -> {
                if (ViewCompat.isAttachedToWindow(view)) {
                    int centerX = view.getWidth() / 2;
                    int centerY = view.getHeight() / 2;
                    Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 20, view.getHeight());
                    animator.setDuration(animDuration);
                    animator.start();
                }
            });
        }
    }
}
项目:mvvm-template    文件:AnimHelper.java   
@UiThread public static void dismissDialog(@NonNull DialogFragment dialogFragment, int duration, AnimatorListenerAdapter listenerAdapter) {
    Dialog dialog = dialogFragment.getDialog();
    if (dialog != null) {
        if (dialog.getWindow() != null) {
            View view = dialog.getWindow().getDecorView();
            if (view != null) {
                int centerX = view.getWidth() / 2;
                int centerY = view.getHeight() / 2;
                float radius = (float) Math.sqrt(view.getWidth() * view.getWidth() / 4 + view.getHeight() * view.getHeight() / 4);
                view.post(() -> {
                    if (ViewCompat.isAttachedToWindow(view)) {
                        Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, radius, 0);
                        animator.setDuration(duration);
                        animator.addListener(listenerAdapter);
                        animator.start();
                    } else {
                        listenerAdapter.onAnimationEnd(null);
                    }
                });
            }
        }
    } else {
        listenerAdapter.onAnimationEnd(null);
    }
}
项目:MyDemo    文件:NewsDetailActivity.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void showAnim() {
    int cx = (mIvIconBg.getLeft() + mIvIconBg.getRight()) / 2;
    int cy = (mIvIconBg.getTop() + mIvIconBg.getBottom()) / 2;
    int finalRadius = Math.max(mIvIconBg.getWidth(), mIvIconBg.getHeight());
    Animator anim = ViewAnimationUtils.createCircularReveal(mIvIconBg, cx, cy, finalRadius/3, finalRadius);
    anim.setDuration(200);
    anim.start();
    mIvIconBg.setImageResource(R.color.pink);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mIvIconBg.setVisibility(View.GONE);
            mIvIcon.animate().alpha(1).setStartDelay(100).start();
            mWebView.animate().alpha(1).setStartDelay(100).start();
        }
    });
}
项目:Melophile    文件:PlaylistFragment.java   
@Override
public void showTitle(String title) {
    playlistTitle.setText(title);
    playlistTitle.setScaleX(0);playlistTitle.setScaleY(0);
    titleBackground.post(()->{
        int cx=titleBackground.getWidth()/2;
        int cy=titleBackground.getHeight()/2;
        Animator animator=ViewAnimationUtils.createCircularReveal(titleBackground,cx,cy,0,
                (int)Math.hypot(titleBackground.getWidth(),titleBackground.getHeight()));
        animator.setDuration(400);
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                super.onAnimationStart(animation);
                titleBackground.setVisibility(View.VISIBLE);
                playlistTitle.animate()
                        .setDuration(400)
                        .scaleX(1).scaleY(1)
                        .setInterpolator(new OvershootInterpolator())
                        .start();
            }
        });
        animator.start();
    });
}
项目:magellan    文件:CircularRevealTransition.java   
@Override
public void animate(
    View from, View to, NavigationType navType, Direction direction, final Callback callback) {
  int[] clickedViewCenter = getCenterClickedView((ViewGroup) from);
  int circularRevealCenterX = clickedViewCenter[0];
  int circularRevealCenterY = clickedViewCenter[1];
  float finalRadius = (float) Math.hypot(to.getWidth(), to.getHeight());

  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
    Animator anim =
        ViewAnimationUtils.createCircularReveal(to, circularRevealCenterX,
            circularRevealCenterY, 0, finalRadius);
    anim.addListener(new AnimatorListenerAdapter() {
      @Override
      public void onAnimationEnd(Animator animation) {
        callback.onAnimationEnd();
      }
    });
    anim.start();
  } else {
    callback.onAnimationEnd();
  }
}
项目:AndroidProgramming3e    文件:BeatBoxFragment.java   
private void performRevealAnimation(final View view, int screenCenterX, int screenCenterY) {
    int[] animatingViewCoords = new int[2];
    view.getLocationOnScreen(animatingViewCoords);
    int centerX = screenCenterX - animatingViewCoords[0];
    int centerY = screenCenterY - animatingViewCoords[1];

    Point size = new Point();
    getActivity().getWindowManager().getDefaultDisplay().getSize(size);
    int maxRadius = size.y;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        view.setVisibility(View.VISIBLE);
        Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, maxRadius);
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                view.setVisibility(View.INVISIBLE);
            }
        });
        animator.start();
    }
}
项目:FancyShowCaseView-master    文件:FancyShowCaseView.java   
/**
 * Circular reveal exit animation
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void doCircularExitAnimation() {
    final int revealRadius = (int) Math.hypot(getWidth(), getHeight());
    Animator exitAnimator = ViewAnimationUtils.createCircularReveal(this,
            mCenterX, mCenterY, revealRadius, 0f);
    exitAnimator.setDuration(mAnimationDuration);
    exitAnimator.setInterpolator(AnimationUtils.loadInterpolator(mActivity,
            android.R.interpolator.decelerate_cubic));
    exitAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            removeView();

        }
    });
    exitAnimator.start();


}
项目:AndroidBlueprints    文件:Utils.java   
/**
 * Create the reveal effect animation
 *
 * @param view the View to reveal
 * @param cx   coordinate X
 * @param cy   coordinate Y
 */
@TargetApi(VERSION_CODES.LOLLIPOP)
public static void reveal(final View view, int cx, int cy) {
    if (!hasLollipop()) {
        view.setVisibility(View.VISIBLE);
        return;
    }

    //Get the final radius for the clipping circle
    int finalRadius = Math.max(view.getWidth(), view.getHeight());

    //Create the animator for this view (the start radius is zero)
    Animator animator =
            ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);

    //Make the view visible and start the animation
    view.setVisibility(View.VISIBLE);
    animator.start();
}
项目:FamilyBond    文件:CircularAnimUtils.java   
/**
 * 向四周伸张,直到完成显示。
 */
@SuppressLint("NewApi")
public static void show(View myView, float startRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.VISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int finalRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius);
    myView.setVisibility(View.VISIBLE);
    anim.setDuration(durationMills);
    anim.start();
}
项目:showroom-android    文件:ShowroomActivity.java   
private void hideHelpOverlay() {
    if (animationsInProgress) return;
    animationsInProgress = true;
    titleLayout.bringToFront();
    mainLayout.setVisibility(View.VISIBLE);

    Animator hideAnimation;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        hideAnimation = ViewAnimationUtils.createCircularReveal(helpLayout, titleBtnHelpCenterX, titleBtnHelpCenterY, screenDiagonalPx, 0);
    } else {
        hideAnimation = ObjectAnimator.ofFloat(helpLayout, "alpha", 1f, 0f);
    }

    hideAnimation.setInterpolator(new AccelerateInterpolator());
    hideAnimation.setDuration(250);

    hideAnimation.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            helpLayout.setVisibility(View.GONE);
            animationsInProgress = false;
            helpLayoutShown = false;
            helpLayoutScrollView.scrollTo(0, 0);
        }
    });
    hideAnimation.start();
}
项目:GitHub    文件:CircularAnimUtil.java   
/**
 * 由满向中间收缩,直到隐藏。
 */
@SuppressLint("NewApi")
public static void hide(final View myView, float endRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.INVISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;
    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int initialRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, endRadius);
    anim.setDuration(durationMills);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            myView.setVisibility(View.INVISIBLE);
        }
    });

    anim.start();
}
项目:GitHub    文件:RevealVisibilityTransition.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
                         TransitionValues endValues) {

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
        0, 1000);
    return new NoPauseAnimator(reveal);

}
项目:GitHub    文件:RevealVisibilityTransition.java   
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
                            TransitionValues endValues) {

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
       1000, 0);
    return new NoPauseAnimator(reveal);

}
项目:GitHub    文件:RevealVisibilityTransition.java   
private Animator createAnimator(View view, float startRadius, float endRadius) {
    int centerX = view.getWidth() / 2;
    int centerY = view.getHeight() / 2;

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, centerX, centerY,
            startRadius, endRadius);
    return new NoPauseAnimator(reveal);
}
项目:GitHub    文件:RevealTransition.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
    Animator animator = ViewAnimationUtils.createCircularReveal(view, mEpicenter.x, mEpicenter.y,
            mSmallRadius, mBigRadius);
    animator.setDuration(mDuration);
    return new PauseableAnimator(animator);
}
项目:GitHub    文件:RevealTransition.java   
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues, TransitionValues endValues) {
    Animator animator = ViewAnimationUtils.createCircularReveal(view, mEpicenter.x, mEpicenter.y,
            mBigRadius, mSmallRadius);
    animator.setDuration(mDuration);
    return new PauseableAnimator(animator);
}
项目:GitHub    文件:Utils.java   
/**
 * Create the un-reveal effect animation
 * @param view the View to hide
 * @param cx coordinate X
 * @param cy coordinate Y
 */
@TargetApi(VERSION_CODES.LOLLIPOP)
public static void unReveal(final View view, int cx, int cy) {
    if (!hasLollipop()) {
        view.setVisibility(View.GONE);
        return;
    }

    //Get the initial radius for the clipping circle
    int initialRadius = view.getWidth();

    //Create the animation (the final radius is zero)
    Animator animator =
        ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0);

    //Make the view invisible when the animation is done
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(View.GONE);
        }
    });

    //Start the animation
    animator.start();
}
项目:GitHub    文件:CircularAnimUtil.java   
/**
 * 由满向中间收缩,直到隐藏。
 */
@SuppressLint("NewApi")
public static void hide(final View myView, float endRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.INVISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;
    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int initialRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, endRadius);
    anim.setDuration(durationMills);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            myView.setVisibility(View.INVISIBLE);
        }
    });

    anim.start();
}
项目:GitHub    文件:RevealVisibilityTransition.java   
@Override
public Animator onAppear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
                         TransitionValues endValues) {

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
        0, 1000);
    return new NoPauseAnimator(reveal);

}
项目:GitHub    文件:RevealVisibilityTransition.java   
@Override
public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
                            TransitionValues endValues) {

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
       1000, 0);
    return new NoPauseAnimator(reveal);

}
项目:GitHub    文件:RevealVisibilityTransition.java   
private Animator createAnimator(View view, float startRadius, float endRadius) {
    int centerX = view.getWidth() / 2;
    int centerY = view.getHeight() / 2;

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, centerX, centerY,
            startRadius, endRadius);
    return new NoPauseAnimator(reveal);
}