eazy_data/easing/
bezier.rs1pub mod cubic_bezier;
2
3use crate::easing::Curve;
4
5#[derive(Copy, Clone, Debug, Default)]
7pub enum Bezier {
8 #[default]
11 Ease,
12 InEase,
15 OutEase,
18 InOutEase,
21 Curve(f32, f32, f32, f32),
25}
26
27impl Curve for Bezier {
28 #[inline(always)]
29 fn y(&self, p: f32) -> f32 {
30 match self {
31 Self::Ease => cubic_bezier::CubicBezier::ease().y(p),
32 Self::InEase => cubic_bezier::CubicBezier::in_ease().y(p),
33 Self::OutEase => cubic_bezier::CubicBezier::out_ease().y(p),
34 Self::InOutEase => cubic_bezier::CubicBezier::in_out_ease().y(p),
35 Self::Curve(p1x, p1y, p2x, p2y) => {
36 cubic_bezier::CubicBezier::curve(*p1x, *p1y, *p2x, *p2y).y(p)
37 }
38 }
39 }
40}