circle Reveal View - Android Animation

Android examples for Animation:Slide Animation

Description

circle Reveal View

Demo Code


//package com.java2s;
import android.animation.Animator;

import android.annotation.TargetApi;

import android.view.View;
import android.view.ViewAnimationUtils;

public class Main {
    public static final int ANIMATION_DURATION_SHORT = 250;

    @TargetApi(21)//from w  ww  . j a v  a2s  .c  o  m
    public static void circleRevealView(View view, int duration) {
        int cx = view.getWidth();
        int cy = view.getHeight() / 2;
        float finalRadius = (float) Math.hypot(cx, cy);
        Animator anim = ViewAnimationUtils.createCircularReveal(view, cx,
                cy, 0, finalRadius);

        if (duration > 0) {
            anim.setDuration(duration);
        } else {
            anim.setDuration(ANIMATION_DURATION_SHORT);
        }
        view.setVisibility(View.VISIBLE);
        anim.start();
    }

    @TargetApi(21)
    public static void circleRevealView(View view) {
        circleRevealView(view, ANIMATION_DURATION_SHORT);
    }
}

Related Tutorials