Create Circular Reveal Animation via ViewAnimationUtils - Android User Interface

Android examples for User Interface:View Animation

Description

Create Circular Reveal Animation via ViewAnimationUtils

Demo Code


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

import android.annotation.TargetApi;
import android.os.Build;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.ViewAnimationUtils;

public class Main {
    /**/*from   ww  w. j ava2s.  c om*/
     * Circular Reveal Animation
     * @param view View to be animated
     * @param cx x coordinate of the center of the circle
     * @param cy y coordinate of the center of the circle
     * @param startRadius initial circle radius
     * @param finalRadius final circle radius
     * @param duration animation duration in milliseconds
     * @return Animator Object
     */
    @NonNull
    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public static Animator reveal(@NonNull final View view, int cx, int cy,
            int startRadius, int finalRadius, int duration) {
        Animator animator = ViewAnimationUtils.createCircularReveal(view,
                cx, cy, startRadius, finalRadius);
        animator.setDuration(duration);
        return animator;
    }
}

Related Tutorials