Skip to main content

Module traits

Module traits 

Source
Expand description

Core traits that power the entire spanda animation system.

The central idea is simple: any type that can be linearly interpolated can be animated. Implement Interpolate on your type and you get tweening, keyframes, and timeline support for free.

§The trait hierarchy

 Interpolate          — lerp between two values given t ∈ [0.0, 1.0]
     └── Animatable   — Interpolate + Clone + 'static (object-safe bound)
             └── (blanket impls for f32, f64, [f32;2], [f32;3], [f32;4])

 Update               — advance an animation by a delta-time step

Traits§

Animatable
A value that can be animated — combines Interpolate with the bounds needed to store animations generically (Clone + 'static).
Interpolate
Linear interpolation between two values.
Update
Advance an animation by dt seconds.