Animation and Keyboard

We certainly did a lot of drawing in the previous chapter, and you might have noticed that drawing pictures slowly actually creates a short animation of the image in its making. Unfortunately, the approach was a rather crude one and you might also have noticed many shortcomings of given programs.

For example, those programs could not be interrupted before the drawing was completed. Not only that they cannot be interrupted, but no user input is possible at all while the image is being drawn. This might annoy us if we would like to terminate the drawing of the image early, and it might annoy potential users, too.

In this chapter we will present a different and more flexible approach for creating animations. The programs will be drawing a quick succession of images, each one slightly different from the previous. The programs will also be keeping track of time so that they can draw the appropriate image at the right moment. Finally, between drawing and displaying each image, the programs will be able to process the input from a user.