渐变
private void initData() {
ValueAnimator valueAnimator = ObjectAnimator.ofFloat(iv_img,View.ALPHA,1f, 0f, 1f);
valueAnimator.setDuration(2000);
valueAnimator.start();
}
水平
private void initData1() {
ObjectAnimator animator = ObjectAnimator.ofFloat(iv_img, View.TRANSLATION_X, 0, 300, 0);
animator.setDuration(2000);
animator.start();
}
旋转
private void initData2() {
ObjectAnimator animator = ObjectAnimator.ofFloat(iv_img, View.ROTATION, 0, 90, 0);
animator.setDuration(2000);
animator.start();
}
缩放
private void initData3() {
ObjectAnimator animator = ObjectAnimator.ofFloat(iv_img, View.SCALE_X, 1, 3, 1);
animator.setDuration(2000);
animator.start();
}
集合
private void initData4() {
ObjectAnimator animator = ObjectAnimator.ofFloat(iv_img, View.ALPHA, 1f, 0f, 1f);
ObjectAnimator animator1 = ObjectAnimator.ofFloat(iv_img, View.ROTATION, 0, 360, 0);
ObjectAnimator animator2 = ObjectAnimator.ofFloat(iv_img, View.SCALE_X, 1, 2, 1);
ObjectAnimator animator3 = ObjectAnimator.ofFloat(iv_img, View.SCALE_X, 1, 2, 1);
AnimatorSet set = new AnimatorSet();
set.playTogether(animator,animator1,animator2,animator3);
set.setDuration(2000);
set.start();
}
//渐变:
View.ALPHA
//水平:
View.TRANSLATION_X || View.TRANSLATION_Y
//旋转:
View.ROTATION
//缩放:
View.SCALE_X || View.SCALE_Y