Skip to main content

Crate solium_animation

Crate solium_animation 

Source
Expand description

Solium’s animation engine.

Separated from the compositor on purpose, and the separation is load-bearing rather than tidy: an animation you can only judge by launching a compositor is an animation nobody tunes. Everything here is arithmetic on f64 and Duration, so the same code that moves windows can be driven by a test, plotted by the preview tool in preview/, or embedded in whatever else wants to show what a curve does.

There will be many animations and many settings for them. That is the reason for this shape: adding a curve here makes it available to every mode, every script and the preview, without touching the renderer.

use std::time::Duration;
use solium_animation::{Animation, Curve};

let move_window = Animation::new(Duration::ZERO, Duration::from_millis(200), Curve::OutCubic);
assert_eq!(move_window.progress(Duration::ZERO), 0.0);
assert_eq!(move_window.progress(Duration::from_millis(200)), 1.0);

Modules§

ffi
A C ABI over the engine, so it can be called from outside Rust.

Structs§

Animation
One animation: when it started, how long it takes, and how it moves.
Spring
A damped spring.

Enums§

Curve
How a value travels from one end to the other.

Functions§

bezier 🔒
A cubic bezier from (0,0) to (1,1), evaluated at t along the x axis.
lerp
Interpolate between two values.