Sign InCoursewareNuggetsTutorials AboutClassesCodePad

Animation with Pygame

Do you know how animation is created?

Like magic, it's an illusion -- an illusion of motion, to be more specific.

In this unit, you will understand how to create such illusion with computers by rapidly displaying a sequence of images that only differ a little bit from each other.

Frames and Frame Rate

We briefly mentioned the concept of frame rate in the pygame introduction. A frame is simply a static image from the sequence of images (frames). The frame rate determines how fast these images will be displayed -- think of that as the speed of the animation. Concretely, we use frames per second (FPS) to measure the speed.

Lights, Camera, Action

Here is a bouncing ball animation. It's created by displaying six frames at 10 frames per second.

© CS Wonders·About·Classes·Cheatsheet