Create circular Reveal Animation - Android Animation

Android examples for Animation:Animation Creation

Description

Create circular Reveal Animation

Demo Code


//package com.java2s;
import android.animation.Animator;
import android.view.View;
import android.view.ViewAnimationUtils;

public class Main {
    public static void circularReveal(View view) {
        int cx = (view.getLeft() + view.getRight()) / 2;
        int cy = (view.getTop() + view.getBottom()) / 2;

        int finalRadius = Math.max(view.getWidth(), view.getHeight());

        try {/*  ww  w . j a v a  2 s.co m*/
            Animator anim = ViewAnimationUtils.createCircularReveal(view,
                    cx, cy, 0.0f, finalRadius);
            view.setVisibility(View.VISIBLE);
            anim.start();
        } catch (Exception e) {
        }
    }
}

Related Tutorials