Clearing what is first drawn...
in
Programming Questions
•
9 months ago
Hello.
Is there a way to clear/delete what is drawn at the very beginning when the sketch is run?
In other words, when this sketch is run, that rectangle at the top left corner is drawn due to the way in which the program runs, I believe. And I would like to know if there is a way to clear/delete that first object (rectangle).
The code is very simple to illustrate this question. I basically would want the Display Window to be in the background color and nothing drawn until the mouse is brought into the Window.
If there is a way around this, please advise! Thank you very much.
- void setup(){
- size(400,400);
- background(100,0,0);
- }
- void draw(){
- stroke(2);
- fill(130, 100);
- rectMode(CENTER);
- rect(mouseX, mouseY, 50, 50);
- }
1