Created
August 5, 2019 07:28
-
-
Save Mustufa786/e2c37a63191b27ac8d51c127453f9bff to your computer and use it in GitHub Desktop.
This file contains 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
private void FromLeftToRight(View itemView, int i) { | |
if(!on_attach){ | |
i = -1; | |
} | |
boolean not_first_item = i == -1; | |
i = i + 1; | |
itemView.setTranslationX(-400f); | |
itemView.setAlpha(0.f); | |
AnimatorSet animatorSet = new AnimatorSet(); | |
ObjectAnimator animatorTranslateY = ObjectAnimator.ofFloat(itemView, "translationX", -400f, 0); | |
ObjectAnimator animatorAlpha = ObjectAnimator.ofFloat(itemView, "alpha", 1.f); | |
ObjectAnimator.ofFloat(itemView, "alpha", 0.f).start(); | |
animatorTranslateY.setStartDelay(not_first_item ? DURATION : (i * DURATION)); | |
animatorTranslateY.setDuration((not_first_item ? 2 : 1) * DURATION); | |
animatorSet.playTogether(animatorTranslateY, animatorAlpha); | |
animatorSet.start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment