Created
May 27, 2019 15:48
-
-
Save haseebpvt/daf608a724e7d128eaa81d7b76d5e3e2 to your computer and use it in GitHub Desktop.
Animation In Android using Animator set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AnimatorSet animatorSet = new AnimatorSet(); | |
| animatorSet.playTogether( | |
| ObjectAnimator.ofFloat(image,"translationY",-1000,0), | |
| ObjectAnimator.ofFloat(image,"alpha",0,1), | |
| ObjectAnimator.ofFloat(text,"translationX",-200,0) | |
| ); | |
| animatorSet.setInterpolator(new DescelerateInterpolator()); | |
| animatorSet.setDuration(2000); | |
| animatorSet.addListener(new AnimatorListenerAdapter(){ | |
| @Override public void onAnimationEnd(Animator animation) { | |
| AnimatorSet animatorSet2 = new AnimatorSet(); | |
| animatorSet2.playTogether( | |
| ObjectAnimator.ofFloat(image,"scaleX", 1f, 0.5f, 1f), | |
| ObjectAnimator.ofFloat(image,"scaleY", 1f, 0.5f, 1f) | |
| ); | |
| animatorSet2.setInterpolator(new AccelerateInterpolator()); | |
| animatorSet2.setDuration(1000); | |
| animatorSet2.start(); | |
| } | |
| }); | |
| animatorSet.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment