diff --git a/studio/src/math/interpolation.rs b/studio/src/math/interpolation.rs index bd29f52..d434330 100644 --- a/studio/src/math/interpolation.rs +++ b/studio/src/math/interpolation.rs @@ -1,4 +1,4 @@ -use std::ops; +use std::{f32::consts, ops}; use super::NearlyEq; @@ -52,3 +52,11 @@ where t.lerp(to.0, to.1) } } + +/// Fit a [0, 1] `t` interpolation parameter to a sine curve +/// +/// https://www.desmos.com/calculator/k9x4c4cr5y +#[inline] +pub fn curve_sin(t: f32) -> f32 { + -1. * (f32::cos(t * consts::PI) / 2.) + 0.5 +} diff --git a/studio/src/math/util.rs b/studio/src/math/util.rs index a539ccc..c7dafe2 100644 --- a/studio/src/math/util.rs +++ b/studio/src/math/util.rs @@ -1,5 +1,3 @@ -use std::f32::consts; - use bevy::prelude::Vec3; pub trait NearlyEq { @@ -17,11 +15,3 @@ impl NearlyEq for Vec3 { self.x.nearly_eq(rhs.x) && self.y.nearly_eq(rhs.y) && self.z.nearly_eq(rhs.z) } } - -/// Fit a [0, 1] `t` interpolation parameter to a sine curve -/// -/// https://www.desmos.com/calculator/k9x4c4cr5y -#[inline] -pub fn curve_sin(t: f32) -> f32 { - -1. * (f32::cos(t * consts::PI) / 2.) + 0.5 -}