Expand description
Interpolation math for SpriteStudio animation curves.
Curve evaluation with no dependency on ssab or any other SpriteStudio type — just
numbers in, numbers out. Linear, Hermite and Bezier interpolation plus the easing rate
functions, generic over SsFloat so the same code serves f32 and f64; the
interpolate_*_linear batch helpers are f32 only.
use ssruntime::interpolate::{linear, rate_ease_in};
assert_eq!(linear(0.0f32, 100.0, 0.5), 50.0);
assert_eq!(linear(0.0f64, 100.0, 0.5), 50.0); // same code path, f64
// Easing shapes the rate, which then drives the interpolation.
let eased = linear(0.0f32, 100.0, rate_ease_in(0.5, 2.0));
assert!(eased < 50.0);Traits§
- SsFloat
- A trait to abstract floating-point operations for generic interpolation.
Functions§
- bezier
- hermite
- interpolate_
array_ linear - Batch linear interpolation for arrays (e.g. Deform attributes).
- interpolate_
color_ linear - Batch linear interpolation for PartColor attribute (fixed 16 floats: four channels each for LT, RT, LB, RB).
- interpolate_
vertex_ linear - Batch linear interpolation for Vertex attribute (fixed 8 floats: LT.x, LT.y, RT.x, RT.y, LB.x, LB.y, RB.x, RB.y).
- linear
- rate_
accelerate - rate_
decelerate - rate_
ease_ back_ in - rate_
ease_ back_ inout - rate_
ease_ back_ out - rate_
ease_ bounce_ in - rate_
ease_ bounce_ inout - rate_
ease_ bounce_ out - rate_
ease_ elastic_ in - rate_
ease_ elastic_ inout - rate_
ease_ elastic_ out - rate_
ease_ exponential_ in - rate_
ease_ exponential_ inout - rate_
ease_ exponential_ out - rate_
ease_ in - rate_
ease_ inout - rate_
ease_ out - rate_
ease_ sine_ in - rate_
ease_ sine_ inout - rate_
ease_ sine_ out - rate_
linear