Need help with very simple animation new to processing

hi I’m really new to processing and I’m just wondering how I could make something like a rectangle for example disappear when I click and come back when I stop holding the click
if anyone could help me with this I would be really grateful.

1 Like

Welcome to the forum!

Have you discovered the reference?


Look at mousePressed (without the brackets (), there are two different kinds of mousePressed)


say something like :

if(mousePressed == false) {
    //draw rectangle here


Also look at the tutorials section and read the first three text tutorials

e.g. see here:


You need the functions setup() and draw() to make an animation.

Here is an example:

     void setup() {
       size(400, 400);
       background(192, 64, 0);

     void draw() {
       line(150, 25, mouseX, mouseY);

Come back here to ask more questions.


1 Like

thank you this helps a lot :slight_smile:

1 Like

Short form:

if( ! mousePressed ) {