Skip to main content

animate_keyframes

Function animate_keyframes 

Source
pub fn animate_keyframes(
    key: impl Into<String>,
    keyframes: KeyframesSpec<f32>,
    spec: AnimationSpec,
) -> f32
Expand description

Animate f32 through a sequence of keyframes.

The keyframe timestamps range from 0.0 to 1.0, mapped across spec’s duration. The animation loops if repeat is set on the spec.

Example:

let val = animate_keyframes("bounce", KeyframesSpec::new(vec![
    (0.0, 0.0),
    (0.3, 100.0),
    (0.6, 80.0),
    (1.0, 100.0),
]), AnimationSpec::tween(Duration::from_millis(600), Easing::EaseOut));