Skip to main content

materialize

Function materialize 

Source
pub fn materialize(
    animation: &mut Animated<f32>,
    range: TimeRange,
) -> Result<(), CurveError>
Expand description

Spells out as keyframes what the value’s before and after show over range, and sets each side the range reaches to hold: copies of the keyframes for every pass of a repeating mode that meets the range, and one keyframe at the range’s edge for linear.

Every keyframe written holds the value the evaluator gives at its tick (the last keyframe of a side left as it is keeps its own, which a wrap there does not show). Between them the curve is the same, with two exceptions that stay within rounding: the last segment of a repeat pass, which ends one tick early and holds across the wrap, and a mirrored ping_pong pass, whose curves are written reversed. A value that is not keyed is left alone.

The result shows the old curve inside range only. Past the range a spelled side holds, and a repeating side the range does not reach repeats all the keyframes there now are.

§Errors

CurveError::TooManyKeys when the result would hold more than MAX_KEYFRAMES keyframes; the value is then left as it was.