整理了一下动画的属性
AnimatorSet set=new AnimatorSet(); set.playTogether( ObjectAnimator.ofFloat(view,"rotationX",0,360),//绕X轴翻转 ObjectAnimator.ofFloat(view,"rotationY",0,180),//绕Y轴旋转 ObjectAnimator.ofFloat(view,"rotation",0,-90),//绕中心点逆时针旋转 ObjectAnimator.ofFloat(view,"translationX",0,90),//X轴平移 ObjectAnimator.ofFloat(view,"translationY",0,90),//y轴平移 ObjectAnimator.ofFloat(view,"scaleX",1,1.5f),//X轴拉伸 ObjectAnimator.ofFloat(view,"scaleY",0,0.5f),//Y轴从零拉伸 ObjectAnimator.ofFloat(view,"alpha",1,0.25f,1)//透明度 ); set.setDuration(5*1000).start();//时间
背景颜色变换
代码如下
ValueAnimator colorAnim = ObjectAnimator.ofInt(view, "backgroundColor",/*Red*/0xFFFF8080 ,/*Blue*/0xFF8080FF); colorAnim.setDuration(3000); colorAnim.setEvaluator(new ArgbEvaluator()); colorAnim.setRepeatCount(ValueAnimator.INFINITE); colorAnim.setRepeatMode(ValueAnimator.REVERSE); colorAnim.start();