-
Notifications
You must be signed in to change notification settings - Fork 5
anim.um
Marek Maskarinec edited this page Oct 9, 2022
·
2 revisions
Module for frame based image animation.
TODO: Rework this module to use atlases.
type Anim* = struct {
anim: []image.Image
rot: th.fu
scale: th.fu
fps: th.uu
looping: bool
pos: th.Vf2
zeroTime: int
frame: int
}
Anim is able to animate an array of images. As opposed to ent.Ent.animate, it starts from the first frame.
fn mk*(pos: th.Vf2, anm: []image.Image, fps: th.uu): Anim {
Anim's constructor.
fn (a: ^Anim) start*(t: int) {
Starts animation with start_time of t.
fn (a: ^Anim) handle*(t: uint, cam: rect.Rect): bool {
This draws the animation. Returns true, if the animation ended.