Processing day 1 — Getting started

Hello world!

First day learning Processing https://processing.org

First, I’m a noob. Second, I’m not a English native. I’m documenting everything here so I can look at it later, sort of like a journal.

The first tutorial: https://processing.org/tutorials/gettingstarted/

Every scripts need this to set it up (because void setup() — haha…ok)

void setup(){
size (480,320);
}

I think the code should be indented for the sake of reading it later, but I can’t do it :(

Then the second method:

void draw(){
if (mousePressed){
fill(0);
}else{
fill(255);
}
ellipse(mouseX, mouseY, 80,80);
}

if(mousePressed)//when you press the mouse

{ fill(0);

//fill it black. The full syntax goes like this fill(0,0,0) meaning fill(red, green, blue). And black’s rgb value is red=0, green=0, blue=0, so for convenience, just write 0. The syntax reference for fill is here.

}

else

{ fill(255);

}// if you don’t press the mouse, it’ll fill it white.

if (something happen){
do this;
)else {
do this if that something doesn’t happen;
};

ellipse(mouseX, mouseY, 80, 80);

//draw an ellipse;

//having ellipse(a, b, c, d) — a, b are position of the ellipse, in this case mouseX, mouseY mean wherever the mouse is. c,d are the size of the ellipse. c is height, d is width.

}

That’s it.