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

属性动画

程序员文章站 2022-01-28 21:53:29
...

属性动画——平移

AnimatorSet animatorSet = new AnimatorSet();
    /*int colorA = Color.parseColor("#ff0000");
    int colorB = Color.parseColor("#00ff00");
    int colorC = Color.parseColor("#00ffff");*/
    ObjectAnimator objectAnimator = ObjectAnimator.ofInt(anmitor, "backgroundColor", colorA,colorB,colorC);
    ObjectAnimator translationX = ObjectAnimator.ofFloat(anmitor, "translationX", 0, 850f);
    ObjectAnimator translationY = ObjectAnimator.ofFloat(anmitor, "translationY", 0, 1500f);
    animatorSet.playTogether(translationX,translationY,objectAnimator);
    animatorSet.setDuration(5000);
    animatorSet.start();
相关标签: 动画