自定义属性动画
程序员文章站
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();
上一篇: python爬虫有道词典翻译
下一篇: js 利用逗号运算符偷梁
推荐阅读