一、前言
在Android 中, 制作混合型动画,肯定少不了AnimationSet和 AnimatorSet了,接下来我会简单说一下这两个的区别
1. AnimationSet 可以让许多个动画在同一时间开始(也就是动画的叠加)
2.AnimatorSet 就比 AnimationSet 功能强大很多了, AnimatorSet 可以使用playSequentially、playTogether两个方法,来让一些列的动画串行和并行
二、AnimationSet的简单使用
ImageView01 = (ImageView) findViewById(R.id.ImageView01);
AnimationSet set = new AnimationSet(true);
Animation temAnimation01 = new TranslateAnimation(0,120 , 0, -300);
temAnimation01.setDuration(1000);
set.addAnimation(temAnimation01);
temAnimation01 = new ScaleAnimation(2, 1, 2, 1);
temAnimation01.setDuration(1000);
set.addAnimation(temAnimation01);
ImageView01.startAnimation(set);//这样ImageView01就可以同时平移和缩放了
三、AnimatorSet的简单使用
温馨提示,下面的代码不可以直接运行
其中。 balls 是一个球的数组 。getHeight() 可以获取屏幕的高度
// =======