void setup(){
size(400, 400);
frameRate(30);
}
void draw() {
background(220); // Set background color
// Using stroke() and fill()
stroke(0); // Set outline color to black
fill(255, 0, 0); // Set fill color to red
rect(20, 20, 50, 50);
fill(0, 255, 0); // Set fill color to green
stroke(255, 0, 0); // Set outline color to red
rect(90, 20, 50, 50);
noFill(); // No fill
stroke(0, 0, 255); // Set outline color to blue
rect(160, 20, 50, 50);
noStroke(); // No outline
fill(0, 0, 255, 100); // Set fill color to blue with transparency
ellipse(50, 150, 80, 80);
// Using noStroke() and noFill()
stroke(0); // Set outline color to black
fill(255); // Set fill color to white
rect(230, 20, 50, 50);
noStroke(); // No outline
noFill(); // No fill
rect(290, 20, 50, 50);
}
Comments