From dde982726272341a760cea068199b96c0e660f66 Mon Sep 17 00:00:00 2001 From: memdmp Date: Thu, 16 Jan 2025 13:38:48 +0100 Subject: fix: i now hate life --- src/interpolation.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/interpolation.rs') diff --git a/src/interpolation.rs b/src/interpolation.rs index 17e4a48..4543ffb 100644 --- a/src/interpolation.rs +++ b/src/interpolation.rs @@ -21,9 +21,14 @@ where } #[derive(Clone, Copy)] -pub enum TimingFunction { +pub enum TwoValueTimingFunction { Lerp, } +#[derive(Clone, Copy)] +pub enum ManyValueTimingFunction { + Bezier, +} + #[derive(Clone, Copy, PartialEq, PartialOrd)] // We could make a TimeType generic (I initially did), however it's safe to assume we use a 64-bit float for this pub struct KeyFrame { @@ -50,7 +55,7 @@ impl< from: &KeyFrame, to: &KeyFrame, time: f64, - timing_function: TimingFunction, + timing_function: TwoValueTimingFunction, ) -> ValueType { // Order them so `from` is always the lower bound let (from, to) = if from.time < to.time { @@ -61,7 +66,7 @@ impl< let length = to.time - from.time; let position = (time - from.time) / length; match timing_function { - TimingFunction::Lerp => raw_lerp(from.val, to.val, position), + TwoValueTimingFunction::Lerp => raw_lerp(from.val, to.val, position), } } } @@ -161,7 +166,7 @@ impl< // We have the user pass this, as to prevent needing to constantly re-calculate it. sorted_keyframes: Vec>, time: f64, - timing_function: TimingFunction, + timing_function: TwoValueTimingFunction, ) -> Option { let frames = self.get_current_keyframes(sorted_keyframes, time); match frames { -- cgit v1.2.3