use crate::easing::Curve;
#[derive(Debug)]
pub struct InHectic;
impl Curve for InHectic {
#[inline]
fn y(&self, p: f32) -> f32 {
p.powi(100)
}
}
#[test]
fn test_in_hectic() {
let p = InHectic.y(1.0);
assert_eq!(p, 1.0);
}
#[derive(Debug)]
pub struct OutHectic;
impl Curve for OutHectic {
#[inline]
fn y(&self, p: f32) -> f32 {
let m = p - 1.0;
1.0 - m.powi(100)
}
}
#[test]
fn test_out_hectic() {
let p = OutHectic.y(1.0);
assert_eq!(p, 1.0);
}
#[derive(Debug)]
pub struct InOutHectic;
impl Curve for InOutHectic {
#[inline]
fn y(&self, p: f32) -> f32 {
let m = p - 1.0;
let t = p * 2.0;
if t < 1.0 {
return p.powi(100) * 2.0;
}
1.0 - m.powi(100) * 2.0
}
}
#[test]
fn test_in_out_hectic() {
let p = InOutHectic.y(1.0);
assert_eq!(p, 1.0);
}