animato_physics/lib.rs
1//! # animato-physics
2//!
3//! Input-driven physics for Animato: friction inertia, drag tracking with
4//! velocity estimation, and gesture recognition.
5//!
6//! ## Quick Start
7//!
8//! ```rust
9//! use animato_core::Update;
10//! use animato_physics::{Inertia, InertiaConfig};
11//!
12//! let mut inertia = Inertia::new(InertiaConfig::smooth());
13//! inertia.kick(500.0);
14//!
15//! while inertia.update(1.0 / 60.0) {}
16//! assert!(inertia.is_settled());
17//! ```
18//!
19//! ## Feature Flags
20//!
21//! | Feature | Effect |
22//! |---------|--------|
23//! | `std` | Enables `alloc` and forwards `animato-core/std` |
24//! | `alloc` | Enables [`InertiaN<T>`] and [`DragState`] |
25//! | `serde` | Derives `Serialize`/`Deserialize` on public types |
26
27#![cfg_attr(not(feature = "std"), no_std)]
28#![deny(missing_docs)]
29#![deny(missing_debug_implementations)]
30
31#[cfg(any(feature = "std", feature = "alloc"))]
32extern crate alloc;
33
34#[cfg(any(feature = "std", feature = "alloc"))]
35pub(crate) mod decompose;
36
37pub mod drag;
38pub mod gesture;
39pub mod inertia;
40
41#[cfg(any(feature = "std", feature = "alloc"))]
42pub use drag::DragState;
43pub use drag::{DragAxis, DragConstraints, PointerData};
44pub use gesture::{Gesture, GestureConfig, GestureRecognizer, SwipeDirection};
45#[cfg(any(feature = "std", feature = "alloc"))]
46pub use inertia::InertiaN;
47pub use inertia::{Inertia, InertiaBounds, InertiaConfig};