Crate simple_easing

Source
Expand description

This package contains a set of simple easing functions. That consume a standardised time attribute in the range between 0.0 and 1.0, that represent the progress of a transition. 0.0 being the beginning, 1.0 the end.

They return a value between 0.0 and 1.0 (it might exceed the 0..=1 range temporarily for a bounce effect). The returned value can be used to interpolate between the initial (0.0) and the final (1.0) transition state, allowing for a “more natural” feel of a transition by accelerating and decelerating at certain points, depending on the easing function used.

Visit easings.net to see visualisations of the different easing functions.

All easing functions have the same signature ((f32) -> f32) and can be easily stored as fn pointers.

use ::simple_easing::linear;
let easing: fn(f32) -> f32 = linear;
assert_eq!(easing(1.0), 1.0);

Functions§

back_in
https://easings.net/#easeInBack
back_in_out
https://easings.net/#easeInOutBack
back_out
https://easings.net/#easeOutBack
bounce_in
https://easings.net/#easeInBounce
bounce_in_out
https://easings.net/#easeInOutBounce
bounce_out
https://easings.net/#easeOutBounce
circ_in
https://easings.net/#easeInCirc
circ_in_out
https://easings.net/#easeInOutCirc
circ_out
https://easings.net/#easeOutCirc
cubic_in
https://easings.net/#easeInCubic
cubic_in_out
https://easings.net/#easeInOutCubic
cubic_out
https://easings.net/#easeOutCubic
elastic_in
https://easings.net/#easeInElastic
elastic_in_out
https://easings.net/#easeInOutElastic
elastic_out
https://easings.net/#easeOutElastic
expo_in
https://easings.net/#easeInExpo
expo_in_out
https://easings.net/#easeInOutExpo
expo_out
https://easings.net/#easeOutExpo
linear
quad_in
https://easings.net/#easeInQuad
quad_in_out
https://easings.net/#easeInOutQuad
quad_out
https://easings.net/#easeOutQuad
quart_in
https://easings.net/#easeInQuart
quart_in_out
https://easings.net/#easeInOutQuart
quart_out
https://easings.net/#easeOutQuart
quint_in
https://easings.net/#easeInQuint
quint_in_out
https://easings.net/#easeInOutQuint
quint_out
https://easings.net/#easeOutQuint
reverse
A linear easing that goes from 1.0 to 0.0.
roundtrip
A linear easing that goes from 0.0 to 1.0 and back to 0.0. That might be used in combination with other easing functions.
sine_in
https://easings.net/#easeInSine
sine_in_out
https://easings.net/#easeInOutSine
sine_out
https://easings.net/#easeOutSine