--!strict

local startAngle = -60
local endAngle = 60

local function Map(n: number, oldMin: number, oldMax: number, min: number, max: number): number
	return (min + ((max - min) * ((n - oldMin) / (oldMax - oldMin))))
end

local function run(LightChanger)
	local lights = LightChanger:GetLights("Numbered")
	LightChanger:Tilt(60)
	for groupNumber, lightGroup in lights do
		local percent = (groupNumber - 1) / (#lights - 1)
		local angle = Map(percent, 0, 1, startAngle, endAngle)
		LightChanger:Pan(angle, lightGroup)
	end
end

return function(LightChangerA, LightChangerB)
	run(LightChangerA)
	run(LightChangerB)
end
