There are a lot of separate images — each “frame” is one image — but they’re all hidden, except one of them. Which one is visible, just depends on the position of the mouse.
The canvas is (probably) only used to detect the position of the mouse.
If the left coordinate of the mouse position is 0, then the first image is visible. If the left coordinate is between 20 and 30 (or so), the second image is visible. If it’s between 30 and 35, the third image is visible. And so on, and so on.