Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rainbow = {}
- local size = 64
- local gui = script.Parent
- function color3FromHex(n)
- n = math.floor(n)
- local b = n % 256
- local g = ((n-b)/256)%256
- local r = (n-b-g*256)/65536
- return Color3.new(r/255,g/255,b/255)
- end
- local function numberToString(x)
- local options = {'F', 'E', 'D', 'C', 'B', 'A'}
- return options[16-x]
- end
- local function hexOf(i)
- local base = math.floor(i / 16)
- local remainder = (i - (base * 16))
- if base >= 10 then
- base = numberToString(base)
- end
- if remainder >= 10 then
- remainder = numberToString(remainder)
- end
- return (base..remainder)
- end
- local function sin_to_hex(i, shift)
- local sin = math.sin(math.pi / size * 2 * i + shift)
- local int = math.floor(sin * 127) + 128
- local hex = hexOf(int)
- return hex
- end
- for i = 0, size do
- local red = sin_to_hex(i, 0 * math.pi * 2/3)
- local blue = sin_to_hex(i, 1 * math.pi * 2/3)
- local green = sin_to_hex(i, 2 * math.pi * 2/3)
- local result = (red..green..blue)
- table.insert(rainbow, result)
- end
- local x = 0
- local y = 0
- for i = 1, #rainbow do
- local frame = Instance.new("Frame")
- frame.Parent = gui
- frame.Size = UDim2.new(0,20,0,20)
- frame.BorderSizePixel = 0
- frame.BackgroundColor3 = color3FromHex("0x"..rainbow[i])
- x = math.random(20, 60)
- y = math.random(60, 200)
- frame.Position = UDim2.new(0,x,0,y)
- end
- while wait() do
- for i,v in pairs(gui:GetChildren()) do
- if v.ClassName == "Frame" then
- x = math.random(20, 60)
- y = math.random(60, 200)
- t = math.floor((math.random()*100)-0.5)
- v.Position = UDim2.new(0,x,0,y)
- v.BackgroundTransparency = t
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement