Skip to main content

Crate animato

Crate animato 

Source
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 = "1.6.0", default-features = false }
animato-tween  = { version = "1.6.0", default-features = false }
animato-spring = { version = "1.6.0", default-features = false }
animato-physics = { version = "1.6.0", default-features = false }
animato-color = { version = "1.6.0", default-features = false }

§Feature Flags

FeatureWhat it adds
defaultstd + tween + timeline + spring + driver
stdWall clock, heap-backed types
tweenTween<T>, KeyframeTrack<T>, Loop
timelineTimeline, Sequence, stagger()
springSpring, SpringConfig, SpringN<T>
path[MotionPath], [MotionPathTween], [SvgPathParser]
physics[Inertia], [DragState], [GestureRecognizer]
color[InLab<T>], [InOklch<T>], [InLinear<T>]
driverAnimationDriver, all Clock variants
gpu[GpuAnimationBatch] for high-volume Tween<f32> batches
bevy[AnimatoPlugin], Bevy tween/spring wrapper components
wasm[RafDriver] for requestAnimationFrame loops
leptosSignal-backed Leptos hooks and components
dioxusDioxus signal hooks, motion, presence, gestures, and native helpers
yewYew hooks, CSS helpers, scroll, presence, FLIP lists, gestures, and agents
jsWASM-to-NPM JavaScript bindings
devtoolsTimeline inspector, easing editor, spring visualizer, recorder controls, perf monitor
tokio[Timeline::wait()] async completion waiting
serdeSerialize/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§

Angle
An angle stored in degrees.
AnimationDriver
Manages a collection of animations, ticking them each frame and automatically removing completed ones.
AnimationGroup
A group of animations controlled as a single playable unit.
AnimationId
An opaque handle to an animation registered with AnimationDriver.
AnimationIntrospection
Renderer-agnostic runtime state for a single animation.
AnimationRecorder
Captures scalar animation values for later replay or DevTools export.
AnimationUpdateCost
Per-animation update cost produced by AnimationDriver::tick_profiled.
Color
A lightweight linear RGBA color value.
DriverFrameProfile
Timing data produced by a profiled driver tick.
DriverSnapshot
Snapshot of one inspectable animation registered with AnimationDriver.
Keyframe
A value sample in a KeyframeTrack.
KeyframeTrack
A sorted collection of keyframes that evaluates a value over time.
ManualClock
A clock where the caller explicitly sets the dt each frame.
Mat4
A column-major 4x4 affine transform matrix.
MockClock
A fixed-step clock for deterministic tests.
Quaternion
Unit quaternion used for 3D rotation interpolation.
RecordedSample
A recorded scalar sample.
RecordedTrack
Samples for one recorded animation label.
ScrollClock
A Clock implementation backed by scroll-position changes.
ScrollDriver
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.
SpringConfig
Configuration for a damped harmonic oscillator spring.
SpringN
A multi-dimensional spring that animates any type that can be decomposed into independent f32 components (see the sealed Decompose trait).
Timeline
Composes multiple animations on one shared clock.
Tween
A single-value animation from start to end over duration seconds.
TweenBuilder
Consuming builder for Tween<T>.
TweenSnapshot
Immutable runtime state snapshot for Tween.
WallClock
A real-time clock backed by std::time::Instant.

Enums§

AnimationKind
High-level animation category reported to DevTools and inspectors.
At
Positioning rule for a timeline entry.
Easing
All 31 classic easing variants, CSS-compatible parameterized variants, and an escape-hatch Custom function pointer.
GridOrigin
Origin used by grid-based stagger patterns.
Integrator
Integration method for the spring ODE.
Loop
Controls how a tween behaves when it reaches the end of its duration.
PlaybackState
Coarse playback state reported by inspectable animations.
RecorderError
Error returned when recorder import fails.
StaggerPattern
Deterministic delay pattern for staggered animation starts.
TimelineState
Current playback state of a Timeline.
TweenState
The current execution state of a Tween.
Waveform
A procedural scalar waveform.

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.
Inspectable
Animation interface for DevTools and runtime inspectors.
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.

Functions§

round_to
Round a value to a given number of decimal places.
snap_to
Snap a value to the nearest multiple of grid.
stagger
Create a timeline where each animation starts delay seconds after the previous one.