Expand description
Core of oxframe: signals, tweens, easing and a deterministic, single-threaded coroutine executor.
Status: oxframe is under very active development. The API is not stable yet and may change from version to version. Pin the exact version in your Cargo.toml and check the changelog before upgrading.
An animation is an async fn; every .await on a Tween,
wait_for or next_frame is a frame boundary. One poll of the root
future is exactly one frame, with a fixed dt = 1 / fps.
Re-exports§
Modules§
- presets
- Named Bézier presets (values follow easings.net / CSS).
Structs§
- Affine
- A 2D affine transform.
- All
- Future returned by
all. - BezPath
- A Bézier path.
- Color
- sRGB color with straight (non-premultiplied) alpha, components in
0..=1. - Cubic
Bezier - CSS-style cubic Bézier easing with control points
(x1, y1),(x2, y2); the end points are fixed at(0, 0)and(1, 1). - Executor
- Deterministic single-threaded executor: one
stepis one frame. The root future and every spawned task are polled once per step, in a fixed order (root, then tasks in spawn order). No wakers, no clocks, no threads — the same input always produces the same frames. - Gradient
- A gradient in the node’s local coordinates (origin at the node center).
- Image
- 8-bit sRGB RGBA, straight alpha, row-major, no padding.
- Join
Handle - Awaiting it waits for the spawned task to finish.
- Point
- A 2D point.
- Signal
- A reactive value.
- Transform
- Decomposed 2D transform. Interpolates component-wise, so rotations turn instead of shearing through the matrix midpoint.
- Tween
- Animates a
Signaltowards a target. Created bySignal::to. - Vec2
- A 2D vector.
Enums§
- Blend
Mode - How a node’s layer is composited onto what is below it.
- Gradient
Kind - Shape of a
Gradient.
Constants§
- TIME_
EPSILON - Times are compared with this tolerance so that sums of
f64seconds (0.1 + 0.2) land on the frame they were meant for.
Traits§
- Ease
- Maps linear progress
t ∈ [0, 1]to eased progress. - Frame
Source - A timeline that can draw any of its frames: “give me frame
n”. - Lerp
- Linear interpolation;
tis already eased and may leave[0, 1](e.g. with back easings).
Functions§
- all
- Runs futures concurrently and completes when all of them have. Takes a tuple of up to 12 futures and returns a tuple of their outputs.
- all_vec
allfor a dynamic number of futures.- bounce_
in - Bounces before leaving.
- bounce_
in_ out - Bounces at both ends.
- bounce_
out - Bounces into place, like a dropped ball.
- dt
- Duration of one frame in seconds,
1 / fps. - ease_
named - Named easing from
meta.json;defaultis recorded there on first use. Use through theease!macro. - elastic_
in - Oscillates before leaving, like a spring being wound.
- elastic_
in_ out - Spring at both ends.
- elastic_
out - Overshoots and oscillates into place, like a spring.
- fps
- Frames per second of the running project.
- frame
- Index of the frame being computed.
- meta_
snapshot - Copy of the running scene’s markers, eases and tunables.
- next_
frame - Yields until the next frame.
- now
- Time of the current frame,
frame / fpsseconds. - random
- Uniform random number in
[0, 1)from the scene’s seeded generator. - random_
range - Uniform random number in
[min, max)from the scene’s seeded generator. - sequence
- Starts the futures one after another with
delayseconds between their starts; they then run concurrently. Completes when all have. - spawn
- Runs
futin the background, starting this frame. Background tasks stop when the scene ends. - time
- Virtual time of the current task — where the next animation starts.
- tunable
- Value of tunable
namefrommeta.json;defaultis recorded there on first use. Use through thetune!macro. - wait_
for - Waits
secondsof scene time. - wait_
until - Waits until marker
namefrommeta.json. On first encounter the current time becomes the marker’s default, so it does not wait at all. - with_
rng - Runs
fwith the scene’s random generator. It is seeded from the project seed and the scene name, so results are reproducible; never userand::rng()or other entropy sources in scenes.