Floating start button animation
I have been looking online for a while, but I cannot find it anywhere. I have a floating action button that I am already working on. It is visible and clickable and so on, but nothing is associated with it at the moment. Before I go any further, I want to know how to make the startup animation.
On the Material Design page for FABs, it shows how the animation sprouts where it comes from the correct location, but animates its intended size. Found here .
Any information is appreciated.
+3
source to share
2 answers
You can take a look at the class Behavior
inside FloatingActionButton
. For example, input animation is implemented:
private void animateIn(FloatingActionButton button) {
button.setVisibility(0);
if(VERSION.SDK_INT >= 14) {
ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR).withLayer().setListener((ViewPropertyAnimatorListener)null).start();
} else {
Animation anim = android.view.animation.AnimationUtils.loadAnimation(button.getContext(), anim.fab_in);
anim.setDuration(200L);
anim.setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR);
button.startAnimation(anim);
}
}
+2
source to share