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();
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容