pub struct Animator { /* private fields */ }
Expand description
Manages animations. Assumes that you always pass it with Anim
objects with
the same types of Track
s. For example, if track 0 represents represents a
color Vec4, and track 1 represents a Float value, then make sure to use that
consistently throughout the lifetime of an Animator.
TODO(JP): Look into enforcing this through the type system, instead of at runtime.
Also note that the Animator
always contains the “source of truth” for the
values it manages, so whenever necessary you should copy the values kept
here to the actual “draw objects”.
Implementations
Play an animation. If an animation is already playing, it’s either cut
off, or remains playing with the new animation queued up, if Anim::chain
is set in the new animation. If there was already another animation
queued up, then it’s kicked from the queue.
Process animations from a “draw” function. This must be called before reading any values.
The anim_default
will initialze the Animator if it’s currently uninitialized.
Convenient function for only calling Animator::run_animator
if the event is
an Event::NextFrame
. Returns true if we processed the animation so you
can update your “draw objects”.