android 2D animation 开发小结
2010-08-20 02:02:00 来源:WEB开发网在Android中提供了两种animation处理方式一种是frame-by-frame animation,一种是tweening animation。
Animation is a process by which an object on a screen changes its color, position, size, or orientation over time. Android supports three types of animation: frame-by-frame animation, which occurs when a series of frames is drawn one after the other at regular intervals; layout animation, in which you animate views inside a container view such as lists and tables; and view animation, in which you animate any general-purpose view.
The latter two types fall into the category of tweening animation, which involves the
drawings in between the key drawings. The idea is that knowing the beginning state and ending state of a drawing allows an artist to vary certain aspect of the drawing in time. This varying aspect could be color, position, size, etc. With computers, you accomplish this kind of animation by changing the intermediate values at regular intervals and redrawing the surface. We will cover each type of animation using working examples and in-depth analysis.
frame by frame animation代码示例
res/drawable中设置相关图片,以及如下文件:
< !--
android:oneshot属性代表运行次数,如果为true为只运行一次,false代表运行多次
对应AnimantionDrawable方法中的setOneShot,
android:duration,为显示的时间长度,
对应AnimationDrawable中的addFrame(drawable,duration)方法。
-->
< animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true">
< item android:drawable="@drawable/frametoframe1" android:duration="50">< /item>
< item android:drawable="@drawable/frametoframe2" android:duration="50"/>
< item android:drawable="@drawable/frametoframe3" android:duration="50"/>
< item android:drawable="@drawable/frametoframe4"
- ››Android 当修改一些代码时,使用什么编译命令可以最...
- ››Android 如何添加一个apk使模拟器和真机都编译进去...
- ››Android 修改Camera拍照的默认保存路径
- ››Android 如何修改默认输入法
- ››android开发中finish()和System.exit(0)的区别
- ››Android手势识别简单封装类
- ››android中查看项目数字证书的两种方法
- ››Android中获取IMEI码的办法
- ››android 相机报错 setParameters failed
- ››Android重启运用程序的代码
- ››Android为ListView的Item设置不同的布局
- ››android bitmap与base64字符串的互相转换
更多精彩
赞助商链接