animato_tween/lib.rs
1//! # animato-tween
2//!
3//! `Tween<T>` — single-value animation from a start to an end value over time.
4//!
5//! This crate is fully `no_std`-compatible and requires no heap allocation.
6//!
7//! ## Quick Start
8//!
9//! ```rust
10//! use animato_tween::{Tween, Loop};
11//! use animato_core::{Easing, Update};
12//!
13//! let mut tween = Tween::new(0.0_f32, 100.0)
14//! .duration(1.0)
15//! .easing(Easing::EaseOutCubic)
16//! .build();
17//!
18//! // Advance by 0.5 seconds (half the duration):
19//! tween.update(0.5);
20//! assert!(tween.value() > 50.0); // EaseOut front-loads motion
21//! assert!(!tween.is_complete());
22//!
23//! tween.update(0.5);
24//! assert!(tween.is_complete());
25//! assert_eq!(tween.value(), 100.0);
26//! ```
27//!
28//! ## Feature Flags
29//!
30//! | Feature | Effect |
31//! |---------|--------|
32//! | `std` | Enables std-dependent features (forwarded to `animato-core`) |
33//! | `serde` | Derives `Serialize`/`Deserialize` on public types |
34
35#![cfg_attr(not(feature = "std"), no_std)]
36#![deny(missing_docs)]
37#![deny(missing_debug_implementations)]
38
39#[cfg(any(feature = "std", feature = "alloc"))]
40extern crate alloc;
41
42pub mod builder;
43#[cfg(any(feature = "std", feature = "alloc"))]
44pub mod keyframe;
45pub mod loop_mode;
46pub mod modifiers;
47pub mod tween;
48
49pub use builder::TweenBuilder;
50#[cfg(any(feature = "std", feature = "alloc"))]
51pub use keyframe::{Keyframe, KeyframeTrack};
52pub use loop_mode::Loop;
53pub use modifiers::{round_to, snap_to};
54pub use tween::{Tween, TweenState};