热门搜索 :
考研考公
您的当前位置:首页正文

android动画学习之属性动画ObjectAnimator

来源:东饰资讯网

ObjectAnimator可以实现多种动画效果,包括透明度,移动,旋转,缩放,并且非常简单

透明度设置:

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();

旋转:

ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, 'rotationX', 0.0f, 90.0f,0.0F);
animator.setDuration(2000).start();
Top