`Hi guys. This is a code that I call the shading affect. I think it is very cool and I hope you enjoy.
--The Shading Affect
-- These lines happen at the start to setup the program
function setup()
background(0,0,0,255) -- This sets the background color to black
s = 700 -- This sets the size to a variable that we can change
x = WIDTH/2 -- These set the x and y coordinates to a number that we can change
y = HEIGHT/2 -- during the code. These values make the shading affect.
one = color(255, 0, 247, 255) -- These next 4 lines set the colors. We need these so that it doesnt
two = color(255, 0, 6, 255) -- glitch after the end of the shading affect.
three = color(255, 140, 0, 255)
four = color(255, 255, 255, 255)
end
-- These lines of code get called 60 times per second
function draw()
ellipse(x, y, s) -- All of the 4 sets of code (staring will ellipse and ending with s =) are very
fill(one) -- similar. they all create an ellipse at ("x","y") with the size of "s". This
y = y+1 -- allowes the circle to be differnt every time. Then it either adds or subracts 1
s = s-0.5 -- from "x" or "y". This makes the circle change it's postion evry time and makes the
ellipse(x, y, s) -- shading affect. Next it reduces "s" (the size) by 1 so the next is a bit smaller.
fill(two) -- This repeats until the value "s" gets to 0.
x = x+1
s = s-0.5
ellipse(x, y, s)
fill(three)
y = y-1
s = s-0.5
ellipse(x, y, s)
fill(four)
x = x-1
s = s-0.5
if s == 0 then -- This is checking if the size of the circle is 0. If it is 0
one = color(255, 159, 0, 0) -- then change all the colors to transparent so we cant see them.
two = color(255, 255, 255, 0) -- Feel free to change the colors at the top to make your own,
three = color(255, 255, 0, 0) -- unique circle. Hope you enjoy.
four = color(255, 197, 0, 0)
end
end