ozodrukh/CircularReveal

Reverse Circular Reveal Effect

Closed this issue · 8 comments

Is it possible to create the reverse Circular Reveal effect?

Yep,

View myView = findView(R.id.awesome_card);

    // get the center for the clipping circle
    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());
    // i just swapped from radius, to radius arguments
    SupportAnimator animator =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, finalRadius, 0);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(1500);
    animator.start();

Thanks a lot for it.

It does not work for me.

checkout a latest version, i added reverse animation

I am just working with the solution that you gave me and its working just fine.

kai91 commented

@tounaobun

If you're talking about the reverse function, you're supposed to use animator.reverse().start().

reverse() only returns the SupportAnimator and not start the animation itself.

It's not working for me either. I am using the latest version and I have tried the animator.reverse.start() too.

Ok I too had the reverse animator problem. Actually I was setting the view INVISIBLE after anim.start();
which does not wait for animation to end.

Solution:

        anim.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {

            }

            @Override
            public void onAnimationEnd(Animator animation) {
                mConfigCard.setVisibility(View.INVISIBLE);
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });