Skip to main content

insert_key

Function insert_key 

Source
pub fn insert_key(
    animation: &mut Animated<f32>,
    time: MediaTime,
) -> Result<(), CurveError>
Expand description

Adds a keyframe at time without changing the curve: the segment it falls in is cut by de Casteljau subdivision and the new keyframe takes the curve’s value there, rounded to f32. A steps segment becomes held keyframes, one where each value starts, and a points segment two tables, or straight lines between keyframes where a part ends level.

§Errors

CurveError::NotKeyed, CurveError::Empty, CurveError::OutsideKeys (a time past an end needs a keyframe of its own, not a cut), CurveError::OnAKey, or CurveError::TooManyKeys.