Fill, Stroke, and Background
We’ve been able to change the color of our shapes, but did you notice that they always have a black border around them? What if we want to change that?
Luckily, there’s another function that can help us with this. It’s called
stroke, and it works a lot like
fill; the only difference is that it changes the color of the border instead of the center:
Sets the color used to draw lines and borders around shapesLearn More
So, if we wanted to make a face with red lines we might type something like this:
stroke(255,0,0); ellipse(25,30,30,30); ellipse(75,30,30,30); rect(20,60,60,20);
What if we want to change the background? Turns out there is another function for that as well, called
background. It also works just like
stroke, but it changes the color of the entire background.
The background() function sets the color used for the background of the Processing windowLearn More
So, if we wanted to make a face with a purple background, we might type something like this:
background(255,0,255); ellipse(25,30,30,30); ellipse(75,30,30,30); rect(20,60,60,20);