Processing Forum
void setup() {It says "... when the mouse is pressed, the screen is cleared via the background() function". This is true; however, if I use that code it also starts me with a grey background that changes to orange on pressing the mouse, because there's no background colour specified in the setup.
size(400, 400);
stroke(255);
}
void draw() {
line(150, 25, mouseX, mouseY);
}
void mousePressed() {
background(192, 64, 0);
}
void setup() {... that way the background is already orange when the sketch runs, and clears the drawing on mouse click back to orange.
size(400, 400);
stroke(255);
background(192, 64, 0);
}
void draw() {
line(150, 25, mouseX, mouseY);
}
void mousePressed() {
background(192, 64, 0);
}