From 032da9962461783ace8a54b2f7d27c8ee7816212 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Thu, 8 Dec 2016 00:31:50 +0100 Subject: [PATCH] Clear the Quint easing functions --- src/functions/quint.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/functions/quint.rs b/src/functions/quint.rs index 99f6230..c524cec 100644 --- a/src/functions/quint.rs +++ b/src/functions/quint.rs @@ -4,24 +4,24 @@ use super::ease::Easing; pub struct Quint; impl Easing for Quint { - fn ease_in(t: f32, b: f32, c: f32, d: f32) -> f32 { - let inner_t = t / d; - c * inner_t.powi(5) + b + fn ease_in(mut t: f32, b: f32, c: f32, d: f32) -> f32 { + t = t / d; + c * (t * t * t * t * t) + b } - fn ease_out(t: f32, b: f32, c: f32, d: f32) -> f32 { - let inner_t = t / d - 1.0; - c * (inner_t.powi(5) + 1.0) + b + fn ease_out(mut t: f32, b: f32, c: f32, d: f32) -> f32 { + t = t / d - 1.0; + c * ((t * t * t * t * t) + 1.0) + b } - fn ease_in_out(t: f32, b: f32, c: f32, d: f32) -> f32 { - let mut inner_t = t / (d / 2.0); - if inner_t < 1.0 { - return (c / 2.0) * inner_t.powi(5) + b; + fn ease_in_out(mut t: f32, b: f32, c: f32, d: f32) -> f32 { + t = t / (d / 2.0); + if t < 1.0 { + (c / 2.0) * (t * t * t * t * t) + b + } else { + t -= 2.0; + c / 2.0 * ((t * t * t * t * t) + 2.0) + b } - inner_t -= 2.0; - return c / 2.0 * (inner_t.powi(5) + 2.0) + b; - } }