Processing notes:
| Function | Function |
| size (640, 480, JAVA20); | The standard renderer; this is used if nothing else is specified |
| size (640, 480, P2D); | Processing 2D renderer; this is quicker but less accurate |
| size (640, 480, P3D); | Processing 3D renderer; this is quick and is reliable on the web |
| size (640, 480, OPENGL); | OpenGL renderer: this uses (and requires) OpenGL-compatible graphic hardware. Here the graphic card and CPU share the computational efforts, making it the fastest renderer |
| translate(40, 20);rotate(0.5);scale(1.5); | The coordinate system is moved 40 pixels to the right and 20 pixels downwards, then rotated 0.5 radians (rotation in Processing is in a clockwise direction) and finally scaled by a factor of 1.5 |
| Boolean | Logic values – true or false |
| int | Integers |
| float | Floating point value (decimals) |
| char | A single character |
| String | Character string/text |
| arrays | To manage a list of values, indicated by square brackets [ ] |
| Int roundedValue = round (2.67) | Round a number. The rounded Value is then 3. |
| float randomValue = random(-5, 5); | Produce a random number between -5 and 5 |
| float cosineValue = cos(angle); | Calculate the cosine of the specified angle |
| mouseX, mouseY | Calculates the exact coordinates of the cursor |
| mousePressed | True if one of the mouse buttons is pressed |
| keyPressed | Indicates if a key is pressed, the last key pressed appears in key |
| mouseReleased() | When the mouse button is released |
| Event handlers | They are called when the corresponding event occurs – i.e. when a mouse button or key on the keyboard is pressed |
| mouseMoved() | When the mouse is moved |
| Conditions | If, if… else, |
| Switch command | To differentiate between multiple values of a variable |
| loops | Used to execute a particular command several time within a programme |
| For loop | For a loop to be executed a particular number of times |
| While loop | Continues till a certain condition is fulfilled |
| function | Parts of a programme that appear in a similar way in different places |
| noCursor() | Makes the cursor in the display window invisible |
| width | System variable – uses the width of the defined canvas |
| height | System variable – uses the height of the defined canvas |
Resources:
