您的位置:首页 > 移动开发 > Android开发

android属性动画

2017-11-22 11:00 162 查看
//透明度
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());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: