Animato computes animated values. Rendering, layout, entity ownership, and DOM updates stay in your application.
Interpolate is the only trait a custom value needs:
use animato::Interpolate;
#[derive(Clone)]
struct Point {
x: f32,
y: f32,
}
impl Interpolate for Point {
fn lerp(&self, other: &Self, t: f32) -> Self {
Self {
x: self.x + (other.x - self.x) * t,
y: self.y + (other.y - self.y) * t,
}
}
}Animatable is implemented automatically for Interpolate + Clone + 'static.
Do not implement it manually.
Update advances state by seconds:
use animato::{Tween, Update};
let mut tween = Tween::new(0.0_f32, 1.0).duration(1.0).build();
assert!(tween.update(0.5));dt values below zero are treated as zero by animation types.
Easing transforms linear progress before interpolation. Use enum variants when
the easing must be stored, or free functions from animato::easing when a direct
function call is preferred.
Animato accepts dt; it does not require one clock implementation. Use:
WallClockin native hosted loops.MockClockin deterministic tests.ManualClockwhen an external scheduler owns time.RafDriverin browsers.- Bevy's
TimethroughAnimatoPlugin.
Use Timeline for concurrent animations and Sequence for back-to-back steps.
Each entry is a Playable, so timelines can own tweens, keyframe tracks, and
other playable animation types.