aboutsummaryrefslogtreecommitdiff
path: root/src/math.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/math.odin')
-rw-r--r--src/math.odin21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/math.odin b/src/math.odin
new file mode 100644
index 0000000..0cd2a27
--- /dev/null
+++ b/src/math.odin
@@ -0,0 +1,21 @@
+package demonchime
+
+import "core:math"
+import "core:math/linalg"
+
+import rl "vendor:raylib"
+
+dt_lerp :: proc {
+ dt_lerp_f32,
+ dt_lerp_arr,
+}
+
+dt_lerp_f32 :: proc(a: f32, b: f32, t: f32) -> f32 {
+ dt := rl.GetFrameTime()
+ return math.lerp(b, a, math.pow(0.5, dt * t))
+}
+
+dt_lerp_arr :: proc(a: [$N]$T, b: [N]T, t: T) -> [N]T {
+ dt := rl.GetFrameTime()
+ return linalg.lerp(b, a, math.pow(0.5, dt * t))
+}