simple_easing/
expo.rs

1/// <https://easings.net/#easeInExpo>
2pub fn expo_in(t: f32) -> f32 {
3	if t <= 0.0 {
4		0.0
5	} else {
6		2f32.powf(10.0 * t - 10.0)
7	}
8}
9
10/// <https://easings.net/#easeOutExpo>
11pub fn expo_out(t: f32) -> f32 {
12	if 1.0 <= t {
13		1.0
14	} else {
15		1.0 - 2f32.powf(-10.0 * t)
16	}
17}
18
19/// <https://easings.net/#easeInOutExpo>
20pub fn expo_in_out(t: f32) -> f32 {
21	if t <= 0.0 {
22		0.0
23	} else if 1.0 <= t {
24		1.0
25	} else if t < 0.5 {
26		2f32.powf(20.0 * t - 10.0) / 2.0
27	} else {
28		(2.0 - 2f32.powf(-20.0 * t + 10.0)) / 2.0
29	}
30}