Guide

Each frame

ay2d_set_parameters(m, indices, values, n);   /* 1. what you want   */
ay2d_update(m, dt);                           /* 2. work it out     */
ay2d_drawables(m, list, cap);                 /* 3. what to draw    */

Set puts values into the model's inbox. Nothing is evaluated yet, and setting the same parameter twice before an update keeps the newest value. Values are held to the parameter's range.

Update does all the work, in this order:

  1. values from the inbox come in
  2. playing motions write over the pose
  3. the shown expression writes over that
  4. physics steps (if the model has a rig and it is on)
  5. deformers and meshes move, draw order sorts
  6. the result is published: drawables, parameter values, events and change flags all come from this published result until the next update
The six steps of ay2d_update, from the inbox to the published frame

Draw reads the published result. Reading values back works the same way: ay2d_get_parameters returns what the last update made of the pose, so a value you set shows up there after the next update, not before.

Call update once per frame, after your set calls for that frame. dt is the time since the last update in seconds; 0 re-evaluates without moving motions or physics.