module
value
Interpolating CSS-ish values the way GSAP does: numbers with units, colours (hex, rgb(), rgba(), hsl(), named), relative values ("+=40"), and compound strings ("0 0 20px rgba(0,0,0,.5)") whose numbers are tweened while the rest stays put.
Structs
- Shape
A string split into literal text and numbers.
Functions
interpolate
pub fn interpolate(from: &str, to: &str, progress: f64) -> StringThe value progress of the way from from to to (both strings). Numbers (and colours) are interpolated when the two have the same shape; a unitless side adopts the other side's units (0 → 40px). Otherwise the value jumps to to at the end.
normalize_colors
pub fn normalize_colors(s: &str) -> StringReplace every colour in a string with rgba(r, g, b, a) so colours line up for interpolation.
parse_color
pub fn parse_color(s: &str) -> Option<[f64; 4]>Parse any supported colour to [r, g, b, a].
parse_hex
pub fn parse_hex(s: &str) -> Option<[f64; 4]>#rgb, #rgba, #rrggbb, #rrggbbaa → [r, g, b, a] (a in 0..1).
resolve_relative
pub fn resolve_relative(current: &str, target: &str) -> StringResolve a relative value ("+=40", "-=10px", "*=2") against the current value; other values are returned as they are.