Module hilo/util/TextureAtlas
Requires
hilo/core/Class
Source
TextureAtlas.js
TextureAtlas纹理集是将许多小的纹理图片整合到一起的一张大图。这个类可根据一个纹理集数据读取纹理小图、精灵动画等。
| Method | Defined | |
|---|---|---|
|
TextureAtlas(atlasData:Object)
Constructor
|
TextureAtlas | |
|
getFrame(index:Int):Object
获取指定索引位置index的帧数据。
|
TextureAtlas | |
|
getSprite(id:String):Object
获取指定id的精灵数据。
|
TextureAtlas | |
|
createSpriteFrames(name:String|Array, frames:String, w:Number, h:Number, loop:Boolean, duration:Number, duration)
static
Shorthand method to create spirte frames
|
TextureAtlas |
//demo1 make one animation
createSpriteFrames("walk", "0-5,8,9", meImg, 55, 88, true, 1);
//demo2 make a group of animation
createSpriteFrames([
["walk", "0-5,8,9", meImg, 55, 88, true, 1],
["jump", "0-5", meImg, 55, 88, false, 1]
]);