API ReferencePainting & Animation
Tweens
Typed interpolation values and weighted sequences.
use incular::prelude::*;
fn main() {
let eased = Curve::EaseOut.apply(0.5);
let tween = TweenValue::curved(0.0f32, 100.0, Curve::EaseInOut);
let seq = TweenSequence::new()
.push(TweenValue::new(0.0f32, 50.0), 1.0)
.push(TweenValue::new(50.0, 100.0), 2.0);
println!(
"eased: {eased}, mid: {}, seq: {:?}",
tween.evaluate(0.5),
seq.evaluate(0.75)
);
}Tween is implemented for f32, f64, i32, u32,
Offset, Size,
Color. Non-finite or non-positive segment weights
are ignored.
| Type | Purpose |
|---|---|
TweenValue<T> | Begin/end pair with optional curve |
TweenSegment<T> | Value plus sequence weight |
TweenSequence<T> | Weighted multi-segment interpolation |
Animation<T> | Controller-bound evaluated value |
ImplicitAnimation<T> | Retargets from the current value |
Animation::new(controller, tween) / from_to(controller, from, to) bind
values to controllers (value(), value_at(t), forward, tick, map);
ImplicitAnimation::new(controller, begin, end) retargets from the current
value (set_target, set_curve).
Related: Curves.