aboutsummaryrefslogtreecommitdiffstats
path: root/src/interpolation.rs
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-16 13:38:48 +0100
committerLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-01-16 13:38:48 +0100
commitdde982726272341a760cea068199b96c0e660f66 (patch)
tree59e51950a5ef3bddd93bfe051d8adf833d6773b6 /src/interpolation.rs
parent53cf1e9fb257e3fa351277c98b70e5244718d0db (diff)
downloadcosin25-invite-mountainbytes-dde982726272341a760cea068199b96c0e660f66.tar.gz
cosin25-invite-mountainbytes-dde982726272341a760cea068199b96c0e660f66.tar.bz2
cosin25-invite-mountainbytes-dde982726272341a760cea068199b96c0e660f66.tar.lz
cosin25-invite-mountainbytes-dde982726272341a760cea068199b96c0e660f66.zip

fix: i now hate life

Diffstat (limited to 'src/interpolation.rs')
-rw-r--r--src/interpolation.rs13
1 files changed, 9 insertions, 4 deletions
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<ValueType> {
@@ -50,7 +55,7 @@ impl<
from: &KeyFrame<ValueType>,
to: &KeyFrame<ValueType>,
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<KeyFrame<ValueType>>,
time: f64,
- timing_function: TimingFunction,
+ timing_function: TwoValueTimingFunction,
) -> Option<ValueType> {
let frames = self.get_current_keyframes(sorted_keyframes, time);
match frames {