2.平移
ObjectAnimator anim1 = ObjectAnimator.ofFloat(balls.get(0), "y",
0f, getHeight() - balls.get(0).getHeight()).setDuration(500);
3.复制动画
ObjectAnimator anim2 = anim1.clone();
anim2.setTarget(balls.get(1));
4.添加监听器
anim1.addUpdateListener(this);
5.动画集
//动画一
ObjectAnimator animDown = ObjectAnimator.ofFloat(ball2, "y",
0f, getHeight() - ball2.getHeight()).setDuration(500);
//设置加速器
animDown.setInterpolator(new AccelerateInterpolator());
//动画二
ObjectAnimator animUp = ObjectAnimator.ofFloat(ball2, "y",
getHeight() - ball2.getHeight(), 0f).setDuration(500);
//设置减速器
animUp.setInterpolator(new DecelerateInterpolator());
//动画集
AnimatorSet s1 = new AnimatorSet();
//设置动画播放顺序
s1.playSequentially(animDown, animUp);
6、复制动画集
AnimatorSet s2 = (AnimatorSet) s1.clone();
s2.setTarget(balls.get(3));
7、播放动画
animation = new AnimatorSet();
animation.playTogether(anim1, anim2, s1);
animation.playSequentially(s1, s2);
animation.start();