Module suzy::animation [−][src]
Animations integrate with Suzy’s watch system to interpolate values over time.
watch
closures which contain
Animation::apply
will be re-run
every frame while the animation is in progress.
Examples
Animate a color to green with a speed of 1.
struct MyWidgetData { current_color: Color, animation: Animation<Color>, } impl WidgetContent for MyWidgetData { fn init(mut init: impl WidgetInit<Self>) { init.watch(|this, rect| { this.animation.set_speed(1.0); this.animation.animate_to(Color::GREEN); }); init.watch(|this, rect| { this.animation.apply(&mut this.current_color); println!("current color value: {:x}", this.current_color); }); } // ... }
Modules
eases | Built-in easing function constants. |
Structs
Animation | An instance of an animation. |
CubicPoly | An easing function implementation based on cubic polynomials. |
Traits
Easing | A trait which represents an easing function. |
Lerp | A trait with describes how to linearly interpolate between two values of the type. |
LerpDistance | A trait for calculating the distance between two values, for the purposes of linear interpolation. |