IAnim 序列帧动画类


构造函数

构造函数 说明 备注
IAnim(bmps, z, viewport)

bmps 序列帧动画图片

z 动画的z坐标 z-coordinate of animation

viewport 动画的视窗(可缺省) animation viewport (it can be default)

属性

属性 说明 备注
isLoop(bool)

动画是否循环播放 Whether Animation loop or not

默认false Default is false

sanim(ISprite)

动画绑定的精灵对象 The sprite binding on animation

x(Number)

动画x坐标 x-coordinate of animation

y(Number)

动画y坐标 y-coordinate of animation

z(Number)

动画图层 layer of animation

onload(function)

动画预加载函数 function preload

仅web

函数

函数 说明 备注
setPlaytimes(times)

设置动画播放次数 Set frequency of play

times(Number)次数 number of times

setIndex(index)

设置当前动画帧 Set current frame

index(Number)动画帧位置 the order of frame

setXY(x,y)

设置动画坐标 Set coordinates of animation

x(Number)x坐标 x-coordinate

y(Number)y坐标 y-coordinate

setSpeed(speed)

设置动画播放速率 Set the speed of play

speed(Number)间隔速度,越大越慢 interval speed, the larger the slower

start()

开始播放动画 Play animation

stop()

停止播放动画 Stop playing animation

setBitmaps(bmps)

为动画重新设置图片 Reset images for animation

update()

刷新动画 update animation

此函数需要放进状态机中动画才能有实际效果 This function must be put in statemachine.
pause()

动画暂停 Animation pause

isFinishd()

判断动画是否播放完毕 Whether animation ends or not

返回值 bool Return bool

dispose()

释放动画资源 Free up animation resources

disposeMin()

释放动画索引资源,不释放位图资源 Free up animation index resource but retain image resource

setOnFinishAnim(ofa)

设置动画播放完毕后的回调 Set the callback

ofa(function) 播放完毕要执行的回调函数 the function will be executed after playing

setOnFrameAnim(ofa,frame)

设置动画在某帧要执行的回调 Set the callback which will execute at a selected frame

ofa(function) 播放到某帧时执行的回调函数 the function will be executed at a selected frame

frame(Number) 具体帧 specific frame

clearFrameAnim()

清空帧动作回调 Clear callback