标签:代码动画编写
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