O'Reilly logo

Make: Getting Started with Processing, 2nd Edition by Ben Fry, Casey Reas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Motion

Like a flip book, animation on screen is created by drawing an image, then drawing a slightly different image, then another, and so on. The illusion of fluid motion is created by persistence of vision. When a set of similar images is presented at a fast enough rate, our brains translate these images into motion.

Frames

To create smooth motion, Processing tries to run the code inside draw() at 60 frames each second. A frame is one trip through the draw() and the frame rate is how many frames are drawn each second. Therefore, a program that draws 60 frames each second means the program runs the entire code inside draw() 60 times each second.

Example 8-1: See the Frame Rate

To confirm the frame rate, run this program and watch ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required