ObjectAnimator可以實現(xiàn)多種動畫效果,包括透明度,移動,旋轉(zhuǎn),縮放,并且非常簡單
透明度設(shè)置:
ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, 'alpha', 1.0f, 0.3f, 1.0F);
animator.setDuration(2000);
縮放:
ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, 'scaleX', 1.0f, 1.5f);
animator.setDuration(2000).start();
移動:
ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, 'translationX', 0.0f, 350.0f, 0f);
animator.setDuration(2500).start();
旋轉(zhuǎn):
ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, 'rotationX', 0.0f, 90.0f,0.0F);
animator.setDuration(2000).start();