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. - Any
- Future returned by
any. - BezPath
- A Bézier path.
- Blend
- The two layers of one transition frame.
- 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). - Delayed
- A future that starts after a wait; see
sequence. - 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.
- Layer
Pose - How one of the two layers is drawn. Offsets are fractions of the frame
(positive x moves the layer right, positive y moves it down). Scale is
around the frame center. A wipe reveals that fraction of the layer from
dirand hides the rest. - Point
- A 2D point.
- Recorded
- A transition a scene has started. Copied out of the executor after the scene has been measured.
- Seeded
Rng - A generator seeded by the caller. Drawing with this does not advance the
scene’s
randomgenerator, and the same seed always yields the same sequence, including after a seek. - Shader
Transition - A transition drawn by a shader preset from both scenes’ pixels.
- Signal
- A reactive value.
- Sound
Clip - One sound effect placed on the scene timeline.
- 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.
- VecBranches
- Branches of
alloranyover many futures of one type. - Voice
Line - A spoken line recorded while a scene runs.
- WaitFor
- A wait returned by
wait_for.
Enums§
- Blend
Mode - How a node’s layer is composited onto what is below it.
- Dir
- Edge a slide or a wipe moves toward.
- Gradient
Kind - Shape of a
Gradient. - Kind
- Which built-in, or a function of progress. Not part of the prelude;
scenes build one through
cratere-exports inoxframe::Transition. - Slide
Mark - What a scene recorded for the presentation, in scene time.
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§
- Animation
- Anything that can be awaited in a scene: a tween,
wait_for,all(..), anasyncblock… Every future is one; the trait exists for the error message when a closure returns something else. - Branches
- Branches run by
allandany. Implemented by the crate only. - 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”. - IntoAll
- What
allandanyaccept: a tuple of futures, or aVec, array or iterator of futures of one type. - Lerp
- Linear interpolation;
tis already eased and may leave[0, 1](e.g. with back easings). - Seconds
- A length of time.
f64means seconds; other types (a theme pace) convert.
Functions§
- all
- Runs animations at the same time and completes when all of them have.
- all_vec
Deprecated allfor boxed futures.- any
- Runs animations at the same time and completes as soon as the first one
does; the others stop where they are. Returns the index of the one that
finished. Takes the same arguments as
all. - begin_
transition - Records
spec, lettingmeta.jsonoverride its duration the way markers do. Returns the duration to wait. Panics if the scene already started one. - 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.
- end_
sound - Sets the end point in the file of clip
index(fromrecord_sound), for a clip whose length is known only later, such as the sound of a video that is paused. - fps
- Frames per second of the running project.
- frame
- Index of the frame being computed.
- has_
previous - Whether the running scene has a scene before it.
- loop_
while - Runs the animation
make()returns again and again whilekeep_going()is true (checked before each run). Usuallyspawned for a background loop:spawn(loop_while(|| true, || pulse.scale().to(1.1, 0.5))). - meta_
snapshot - Copy of the running scene’s markers, eases and tunables.
- next_
frame - Yields until the next frame.
- notes
- Speaker notes for the slide being shown: the presenter window of
oxframe presentshows them until the next stop. Several calls before one stop are joined. - 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. - record_
sound - Records
clipon the running scene. Called bysound(). - record_
voice - Records a spoken line. Called by
voice(). - repeat
- Runs the animation
make()returnstimestimes in a row. - sequence
- Starts animations one after another,
delayseconds apart; they then run concurrently. Completes when all have. Takes aVec, an array or an iterator of animations of one type. For “the same animation on many nodes”,staggerreads better. - slide_
break - A stop for
oxframe present: the presentation pauses here until the next key press. A render plays straight through, so a scene with stops is still a video. Every scene also ends with a stop. - spawn
- Runs
futin the background, starting this frame. Background tasks stop when the scene ends. - stagger
- Runs
animateon every item, starting eachdelayseconds after the previous one; completes when all have finished: - 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.