You've seen those animated GIFs (small, fast-loading videos) around the Internet, right? This lesson will allow you to make them using programming. Here's how.
If you made it through this lesson
, you know how to plot things like
points, lines and circles on the screen. An animation is just such drawing, but with the pixel drawn in different positions, across multiple frames, all played back in rapid succession. Got it?
Let's start by making a GIF animation that flashes the screen. We'll use some new functions to handle the animation, called
starts a new animated-GIF.
takes what you've drawn and pushes it all out to a single frame in the GIF.
tells the code to end your GIF animation.
So, to make a GIF-animation, all you have to do is use
to start a new animation, draw a bunch of stuff to make your scene, add it to the movie with
, then draw everything again, but in a slightly different position, then add it all as the next frame, again, using
. When done, wrap it all up using
In this first lesson, we'll learn how to clear a whole frame in your animation, using
Your GIF will play below. You may have to scroll down to see it.
Move the mouse over a dotted box for more information.