android属性动画

来源:互联网 发布:app inventor小软件 编辑:程序博客网 时间:2024/06/15 01:07
//透明度ObjectAnimator alpha = ObjectAnimator.ofFloat(        img,        "alpha", 0, 1);alpha.setDuration(3000);alpha.start();//旋转ObjectAnimator rotation = ObjectAnimator.ofFloat(        img, "rotation", 10, 360);rotation.setDuration(3000);rotation.start();//平移ObjectAnimator translationX = ObjectAnimator.ofFloat(        img, "translationX", 0, 50);translationX.setDuration(3000);translationX.setRepeatCount(3);translationX.start();//缩放ObjectAnimator scaleX = ObjectAnimator.ofFloat(        img, "scaleX", 0, 1);scaleX.setDuration(3000);scaleX.start(); // 动画自定义差值器// 先加速后减速animatr.setInterpolator(new AccelerateDecelerateInterpolator());// 加速animatr.setInterpolator(new AccelerateInterpolator());// 减速animatr.setInterpolator(new DecelerateInterpolator());// 匀速animatr.setInterpolator(new LinearInterpolator());
原创粉丝点击