ANIMATION THE EASY WAY
by STEVE BLAIR
Original walking man art scanned from "Male And Female Figure in
Motion" by Eadweard Muybridge; cartoon overlays by Jon Bell.
Walt Disney started his first cartoon with a pencil and paper-he didn't have the graphics power of an Atari ST for smooth movement and flicker-free animation. But with Steve Blair's sprite editor, The Cartoonist, you can be cranking out your own Silly Symphonies in no time! You'll find the program, along with a complete demonstration, on your START Disk.
You'll find the program for this article in the file CARTOON.ARC on your START Disk.
One of the main reasons I purchased an ST was the graphics capability. The STs special graphics hardware coupled with its 68000 processor should make smooth and flicker-free animation a reality.
Animation is performed by moving an image on the computer screen. That sounds easy, but it's not. Whenever an image is moved, it must be erased and the background restored before it can be repositioned. An image can also have many different frames associated with it; these frames are displayed one after another to create more realistic movement. Imagine a person walking across the screen; in addition to moving the image, the different poses must also be displayed in sequence.
The ST's operating system has routines for animation, but unfortunately they are difficult to use and slow when manipulating more than a few objects. The Cartoonist is a sprite editor that lets anyone with a little artistic talent do low-resolution animation quickly and easily.
A SPRITELY BEGINNING
What's a sprite? It's a small chunk of a picture. Once you've drawn a sprite, you can move it around the screen easily as a block. The Cartoonist lets you design and manipulate a sprite of any size. However, it only works in low resolution, and it requires a color monitor.
To use the Cartoonist, first copy CARTOON.ARC to a fresh disk, along with ARCX.TTP. Run ARCX, and when the Open Applications box appears type CARTOON .ARC and press the Return key. Your disk drives will whir, messages on the screen will let you know that files are being uncompressed, and soon you'll return to the Desktop with a runnable version of the program, CARTOON.PRG, on your disk.
When you run CARTOON.PRG, you'll see four menus and a number across the top of the screen. The number tells you how many bytes of memory you have free. The four menus arc Desk (which gives you access to desk accessory programs), File, Sprite and Options.
The File menu contains six options. Load Pic lets you load a DEGAS low-res picture into Cartoonist as your background screen; Save Pic saves the current screen as a DEGAS picture. Load Sprites loads an animation sequence into memory (and wipes out any sprites that are already there); Save Sprites saves an animation sequence. Delete. lets you delete files from your disk- very useful, since animations can be long and you may have to make extra room. Quit lets you leave Cartoonist and return to the Desktop.
The Sprite menu has five options that let you define animation sequences. Define Sprite lets you cut out part of the screen to use as a sprite. An open hand will appear; you simply press the left button on the upper left corner of the desired image and drag the resulting "rubberbox"to the lower right corner. Set Current Sprite lets you choose which of the program's 16 sprites you're working with (they're numbered 0 through 15). Define Frame lets each sprite have up to 16 different frames, numbered 0 through 15; the first frame is the sprite as you first defined it. In an animation, the sprite will flip through the frames in order. (If this seems confusing, well get to an example in a moment.) Show Numbers displays each sprite number and frame number on the screen near the sprite, and Delete Sprite completely removes the current sprite from memory.
On the Options menu there are six options. Set Priority lets you set a sprite's priority level, from 0 to 15. A sprite with a priority of one will overlap a sprite with a priority greater than one. If a sprite has a priority of zero, it will appear only through holes in the background; a hole is the background color of the screen. Display Sprite lets you select which sprites to display, and Display All displays all the sprites. Select All lets you drag all the sprites around the screen at once using the mouse; Select One (the default) lets you drag just one sprite at a time. Display Speed shows you how fast the current animation can be shown, in frames per second. The number appears in the upper right-hand corner of the screen; the default is Display Free, which shows how much memory is available. Clear Screen clears the screen except for any sprites displayed; the screen will reappear if you select Restore Screen.
USING THE PROGRAM
You can see exactly how the program works by building a simple animation yourself. On your START Disk you'll find a DEGAS picture called WALKER.PI1; it contains a series of views of a man walking. To create an animation, first load the picture using Load Pic from the Files menu. Next, make sure the current sprite is 0 with Set Current Sprite. Select Define Sprite and drag a box to surround the first view of the man (be sure you leave enough leg room for the other views). Once you release the mouse button, you can position the window and then click again to define the sprite. (You may have to hold down the mouse button for longer than usual when you click.) You can display the sprite with Display Sprite, and drag it around the screen by holding down the left mouse button as you move the mouse.
Now click on Define Frame, and choose frame number 1. You'll see a shadowed version of your sprite. Position it over the second view of the man, and click again. Now define frames 2 through 13 in the same way- positioning the shadow figure and clicking to define the frame.
Now you can flip through the frames of your animated sprite. First click on Clear Screen. and drag the sprite to the middle of the screen. Then hold down the right mouse button, and you'll see the man walk as the sprite flips through its frames. (You can move the sprite around as it flips by holding down both the left and right mouse buttons and moving the mouse.) Next. save the animation sequence by clicking on Save Sprites in the File menu-for the moment, type in the filename WALKER.ANI. Finally, leave Cartoonist by selecting Quit on the File menu.
Once you're back at the Desktop, you can run your animation sequence separately by double-clicking on DEMO.PRG. When the file selector appears, choose WALKER.ANI, and the Demo program will flip through your animation automatically. Press any key to return to the file selector box, then either load another sequence or click on Cancel to exit. You can also use this program to see START's sequence of a walking man; the filename is DEMO.ANI. When you run DEMO.PRG, you should make sure it is on the same disk as the sequences you wish to run.
THE DISNEY SYNDROME
The Cartoonist isn't a tull-fledged animation program, but it does have one big advantage for programmers: You can use these routines to create simple animated sequences in your own programs. You'll find the source code for the sprite editor and DEMO.PRG, along with explanations of how the routines work and how to use them in programs, on your START Disk.
If you're a programmer, these routines will make your programs flashier and easier to write. If you're not a programmer, Cartoonist is an easy and fun way to put together your own animations!
If you would like more articles like this, circle 272 on Reader Service Card.
Steve Blair is a college student who lives in Terre Haute, Indiana.