Logo type; animating Turtle Graphics. Jim Muller.
Logo Type
Animating Turtle Graphics
Lights! Camera! Action!
There is a little bit of Steven Spielberg or Walt Disney in all of us. Staring at the computer screen, it is very easy to envision all sorts of grand and glorious programs passing before your eyes.
Putting those displays there can be a very intimidating experience, however. Arcade-style graphics are marvels of machine language programming, not something novice programmers can jump into right away. Low-resolution graphics don't have much to offer, and high-resolution graphics get to be a bit complicated.
Logo is a good place to start. It is a very friendly, interactive language that allows even very young programmers to get actively involved with animation very quickly. Sprites are one feature of Logo which can be used for animation. But sprites have distinct limitations. And all versions of Logo don't offer sprites. So let's take a look at what can be done with Turtle Graphics. This feature is in all versions of Logo and several other languages as well.
Last spring, the Young People's Logo Association started out with a relatively simple procedure to develop a picture of Puff, The Magic Dragon. It was a static picture using simple geometric shapes: triangles and arcs.
Some people obviously enjoyed Puff, because soon he was chewing his dinner. Then we received a letter showing us how to make Puff breathe fire. From Australia came a letter changing Puff into a more ferocious dragon. And now, we have a colorful winged dragon eating dinner, breathing fire, and blowing smoke. It has been a lot of fun watching Puff evolve. More importantly, it is a nice simply example of how Turtle Graphics drawings can come alive on the screen.
Animating Turtle Graphics is done much the way animation is done in cartoons. You really have to think about each action you want to have your figure make. In this case, Puff is drawn first with his mouth open. The lower jaw has to be erased and then redrawn again to show the mouth shut. The closed mouth then has to be erased and shown to be open again.
The flickering fire is made by drawing a red line coming out of the dragon's mouth, erasing it, and then drawing it again coming out at a slightly different angle. It alternates between the two angles to give the appearance of flickering flame. The same procedure is used to create the smoke rising from the nostrils.
Sometimes, you have to do a lot of experimenting to get just the effect you want. But that is half of the fun. It is fun to put your ideas down on paper, and then draw them on the computer. This helps you think through what you want to accomplish.
There are some very practical problems you must keep in mind when doing animation in Logo. First of all, remember that the Turtle draws much faster when hidden using HT or Hideturtle. Also, the Turtle draws straight lines much faster than curves. If your version of Logo has a PENREVERSE command, that can speed up the drawing and erasing of lines.
Of course, no Turtle Graphics drawing will move as quickly or as smoothly as an arcade game. Interpreted language can never do things as quickly as machine language programs. But experimenting with and modifying the following programs will give you an idea of what is involved in animated graphics.
Table: Listing.