欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

自定义属性动画

程序员文章站 2022-05-04 11:49:56
...

public class MainActivity extends AppCompatActivity {

private MyCircles circles;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    circles = findViewById(R.id.mycircle);
    circles.getScaleX();
    circles.getScaleY();
    AnimatorSet animatorSet = new AnimatorSet();
  //  ObjectAnimator translationX = ObjectAnimator.ofFloat(circles, "translationX", 0, 1000, 0);
    ObjectAnimator translationY = ObjectAnimator.ofFloat(circles, "translationY", 0, 1000, 0,3000,3000,0);
    ObjectAnimator rotationX = ObjectAnimator.ofFloat(circles, "rotation", 0, 360);
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(circles, "scaleX", 1, 6, 0, 6, 1);
    ObjectAnimator rotation = ObjectAnimator.ofFloat(circles, "rotation", 360, 0, 360, 180, 0, 180);
    rotationX.setRepeatCount(1);
   /* translationX.setDuration(6000);
    translationX.start();*/
    /*translationY.setDuration(6000);
    translationY.start();*/
    animatorSet.play(translationY).with(rotation);
    animatorSet.setDuration(6000);
    animatorSet.start();
相关标签: animator