October 2015
Beginner
246 pages
4h 6m
English
Code that responds to input from the mouse, keyboard, and other devices depends on the program to run continuously. We first encountered the setup() and draw() functions in Chapter 1. Now we will learn more about what they do and how to use them to react to input to the program.
The code within the draw() block runs from top to bottom, then repeats until you quit the program by 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.)
To see how draw() works, run this example:
functiondraw(){// Displays the frame count to the console("I’m drawing");(frameCount);}
You’ll see ...
Read now
Unlock full access