ravenrs_animation/lib.rs
1//! Motion primitives: pure functions of time, with no timers or frame loop.
2//!
3//! [`Animated`] is the center of the crate: a value that heads for a target
4//! under a [`Transition`] and can be sent somewhere else at any moment without
5//! a jump in position or velocity.
6//!
7//! ```
8//! use ravenrs_animation::{Animated, Transition};
9//!
10//! let mut x = Animated::new(0.0_f32);
11//! x.set_target(100.0, Transition::snappy(), 0.0);
12//! assert!(x.value(0.05) > 0.0);
13//! // Interrupted halfway: it turns around smoothly, from where it is.
14//! let before = x.value(0.1);
15//! x.set_target(0.0, Transition::snappy(), 0.1);
16//! assert!((x.value(0.1) - before).abs() < 1e-3);
17//! ```
18
19mod animated;
20mod easing;
21mod oklab;
22mod spring;
23
24pub use animated::{Animatable, Animated, Transition};
25pub use easing::{CubicBezier, Easing};
26pub use oklab::{from_oklab, mix_oklab, to_oklab};
27pub use spring::Spring;