facebook google plus twitter
Webucator's Free Adobe Flash CS6/CC Tutorial

Lesson: Basic Animation

Welcome to our free Adobe Flash CS6/CC tutorial. This tutorial is based on Webucator's Introduction to Flash CS5 Training course.

So far, much of what we have learned could be applied to graphics programs like Photoshop. Everything you have learned has been static. We have not yet seen any animation.

In this section you will learn the key Flash features that have made it such a great animation tool!

It can be a little intimidating to learn Flash. For most people, it is the first time working with timeline animation. This adds a layer of complexity that still graphics do not have. Don't worry, if you take it step-by-step, you will get it.

Lesson Goals

  • Learn to understand and organize a Timeline.
  • Learn to animate using keyframes.
  • Learn to use Motion Presets.
  • Learn to animate filters.

Understanding the Timeline

The timeline is a matrix of frames and layers. Think of it like a spreadsheet where A1 is the first cell. The letter refers to the column and the number refers to the row. In Flash it is analogous, but the columns are called frames and the rows are called layers. The Frame numbers appear across the top of the timeline and the layer names go down the left column. The animation plays from the beginning to the end based on placement of objects along the timeline. Code, called ActionScript, can alter that timeline; this would be the trademark of a more complex animation. We will focus on a basic left-to-right timeline animation.

The red playhead selects which part of the timeline is visible on the stage. Open BasicAnimation/demos/FrameByFrame.fla and drag the playhead back and forth. This is called scrubbing the timeline.

Keyframes are the only frames you may edit. All Keyframes have small circles on them. Keyframes with visible content have solid circles while blank keyframes have hollow circles.

Click on the several different keyframes and watch the content on the stage change. You can hide or lock any layer by clicking on the dot under the eyeball (to hide) or the lock (to lock). Click on the eyeball or lock directly to hide or lock all layers at once.

In Photoshop hidden layers are not part of an exported file, but in Flash they are. Even hidden layers will be included in the exported document (unless you change this in the Publish Settings).

Organizing Layers in a Timeline

When dealing with the timeline and the order of the final animation, the order of layers matters. The higher the layer in the stack, the higher the content will appear. It is like stacking several transparencies on an overhead projector.

One important difference between Photoshop and Flash is that in Photoshop if you click on a layer, that layer is active and selected until you select a different layer. In other words, if you try to click on content from a different layer, Photoshop will not change to the other layer. You would have to select the layer first.

Flash is different. When you select content on the stage, Flash will change to the layer the item is on - unless that layer is locked, at which time you would not be able to select the content.

It is important to minimize the number of items on each layer. Many animation types require that only one item be on the layer in order to properly animate.

Layers should also be named appropriately as at the moment of creation, your organization makes sense, however, 6 months from now when you need to edit a .fla file, the process might not make sense. By taking the time to plan, organize, and name layers, you will save yourself valuable time in the future.

About Animation

The idea of timeline animation goes back to flipbooks. If you ever made a flipbook you were doing frame by frame animation. Each frame appears on the screen for a fraction of a second. Typical frame rates are from 15 to 30 frames per second. By using 15 frames per second timing, you are making each frame visible for 1/15 of a second. Beyond about 30 frames per second, the computer cannot display more information and your eye stops being able to see the difference.

Demo: Frame by Frame Animation

The following demo is saved as BasicAnimation/demos/FrameByFrame.fla. Take a look at the timeline. You will notice two layers (named number and back) and a timeline which spans 50 frames. Note the keyframes on the number layer.

Drag the playhead from the beginning to end. This will give you a sense of how the movie will play. But, did you drag too fast or too slow? How fast will the movie play? The Properties Panel shows that this movie will play at 24 frames per second. That means it will last about 2 seconds.

If you press the Enter key (or Return on a Mac) you will see the timeline in action as Flash moves the playhead for you.

Hide the back layer and the blue box will disappear. Hide the number layer and the numbers will disappear.

Adding Frames, Keyframes and Blank Keyframes

As mentioned earlier, only keyframes are editable. That means, when you want to build an animation, you will need to add keyframes to the timeline at the point in time in which you need to make an edit. There are two main ways to do this. First, you can right-click at the junction of the layer, and frame, and then choose Keyframe from the shortcut menu. Or, you can choose Insert > Timeline from the menus once you have pre-selected the proper layer and frame. The following are shortcuts you may use to add different types of frames:

  • Insert Frame (F5): This adds frames that extend from the previous frame to the selected frame. It extends content on the stage, but these frames are not editable.
  • Insert Keyframe (F6): This adds an editable keyframe, but it also copies any content from the previous keyframe. This is helpful in animating objects since it gives you another instance of the object to work with.
  • Insert Blank Keyframe (F7): This also adds an editable keyframe, but it will be blank. This is useful if you have ended an animation and want to start with nothing in that frame.

Animating Position: Frame-by-Frame Animation

Open the following demo saved as BasicAnimation/demos/FrameByFrame-car.fla. You will find that a car is being animated across the screen. Every 5 frames or so, the car moves farther down the road. If you scrub the playhead (or just press Enter/Return) you will find the animation is pretty jumpy.

To make the quality of the animation better, you could add a keyframe to every frame, but that will mean you will need to position the car in many different positions along the way, still creating a choppy animation. It would be very difficult to position each one accurately to create smooth motion. Luckily, Flash can help with these animations using Motion Tweens. We will look at Motion Tweens in the next demo.

Changing the Pacing and Timing

The car takes about one second to get from the beginning to the end. This movie plays at 12 frames per second (fps). To make the car move more slowly, we need more frames. You could click and drag the keyframes to a later point on the timeline. This will stretch out the length of the animation, but it will still be jumpy.

To make it less jumpy, you need not just more frames but more keyframes. This would allow the car to move less each time, giving the illusion of a smooth transition.

Animating Transparency

Many properties can be animated! Above you saw how easy it is to animate position by placing the object at one place in the first frame and a different place in the next keyframe.

Also, you may animate an object's transparency, rotation, size, tints and more. Imagine if you set the transparency of the car to 10% in the first keyframe and then 10% higher in each later keyframe. The car will then fade in. By changing the properties of keyframes, you are animating!

Previewing the Animation

In addition to scrubbing the timeline, another way to test the movie is to preview the SWF. This will actually publish a .swf file to the same folder as the .fla document. The SWF file is the file that will play in the internet browser. It is the file which must be uploaded to the webserver upon completion of the project. Make sure you publish all relevant files as Flash will often create several companion files to help the .swf file work on a public web site. During the local preview, you will not need to concern yourself with companion files. Preview the SWF by pressing Control+Enter (Command+Return on a Mac). Or, select Control > Test Movie > Test.

Demo: Animation with a Motion Tween

The following demo is saved as BasicAnimation/demos/Clouds-done.fla. Take a look at the completed version. It has a Motion Tween on the timeline. Scrub the timeline and watch how even the cloud animation is. Also, notice the blue section of frames which has been added to the timeline. This blue section is a motion tween. In this demo you will see how to create that Motion Tween.

  1. Close the completed file and open BasicAnimation/demos/Clouds.fla. Examine the existing layer structure and timeline. You will find one (locked) layer named "ground".
  2. Add a layer and name it clouds.
  3. Drag an instance of the clouds symbol from the Library onto your new layer in whatever you would like to designate as the starting position. (Our example will start on the left and move to the right.)
  4. Single click on the clouds instance.
  5. Select Insert > Motion Tween (or right-click and select Create Motion Tween) and notice the change to the timeline. Flash just added frames on this layer.
  6. Now, drag the red play head to the last frame. This is where the animation ends.
  7. Move the clouds to your desired ending position.
  8. This path of the animation will follow the line that appears on the stage. This line will not appear in your finished product. You may treat this line just as you would any other stroke. That means you may stretch or bend it in anyway and the clouds will follow that path. Each dot on the line represents a frame. You can start to see how far your animation will move each frame.
  9. Test the movie by pressing Control+Enter (Command+Return on a Mac). Or, select Control > Test Movie > Test.
  10. The ground layer only appears for one frame. So, while your clouds might move, the ground disappears after one frame. Adding frames to the ground layer will fix this. Check how many frames were added to the clouds layer. Flash added 24 frames to ours. Since you want the ground layer to be there the whole time, so it should have the same number of frames as the cloud layer.
  11. Select the last frame on the ground layer and press F5 to Add Frames (Insert > Timeline > Frame).

Use Motion Tween to Animate Airplane

Duration: 20 to 25 minutes.

In this exercise, you will animate an airplane with a Motion Tween. There will be two separate animations. The first shows the plane running along the runway. In the second, it is taking off.

  1. Open the file saved as BasicAnimation/exercises/Airplane.fla. It is shown below:
  2. Notice that the layer structure matches the Clouds demo. In fact, you may use your Cloud file in this exercise if you prefer.
  3. Add a new layer and name it airplane.
  4. Select the new layer and open the Library. Drag an instance of an airplane onto the first keyframe of the new layer.
  5. Single-click on the airplane instance (to select it) and add a Motion Tween (by right-clicking or choosing Insert > Motion Tween from the Menu.)
  6. Flash just added the default number of frames for a new Tween (about 24). Drag the playhead to frame 12 (or about half way to the end of the animation). Now, position the airplane about halfway across the screen (as shown below).
  7. To complete the second part of the animation (taking off), drag the play head to the last frame and reposition the airplane once again (see below).This time, position the plane in the air at the end of the timeline.
  8. When you run the movie, you might decide that it is moving too quickly. By adding more frames, the animation will take more time. For layers with tweens, you can simply drag the end of the last keyframe to some frame in the future (like frame 50). On layers without tweens, use a Control+Click and then drag the end of the last frame to a later frame.
  9. Adjust your animation until you are satisfied! Test the movie to watch your animation.

If you are done early...

  • Pull some of the other airplanes from the Library. Practice adding multiple motion tweens. Remember, each must be on its own layer.
  • Adjust the rotation of the plane after it takes off.

Using Timelines to Create Movie Structure

In the next exercise you will build the structure of the web site that you will use in several of the upcoming Lessons. So far, our movies have been very small, focusing on small aspects of the final animation. In this section, you will see that if you make an entire web site out of Flash, the timeline will be more complicated. Instead of playing straight through the timeline, it has certain destination keyframes that hold "pages" of content. ActionScript will be used to build a navigation system to jump from page to page.

Open the following demo, saved as BasicAnimation/demos/MovieStructure.fla. Test the movie by clicking Control+Enter (Windows) or Command+Return (Mac). The project functions like many other web sites - the navigation links are used to take you to different pages (keyframes in the timeline).

Examine the timeline and you will see four small red flags on the labels layer with the names of the four pages: intro, home, contact and about. This timeline works a little differently than most we have seen so far. It does not play straight through because it has stop() actions at frames 10, 20 and 30. ActionScript is covered in the Advanced course.

Please notice that when the movie first begins, it plays the first 9 frames then stops at frame 10. Timeline animations are still used in some sections of this project. But, some frames act as static pages. Frame 10 is the "home" page. The buttons are assigned to jump to either home, contact or about. The timeline is told to stop when it gets there. This action is called gotoAndStop().

Understanding our Project File

Now, let's turn to the exercise file to get an idea of how this project is put together. Open the solution to the next exercise. It is saved as BasicAnimation/solutions/Website.fla.

First test the movie to see the final product. You will notice that several pieces of the movie slide into position as a quick intro. We eventually want the timeline to stop once everything is in position.

Build Site Structure on Timeline

Duration: 20 to 30 minutes.

In this exercise, you will put together an entire web site for Griffin Park. We will continue to use this site in later topics. You will have a chance to practice tweening by bringing in the various parts of the site one at a time. Because there are no actions yet, it will just play through and repeat. In later topics we will add actions and buttons to allow users to control navigation.

  1. If you haven't already done so, open and test the solution so that you can see the animation in action. It is saved as BasicAnimation/solutions/Website.fla.
  2. Now that you've see the end result, close the completed file and open BasicAnimation/exercises/Website.fla. You will find one layer with a simple graphic of the sky.Sky Layer
  3. The only layer is currently named Layer 1. Rename this layer sky since it holds the sky graphic.Logo Layer
  4. Add a new layer and name it logo.
  5. Drag an instance of the logo to the center of the stage on Frame 1.
  6. Use the Free Transform tool to increase the size. It should be large.
  7. Add a Motion Tween (Right-click or select Insert > Motion Tween).
  8. Drag the end of the motion tween span to frame 39 to extend the motion.
  9. Drag the playhead to the end of the motion tween. Reduce the size of the logo and reposition it to the upper right corner of the screen.
  10. Scrub the timeline to see your animation. The logo should decrease in size and move into its final position.
  11. If your sky layer has only one frame, it will disappear after frame 1. It will need additional frames to match the other layer. Single-click on frame 39 of the sky layer. Press F5 to add regular frames.
  12. Since the logo is in position and will not move again, we could use a single instance of the logo in frame 40. This will be a static instance. Click on Frame 40 and Insert Blank Keyframe.
  13. Click on frame 39 (the end of the logo animation). Single click the logo in its ending position. Press Control+c to copy the logo.
  14. Click back on the new blank keyframe in Frame 40 and choose Paste in Place (Control+Shift+v). This will place a new instance in the exact same position as the previous frame.
  15. Add enough frames to the sky layer so that it will be the background throughout the animation.Prepare the Text Links Layer
  16. Next you will create the text (which will eventually become buttons in a later lesson). Add a new layer and name it Text Links.
  17. Add a new Keyframe in Frame 40.
  18. Select the Text Tool. Set your text properties as desired in the Properties Panel. We chose Arial, white, 26 point.
  19. Create a text box and type the text "home" in Frame 40 on the Text Links Layer.
  20. To create the additional text links, copy and paste the home text and replace the word "home" with "facilities," "videos," "photos" and "contact".
  21. To line up the text links easily, use Shift+click to select all of the text boxes. Open the Align Panel. Unclick "align to stage" then click Align Left Edge and Distribute Vertical Center. This will even out the space between the text links. (Be sure to unclick "align to stage!")Animate the Text Links Layer
  22. Now let's animate the text links by adding a Motion Tween. Select all of the text links at once (in Frame 40) and press F8 (or select Modify > Convert to Symbol). Select Graphic Symbol and name it navigation.
  23. In Frame 40 on the text links layer, create a motion tween.
  24. Drag the navigation instance in frame 40 just off the stage. This will position the instance to slide into the screen.
  25. Decide how long it should take for the text to slide in. Place your cursor in that frame (we chose frame 60) and drag the text into the ending position.
  26. Extend the other layers to the end of your animation. Ours ends in frame 60. Add Remaining Layers
  27. We need a layer with a background for the photos fading in. There will be no animation on this layer. Add a layer called content back and add a new keyframe in Frame 40. Drag an instance of the content back symbol to the new keyframe.
  28. Add a layer called photo. Add a Keyframe in Frame 40 for an instance of the photo symbol. Add a motion tween and click on the instance in Frame 40. Using the Properties Panel, set the Effect called "Alpha" to 0%. Then, drag the playhead to frame 55 and change the Alpha to 100%. This will fade the photo layer in over 15 frames.
  29. Add a layer called airplane. In Frame 55 add a keyframe and an instance of the airplane from the Library. Add a Motion Tween to position the airplane off stage initially and fly in.
  30. Add one final layer named labels. Add a keyframe in Frame 40. Using the Properties Panel, add labels for frames 1 (logo) and 40 (intro).
  31. Save your movie and test it! Does the animation behave the way you intend it to?
  32. In later exercises, the web site file will be used again. You will have the choice of using yours or a version provided for you. To make it easy to find this file later, save it in the Course Files folder as CourseFiles/Website.fla.

If you are done early...

  • Adjust any of your existing animations.
  • Add additional objects to animate.

More with Animation

Over the years, Flash has added tools that help you animate with even more precision and less work! In this section, we will look at techniques for automating and taking control of tweens.

Using Motion Presets

Flash now has some predesigned animations which may be applied to objects. These presets were recently added to Flash and allow for quick and easy animation of objects. Best of all, they are completely editable, so you may use them as a starter, and then modify the motion to fit your needs.

To see a motion preset in use, open the demo saved as BasicAnimation/demos/MotionPresets.fla. You will find a ball bouncing in. Notice the path and timing of the bounce on the stage. Creating this animation realistically from scratch would be quite time consuming and difficult to maintain a smooth appearance.

To create your own animation automatically using motion presets, follow these steps:

  1. Place an instance of a symbol in the starting position on the stage.
  2. With the Motion Presets Panel open, select the instance.
  3. Single-click on a preset and watch the preview in the panel.
  4. When you have found one you would like to try, click Apply.

    Note: Some of the presets, including the 3D presets, require that the object be Movie Clip Symbols.

It is that easy! Depending on which preset you choose, it will add a certain number of frames to suit the animation. You may click to add keyframes to change any position, size, alpha, etc. You may also stretch or shrink the animation to fit your needs.

Animating Filters

Filters may be added to instances of symbols and text instances. The process of adding a filter is as follows: single-click on the instance or text, and then look near the bottom of the Properties Panel for the heading Filters.

Click the Add Filter icon to add a filter. You may select Drop Shadow, Blur, Glow, Bevel, Gradient Glow, Gradient Bevel, or Adjust Color.

Each of these filters has several options which can be manipulated. And, as a bonus, if you adjust the filter at the beginning and end of any animation, Flash will tween the filter. The demo, which has a glow fading in and out, is saved as BasicAnimation/demos/Filters.fla.

Animating Transformations

As you have already seen, if the artwork has different positions at both the beginning and ending points of a Motion Tween, Flash adds the tween. This is true with transformation, too. Use either the Free Transform Tool or the Transform Panel to make changes to an object.

In the example shown below, saved as BasicAnimation/demos/Transformation.fla, the bike is skewed to the right slightly. By the last frame, two changes have taken place: (1) it has skewed back a bit toward the left and (2) the size has been reduced giving it the illusion of perspective.

Changing the Path of the Motion

Since the path of a tween is just a stroke, it can be manipulated like any other stroke. For example, you can use the selection tool to bend the path.

Swapping Tween Targets

If you have a tween on the stage that is already set up, you may easily change the symbol being tweened. Just click on the instance of the symbol and open the Properties Panel. Then click Swap... and browse to the new symbol.

Easing

Our animations so far have looked pretty good, but sometimes they can appear mechanical and not very natural. This is because the speed of the animation is uniform throughout the tween.

Imagine a car stopping and starting at a red light. As the car comes to a stop, it gradually slows down. And, as it starts again, it gradually increases speed. Flash calls this Easing, objects can ease into or out of animations.

Compare a regular tween (saved as BasicAnimation/demos/MotionTween-car.fla) to one with easing (saved as BasicAnimation/demos/MotionTweenEase-car.fla). Test both. Which looks more natural?

Using the Motion Editor

The Motion Editor Panel is a complicated one. It allows for precise manipulation of all properties of objects that are being tweened. The best place to start is to open a simple animation such as BasicAnimation/demos/MotionTween-car.fla. In this animation, the car moves across the screen. In other words, we are changing the value of its X property, or horizontal position.

In the screenshot below, the X Property is selected. Its value increases on the chart over time as the car moved.

Now, look at a more complicated tween. Open a file that uses one of the Motion Presets. (Ours is saved as BasicAnimation/demos/MotionPresets.fla.)

Notice in the screen shot below the Y Property is selected. Its position is going up and down as it bounces in.

Additional easing controls are available in the Motion Editor Panel. Scroll down to the bottom of the panel to find Color Effect, Filters and Easing. To add any of these, click the plus. It will apply to the selected object in the frame indicated by the playhead.

Easing is a little different than the other two in that after you have added an easing option, it will be available for selection by any of the properties in the motion editor.

The Motion Editor is just a different way to modify animations. You may choose to do your own animations on the stage. But, when you need precise control, the Motion Editor is helpful.

Animating 3D Motion

You already know about animating in two dimensions: X and Y. Flash can also animate the Z axis. There are two tools used specifically for 3D animation. They are the 3D Rotation Tool () and the 3D Translation Tool (). The 3D Rotation tool lets you spin the object in all 3 directions. The 3D Translation Tool slides the object to the left and right, and up and down (along the X, Y axes) and even forward and back (along the Z axis). Translation is the term used to move objects left, right and forward and back in 3D.

Open the demo saved as BasicAnimation/demos/3D-Tween.fla to work with a photo rotating in 3D.

If you click on either tool, you will see a special shape which gives you easy access to the X, Y, Z and X Rotation, Y Rotation and Z Rotation properties. Try them all!

Improving Motion Tweens with Easing and Motion Presets

Duration: 15 to 25 minutes.

In this exercise, you will improve the files you used in the last two exercises by adding Motion Tweens and Easing. Or, as an alternative, create a new blank movie to practice using the following items:

  • Motion Presets
  • Easing
  • The Motion Editor

Open BasicAnimation/exercises/Airplane.fla (or the solution version saved as BasicAnimation/solutions/Airplane.fla) to add easing.

  1. Be sure the Properties Panel is open.
  2. Click on Frame 1 of the airplane layer to select the motion tween.
  3. Open the Ease category in the Properties Panel.
  4. Change the value of Ease to -100.
  5. Test the movie and you will see the plane speed up as it starts taking off. It will pick up speed as it goes along.

Open BasicAnimation/exercises/Website.fla (or the solution version of the last exercise saved as BasicAnimation/solutions/Website.fla) and use a Motion Preset to adjust the animation.

  1. Find the first frame of the airplane animation. Single-click on it and open the Motion Editor.
  2. Scroll down to the Eases section. Click the plus to add a new Ease. Select Bounce in.
  3. Look for the X Property above in the same panel. Select the new Ease "Bounce in" for x.
  4. Test the movie. This ease might not be the appropriate since it makes the airplane fly backward part of the time.
  5. Open the Motion Editor again and click again on the Tween. This time add the ease called Simple (Fast). And, set it as the X Property.
  6. Test the movie.

If you are done early...

  • Practice with additional Easings.
  • Apply one of the Motion Presets to another existing animation.