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

无