-
Notifications
You must be signed in to change notification settings - Fork 0
Cheat Sheet
Kyle Hollars edited this page Sep 11, 2021
·
2 revisions
These are some basic shapes used for most projects, as well as some other useful Processing-specific things Feel free to check the processing reference for other shapes.
background(red, green, blue); //set the background color, use at the beginning of draw()
triangle(x1, y1, x2, y2, x3, y3);
rect(x, y, height, width);
circle(x, y, diameter);
line(x1, y1, x2, y2);
if(condition){
//run some code
} else if(condition){ //OPTIONAL
//run some different code
} else { //OPTIONAL
//run some different code
}
while(condition){
//some code to run over & over
}
//This is a comment, it’s written with the code, but not run
exampleFunction(); //All lines end with a “;”
void exampleFunction() { } //or a “{“
exampleNameMultipleWords(); //use camelCase (nameThingsLikeThis, dont_use_spaces, DontCapitalizeTheFirstWord)
if(condition){ //This example is meant to show
while(condition){ //correct indentation. After a { you
rect(10,10,10,10); // should always indent and before
circle(1,2,3); // a } you should always unindent.
}
clear();
}
line(1,3,5,7);