on.update = function(dt) local P = 10 -- Period in seconds local t = Current_time - math.floor(Current_time/P)*P -- t is between 0 and P assert(0 <= t) assert(t <= P) if t > P/2 then Night_blue = (P-t)/(P/2) else Night_blue = t/(P/2) end Angle = t*2*math.pi/P table.insert(Debug_state, Night_blue) if #Debug_state > 800 then table.remove(Debug_state, 1) end end