android tween animation 补间动画
来源:互联网 发布:高仿包 淘宝 编辑:程序博客网 时间:2024/05/03 23:00
public class MainActivity extends Activity {private ImageView imageView;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);imageView = (ImageView) findViewById(R.id.image);}/*** 透明度* * @param view*/public void click1(View view) {// 两个参数分别代表动画图片开始的透明度和结束的透明度AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);// 设置动画的时间长度animation.setDuration(2000);// 设置动画播放的重复次数,设置为2代表一共播放3次animation.setRepeatCount(2);// 设置重复的模式,Animation.REVERSE代表往返重复animation.setRepeatMode(Animation.REVERSE);imageView.startAnimation(animation);}/*** 缩放* * @param view*/public void click2(View view) {// 0.2f(X或Y方向的开始缩放大小为图片的20%) 1.0f(X或Y方向的结束缩放大小为图片的100%)// Animation.RELATIVE_TO_SELF(以自身相关来改变) 0.5f(X和Y以自身的中心圆点来缩放)ScaleAnimation animation = new ScaleAnimation(0.2f, 1.0f, 0.2f, 1.0f,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);animation.setDuration(2000);animation.setRepeatCount(2);animation.setRepeatMode(Animation.REVERSE);imageView.startAnimation(animation);}/*** 旋转* * @param view*/public void click3(View view) {RotateAnimation animation = new RotateAnimation(0, 360,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);animation.setDuration(2000);animation.setRepeatCount(2);animation.setRepeatMode(Animation.REVERSE);imageView.startAnimation(animation);} /*** 平移* * @param view*/public void click4(View view) {// 水平移动TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,Animation.RELATIVE_TO_PARENT, 1.0f,Animation.RELATIVE_TO_PARENT, 0.0f,Animation.RELATIVE_TO_PARENT, 0.0f);animation.setDuration(2000);animation.setRepeatCount(2);animation.setRepeatMode(Animation.REVERSE);imageView.startAnimation(animation);}/*** 组合* * @param view*/public void click5(View view) {AnimationSet animationSet = new AnimationSet(false);ScaleAnimation scaleAnimation = new ScaleAnimation(0.2f, 1.0f, 0.2f,1.0f, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF, 0.5f);scaleAnimation.setDuration(2000);scaleAnimation.setRepeatCount(2);scaleAnimation.setRepeatMode(Animation.REVERSE);RotateAnimation rotateAnimation = new RotateAnimation(0, 360,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);rotateAnimation.setDuration(2000);rotateAnimation.setRepeatCount(2);rotateAnimation.setRepeatMode(Animation.REVERSE);TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,Animation.RELATIVE_TO_PARENT, 1.0f,Animation.RELATIVE_TO_PARENT, 0.0f,Animation.RELATIVE_TO_PARENT, 0.0f);translateAnimation.setDuration(2000);translateAnimation.setRepeatCount(2);translateAnimation.setRepeatMode(Animation.REVERSE);animationSet.addAnimation(translateAnimation);animationSet.addAnimation(rotateAnimation);animationSet.addAnimation(scaleAnimation); // 把平移、旋转、缩放结合在一起的动画imageView.startAnimation(animationSet);}}
0 0
- Android 动画--补间动画(Tween Animation)
- android tween animation 补间动画
- android补间动画(Tween Animation)
- Android-Animation动画之Tween Animation补间动画
- Tween Animation 补间动画
- android 动画 补间动画,渐变动画 Tween Animation
- android tween animation 补间动画 xml设置动画属性
- Android动画之补间动画(Tween Animation)
- Android 动画解析(二) 补间动画(Tween Animation)
- Android动画之补间动画(Tween Animation)
- Android动画效果之Tween Animation(补间动画)
- Android动画——补间动画(Tween Animation)
- android 动画实现之 Tween Animation(补间动画)
- Android动画效果之Tween Animation(补间动画)
- android 补间动画 tween animation xml基本属性
- Android ViewAnimation(tween animation补间动画)文档教程
- android补间动画(tween animation)xml基本属性
- Android 连续的补间动画(Animation/Tween)
- arcgis api fro silverlight使用在线地图各种方法
- SciPy子模块
- android music开发笔记
- Google Play开发者账号注册 最新攻略
- PHPexcel 导出excel
- android tween animation 补间动画
- cocos2dx- call to OpenGL ES API with no current context(logged once per thread)
- python里的copy和deepcopy
- JavaScript String对象方法(二)
- 几款开源的图形界面库(GUI Libraries)
- 设计模式——观察者模式 JDK内置的Observable类和Obsever接口
- linux c之gdb
- 犹太人:赚钱能培养孩子独立责任奋进多种能力!
- Struts2 WEB-INF/lib/struts2-core-2.1.8.1jar!/struts-default.xml:47:178