June 2010
Beginner
210 pages
3h 45m
English
Code that responds to input from the mouse, keyboard, and other devices has to run continuously. To make this happen, place the lines that update inside a Processing function called draw().
To see how draw() works, run this example:
voiddraw(){// Displays the frame count to the Consoleprintln("I'm drawing");println(frameCount);}
You’ll see the following:
I'm drawing 1 I'm drawing 2 I'm drawing 3 ...
The code within the draw() block runs from top to bottom, then repeats until you quit the program by clicking the Stop button or closing the window. Each trip through draw() is called a frame. (The default frame rate is 60 frames per second, but this can be changed. See Example 7-2: Set the Frame ...
Read now
Unlock full access