Let's develop a tool that can create an animation and display it on the screen. This tool will create and display the animation using the given image files. Each of the image files will be displayed as a frame in the animation for a specified amount of time. This is going to be a fun little animation that shows a grandfather clock with a pendulum. We will animate the pendulum oscillations with other things, including making the dial remaining still. This animation has only three image frames; two of them show the pendulum at opposite extremes. These images are sequenced as shown in the next illustration.
Clock image frames to be animated appear in the preceding image.
Download the file
ImageSequenceAnimation.py
from the Packt website.The code in this file is presented below.
1 import pyglet 2 3 image_frames = ('images/clock1.png', 4 'images/clock2.png', 5 'images/clock3.png') 6 7 # Create the list of pyglet images 8 images...