Change of magic number to 2 * math.pi

This commit is contained in:
Cauchy Underground 2024-04-08 15:41:28 +02:00
parent c9a7698677
commit a38e31674c
1 changed files with 1 additions and 1 deletions

View File

@ -569,7 +569,7 @@ function scroll.step_functions.smooth_back_and_forth(elapsed, size, visible_size
local state = ((elapsed * speed) % (size)) / size local state = ((elapsed * speed) % (size)) / size
-- The cosine function is scaled to map [0,1] to [0,2π] then its output is -- The cosine function is scaled to map [0,1] to [0,2π] then its output is
-- scaled from [1 -- -1 -- 1] to [0 -- 1 -- 0] -- scaled from [1 -- -1 -- 1] to [0 -- 1 -- 0]
return (size - visible_size) * (0.5 - 0.5*math.cos(state*6.2832)) return (size - visible_size) * (0.5 - 0.5*math.cos(state * 2 * math.pi))
end end
return scroll return scroll