method
Anim.frame
Anim.frame(timer, fps, count) -> int
Returns the current frame of a looping clip: floor(timer * fps) reduced modulo count. timer is elapsed seconds as a fixed, fps the clip's frames per second, and count the number of frames. The clip wraps forever — frame count-1 is followed by frame 0.
Parameters
timerelapsed seconds (a fixed)fpsframes per secondcountnumber of frames in the clipExample
program Demo {
property Sprite { timer: fixed = 0.0 }
model Hero { Sprite }
handler Run phase Update {
Sprite.timer = Sprite.timer + Time.delta()
let cell = Anim.frame(Sprite.timer, 12, 4) # 4-frame run at 12 fps
print(cell)
}
}