android 属性动画
![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NzZG5fbG92ZVFpbmdRaW5n_size_16_color_FFFFFF_t_70][]
使用环境:
帧动画、补间动画之外的选择-->属性动画
使用方法:
ObjectAnimator --> ofFloat()方法
// 参数解析:
// target 属性动画作用的对象
// propertyName 属性名,代表要做什么动画
// values 形参,一般来说是传入两个参数,代表从..到..
public static ObjectAnimator ofFloat(Object target, String propertyName, float... values) {
throw new RuntimeException("Stub!");
}
渐变动画
ObjectAnimator animator = ObjectAnimator.ofFloat(view,”alpha”,1.0f,0.0f)
.setDuration(1000)//设置动画时长
animator.setRepeatCount(1);
animator.start();平移动画
//平移X轴
ObjectAniamtor animator = ObjectAnimator.ofFloat(view,”translationX”,0f,200f);
animator.start();//平移Y轴
ObjectAnimator animator = ObjectAnimator.ofFloat(view,”translationY”,0f,200F);
animator.start();缩放动画
//缩放X轴
ObjectAnimator animator = ObjectAnimator.ofFloat(view,”scaleX”,1f,3f);//缩放Y轴
ObjectAnimator animator = ObjectAnimator.ofFloat(view,”scaleY”,1f,3f);旋转动画
ObjectAnimator animator = ObjectAnimator.ofFloat(view,”rotation”,0F,360F);
animator.start();转自:https://blog.csdn.net/young_time/article/details/80880124
谢谢分享!
还没有评论,来说两句吧...