Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you make a smooth rainbow effect in Frame?

I'm a noob at scripting but i'm trying to make a Frame that will switch between the rainbow colors smoothly, not like just flashing the colors of the rainbow. Do I have to script all of the RGB colors manually or is there a more efficient way of doing it. Are there any references I can use?

1 comment

0

Try looking at the forums next time. Look what I did https://forum.scriptinghelpers.org/topic/188/screen-saver

1 answer

Color3 has a function called fromHSV which takes the hue, saturation, and value as arguments, and converts them to a Color3. You can use a for loop to rotate through all the hues of the rainbow with as much precision as you want.

for hue=0, 1, 1/30 do
frame.BackgroundColor3 = Color3.fromHSV(hue, 1, 1)
wait()
end

Another useful method of Color3s is the lerp method, which lets you smoothly transition between two colors. Unfortunately this will not necessarily retain the saturation and value along the way, but it can still be useful.

local color1 = Color3.new(1, 0, 0) --red
local color2 = Color3.new(0, 1, 1) --cyan
for t = 0, 1, 1/30 do
whatever.BackgroundColor3 = color1:lerp(color2, t)
end

1 comment

0

Why not Color3.fromRGB? You can easily get red, green, and blue values without looking them up.

This discussion is preserved as it was. New answers, comments, and votes are closed.