simple_easing/cubic.rs
1/// <https://easings.net/#easeInCubic>
2pub fn cubic_in(t: f32) -> f32 {
3 t * t * t
4}
5
6/// <https://easings.net/#easeOutCubic>
7pub fn cubic_out(t: f32) -> f32 {
8 1.0 - (1.0 - t).powi(3)
9}
10
11/// <https://easings.net/#easeInOutCubic>
12pub fn cubic_in_out(t: f32) -> f32 {
13 if t < 0.5 {
14 4.0 * t * t * t
15 } else {
16 1.0 - (-2.0 * t + 2.0).powi(3) / 2.0
17 }
18}