ozodrukh / CircularReveal

Lollipop ViewAnimationUtils.createCircularReveal for everyone 4.0+
MIT License
2.43k stars 391 forks source link

Cant reverse animator #104

Closed peppingdore closed 7 years ago

peppingdore commented 7 years ago

I have no reverse() method in Animator object

` void CloseView(){ // get the center for the clipping circle int cx = (revealView.getLeft() + revealView.getRight()) / 2; int cy = (revealView.getTop() + revealView.getBottom()) / 2;

    // get the final radius for the clipping circle
    int dx = Math.max(cx, revealView.getWidth() - cx);
    int dy = Math.max(cy, revealView.getHeight() - cy);
    float finalRadius = (float) Math.hypot(dx, dy);

    // Android native animator
    Animator animator =
            ViewAnimationUtils.createCircularReveal(revealView, cx, cy, 0, 0, View.LAYER_TYPE_HARDWARE);
    animator.setInterpolator(new FastOutSlowInInterpolator());
    animator.setDuration(500);
    animator.start();
    animator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animator) {

        }

        @Override
        public void onAnimationEnd(Animator animator) {
            parentView.setVisibility(View.GONE);
        }

        @Override
        public void onAnimationCancel(Animator animator) {

        }

        @Override
        public void onAnimationRepeat(Animator animator) {

        }
    });
    IsOpen = false;
}
peppingdore commented 7 years ago

Solved:) I used wrong parent View