From 1b396037a2fbc43c110ba31d1fc9db876931ea0e Mon Sep 17 00:00:00 2001 From: Max Cahill <1bardesign@gmail.com> Date: Thu, 23 Nov 2023 16:16:15 +1100 Subject: [PATCH] added mathx.identity for use as a default easing function without a branch --- mathx.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mathx.lua b/mathx.lua index 9346bd5..1f3a51d 100644 --- a/mathx.lua +++ b/mathx.lua @@ -95,6 +95,11 @@ end --easing curves --(generally only "safe" for 0-1 range, see mathx.clamp01) +--no curve - can be used as a default to avoid needing a branch +function mathx.identity(f) + return f +end + --classic smoothstep function mathx.smoothstep(f) return f * f * (3 - 2 * f)