animato_driver/lib.rs
1//! # animato-driver
2//!
3//! Runtime management for Animato animations.
4//!
5//! - [`AnimationDriver`] — owns and ticks many animations; auto-removes completed ones.
6//! - [`Clock`] — trait abstracting time sources.
7//! - [`WallClock`] — real wall-clock time via `std::time::Instant`.
8//! - [`ManualClock`] — caller-driven time for custom loops.
9//! - [`MockClock`] — fixed-step clock for deterministic tests.
10//!
11//! ## Quick Start
12//!
13//! ```rust
14//! use animato_driver::{AnimationDriver, MockClock, Clock};
15//! use animato_tween::Tween;
16//! use animato_core::{Easing, Update};
17//!
18//! let mut driver = AnimationDriver::new();
19//! let id = driver.add(
20//! Tween::new(0.0_f32, 100.0)
21//! .duration(1.0)
22//! .easing(Easing::EaseOutCubic)
23//! .build()
24//! );
25//!
26//! let mut clock = MockClock::new(1.0 / 60.0);
27//! assert!(driver.is_active(id));
28//! for _ in 0..61 { // 61 × (1/60s) > 1.0s → tween completes and is auto-removed
29//! driver.tick(clock.delta());
30//! }
31//! assert!(!driver.is_active(id)); // auto-removed after completion
32//! ```
33
34#![deny(missing_docs)]
35#![deny(missing_debug_implementations)]
36
37pub mod clock;
38pub mod driver;
39
40pub use clock::{Clock, ManualClock, MockClock, WallClock};
41pub use driver::{AnimationDriver, AnimationId};