public void btn_alpha(View v){//渐变 ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"alpha",0f,1f); animator.setDuration(1000); animator.setRepeatCount(1); animator.setRepeatMode(ValueAnimator.RESTART); animator.start(); } public void btn_robot(View v){//旋转 ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"rotation",0f,360f); animator.setDuration(1000); animator.setRepeatCount(1); animator.setRepeatMode(ValueAnimator.RESTART); animator.start(); } public void btn_tran(View v){//偏移 ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"translationX",0,360); animator.setDuration(1000); animator.setRepeatCount(1); animator.setRepeatMode(ValueAnimator.REVERSE); animator.start(); } public void btn_suo(View v){//缩放 ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"scaleX",1f,0.5f); animator.setDuration(1000); animator.setRepeatCount(1); animator.setRepeatMode(ValueAnimator.RESTART); animator.start(); } public void btn_set(View v){//集合 ObjectAnimator animator1=ObjectAnimator.ofFloat(iv,"scaleX",1f,0.5f); ObjectAnimator animator2=ObjectAnimator.ofFloat(iv,"translationX",0,360); ObjectAnimator animator=ObjectAnimator.ofFloat(iv,"rotation",0f,360f); AnimatorSet set=new AnimatorSet(); //在旋转之后 after rotation set.play(animator1).with(animator2).before(animator); set.setDuration(2000); set.start(); }
安卓属性动画
最新推荐文章于 2023-06-12 19:37:03 发布