HTML and CSS Reference
Animating on the Canvas
The player ship we just created has two frames (static and thrust), but we can display only a
single frame at a time. Our game will need to switch out the frame of animation based on the
state of the player ship, and it will need to run on a timer so that this animation can occur.
Let's take a quick look at the code necessary to create our game timer.