码迷,mamicode.com
首页 > 其他好文 > 详细

代码动画编写

时间:2015-04-14 16:40:34      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:代码动画编写

 

private void startCodeAnim(){
		AnimationSet animationSet = new AnimationSet(true);
//		AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
//		alphaAnimation.setDuration(1000);
//		alphaAnimation.setStartOffset(10000);
		//scale缩放比从2倍到1(原始大小)
		ScaleAnimation scale = new ScaleAnimation(2.0f, 1.0f, 2.0f, 1.0f,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
		scale.setDuration(1000);//动画播放间隔
		animationSet.addAnimation(scale);
		//rotate反方向旋转20度
		RotateAnimation rotate =new RotateAnimation(0f,-20f,Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f); 
		rotate.setDuration(1000);
		animationSet.addAnimation(rotate);
		//translate从原始位置向x和y的正方向移动原始图片大小的10%距离
		TranslateAnimation translate = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0.1f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0.1f);
		translate.setDuration(1300);
		animationSet.addAnimation(translate);
		//animationSet.setStartOffset(10000);
//		animationSet.setFillBefore(false);
		//设置不动画播放完后不回到原始位置
		animationSet.setFillAfter(true);
		//添加并播放动画
		iv1.startAnimation(animationSet);
	}


 

代码动画编写

标签:代码动画编写

原文地址:http://blog.csdn.net/xiaoyi_tdcq/article/details/45043721

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!