Expand description
§Animato
Italian: animato — animated, lively, with life and movement.
A professional-grade, renderer-agnostic animation library for Rust.
Zero mandatory dependencies. no_std-ready.
Works everywhere: TUIs, Web (WASM), Bevy games, embedded targets, and native apps.
§Quick Start
ⓘ
use animato::{Tween, Easing, Update};
let mut tween = Tween::new(0.0_f32, 100.0)
.duration(1.0)
.easing(Easing::EaseOutCubic)
.build();
tween.update(1.0);
assert_eq!(tween.value(), 100.0);
assert!(tween.is_complete());§Spring Physics
ⓘ
use animato::{Spring, SpringConfig, Update};
let mut spring = Spring::new(SpringConfig::wobbly());
spring.set_target(200.0);
while !spring.is_settled() {
spring.update(1.0 / 60.0);
}
assert!((spring.position() - 200.0).abs() < 0.01);§Input Physics
ⓘ
use animato::{Inertia, InertiaConfig, Update};
let mut inertia = Inertia::new(InertiaConfig::smooth());
inertia.kick(800.0);
while inertia.update(1.0 / 60.0) {}§AnimationDriver
ⓘ
use animato::{Tween, Easing, AnimationDriver, WallClock, Clock};
let mut driver = AnimationDriver::new();
let id = driver.add(
Tween::new(0.0_f32, 1.0).duration(2.0).easing(Easing::EaseInOutSine).build()
);
let mut clock = WallClock::new();
// In your loop: driver.tick(clock.delta());§no_std Usage
For no_std targets, depend on the sub-crates directly:
[dependencies]
animato-core = { version = "0.7", default-features = false }
animato-tween = { version = "0.7", default-features = false }
animato-spring = { version = "0.7", default-features = false }
animato-physics = { version = "0.7", default-features = false }
animato-color = { version = "0.7", default-features = false }§Feature Flags
| Feature | What it adds |
|---|---|
default | std + tween + timeline + spring + driver |
std | Wall clock, heap-backed types |
tween | Tween<T>, KeyframeTrack<T>, Loop |
timeline | Timeline, Sequence, stagger() |
spring | Spring, SpringConfig, SpringN<T> |
path | [MotionPath], [MotionPathTween], [SvgPathParser] |
physics | [Inertia], [DragState], [GestureRecognizer] |
color | [InLab<T>], [InOklch<T>], [InLinear<T>] |
driver | AnimationDriver, all Clock variants |
bevy | [AnimatoPlugin], Bevy tween/spring wrapper components |
wasm | [RafDriver] for requestAnimationFrame loops |
tokio | [Timeline::wait()] async completion waiting |
serde | Serialize/Deserialize on all public types |
Modules§
- easing
- All free easing functions (
ease_out_cubic,cubic_bezier, etc.) re-exported at crate root. - stagger
- Stagger helper for offsetting many animations.
Structs§
- Animation
Driver - Manages a collection of animations, ticking them each frame and automatically removing completed ones.
- Animation
Id - An opaque handle to an animation registered with
AnimationDriver. - Keyframe
- A value sample in a
KeyframeTrack. - Keyframe
Track - A sorted collection of keyframes that evaluates a value over time.
- Manual
Clock - A clock where the caller explicitly sets the dt each frame.
- Mock
Clock - A fixed-step clock for deterministic tests.
- Scroll
Clock - A
Clockimplementation backed by scroll-position changes. - Scroll
Driver - Drives registered animations from a normalised scroll position.
- Sequence
- Builder for timeline entries that play one after another.
- Spring
- A 1D damped harmonic oscillator spring.
- Spring
Config - Configuration for a damped harmonic oscillator spring.
- SpringN
- A multi-dimensional spring that animates any type that can be decomposed
into independent
f32components (see the sealedDecomposetrait). - Timeline
- Composes multiple animations on one shared clock.
- Tween
- A single-value animation from
starttoendoverdurationseconds. - Tween
Builder - Consuming builder for
Tween<T>. - Wall
Clock - A real-time clock backed by
std::time::Instant.
Enums§
- At
- Positioning rule for a timeline entry.
- Easing
- All 31 classic easing variants, CSS-compatible parameterized variants,
and an escape-hatch
Customfunction pointer. - Integrator
- Integration method for the spring ODE.
- Loop
- Controls how a tween behaves when it reaches the end of its duration.
- Timeline
State - Current playback state of a
Timeline. - Tween
State - The current execution state of a
Tween.
Traits§
- Animatable
- Marker trait for types that can be used as animation targets.
- Clock
- Abstracts any time source that can produce a
dt(delta-time) value in seconds. - Interpolate
- A value that supports linear interpolation between two instances.
- Playable
- Object-safe animation interface used by composition containers.
- Update
- A value that advances through time.