Help with ui gradient effect

Hey I’m trying to animate a ui gradient to do this
ee9b9eedcf7d16dcfa0be12f1609eff5
Although I can’t seem to find any tutorials besides how to make a rainbow UI gradient and the code for these I can’t seem to figure out how to adjust

local gradient = screenGui.Frame.Player1.Guage.Frame.UIGradient

local counter = 0       -- phase shift 
local w = math.pi / 12  -- frequency 
local CS = {}           -- colorsequence table
local num = 17			-- number of colorsequence points (maxed at 15 or 16 I believe)
local frames = 0		-- frame counter, used to buffer if you want lower framerate updates

RunService.Stepped:Connect(function()
	if math.fmod(frames, 2) == 0 then
		for i = 0, num do
			local c = Color3.fromRGB(255, 255, 255)
			table.insert(CS, i+1, ColorSequenceKeypoint.new(i/num, c))
		end
		gradient.Color = ColorSequence.new(CS)
		CS = {}
		counter = counter + math.pi/40
		if (counter >= math.pi * 2) then
			counter = 0
		end
	end
	if frames >= 1000 then
		frames = 0
	end
	frames = frames + 1
end)