Skip to content

Commit

Permalink
Clear the Quint easing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerollmops committed Dec 7, 2016
1 parent db1cbae commit 032da99
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/functions/quint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
}

Expand Down

0 comments on commit 032da99

Please sign in to comment.