I’m trying to figure out what’s the code to make the circles disappear if the mouse is pressed. If you know what it is, please share it! I pasted my code below thanks!
// Lab 3 Question 7
// Write a program that draws a red circle on a black background on the right hand side of the screen and a white circle on a grey background on the left hand side of the screen.
// If the mouse is pressed, the window should reset (the circles should disappear).
void setup()
{
background(255); // White background
size(500,500); // Canvas size is 500x500
noStroke(); // No outline
fill(0,0,0); // Black
rect(250,0,250,500); // Right
fill(100,100,100); // Grey
rect(0,0,250,500); // Left
}
void draw()
{
if(mouseX < 250 == true) // 250 is the middle, so if you move the mouse more than 250 from the black background, it turns white, otherwise it stays red
**if(mousePressed == true) // If the mouse is pressed, it will make the circles disappear ???**
{
fill(255,255,255); // White circle
} else {
fill(255,0,0); // Red circle
}
ellipse(mouseX,mouseY,40,40); // Draws a 40x40 circle wherever the mouse is
stroke(0,0,0); // Black outline
}