Reference

Motions

ay2d_motion_count, ay2d_motion_id, ay2d_motion_index

uint32_t    ay2d_motion_count(const ay2d_model *m);
const char *ay2d_motion_id(const ay2d_model *m, uint32_t i);
int32_t     ay2d_motion_index(const ay2d_model *m, const char *name);

The motions: the file's scenes, then its compositions, then any you added. Thread: frame.

ay2d_motion_info

ay2d_status ay2d_motion_info(const ay2d_model *m, uint32_t i, ay2d_motion_facts *out);

Length, frame rate, whether it loops, whether it is a composition, its authored fades (−1 when it has none) and how many events it has. Thread: frame.

ay2d_motion_play

ay2d_status ay2d_motion_play(ay2d_model *m, uint32_t i, int32_t looping, float fade_in);

Starts motion i from the beginning, crossfading from whatever played.

looping 1 repeats it, 0 plays it once and holds the last frame
fade_in seconds; negative uses the authored fade (or 1 s), 0 starts at full weight
Thread frame

ay2d_motion_stop

ay2d_status ay2d_motion_stop(ay2d_model *m, float fade_out);

Fades every playing motion out, with the same fade rules. Thread: frame.

ay2d_motion_playing, ay2d_motion_finished, ay2d_motion_time

int32_t ay2d_motion_playing(const ay2d_model *m);
int32_t ay2d_motion_finished(const ay2d_model *m);
float   ay2d_motion_time(const ay2d_model *m);

The motion in front (−1 for none), 1 when a one-shot reached its end, and where it is in seconds (−1 for none). Thread: frame.

ay2d_motion_seek, ay2d_motion_set_speed

ay2d_status ay2d_motion_seek(ay2d_model *m, float t);
ay2d_status ay2d_motion_set_speed(ay2d_model *m, float speed);

Moves the motion in front to t seconds, or plays it at speed times its rate. RANGE when nothing plays. Thread: frame.

ay2d_motion_events

uint32_t ay2d_motion_events(const ay2d_model *m, ay2d_event *out, size_t n);

The events fired during the last update: which motion, when, and the text. Returns how many and writes the first n. Thread: any.