0% found this document useful (0 votes)
4 views1 page

RGB Line

Uploaded by

gregorydcfake
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

RGB Line

Uploaded by

gregorydcfake
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

local function hsv2rgb(h, s, v, a)

local r, g, b

local i = math.floor(h * 6);


local f = h * 6 - i;
local p = v * (1 - s);
local q = v * (1 - f * s);
local t = v * (1 - (1 - f) * s);

i = i % 6

if i == 0 then r, g, b = v, t, p
elseif i == 1 then r, g, b = q, v, p
elseif i == 2 then r, g, b = p, v, t
elseif i == 3 then r, g, b = p, q, v
elseif i == 4 then r, g, b = t, p, v
elseif i == 5 then r, g, b = v, p, q
end

return r * 255, g * 255, b * 255, a * 255


end

local function rgb2rainbow(rgb_split_ratio)


local r, g, b, a = hsv2rgb(global_vars.realtime * 0.1, 1, 1, 1)

r = r * rgb_split_ratio
g = g * rgb_split_ratio
b = b * rgb_split_ratio

return r, g, b
end

function on_paint()
local r, g, b = rgb2rainbow(1)
local a = 255

local screen = {render.get_screen_size()}

local thick = 5

for i = 0, thick do
ap = 255 - a * (i / thick)

render.rect_filled_multicolor(
0, i, screen[1] / 2, i + 1,
render.color(g, b, r, ap), render.color(r, g, b, ap), render.color(r,
g, b, ap), render.color(g, b, r, ap)
)

render.rect_filled_multicolor(
screen[1] / 2, i, screen[1], i + 1,
render.color(r, g, b, ap), render.color(b, r, g, ap), render.color(b,
r, g, ap), render.color(r, g, b, ap)
)
end
end

You might also like