ferroui-livecharts 0.4.0

LiveCharts2 chart calculation, geometry, interaction and animation for FerroUI
Documentation
pub struct ElasticEasingFunction;
impl ElasticEasingFunction {
    fn tpmt(x: f64) -> f64 {
        (2.0_f64.powf(-10.0 * x) - 0.0009765625) * 1.0009775171065494
    }
    pub fn ease_in(t: f64, amplitude: f64, period: f64) -> f64 {
        let a = amplitude.max(1.0);
        let p = period / std::f64::consts::TAU;
        let s = (1.0 / a).asin() * p;
        let t = t - 1.0;
        a * Self::tpmt(-t) * ((s - t) / p).sin()
    }
    pub fn ease_out(t: f64, amplitude: f64, period: f64) -> f64 {
        let a = amplitude.max(1.0);
        let p = period / std::f64::consts::TAU;
        let s = (1.0 / a).asin() * p;
        1.0 - a * Self::tpmt(t) * ((t + s) / p).sin()
    }
    pub fn ease_in_out(t: f64, amplitude: f64, period: f64) -> f64 {
        let a = amplitude.max(1.0);
        let p = period / std::f64::consts::TAU;
        let s = (1.0 / a).asin() * p;
        let t = t * 2.0 - 1.0;
        // The source intentionally applies the divisor only to the second arm.
        if t < 0.0 {
            a * Self::tpmt(-t) * ((s - t) / p).sin()
        } else {
            (2.0 - a * Self::tpmt(t) * ((s + t) / p).sin()) / 2.0
        }
    }
}