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?
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
2 Likes
thank you this helps a lot
1 Like
Short form:
if( ! mousePressed ) {
1 Like