aintnothingbutapeanut/data/scripts/utils.lua
2025-01-26 23:16:13 +03:00

31 lines
536 B
Lua

require "math"
function table.shallow_copy(t)
local t2 = {}
for k,v in pairs(t) do
t2[k] = v
end
return t2
end
function thisorthat(c, a, b)
if c then return a else return b end
end
function pingpong(at, over)
local c = (over - 1) * 2
if math.fmod(at, c) >= over then
return c - math.fmod(at, c)
else
return math.fmod(at, c)
end
end
function linease(c, t, d, b)
return c * t / d + b
end
function sinease(c, t, d, b)
return -c*math.cos(t/d*(math.pi/2)) + c + b
end