Hi sorry to ask such an elementary question but I am new to processing and really need help. Suppose I run this code this in Processing:
void setup ()
size (400, 400);
void draw ()
// pmouseX, pmouseY: previous pointer coordinates
// mouseX, mouseY: current pointer coordinates
line (pmouseX, pmouseY, mouseX, mouseY);
It will use the variables to draw a line that follows the movement of the pointer around the program window. I need to modify the code so that Processing clears the screen whenever I click the mouse button. Any advice would be greatly appreciated, Thank you.
[Moderator's note: I renamed the title from "Question need help asap" which isn't informative at all on the nature of the question... Also marked the thread as answered, even if very few people do it actually...]
Thanks to everyone for leading me to the references, however like I said I just started using Processing a couple of weeks ago, I cannot really make much sense of it. So if anyone can give me a tip or a pseudo example of this problem please do, Thanks!
mouseReleased() is called whenever a mouse button is released (surprisingly enough) so you can just put a background() call in it to clear the screen. Add something like this to your code after the end of your draw() block should work: