LEGO CAD LEGO CAD: Simple Machines CyberToys Home Page

LEGO(TM) CAD : Creating Your Own Animations

by Ray C. Freeman III, LEGO CAD designer


Other Topics:

Technical Background
Using LEGO CAD With Other Software
Making Tricky Connections


Animated CrankJust because we didn't put any animation features into LEGO CAD doesn't mean you can't create your own - after all, we did!

There are two parts to any animation to be played with the LEGO Motion Player, a series of Bitmaps and an Animation Control File.

First, the Bitmaps. An animation is really just a series of images played back in a certain order. The bitmaps can be created using the Save Bitmap command on the File menu. In Windows this creates a file in .BMP format, while on the Macintosh a PIC file is created.

Before saving any bitmaps, there are a few things to consider. For one thing, the smaller the files, the better performance you will get at playback time. If possible, set your color depth to 16 colors. Only sixteen colors are actually used in LEGO CAD, so you won't be giving anything up. At this color setting, much smaller files are created than at higher color depths.

It is also helpful to make the LEGO CAD window as small as you want the animation to be, so that you aren't saving a lot of extra white space. Again, the smaller the area to be saved, the smaller and more efficient the saved images will be. Only the part inside the Model window is saved, so you can make the images less tall by pulling up the top edge of the Information or Journal window on the PC, or by simply resizing the Model window on the Mac. Unfortunately you can’t really make the window any narrower than the tool bar on a PC and still use the Zoom buttons. When we made the animations that ship with LEGO CAD, we used an image processing program, such as Adobe Photoshop or Paint Shop Pro to trim off the extra white space after saving to make the images even smaller.

In addition to playback speed, another reason to create smaller images is that if your images are too big, they will push the animation controller interface right off the screen when you try to play them back!

O.K., now that you've got your color depth and window sized optimized for creating animations, let's make some bitmaps. Start by building or loading the model that you want to animate. Get it fully in the window by clicking the Zoom All button. If you are going to be moving or rotating elements, make sure that you configure the model to it's maximum extent before zooming. Sometimes I even put temporary bricks out at the far corners of where I plan to move things to just to make sure that Zoom All gives me enough room. Now, turn the Floor On or Off depending on which you want, and click the button for the Display Mode that you want to create you animation with if it is not already set. Save your first image be choosing Save Bitmap from the File menu, and giving it a name like CRANK01.BMP, to indicate that is the first image in the series.

Now, Move or Rotate the part that you want to animate. Before you do this, think about how much motion you want, and how many frames (images) you want to use. To make something spin around 360 degrees, for example, you could do it in eight steps, rotating 360/8= 45 degrees per frame. Before you start rotating, use the + and - keys to set the Rotation Step to the desired value (45 degrees in this example). Use a similar method to figure out how far to move something in each image if you moving things instead of rotating them. Don't get too ambitious at first. Make your first animations by moving things in relatively large steps as an experiment. You'll soon learn what works to achieve the effect you're looking for.


First element selectedIn this example, I want to turn the crank, which causes the axle and the gear to rotate. First, select the axle, because you really want to rotate everything around the axis of the axle. If you start with the crank handle, for example, everything might rotate around it, instead of the long axle.



All rotating elements selectedNext, make sure that you select everything else that you want to rotate by holding down the Shift key and selecting the other items. If you make a mistake and get the wrong elements, press Esc and start again with the first element.



Element rotation buttonsUse these buttons to rotate the selected parts. When you've got them where you want them, click a point on the white background far away from any parts in the model. This will help to avoid moving the parts that you really want to rotate. If you click your final point somewhere near the model, LEGO CAD might find a connector nearby and think that you want to move the elements in addition to rotating them.



Be careful not to use any Zoom buttons after saving the first images, or your animation will probably jump all over the place when you play it back. This is because it's really hard to zoom back to exactly the same place. Even Zoom All is not guaranteed to zoom back exactly the same every time, because you might have changed the overall shape of your model by moving or rotating parts.


CRANK01.BMPCRANK02.BMPCRANK03.BMPSave a bitmap at each frame, using sequential names, like CRANK02.BMP, CRANK03.BMP, etc. This just helps you to remember where you're at. Once you have saved all your images, you are ready to create your Animation Control File so that you can play them back

An Animation Control File is really just a text file with a few special words in it that the Animation player needs to know how to play back your animation. In Windows, you can create this file with any Word Processor or Text Editor that can save plain text files. We use Windows Notepad. On a Mac, use the Simple Text application.

The first line of the text file controls the order in which the files are played back, and must be one of the following words, in all upper case letters: LOOP, NOLOOP, or PINGPONG.

If the first line of your file is LOOP, the animation will play through from the first image to the last, then start again at the first, repeating over and over again until you stop it. This is a good one to use for objects that rotate around and around like the Merry-Go-Round animation.

If the first line of your file is NOLOOP, the animation will play through from the first image to the last and then stop. This is for creating non-repeating animations.

Finally, if the first line of your file is PINGPONG, the animation will play from the first image to the last, the go backwards from the last to the first, back again from first to last, and so on. Note that the images at the two ends, the first and last, are not repeated during playback, or there would be a pause or 'stutter' at that point. If you want to create a pause, use the same image more than once in the image list described in the next section.

The next several lines in your Animation Control File contain the names of the files which contain the images, in the order that you want to play them back. There must be one file name per line. You can use the same file name more than once if you want to use the same image again somewhere else in the playback. On a PC, be sure to include the file extension .BMP as part of the file name.

The very last line of the file should be the word end, in all lower case letters. After typing it, press Enter on a PC or Return on a Mac just to make sure that it is a valid line of text. Your file should now look something like this:

LOOP
crank01.bmp
crank02.bmp
crank03.bmp
crank04.bmp
crank05.bmp
crank06.bmp
crank07.bmp
crank08.bmp
end

Note that this is the file for the eight-step rotation discussed previously. Save the file (as pure text or ASCII text if your program gives you a choice) with the file extension .LMV.

To view your animation, make sure that the Animation Control File is in the same directory or folder as your images, then run LEGO Motion. Use the File Open button to bring up the file dialog and locate and open the file. Once the first image appears, use the Play, Stop, Step Forward and Step Backward buttons and the Speed Slider as usual to view the animation. Good Luck and have fun!


CyberToys, Inc. | The White House Is Our House | LEGO CAD | The CyberToy | Design Thingy | Home Page


©1998 CyberToys, Inc. · 1932 First Avenue, Suite 928 · Seattle, Washington 98101 · (206) 269-0579 fax: 728-2341

This information may be reprinted so long as authorship is credited to Ray C. Freeman III, with the CyberToys, Inc. copyright notice attached.