pub struct Animator { /* private fields */ }
Expand description

Manages animations. Assumes that you always pass it with Anim objects with the same types of Tracks. 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”.

Get the value of the given track as a float. Be sure to call this only if the given track is indeed always a float in the Anims you pass into this Animator. TODO(JP): Instead of having multiple functions here, perhaps we can use [Into?

Get the value of the given track as a Vec2. Be sure to call this only if the given track is indeed always a Vec2 in the Anims you pass into this Animator. TODO(JP): Instead of having multiple functions here, perhaps we can use [Into?

Get the value of the given track as a Vec3. Be sure to call this only if the given track is indeed always a Vec3 in the Anims you pass into this Animator. TODO(JP): Instead of having multiple functions here, perhaps we can use [Into?

Get the value of the given track as a Vec4. Be sure to call this only if the given track is indeed always a Vec4 in the Anims you pass into this Animator. TODO(JP): Instead of having multiple functions here, perhaps we can use [Into?

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.