Skip to content

Instantly share code, notes, and snippets.

@haseebpvt
Created May 27, 2019 15:48
Show Gist options
  • Select an option

  • Save haseebpvt/daf608a724e7d128eaa81d7b76d5e3e2 to your computer and use it in GitHub Desktop.

Select an option

Save haseebpvt/daf608a724e7d128eaa81d7b76d5e3e2 to your computer and use it in GitHub Desktop.
Animation In Android using Animator set
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