Java tutorial
//package com.java2s; //License from project: Open Source License import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.support.annotation.NonNull; import android.view.View; public class Main { @NonNull private static AnimatorSet createRevealAnimation(View headline, View btnPanel, View recyclerView, View locationTxt) { AnimatorSet animAll = new AnimatorSet(); Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 0, 1, 1); Animator anim1_2 = ObjectAnimator.ofFloat(headline, View.TRANSLATION_Y, -headline.getBottom(), 60, 0); Animator anim1_3 = ObjectAnimator.ofFloat(headline, View.SCALE_X, 0.1f, 0.475f, 1); Animator anim1_4 = ObjectAnimator.ofFloat(headline, View.SCALE_Y, 0.1f, 0.475f, 1); setBatchTiming(1000, 0, anim1_1, anim1_2, anim1_3, anim1_4); animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4); Animator anim2_1 = ObjectAnimator.ofFloat(btnPanel, View.ALPHA, 0, 1); Animator anim2_2 = ObjectAnimator.ofFloat(btnPanel, View.TRANSLATION_Y, btnPanel.getHeight() / 4, 0); setBatchTiming(800, 0, anim2_1, anim2_2); animAll.play(anim2_1).with(anim2_2).after(anim1_1); Animator anim3_1 = ObjectAnimator.ofFloat(recyclerView, View.ALPHA, 0, 1); Animator anim3_2 = ObjectAnimator.ofFloat(locationTxt, View.ALPHA, 0, 1); setBatchTiming(1800, 0, anim3_1, anim3_2); animAll.play(anim3_1).with(anim3_2).after(anim1_1); return animAll; } @NonNull private static AnimatorSet createRevealAnimation(View headline, View image, View startBtn, View pick1, View pick2) { AnimatorSet animAll = new AnimatorSet(); Animator anim1_1 = ObjectAnimator.ofFloat(headline, View.ALPHA, 0, 1, 1); Animator anim1_2 = ObjectAnimator.ofFloat(headline, View.TRANSLATION_Y, -headline.getBottom(), 60, 0); Animator anim1_3 = ObjectAnimator.ofFloat(headline, View.SCALE_X, 0.1f, 0.475f, 1); Animator anim1_4 = ObjectAnimator.ofFloat(headline, View.SCALE_Y, 0.1f, 0.475f, 1); setBatchTiming(1000, 0, anim1_1, anim1_2, anim1_3, anim1_4); animAll.play(anim1_1).with(anim1_2).with(anim1_3).with(anim1_4); Animator anim2_1 = ObjectAnimator.ofFloat(image, View.ALPHA, 0, 1); Animator anim2_2 = ObjectAnimator.ofFloat(image, View.TRANSLATION_Y, image.getHeight() / 4, 0); setBatchTiming(800, 0, anim2_1, anim2_2); animAll.play(anim2_1).with(anim2_2).after(anim1_1); Animator anim3_1 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 0, 1); Animator anim3_2 = ObjectAnimator.ofFloat(startBtn, View.ALPHA, 0, 1); Animator anim3_3 = ObjectAnimator.ofFloat(pick1, View.ALPHA, 0, 1); Animator anim3_4 = ObjectAnimator.ofFloat(pick2, View.ALPHA, 0, 1); setBatchTiming(1800, 0, anim3_1, anim3_2, anim3_3, anim3_4); animAll.play(anim3_1).with(anim3_2).with(anim3_3).with(anim3_4).after(anim1_1); return animAll; } private static void setBatchTiming(long millis, long startDelay, Animator... anims) { for (Animator a : anims) { a.setDuration(millis); a.setStartDelay(startDelay); } } }