AnimatorSet bouncer = new AnimatorSet();
bouncer.play(bounceAnim).before(squashAnim1);
bouncer.play(squashAnim1).with(squashAnim2);
bouncer.play(squashAnim1).with(stretchAnim1);
bouncer.play(squashAnim1).with(stretchAnim2);
bouncer.play(bounceBackAnim).after(stretchAnim2);
ValueAnimator fadeAnim = ObjectAnimator.ofFloat(newBall, "alpha", 1f, 0f);
fadeAnim.setDuration(250);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(bouncer).before(fadeAnim);
animatorSet.start();
- Plays
bounceAnim
. - Plays
squashAnim1
,squashAnim2
,stretchAnim1
, andstretchAnim2
at the same time. - Plays
bounceBackAnim
. - Plays
fadeAnim
.
说明:播放bounceAnim 播放完成之后同时播放squashAnim1
, squashAnim2
, stretchAnim1和
stretchAnim2 这四个播放完成之后播放bounceBackAnim 最后播放fadeAnim