Android中的属性动画
来源:互联网 发布:逻辑门电路实验数据 编辑:程序博客网 时间:2024/05/22 06:44
Android中的动画分为三类
view animatiom
包括scale, alpha, rotate, translate。也叫补间动画。drawable animation
也就是帧动画,按照顺序播放图片资源。property animation
属性动画,在android 3.0,也就是API 11之后引入。比view animation要更强大。
以下是官网对属性动画Property Animation的概叙:
The property animation system is a robust framework that allows you to animate almost anything. You can define an animation to change any object property over time, regardless of whether it draws to the screen or not. A property animation changes a property’s (a field in an object) value over a specified length of time. To animate something, you specify the object property that you want to animate, such as an object’s position on the screen, how long you want to animate it for, and what values you want to animate between.
属性动画的使用很简单,比如下面这个例子:
public void rotateyAnimRun(View view) { ObjectAnimator.ofFloat(view, "rotationX", 0.0F, 180.0F, 0.0F) .setDuration(2000) .start();}public void onClick(View v) { switch (v.getId()) { case R.id.img: rotateyAnimRun(v); break;
也就是点击了一个图片之后会在这个图片上出现一些动画效果。效果如下
这个属性动画意思是操作view的rotationX
属性,先变成0.0F,再变成180.0F,再变成0.0F。setDuration自然就是设置这段动画持续的时间。
属性动画大概的过程如下
上面的例子中的ObjectAnimator就是ValueAnimator的一个实现类。TimeInterpolator,这个类可以控制动画在各个时段的速度。上面是动画是匀速的,也可以创建出变化速度先快后慢,或者类似重力加速度的动画效果。
和View Animation像比较,Property View有好些优点。
View Animation的动画效果只是效果,并没有真正的改变view的属性,比如说位置。而Property View是确实改变了属性。而且View Animation只能用在View上,而Property View可以用在其他不是View的子类的类上。View Animation只能做出某些属性上的效果,Property View则没有这个限制。
- Android中的动画,属性动画
- Android中的属性动画
- Android中的属性动画
- Android中的属性动画:
- Android中的属性动画
- Android中的属性动画理解
- Android中的动画(三)属性动画
- Android中的动画3(属性动画)
- android中的动画:帧动画、补间动画、属性动画
- Android中的属性动画(一般属性动画,组合属性动画,AnimatorSet,动画监听)
- Android动画中的fillBefore和fillAfter属性
- Android动画中的fillBefore和fillAfter属性
- Android中的属性动画(Property Animation)
- Android 中的属性动画 --- 2(插值器)
- Android动画--属性动画
- android动画 -- 属性动画
- Android动画-属性动画
- Android动画【属性动画】
- 19. jQuery 遍历
- Linux 中mysql 安装 导入
- iOS开发有关头像上传的问题
- 找出字符串
- 【转】Android示例HelloGallery中R.styleable unresolved的解决办法
- Android中的属性动画
- MotionEvent的getX(),getY()与getRawX(),getRawY()的区别
- Intint.Parse()int.TryParse()Convert.toInt32()
- 正则表达式
- docker容器网络模式配置场景
- 距某某日期倒计时
- 8.11.1 Internal Locking Methods
- 利用Quartz2D,将一张图片画到一个特殊形状的背景图片上
- android中setText不能传int值