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.

Welcome to the forum!

Have you discovered the reference?

See https://www.processing.org/reference

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

Idea

say something like :

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

Remark:

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

e.g. see here: https://www.processing.org/tutorials/overview/

Remark:

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

Here is an example:

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

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

Come back here to ask more questions.

Chrisir

thank you this helps a lot :slight_smile:

1 Like

Short form:

if( ! mousePressed ) {