Skip to main content

oxframe_core/
lib.rs

1//! Core of oxframe: signals, tweens, easing and a deterministic,
2//! single-threaded coroutine executor.
3//!
4//! > **Status:** oxframe is under very active development. The API is not stable yet and
5//! > may change from version to version. Pin the exact version in your Cargo.toml and check
6//! > the [changelog](https://github.com/oxygenframe/oxframe-sdk/blob/main/CHANGELOG.md)
7//! > before upgrading.
8//!
9//! An animation is an `async fn`; every `.await` on a [`Tween`],
10//! [`wait_for`] or [`next_frame`] is a frame boundary. One poll of the root
11//! future is exactly one frame, with a fixed `dt = 1 / fps`.
12
13#![warn(missing_docs)]
14
15mod color;
16mod ease;
17mod executor;
18mod flow;
19mod frame;
20mod lerp;
21mod paint;
22mod path;
23mod runtime;
24mod signal;
25mod tween;
26
27pub use color::Color;
28pub use ease::{CubicBezier, Ease, presets};
29pub use ease::{bounce_in, bounce_in_out, bounce_out, elastic_in, elastic_in_out, elastic_out};
30pub use executor::Executor;
31#[allow(deprecated)]
32pub use flow::all_vec;
33pub use flow::{
34    All, Animation, Any, BoxFuture, Branches, Delayed, IntoAll, JoinHandle, VecBranches, all, any,
35    loop_while, next_frame, repeat, sequence, spawn, stagger, wait_for, wait_until,
36};
37pub use frame::{FrameSource, Image};
38pub use lerp::{Lerp, Transform};
39pub use paint::{BlendMode, Gradient, GradientKind};
40pub use runtime::{
41    dt, ease_named, fps, frame, meta_snapshot, now, random, random_range, time, tunable, with_rng,
42};
43
44pub use rand;
45pub use signal::Signal;
46pub use tween::{Seconds, Tween};
47
48pub use kurbo::{self, Affine, BezPath, Point, Vec2};
49
50/// Times are compared with this tolerance so that sums of `f64` seconds
51/// (`0.1 + 0.2`) land on the frame they were meant for.
52pub const TIME_EPSILON: f64 = 1e-9;