Chapter 2. Creating and Animating Art

As the name implies, Animate is an animation management tool. Using Edge Animate, you determine what elements show on the stage, their position, and their appearance. You can create text and simple visual elements within Animate, but it’s likely that you’ll create more complicated artwork in some other program like Illustrator, Photoshop, or Fireworks.

This chapter examines what types of graphics you can and can’t create within Animate. It starts off by defining the stage and the ways you can modify it. You’ll learn about all the properties of the rectangle and rounded rectangle. With creativity, you can also create some distinctly non-rectangular shapes. Along the way, you’ll learn how to quickly align and arrange objects on the stage and test-drive the transform and clipping tools. But you’re not stuck in Animate: You’ll also learn how to import artwork from your other favorite applications, such as Illustrator or Fireworks (and you’ll get some tips about the best free graphics programs you can find on the Web).

As the Bard said a few hundred years ago, “All the world’s a stage.” That’s certainly true in Edge Animate. As explained in Chapter 1, when you place an element on the stage, it’s visible to your audience. There are a couple of ways to hide or remove elements from the stage. If you have the stage Overflow properties set to hidden, then you can exit stage right, left, top, or bottom by moving the element off stage. At least, it’s not visible when viewed in a browser. The Hello World exercise also demonstrated how to perform disappearing acts by using the Opacity property.

The stage that you work with in Edge Animate represents a portion of a web page when it’s viewed in a browser. The stage has a limited number of properties. The most obvious are its dimensions and background color, but you’ll want to understand them all. Here’s the rundown starting from the top of the Properties panel:

You can change your view of the Stage in Animate. Initially, you see it Actual Size—that is 100%. This gives you a good idea how it will look in a web browser. When you’re doing intricate work you may want to zoom in for more precision. Press Ctrl+= (⌘-=) and everything gets bigger. If you’re working with a large stage there may be times when you want to zoom out to get the entire picture. The command for that is Ctrl+_ (⌘-_). In the lower-left corner of the stage, there’s a magnifying glass icon and a number that indicates the current zoom level as a percentage. You can use it to adjust the view, too. Just click type in a number or click and drag to scrub in a new value. When you want to quickly jump back to actual size, press Ctrl+1 (⌘-1).

You can scroll your view of the stage, just like you scroll around a browser window to change the view, using your mouse or touch pad. After you move up or down, left or right, there’s a quick way to center the stage in the window. Click the button the button in the lower-left corner of the window that looks like a gun sight.

In its current incarnation, Edge Animate’s drawing tools are limited—no pen tool, no gradients. Why is its art so primitive compared with other Adobe products such as Flash or Illustrator? Part of the reason is that Edge Animate is new. It’s likely that Adobe implemented the graphics features that were easiest first and that Animate will become more full featured over time. Keep in mind that every time you create a graphic object in Animate, it’s busy behind the scenes writing code in JavaScript to describe that object. If you’re a conspiracy theorist, you might think Adobe wants you to spring for Illustrator or one of the other artist’s tools it sells in its Creative Suite. In fact, if you want to create vector graphics with complex paths, you need to use a tool like the pay-to-play Illustrator (www.adobe.com) or the open source Inkscape (www.inkscape.org).

The next section describes in detail the properties of the rectangle. However, many of these properties are used by other objects, such as blocks of text and artwork that you import into Animate. So when you’re learning all about rotating, skewing, and scaling rectangles, keep in mind that you can rotate, skew, and scale text and photos, too.

Using the Rectangle tool (M), you can add blocks of color to the stage. These blocks are great if you want to differentiate portions of the web page. For example, perhaps you want to make a sidebar. Add a rectangle, and then you can place text or graphics over the rectangle, setting it off from the rest of the page. Chances are you know the basic drill for creating a rectangle. Click the Rectangle tool on the Tools palette, and then click and drag on the stage to mark its shape. To create a square, hold the Shift key while you drag. The new element appears on the stage, and it’s automatically selected, so you see eight white squares around the border that represent handles (Figure 2-2). You can continue to change the size and shape of the rectangle after it’s drawn by dragging the handles.

Here are the basic properties that describe your rectangles:

When it comes to selecting, cutting, and pasting objects, Animate works like most other computer programs. You use the same techniques for objects you create in Animate, like rectangles and text, or artwork that you import (as explained on Clipping the Bits That Need Trimming). You use the Arrow in the Tools palette to do the heavy lifting. Click once on an element to select it. Shift-click on another element to add it to the selection. Animate has a handy command (Ctrl+A or ⌘-A) to select everything on the stage. You can easily deselect objects by clicking on an empty spot around the edge of the stage.

Animate also provides the usual suspects when it comes to Cut (Ctrl+X or ⌘-X), Copy (Ctrl+C or ⌘-C), and Paste (Ctrl+V or ⌘-V). The Duplicate command (Ctrl-D or ⌘-D) combines copy and paste into one function. When you’re in need of several carefully rounded and shaded rectangles, it’s much easier to create one and then clone it with Duplicate. (If you prefer menus to shortcut keys, you’ll find all these commands on the Edit menu.)

When you duplicate an element that’s on the stage, you also duplicate any transitions that may have been created for that element. If you don’t want the transitions, use Copy (Ctrl+C or ⌘-C) and Paste (Ctrl+V or ⌘-V). You’ll find details for editing transitions on Editing Transitions.

The Transform properties, along with the Transform Tool (Q), are there to help you fold, spindle, and mutilate your rectangles. Well, actually the transforms are called Rotate, Skew, and Scale. The other property in the Transform group is called Transform Origin. You can think of the origin as an anchor point for your rectangle. It appears as a target symbol when the rectangle is selected. Initially, the origin is at the midpoint. So if you rotate the rectangle, it spins around the midpoint. If you move the transform origin to the bottom-right corner by setting X=100% and Y=100%, your rectangle will rotate around that bottom-right corner point. Using the X and Y Transform Origin properties, you can move the origin to any point in your rectangle. As you make adjustments, the target symbol moves over the surface of the rectangle. If you don’t mind eyeballing it, choose the Transform Tool (Q) and then you can drag the transform origin to a new point as shown in Figure 2-4.

The maxim that “everything has its place” is certainly true when it comes to animation. With more than one element on the stage, their relationship to each other is critical. Designers often have a specific grid in mind when they’re creating printed pages or web pages. It’s best when boxes of text or graphics are aligned with this invisible grid. When several elements are aligned, it usually looks best when there’s an equal distance between them. You can spend a lot of time eyeballing the stage to try to get everything just right, but fortunately, you don’t have to.

To experiment with Animate’s Arrange, Align, and Distribute tools, you may want to create three or four simple objects from the Rectangle and Rounded Rectangle tools like the ones shown in Figure 2-6. As you drag elements around the stage, you’ll notice magenta-colored lines sprouting from the edges and midpoints. These are Smart Guides, and they can help you to quickly align one or more objects while you’re mid-move. In many cases, that may be all the help you need.

For more formal alignment needs, turn to the Modify→Align menu. For align to work, you need to select at least two elements. You can select the elements on the stage or you can use the Elements panel. To use these commands, select all the elements that you want to align and then choose one of the options:

You use the Modify→Distribute commands to put equal distance between three or more elements on the stage. You can choose which part of your elements the distribute command uses for the process and whether the action takes place along the horizontal or vertical axis. The specific commands are:

Roll up your sleeves. Enough theory, it’s time for some animation. In this exercise, you create four rectangles. You give them names, apply color, and skew them. Then you position them on the stage and make them move, change shape, and then appear to dissolve. It’s the sort of effect that might be part of a banner ad or the introduction to a more complex animation. You don’t need any Missing CD files to tackle this exercise. However, if you want to see the finished project, check out 02-1_Color_Bars_done.zip.

This exercise is divided into two parts. In the first set of steps, you create and position the color bars:

  1. Open and save a new Animate project with the name Color_Bars.

    Don’t forget to create a new folder for your project.

  2. Set the stage color to white and the dimensions to W=550px and H=400px.

    Animate remembers the last stage settings you used. So if you followed previous exercises or experimented on your own, you may need to make these changes.

  3. In the timeline (Figure 2-7), make sure that the Auto Keyframe Mode and Auto Transition Mode buttons are pressed.

    If you move your cursor over the buttons, tooltips show their names. For example, at the top of the timeline you see: Auto-Keyframe Mode, Auto-Transition Mode, Toggle Pin, and Easing.

  4. Draw a rectangle and in the Properties→ID, type Red.

    The ID box appears at the top of the Properties panel when the rectangle is selected.

  5. In Properties, click the background color and set it to pure red, and set the border to none.

    When you’re done, the hex color number should be #ff0000.

  6. Set the rectangle’s size to W=550px and H=100px.

    The quickest way to accomplish this is to type the dimensions in the Properties panel, but if you’re a mouse master, you can drag the rectangle’s handles. You may need to click the “link” button next to W and H to change the width and height independently.

  7. Set the Skew (x) to 50 deg (degrees).

    The horizontal skew is the top setting. A positive number slides the top edge to the left and the bottom edge to the right.

  8. Position your red, skewed rectangle in the top-left corner of the stage so that only its point tip is visible. The Location properties should be X=-550px, Y=0px.

    Ideally, just a red triangle shows in the top-left corner of the stage.

  9. With the Red rectangle selected, press Ctrl+D (⌘-D). Change the ID of RedCopy to Green. Then, change the color to match.

    The hex value for solid green is #00ff00. You can change the background color of a selected element in the Properties→Color subpanel or you can use the color swatches in the toolbar above the stage.

  10. Line up the top of the green rectangle with the bottom of the red rectangle (Y=100px). Then, hold the Shift key down and slide Green to the right until only the tip shows (X=430px).

    Holding the Shift key down while you move an element helps to lock it to the horizontal or vertical axis as you drag it. You can still drag it off axis, but it’s a little “sticky.”

  11. Create two more skewed rectangles, naming and coloring them Blue and Yellow. Position the rectangles on alternating sides of the stage.

    The blue color is #0000ff, and yellow color is #ffff00. When you’re done positioning the rectangles, the stage should look like Figure 2-7.

Now that you’ve successfully created and positioned the color bars, it’s time to make them move. Chapter 1 showed how the position of elements on the stage is controlled by property keyframes in the timeline. When the Auto-Keyframe Mode button is pressed, as shown in Figure 2-7, new property keyframes are created whenever you set or change a property. You can also create property keyframes manually by clicking the diamond-shaped buttons in the Properties panel. You want to lock in the Position, Size, and Opacity properties at the beginning of your animation by creating property keyframes. Then you’ll move down the timeline and create different property keyframes. The result will be animation magic.

  1. Make sure the timeline’s playhead is at 0:00. Select the parallelogram named Red; then in the Properties panel, click the diamond-shaped buttons next to X, Y, W, H, and Opacity.

    The X and Y properties are in the Position and Size subpanel. They control the position. The W and H buttons create keyframes for width and height. The Opacity slider is near the top of the Properties panel. The diamond buttons add property keyframes and individual property layers in the timeline as you can see in Figure 2-8. Property keyframes anchor a specific property value at a specific point in time. In the timeline, you should see property keyframes and property layers for:

    If you don’t see all those keyframes and property timelines under Red, you should create them manually by clicking the diamond button next to the missing property.

  2. Repeat step 1 for the Green, Blue, and Yellow color bars to create the property keyframes and property layers for each.

    To speed things up, you can select all three bars first and then click the keyframe buttons.

  3. Make sure the Auto-Keyframe Mode and Auto-Transition Mode are on (pressed in) and the other buttons are not.

    When Auto-Keyframe is on, Animate automatically creates property keyframes as you change elements on the stage (Figure 2-8). It’s a two-step process. Move the playhead to a point in time and then change your element’s properties. You can make changes in the Properties panel or you can make changes on the stage with the Selection and Transform tools.

  4. In the timeline, drag the playhead to the 0:02 position.

    For this step, the pin should be toggled off (not pressed in).

  5. Drag each of the rectangles across the stage until the tail end of the skewed rectangle is visible.

    At this point, most of the stage is covered by the color bars, with white triangles of the stage showing through at the edges. Remember to press the Shift key as you drag if you want to steady the bars’ vertical position.

  6. With all the rectangles selected, in Properties click the Add Key Keyframe for Opacity button. Drag the playhead back and forth to preview the animation.

    The opacity for each color bar is set to 100 percent at the 2 second point. Scrubbing the playhead gives you a quick look at the action.

  7. Drag the playhead to the 0:03 marker.

    This position represents the point 3 seconds into your animation.

  8. Select each rectangle and then change the height (H property) to 300 px and the opacity to 50 percent.

    This has the effect of making the rectangles grow, slicing vertically into one another, and at the same time start to blur. See Figure 2-9. Keep in mind, you may need to delink the W and H properties to change them independently.

  9. Drag the playhead to the 0:04 marker. Then change each rectangle’s height to 500 px and the opacity to 0 percent.

    The effect is that the rectangles keep growing and blur out of view.

OK, Animate pulls a fast one when it comes to the Rectangle, Rounded Rectangle, and Ellipse tools. The dirty little secret is that you can create all these shapes using the Rectangle tool and tweaking the properties. The reasons for this quirk have to do with the fact that JavaScript code is defining these shapes. You can check this by creating a shape with each tool and examining their properties. You can turn a rectangle into a rounded rectangle simply by adjusting the Corners→Radius properties, as shown in Figure 2-10. Likewise, you can square off a rounded rectangle using the same tools. So here’s a look at how they work.

In a new Animate project, create a rectangle and leave it selected. Choose the Transform Tool (Q), then with the mouse, hover over the Corners keyframe diamond in the rounded rectangle properties, and the tooltip explains that it will “Add Keyframe for Top-left Radius, Top-right Radius…” and so on. (The actual tooltip message changes depending on the settings.) The three buttons at the top of the panel are labeled 1, 4, and 8. Below, you see a square made up of buttons where you can individually select the four corners of a rectangle. There’s a number next to the corner buttons that’s initially set to 0. A corner radius of zero means your rectangle has nice, sharp-edged corners. Click on the number and drag to the right to round off the corners. The number box accepts only positive numbers, so you can’t drag left. Notice that as you drag, the black diamonds at the corners of your rectangle move to the center. These diamonds are control points for the corner radii. You can manually drag the diamonds on any rectangle to create and adjust rounded corners.

Reset your rectangle so that it’s square, and then click the upper-right corner in the Properties panel. Change the radius setting and this time, you notice that the upper-right corner remains square while the others take on the rounded style. When a corner button is pressed in, that deselects the corner from the rounded settings.

Reset the rectangle once more and click the upper-right corner so it pops back out. Then click the 4 button at the top of the corner properties. Four new number boxes appear next to each corner. Now you can set each corner independently with different radius values. This gives you the ability to create irregular shapes even though, technically, they still have four corners. Combine this with the skewing and scaling properties, and you can create some really interesting amoeba effects. Click the 8 button, and each corner has two control numbers. This gives you the ability to move the control point off center, making a corner that is flatter on one side compared to the other. Notice that when you adjust the settings, the black diamond control point moves, too. You can always adjust your corners using either the number boxes or the control points in the rectangle.

Drop shadows not only look cool, they give you a way to visually separate different elements. Apply a drop shadow to a graphic, and you make it look like it’s floating above the stage. Add a shadow to the interior of an element, and you give it a more three-dimensional appearance. Shadows are often used with buttons to create a different appearance for over, clicked, and selected states. Animate gives you an easy way to create drop shadows and modify them to your needs and taste.

For a subtle shadow that sets an element off from the background, try the following steps:

If you want one of the elements to look three dimensional, you can use the same settings but click the Inset button. Instead of appearing outside of the element, the shadow is created inside the element. As the name implies, the Spread property controls the size of the shadow making it spread in all directions. As with any other property, you can make the drop shadow change over time. With a little creativity, you can create the impression of the sun changing position in the sky, with shadows moving and changing shape. Shadows are an important tool for text, too: Text is more readable over a busy background when separated by a shadow. For tips on using shadows with text, see Dealing with the Template.

Adding art to your stage isn’t an all or nothing affair. Animate gives you a tool to trim the edges of just about anything. The good news is, using the Clip tool couldn’t be simpler. As with the Shadow properties, there’s a single button in the upper-right corner of the subpanel that toggles the effect on or off. As you can see in Figure 2-13, there are four number settings representing the four edges of the selected element: top, bottom, left, and right. In most cases, it’s easiest to click and drag over the number so you can watch how much Animate trims off the element. If you’re more of a numbers person, you can click and type in a number. Once you’ve clipped an element you can move it around the stage—the trimmed bits remain hidden. What’s more, you can animate the clipping properties like any Animate properties, so you can use this technique in animated transitions (as you’ll see in Chapter 4). Clipping works with just about any element that appears on the stage, so you can also clip imported elements like photos or text boxes (Chapter 3) or symbols (Chapter 6). Clipping gives you yet another way to hide and reveal all or part of elements on the stage.

It’s easy enough to create basic shapes and text in Animate, but when it comes to complex artwork, you’ll probably turn to your favorite art creation tools. For elaborate drawings and line art, that may be Adobe Illustrator. For photographs, you may use Photoshop, Lightroom, or iPhoto. Adobe Fireworks may be the ideal companion tool for Animate because both tools were designed to create Web content. No matter how you create JPEGs, GIFs, PNGs, or SVGs, you can import them into Animate and then animate them by changing their position on the stage and their appearance. There are two methods for storing and displaying images: bitmaps (technically called raster graphics) and vector graphics. For the details see the box on Vector, Raster, and Your Favorite File Formats. For tips on how to use specific file formats in Animate, read on.

There’s one difference in the way Edge handles artwork that you create using the built-in tools like the Rectangle tool, and art that’s imported. Art created with the built-in tools is created on the fly with JavaScript code, while imported art is stored in its native format (JPG, SVG, PNG, or GIF) in the images folder. Those images are referenced by the HTML and JavaScript code. If the files themselves are renamed, moved, or missing, your audience is going to miss part of the show. If you want to update images that were created outside of Animate, just make the changes and save the file with the same name.

Regardless of the file format, the process for importing artwork is the same. Go to File→Import and then find the file you want to bring into your project. The Missing CD folder 02-2_Sliding_Show has three photos in JPEG format. You can practice by creating a new project complete with a new folder named 02-2_Sliding_Show and import each of the photos. After you choose File→Import, a standard file/folder window opens for your PC or Mac. If you want to import all three files at once, just Shift-click to select them. As usual, Animate imports the files and, as a handy time-saver, names them based on the filenames. In this case, you’ll find squirrel, farmhouse, and bike in your Elements panel. Each image is also automatically placed at the 0,0 position on the stage. You’ll only see one of the images though, because they’re covering one another. Remember that Z-order stuff on Rulers and Manual Guides?

Back in the olden days when photographs were recorded on film, there was an event called the slideshow. It was called a slideshow because the projector slid the images on and off the screen. These days, slideshows take the form of PowerPoint presentations, or they’re used to display photos on a website. You can use a slideshow to show products. If you’re selling cars, maybe you want to display all the color options. If you’re selling home theater amplifiers, maybe you want customers to zero in on the different panels with controls and connectors.

In this next exercise, you create your own automated, sliding show. Each image is displayed for a period of time, and then it fades away as it slides offstage. You can use the three imported images from the previous exercise, or you can use as many of your own images as you want. Your show will look best if the slides are the same size and have the same portrait or landscape orientation.

  1. Import your photos using File→Import.

    Animate places the images on the stage and automatically creates an images folder for your project. Copies of the photos are placed in the images folder. In the Library panel, you’ll see the three images listed under Assets. As the Tip on Tip explains, you can also import graphics by dragging them from Windows or Mac OS X folders and dropping them directly onto the stage.

  2. Select the stage in the Elements panel, and then set the stage dimensions and background color. Set the Overflow to hidden.

    Give the stage the same dimensions as your images. With overflow set to hidden, the images will disappear when they move off the stage.

  3. Arrange your images so the first image is at the top of the Elements panel.

    In this project, the Z-order of the images determines when an image is displayed. It’s as if you have a stack of snapshots on a table and you remove the top photo to see the next.

  4. Shift-click to select all the images in the Elements panel, and then in Properties, click the Add Keyframe button next to X and Y, as shown in Figure 2-15.

    Left and Top keyframes are created for each of the images at 0:00 on the time-line. This locks in the starting position for each of the images.

  5. With all the images still selected, in Properties make sure the opacity is set to 100 percent and then click to add keyframes for Opacity.

    All the images will have an opacity of 100 percent until they begin to move off the stage.

  6. Drag the playhead to 0:02, and then with the top image selected, add keyframes for X, Y, and Opacity again.

    This locks in the position and opacity of the top image for the first 2 seconds of the slideshow. In the next steps, the photo will start to move and change. Make sure that the pin moves with the playhead to the new location. If necessary, press P to toggle the pin.

  7. Make sure Auto-Keyframe Mode and Auto-Transition Mode are turned on.

    With these two timeline buttons turned on, keyframes and transitions are created automatically when you make changes to the composition.

  8. Drag the playhead to 0:03, and then drag the top slide completely off the stage.

    You can have your slides move off the stage in any direction. Right movement imitates the old-fashioned slide projectors. Hold the Shift key as you drag if you want the image to slide along a vertical or horizontal axis.

  9. With the image completely offstage, change the opacity to 20 percent.

    This creates a nice fading effect for each image as it moves offstage.

  10. Drag the playhead down the timeline another 2 seconds.

    This gives your audience time to admire your next photographic masterpiece.

  11. Select the next slide that’s visible on stage and then in Properties click the Add Keyframe buttons for X, Y, and Opacity.

    This locks in the position and opacity for the slide that’s showing. Like the previous slide, it will move and fade after this point.

  12. Move the playhead another second down the timeline and drag the photo offstage, and set the opacity to 20 percent.

    This completes the process for the second image in the slideshow.

  13. Repeat steps 10–12 for each of the images in your slideshow.

  14. When the last slide is removed from the stage, display a message to viewers.

    If you want, you can fade a message like “Thanks for watching!” on and off the stage to signal the end of the show.

You can preview your slideshow in Animate (Figure 2-16), or you can view it in your favorite web browser. You’re probably already thinking of ways you can tweak and customize a slideshow like the one described in this exercise. Naturally you can change the timing for the appearance and disappearance of each slide. If you want a fancy pseudo-3D effect, you could use Skew and Size properties to make the slides look as if they are blowing away one by one. In future exercises (Sliding Show Revisited), you’ll see how to give your audience click controls for the slideshow.

So far this book has shown you a few ways to show and hide elements. For example, if you want to show and hide elements while you’re working in Animate, you can use the visibility eyeball-icon in the Elements panel. That tool doesn’t change the way your final animation looks; it merely hides elements while you’re working in Animate. You’ve also seen how you can hide elements using their Opacity property. Set Opacity to 0 and presto-change-o—it disappears. Opacity is particularly good for animated effects like the one in the Sliding Show. Using Opacity, it’s easy to make elements fade in and fade out. Still there’s some work involved in controlling the opacity over the course of an entire Animate composition.

There’s another, more fundamental way to show and hide elements on the stage: You can turn elements on and off. In the Properties panel, directly under the ID box (Figure 2-15), there’s a drop-down menu that is initially set to Always On. So far, that’s the option used in the exercises in this book. There are two other items on the menu: On and Off. Suppose you want to redo the Sliding Show so that images changed instantly without any motion or fading effects. That’s a perfect job for the On/Off switch. Import your images as described on Clipping the Bits That Need Trimming. With all your images in place on the stage, set one image to On and set all the other images to Off. In the timeline move the playhead to the two second mark (or any other interval that suits you). Turn the displayed image off and turn another image on. In this case, the stacking order of the images (the Z-order) doesn’t matter because only one image is visible at a time. If you want to review a working example of this method, check out 02-4_On_Off_Elements_done from the Missing CD at www.missingmanuals.com/cds/animatemm.

There’s one other thing to note: Once you use the On/Off menu in Properties, Animate adds an On/Off toggle button in the timeline for that element. See Figure 2-17. This makes it quick and easy to set the playhead to a particular point in time and turn your elements on or off.