Devtantra Blog

Tutorials about Android, Angular, ReactJS, PHP, MySQL and Web Development

Circular reveal animation on Android

Hey folks, I was looking to make my app Ui/Ux more attractive and fascinated so I used circular revel effect when I was moving one screen to another screen.

1.Let create circular reveal f(n) using ViewAnimationUtils class.

// create the animator for this view (the start radius is zero)
Animator circularReveal = ViewAnimationUtils.createCircularReveal(rootLayout, x, y, 0, finalRadius);
circularReveal.setDuration(450);
circularReveal.setInterpolator(new AccelerateInterpolator());

2. Add the listener on animation class object and

circularReveal.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!animation.isRunning())
getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.home_bg_color));
super.onAnimationEnd(animation);
}

3. Override the on animation start f(n).

@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.revealColor));
}
});
circularReveal.start();
} else {
finish();
}
}

For further knowledge about class and method check this link.
https://developer.android.com/reference/android/view/ViewAnimationUtils.html

0
0

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: