How To Create A Circular Reveal Animation In Android With Design Library Version 28
I Saw few Classes Which They Are Have Reveal Word Like This Items :
android.support.design.circularreveal.CircularRevealFrameLayout
android.support.design.circularreveal.CircularRevealGridLayout
android.support.design.circularreveal.CircularRevealLinearLayout
android.support.design.circularreveal.CircularRevealRelativeLayout
android.support.design.circularreveal.cardview.CircularRevealCardView
android.support.design.circularreveal.coordinatorlayout.CircularRevealCoordinatorLayout
But I Don't Found Any Tutorial For That
Please Give Me Some Ways To Implement this Beautiful Animation With Design Library
I am not familiar with those views, but the way to create circular reveal is as follows:
Here's how to do it, with either version 28.0.0 of the Support library, or the new AndroidX library:
Posting the runnable might not be required depending on how you use it, but it helps with 2 potential issues:
CircularRevealCompat.createCircularReveal
onLayout
so those will always be available this way.Knowing that the reveal starts from the middle of the View, we also know that the View will be fully revealed when the radius of the reveal circle equals half of the View's diagonal.
CircularRevealCompat.createCircularReveal
returns anAnimator
, similar to the old way of doing it (ViewAnimationUtils.createCircularReveal
).By default, there is no scrim color on the reveal animation. If you want to animate the scrim color as the View is being revealed, you need an
ObjectAnimator
of the special propertyCircularRevealWidget.CircularRevealScrimColorProperty.CIRCULAR_REVEAL_SCRIM_COLOR
You can easily create the reverse animation as well by swapping the startRadius and endRadius (and the scrim's start and end colors).