Visualizing gradient over several objects

Hey, so I’m currently creating a dance floor and I’m wondering what the best method for handling a gradient over several objects.

I am currently generating cells to fit an area in which said cells are stored within a meta table with the values {x, y}. My end goal is to easily translate a singular UIGradient and its values to several gradients over multiple frames.

Current Approach:

My current approach is to have a global UIGradient and then retrieve the color value corresponding to the tile’s position (pos) and setting the tile’s individual UIGradients gradient to (pos, pos+1)

Although I do not believe this approach to be efficient and would like secondary advice.

I’m not asking for anyone to write code for me, thats why I have not posted any code.I am purely looking for perspective/methods regarding this matter.

Thank you for any assistance,
xg.

1 Like

update

Have now generated the Gradient over 260 tiles, however due to limitations to the Roblox engine, I am unable to tween anything relative to the gradient’s ColorSequence and have reached a roadblock.

Code + Preview
function GenerateGradient()
	local pos = gradientObj.Color.Keypoints
	for x = 1, dFloor.CountX do
		local region = dFloor:GetRegion(dFloor.Cells[x][1], dFloor.Cells[x][#pos-1])
		for i,v in pairs(region) do
			local p1, p2 = pos[i].Value, pos[i+1].Value
			local f, l = Color3.fromRGB(p1.R*255, p1.G*255, p1.B*255), Color3.fromRGB(p2.R*255, p2.G*255, p2.B*255)
			v.Element.Grad.Color = ColorSequence.new{
				ColorSequenceKeypoint.new(0, f),
				ColorSequenceKeypoint.new(1, l)
			}
		end
	end
end

Creating: