WEB开发网
开发学院手机开发Android 开发 android 2D animation 开发小结 阅读

android 2D animation 开发小结

 2010-08-20 02:02:00 来源:WEB开发网   
核心提示:在Android中提供了两种animation处理方式一种是frame-by-frame animation,一种是tweening animation,android 2D animation 开发小结,Animation is a process by which an object on a screen cha

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"

1 2 3 4  下一页

Tags:android animation 开发

编辑录入:coldstar [复制链接] [打 印]
赞助商链接