
Ever wonder how I made this animation (or any of these)? You'll learn how in this tutorial, including a detailed behind-the-scenes look.
How do you make animations that behave in a realistic way?
Last updated: Apr 10, 2006 (first version)
Level 2 update on Jun 10, 2007 (a few small changes here and there)
This section covers scenery creation, how to make the scenery, tips and how to best optimize looks and download time, and tricks for getting accurate 3D effects.
1 Some important notes
When creating the scenery, there are some important things to consider. The biggest is file compression. GIF files are compressed so they take up less space to store than a regular BMP file would. If you saved an all-white file as GIF, you'd have a very small file size (a few hundred bytes), even if 640x480. If you saved a big mess of random noise as GIF, even a 160x120 image will be 10 kilobytes in size or more. In short, the more detail you have, the lower the compression and the bigger the file will get. A bigger file will take longer to download and use up more bandwidth on your website (especially a concern when using free webhosts). This is why I have plain-looking animations without much detail or antialiasing.
When it comes to lighting, a solid, monotonic lighting is better for compression. Normally, I use a two-tone lighting for mountains, and more enhanced for the character (since the character rarely changes, GIF optimizations will boost the effectiveness more significantly since unchanged areas become one color, that used to denote transparency). Of course, having a sky with the fade to white near the horizon makes it more realistic. This, however, will increase the file size. Our sky will use 4 or 5 stages where, from white, 4 steps are taken toward the actual sky color, 4080FF. These kinds of things need to be worked out when creating the scenery.
For best effects, do the scenery and fine-tune it. To test it's effectiveness, save it as GIF and check the file size. Make a modification of some kind and save the modification as GIF (under a different file name) and check the file size. This way, you can fine-tune the animation to look decent and have the smallest expected file size. Balancing file size and looks is important, especially if using a free webhost. Use dithering in a checkerboard pattern of nearly identical colors to help some. If having the sky looking more realistic has little change on the file size compared to the same thing only with a monotonic sky, then use the more realistic version if you want. For making these small tests, it's wise to create a special test layer. If the change in file size is very large, then avoid using it, unless you really want it. By having the computer automate the scene generation, you can fine-tune it to a very extreme level of detail.
Anyway, enough with the important notes. Let's start making the scenery.
2 The easy stuff
2.1 The sky
The easy parts are the lake and basic fog layers. They're easy for one reason - they're all one color. First though, let's create a new image, 320x240 as our plan was. For the background layer, we'll have the sky. It doesn't move. The top half of the image for the sky is the most important. The bottom half, since it is below the horizon where the ground is, is the fog color, 4060FF. For the start of the fade, we must know where the horizon is. The horizon is the halfway mark from the top of the image to the bottom. Since the bottom 120 pixels will be the fog color, we'll have the top 120 as our fade. The bottom of the top half is at position 119. I use a doubling-up fading system for simple skies where, for every time you double your height, you go one more step closer to the sky color. A sine curve seems to be much more accurate but we won't get into that. The color to use is determined from using the color-averaging formula. At the bottom, it's 4 parts FFFFFF, 0 parts 4080FF. Above that is 3 parts FFFFFF an 1 part 4080FF which gives CFDFFF. Next is 2 parts FFFFFF and 2 parts 4080FF which gives A0C0FF. Then it's a 1:3 mix giving 70A0FF then a 0:4 mix giving the sky color, 4080FF. At this time, here's what we have:

2.2 The fog layers and the lake
The fog layers are easier than the sky is. For the fog layers, we need to create new layers. The closest layer is not affected by fog. The layers after that are. The color of the ground is 40C000. The fog colors are determined with the fog formula and by the closest part (the boundary). This makes the second fog layer based on a distance of 100 (visibility is 600, remember?). The next closest is based on a distance of 200 and so on. The lake is unaffected by the fog and since it isn't visible until the end, hide the lake layer. By using 50, 150, 250, etc. for the fog scaling steps, it's more realistic, but we won't get into that - this method is easier to work with.
The mountains layers also have fog at the bottom so they aren't much different. At this point, we have this:

3 The mountains
3.1 The colors and basic concept
Unlike with the fog, the mountains are a bit more complex. There's not only horizontal scrolling of the mountains, but the system used to make them is different as well. First, choose the fully-lit color. I'll use C06030 as the color. For the darker color, rather than working out the lighting formula, I use 1/2 the brightness which means 603018. Don't bother with the fog yet.
3.2 Processing the mountains
Because of the horizontal movement, the method used to make the mountains is different. Rather than the usual 320 pixels wide, we need a wider view, but how wide? That's where the spreadsheet comes in handy. Look at the column for the x position for the mountains and find the largest number. Ignore the trash after the decimal. The edge is 50.75 for the closest mountains and 40.6 for the furthest ones. This means that the closest mountains need an additional 50 pixels (always add a few extra to be safe in case of changes in the plans - we'll go with around 55 extra) and the furthest mountains need an additional 40 pixels (we'll go with 44 extra for these). So, instead of 320 pixels wide for the two layers, the closest will have 320+55 or 375 and the furthest will have 320+44 or 364. You may resize the image temporarily to cover this, but be sure you revert back to 320x240. Then draw the mountains.
To determine how high you want the mountains, just take the pixel count and multiply by the scaling to get the equivelent height in pixels if at a scaling of 1. That is, if 45 pixels high, the closest mountains, with a scaling of 400, will have a height of 18,000 pixels. This means 18,000 coordinate units which converts to 2640 feet high. To convert from coordinate units to feet, multiply by 11/75, which is an exact value. To convert from feet to coordinate units, multiply by 75/11 instead. To convert feet to pixels, first convert to coordinate units then divide by the scaling. If I wanted the mountains 8000 feet high, for example, the peak of the closest mountains would be 136 4/11 pixels (considered as 136) and the furthest would be at 109 1/9 (considered at 109). Since 40 pixels high is 1/3 the height of the image from the horizon to the top, that's pretty big.
3.3 Adding the perspective effect
The furthest mountains, because of extra distance should be drawn smaller. The size is determined with the simplified 3D formula or just using the scaling. The closest mountains have 400 for the scaling. The furthest have 500. 500 is 5/4 more distant so that means that the furthest mountains, being smaller and more distant, need to be 4/5 the size. So, instead of 40 pixels tall, they'll be 32 instead. Don't forget to add the rest of the ground fog to the right. At the end of drawing the base plan, of which I used 60 as the maximum height of the closest mountains, (48 for the furthest), this is what I have:

3.4 Adding the fog
Once you've completed the mountains, it's time to add the fog. The closest mountains have a scaling of 400 and the visibility is at 600. This means having to use the fog formula to determine the resulting color. The furthest mountains have a scaling of 500 so the fog is more intense on these. After doing this, the mountains are now done. If you changed the image size, don't forget to resize it back to 320x240 but do not change the size of the layer. After completion of the mountains, this is what I have:

3.5 A small change of plans
The mountains don't quite look right in terms of the fog effects. Rather than using 4060FF as the fog color, I'll match the sky, which is 4080FF. This means changing that of the other fog layers as well. When doing the scenery before starting the animation, you can change your plans around as needed. Once you start animating, only small changes can be made without much concern. Fixing a mistake in the scenery could mean redoing the entire animation so it's good to make sure you spot these mistakes. In my case, it's changing the fog color. A change like this would easily mean having to redo the entire animation from the start. Here's what I get after changing the fog color to that of the sky:

Along with changing the fog color, I noticed a few mistakes I made myself. The color used for the ground, the fog layers, had the wrong green value (due to some miscalculation somewhere) for the mountain layers. Fixing these otherwise simple mistakes is important before starting the animating. Next up is the character used.
4 Making the character
4.1 Planning
We first need to decide the scaling to use, or just draw something at random and base it off this. We'll set our character to a 1 scale making each pixel on him equal to 1 coordinate unit. Humans are normally anywhere from 5 feet 6 inches to 6 feet 2 inches tall for a typical adult. We'll use 5 feet 9 inches and round to the nearest integer. 5 feet 9 inches is 5.75 feet which converts to slightly over 39.2 coordinate units. At a scaling of 1, this means that he needs to be 39.2 pixels high or just 39. However, we also have to adjust for the hair since that is often dropped out of height measurements. So, create a new layer for the character (use the full image size, 320x240).
In our animation, the character will float run, jump, fall, and stand. We need a layer for each. I mark the layers as "char [action]" where action without the brackets denotes the action the character is doing for that layer. "Char jumping" is used for the jumping one. Name the layers whatever you want.
Besides just knowing the measurements needed and types of actions to depict, we need to decide on the colors to use and type of clothing as well. I'll leave that up to you to decide. The skin color I'm using is D09880 (or ######). The T-shirt is white (FFFFFF (or ######)), which is common, and the shorts will be the color of the sky, which is 4080FF (or ######). The hair is 503020 (or ######), a dark brownish color. Avoid adding decals to the clothing as it'll increase the file size by a considerable amount. By matching the colors to those used in the image, you can save a bit on the resulting file size, especially if you use local palettes. The effect is miniscule if using a global palette (saving 9 bytes for 3 colors versus a few kilobytes (9 bytes per frame times 300 frames means 2700 bytes saved))
4.2 Centering the character
To center the character horizontally, of which I almost always do, there's two decent methods. The first involves a small and simple mathematical calculation. First, measure the character using the select tool. The select tool is, strangely enough, the best way to measure. The standing version is 11 pixels wide. Take half of this, which gives 5.5. Since a fraction is involved and you can't have a fraction of a pixel (without simulating it through anti-aliasing), what I do is have the offset based on the direction the character is facing. Since he faces to the right, 6 pixels will be to the right of the halfway mark and 5 will be on the left. Find this position and move the character to half the width of the image, 160 in my case. The vertical depends on how you want to do it. In my case, I'm having it set to human-eye level based on the standing position.
After doing all four actions, and cropping the layers, I have this:

4.3 A small adjustment to the spreadsheet
Since we now know the character's size, we can make one adjustment, the starting Y position. To find this value, use the select tool and the standing action and find out how many pixels are from the horizon downward. Divide this value by the scaling used, 1 which means I use 35 instead of 20. Change the content in cell N5 from 20 to 35. This is the only change we can make at this point.
5 Adding the obstacle and speed data
The last thing for creating the scenery that remains is adding the obstacle. This is very easy to do, now that we know the character's scaling. The plan called for the rock to be about 2 feet high with an abrupt angle change. 2 feet high converts to 13 7/11 coordinate units and pixels, which rounds to 14 meaning that the rock needs to be 14 pixels high. Finally, the last thing needed is the speed data. This is easily done with a text object (be sure to avoid using antialiasing as doing so will have a very serious impact on the file size - you may use hinting and the force auto-hinter options as they don't add antialiasing-like effects, I'd suggest using hinting). This screenshot shows what it looks like at the end.

The scenery is now done, at least to what the main plan called for. With the scenery done, it's now time to get the frames for the animation.
3.2.3 Animation creation tutorial - how I make my flash-like animated GIFs to the finest detail
3.2.3.1 Introduction - The indroduction and tools needed
3.2.3.1-1 Introduction
3.2.3.1-2 Tools used
3.2.3.2 History - The history of my animation creation
3.2.3.2-1 The AVI days
3.2.3.2-2 MSPaint and early animated GIFs
3.2.3.2-3 GIMP and my latest animations
3.2.3.2-4 Automation leads to extreme complexity
3.2.3.2-5 Discoveries made along the way
3.2.3.2-6 The future
3.2.3.3 Glossary of terms and common formulas - Common animation-related terms and common formulas involved with art
3.2.3.3-1 Glossary
3.2.3.3-2 Commonly used formulas
3.2.3.4 Planning - Forming the plan - what the animation will do and how to set up the spreadsheet
3.2.3.4-1 The base plan
3.2.3.4-2 The main plan
3.2.3.4-3 The detailed plan
3.2.3.5 Creating the scenery - Making the scenery - how to optimize it and work with it
3.2.3.5-1 Some important notes
3.2.3.5-2 The easy stuff
3.2.3.5-3 The mountains
3.2.3.5-4 Making the character
3.2.3.5-5 Adding the obstacle and speed data
3.2.3.6 Animating - Processing the frames - using the spreadsheet data to make the frames of the animation
3.2.3.6-1 Important notes
3.2.3.6-2 Doing the text objects
3.2.3.6-3 The first scenery frames
3.2.3.6-4 Further scenery frames
3.2.3.7 Testing - Testing the animation - how to test the animation to spot problems
3.2.3.7-1 Compiling the animation
3.2.3.7-2 Testing the animation
3.2.3.8 Tips and tricks - Tips, tricks, and shortcuts to make animation-creation easier and faster
3.2.3.9 FAQ - Some commonly asked questions and help to common problems
Footnotes:
None.