docs improvement

This commit is contained in:
Michael Freno
2025-11-18 13:44:00 -05:00
parent 96150e5cf4
commit d86f7dbd5e
16 changed files with 392 additions and 258 deletions

View File

@@ -86,13 +86,20 @@ function Transform.lerp(from, to, t)
if type(to) ~= "table" then
to = Transform.new()
end
if type(t) ~= "number" or t ~= t or t == math.huge or t == -math.huge then
if type(t) ~= "number" or t ~= t then
-- NaN or invalid type
t = 0
elseif t == math.huge then
-- Positive infinity
t = 1
elseif t == -math.huge then
-- Negative infinity
t = 0
else
-- Clamp t to 0-1 range
t = math.max(0, math.min(1, t))
end
-- Clamp t to 0-1 range
t = math.max(0, math.min(1, t))
return Transform.new({
rotate = (from.rotate or 0) * (1 - t) + (to.rotate or 0) * t,
scaleX = (from.scaleX or 1) * (1 - t) + (to.scaleX or 1) * t,