Chapter 4. Animation in Catalyst

Animation in Catalyst

What we'll cover in this chapter:

  • Animating across states using transitions

  • Tweaking transitions

  • Adding custom actions to transitions

  • Creating actions sequences

Files used in this chapter:

  • animationExample-start.fxp

  • animationExample-complete.fxp

Catalyst is very good at giving you the ability to quickly add animation to a design. This reinforces how the application ultimately responds to the user. It also allows you to finely control and define how the objects respond, rather than passing that work on to the developer.

Animation in Catalyst is primarily done by controlling the changes in object properties across states. If an image is in one position in the first state and in a different position in the second state, you can animate how the image moves between those two positions. This is true of transitions across the application's primary states and in components (such as rollover effects). You can also create animation separate from state transitions by creating action sequences. This chapter looks at all of these topics.

To work through the various kinds of animation features that are available, in this chapter you create an example of a simple interactive magazine layout. You can see the final example at www.greggoralski.com/animationExample (see Figure 4-1) or look at final Catalyst file, animationExample-complete.fxp.

Final project

Figure 4-1. Final project

This file has a series of different types of animations including, in the order you create them, rollover and click animations for the three buttons, a state-change animation when the surfButton is clicked, a state-change animation involving 3D rotation, and a series of fade-in effects on the front page that are action sequences.

Animating Buttons

One of the most common uses of animation in interface design is the creation of rollover and click effects. These can guide users through the interface and let them clearly see when something has been triggered.

To begin this exercise, open animationExample-start.fxp. You can begin with a blank file if you wish, but this one has a collection of objects in the Library that lets you move more quickly through the example and concentrate on the elements that are important for animation. Look through the file before you begin: it's relatively straightforward, with nothing created on the stage but a variety of objects in the Library. These include buttons, custom components, images, and audio, as shown in Figure 4-2.

Library of animationExample-start.fxp

Figure 4-2. Library of animationExample-start.fxp

You begin by creating an animated button from a static image, in this case surf.jpg. Follow these step:

  1. Drag an instance of surf.jpg onto the stage (see Figure 4-3). To drag an item out of the Library, select the name in the list and drag it onto the stage.

  2. The HUD guides you to convert this image into a component. Select Convert Artwork to Component

    Library of animationExample-start.fxp
    Image on the stage

    Figure 4-3. Image on the stage

    Converting an image into a button

    Figure 4-4. Converting an image into a button

    States of the button

    Figure 4-5. States of the button

  3. In each state, you draw how you want the button to look at that time. For now, leave the Up state as it is. Select the Over state, and use the Catalyst drawing tools to draw a box. In the box's Properties, set its stroke to None, the fill to black, and Opacity to 80. Using the Text tool, add text over the box as shown in Figure 4-6.

    The Over state of the button, with a box and text added

    Figure 4-6. The Over state of the button, with a box and text added

    At left in the Timelines panel is a list of all the possible transitions between the states—for example, from Over to Up. If you select Over,

    The Over state of the button, with a box and text added
    Timelines panel for the Over state to the Up state

    Figure 4-7. Timelines panel for the Over state to the Up state

    The addition of the box and the two text fields are recognized as differences between the two states that can be animated. Catalyst automatically gives them the most appropriate change (in this case, because not all of the elements exist in the Up state, but they do exist in the Over state, the most appropriate change is a fade). At this point, the changes happen instantly. To make them animated, you need to provide them with a duration. To do so, drag them out (see Figure 4-8, fading the Up to Over state). By default, a timeline of 1 second is shown, but most animations are shorter.

    Manually dragging out tbe length of an animation

    Figure 4-8. Manually dragging out tbe length of an animation

    Alternatively, you can click Smooth Transition (see Figure 4-9). Doing so gives a default half-second duration to all undefined animations in the selected state transition. You see how to modify these default settings when you use this technique to make transitions between the main states of a project.

    Controlling the length of an animation by clicking Smooth Transition

    Figure 4-9. Controlling the length of an animation by clicking Smooth Transition

  4. Click Smooth Transition, and then run the project to see how this works.

    You've created your first rollover effect. Let's tinker with it a bit to see some of the options you can use to affect this transition. The box fades in nicely, but you want it to resize. This kind of effect needs the object to exist in the transition's starting and ending states. This makes logical sense: in order for something to resize, it must be there in the first place. The same applies for changes in position. You eventually have a variation of the box in every state of the button, so you may as well share it with all the states at this point:

  5. To share the box with all the other states, select it and choose States

    Controlling the length of an animation by clicking Smooth Transition
    Sharing the box with all states

    Figure 4-10. Sharing the box with all states

  6. When you have a copy of the element that needs to change in all the states, you can modify it and smooth the state transitions. Let's start with the Up state. In the Pages/States panel, select the Up state, and scale the box vertically until it's invisible (you can scale a box down to have a height of 0, as shown in Figure 4-11).

    Box with a height of 0

    Figure 4-11. Box with a height of 0

  7. In the Timelines panel, select the Up

    Box with a height of 0
    Timelines panel for the Up Over state transition before the transitions are tweaked

    Figure 4-12. Timelines panel for the Up

    Timelines panel for the Up Over state transition before the transitions are tweaked
    Over state transition before the transitions are tweaked

  8. The animation is closer to what you're looking for, but it's awkward that the text appears before the box opens. You can manually modify the transition's start and duration by dragging the animations on the timelines. To make the texts fade in later than the start of the rectangle resize, move the times as shown in Figure 4-13.

    Timelines panel for the Up Over state transition after the transitions have been tweaked

    Figure 4-13. Timelines panel for the Up

    Timelines panel for the Up Over state transition after the transitions have been tweaked
    Over state transition after the transitions have been tweaked

  9. To create the way the box and texts look in the other states, follow the same process: share the elements with the states as needed, modify the elements on each state in a certain way (for example, resize, change color, change opacity), and click Smooth Transition. To make the process less cumbersome, especially when many states are involved, select all of the state transitions and click Smooth Transitions (see Figure 4-14). Doing so inserts a default half-second of smoothing that you can then tweak.

    Timelines panel with all transitions selected

    Figure 4-14. Timelines panel with all transitions selected

  10. This example uses a trick. If you've tried the completed example, you may have noticed that after the surfButton is clicked, it stays highlighted, reinforcing for the user where they are in the navigation. To get this effect, create the Disabled state to look like a highlighted version of the button. As you build out the next state of the project, you control when the Disabled state is visible by using the button's Enabled property.

  11. As a finishing touch, add an inner shadow to the button by selecting the button in the main state and then, in the Properties panel, selecting Add Filter

    Timelines panel with all transitions selected
    Adding the Inner Shadow filter to the button

    Figure 4-15. Adding the Inner Shadow filter to the button

  12. Create the other two buttons using the same process, or use the buttons named Bike and Snake in the Library to save time. A trick to make the process of creating similar buttons faster is to duplicate buttons that you've already created and then modify them. You do this the same way you would in Flash. You can duplicate a button in the Library by right-clicking it and selecting Duplicate; this duplicate of the button can then be edited.

  13. Arrange the three buttons in the first state (see Figure 4-16).

    Three buttons on the stage

    Figure 4-16. Three buttons on the stage

  14. A new layer was automatically created for each button. To keep things clean and organized, name the layers as shown in Figure 4-17.

    Naming the layers that contain the buttons

    Figure 4-17. Naming the layers that contain the buttons

Animating Across States

Catalyst uses the same logic when creating animations between the main states of a project that it does between the states of a button (or any other component). The significant difference with the main states is that they're created by the designer and tend to have more dramatic changes.

Almost all animations in Catalyst are between states. In this case, the animation you focus on is the transition from the cover to an article page—specifically, an article about surfing in Japan. If you look at the completed example, you can see that it involves the buttons moving to new positions while the article and background image fade in. (The article and the background image are in the Library and are named article and beach.jpg.)

To create the animation, follow these steps:

  1. Because you're creating the states, begin start by naming the first state cover as shown in Figure 4-18.

    Naming the first state

    Figure 4-18. Naming the first state

  2. Duplicate the cover state, and name the duplication surfArticle.

  3. In this new state, you can rearrange and add elements to create the look you want for the surfing article. Move the buttons as shown in Figure 4-19, and notice what happens on the Timelines panel: everything that is different between the two states is listed with the appropriate changes (in this case, Move; see Figure 4-20).

    Repositioning the buttons in the surfArticle state

    Figure 4-19. Repositioning the buttons in the surfArticle state

    Timelines panel for the transition from surfArticle cover

    Figure 4-20. Timelines panel for the transition from surfArticle

    Timelines panel for the transition from surfArticle cover
    cover

  4. Select the cover

    Timelines panel for the transition from surfArticle cover
    The Play button, which lets you preview animations

    Figure 4-21. The Play button, which lets you preview animations

    To change the easing of a movement, you can select the movement in the Timelines panel (you can also select multiple movements if required). The Properties panel shows the movement properties, including Duration, Delay, and Easing. By default, Catalyst has a relatively soft in/out easing that generally works quite well. The other options include the following:

    • Linear: Easing acceleration and deceleration are at a constant rate. You can control the timing of the easing in and out.

    • Sine: The ease accelerates to a mid point and then decelerates. This creates a movement that feels less artificial and stiff than a Linear ease. You can control the timing of the easing in and out.

    • Power: Similar to Sine, because it accelerates to a midpoint; but it allows you to control the amount of acceleration and deceleration using the exponent value. The higher the exponent, the more dramatic the acceleration and deceleration. You can control the timing of the easing in and out.

    • Bounce and Elastic: These options create either a bouncing animation or a rubber-band effect. Because these two easing styles have more movement, you should give them more time, or they look very unnatural.

  5. Drag the background image, beach.jpg, and the surf article, article, from the Library onto the stage. article is a custom/generic component that contains a partially transparent rectangle and text fields containing the article and title. Custom/generic components are covered in Chapter 9; in this case, one is used very simply. The article component is merely a way to group the images and text involved in the article into a single component. Initially, the image and the article are on top of the buttons, as shown in Figure 4-22.

    Article component and background image covering the buttons

    Figure 4-22. Article component and background image covering the buttons

  6. In the Layers panel, move the layers containing the article and the background image below the buttons, as shown in Figure 4-23.

    Article and image layers dragged below the button layers

    Figure 4-23. Article and image layers dragged below the button layers

    With these elements on the stage, you can take a closer look at the default smooth transition you've been working with. Clicking the button to the right of Smooth Transition opens a menu that allows you to modify the default animation settings (see Figure 4-24).

    Smooth Transition Options dialog box

    Figure 4-24. Smooth Transition Options dialog box

    In this dialog box, you can define the duration and also the type of timing to use. Simultaneous runs all the effects at the same time, whereas Smart Smoothing runs the animations for elements that exist in the opening state before starting the transitions on the elements that only exist in the finishing state. This change to the default settings becomes the new setting for the Smooth Transition button, allowing you to use these settings for subsequent transitions.

  7. Use the default settings to complete this transition. The design now has the look for two states defined, along with how the animation looks—but it doesn't yet have the interactions. The interactions control when the application changes states. As you saw in Chapter 1, you create them in the Interactions panel.

  8. In the first state, select the surfButton. In the Interactions panel, click Add Interaction. Define the interaction as being On Click, Play Transition to State, surfArticle (as shown in Figure 4-25). When you created this button, you gave it a visual for all the states, including the Disabled state. This state serves as your highlighted version.

    Interactions panel settings for the surfButton

    Figure 4-25. Interactions panel settings for the surfButton

  9. In the surfArticle state, select the surfButton. In the Properties panel, uncheck Enabled. Test the animation by selecting File

    Interactions panel settings for the surfButton

    The project should now play the animation when you click the surfButton. To make the other buttons work, repeat the same process for each one.

3D Flip: Adding Actions to the Animations

Although most animations in Catalyst are between states, you can add other animation during a transition. In this example, you add a 3D flip to a normal transition. It's an example of how you can add actions to an existing animation to add complexity.

You can see this effect in the finished project: it's triggered by the Rotation button on top of the surfButton. When the Rotation button is clicked, the surfButton flips like a playing card to reveal a description on the back. The placement of the rotation button is shown in Figure 4-26.

Surf button with the Rotation button

Figure 4-26. Surf button with the Rotation button

As before, this is a transition between two states, so the first step is the creation of new state based on surfArticle:

  1. Duplicate the surfArticle state, and name the duplicate surfFlipped. This gives you a new state exactly the same as the surfArticle state. No changes are available in the timeline, but you can add to it.

    surfArticle state duplicated to create the surfFlipped state

    Figure 4-27. surfArticle state duplicated to create the surfFlipped state

  2. Select the surfArticle

    surfArticle state duplicated to create the surfFlipped state
    Clicking Add Action for the Surf button between states

    Figure 4-28. Clicking Add Action for the Surf button between states

  3. In the list of options are a variety of properties along with SWF, Video, and Sound effects. (Chapter 8 looks at these.) Select Rotate 3D, as shown in Figure 4-29. Doing so creates a 3D rotation movement on the timeline, as shown in Figure 4-30.

    Add Action menu

    Figure 4-29. Add Action menu

    3D rotation on the timeline

    Figure 4-30. 3D rotation on the timeline

  4. Selecting the 3D rotation lets you see its properties in the Properties panel. You can set how much and along which axis your want the rotation to occur, along with easing and delay if you choose. For this effect, the surfButton needs to rotate halfway (180 degrees) along the x-axis. Set the rotation as shown in Figure 4-31.

    Rotation settings in the Properties panel

    Figure 4-31. Rotation settings in the Properties panel

  5. Play the animation by clicking the Play button in the Timelines panel to see the effect so far. You see the button rotating in 3D space. Note that even though you're rotating it, it still ends in the same position at the end (because that is how it's defined in the state).

  6. The other half of this effect is the author information that's displayed. To save time, the Library contains a generic component named authorInfoBox that holds the author info. Drag an instance of authorInfoBox directly on top of the surfButton in the surfFlipped state. As shown in Figure 4-32, this creates the appearance of the button when it's flipped. This text is "on the back of the playing card" in this example's analogy.

    Author info placed on top of the Surf button

    Figure 4-32. Author info placed on top of the Surf button

  7. Select the authorInfoBox, and give it a 3D rotation using the same process but rotating from 180 to 360 degrees (see Figure 4-33). The difference is due to the card moving from being on its back to its front, so that it's face up in the surfFlipped state. You set this in the Properties panel.

    3D rotation for the authorInfoBox

    Figure 4-33. 3D rotation for the authorInfoBox

  8. With the authorInfoBox, you can play the animation to see it working. Notice that the authorInfoBox stays on top of the surfButton the entire time. This is because there is no z-stacking in Catalyst (that is to say, the layer order doesn't change during transitions).

  9. Because you only want the authorInfoBox to be visible halfway through the animation (when both objects are at 90 degrees to the viewer), move the fade in for the authorInfoBox to be halfway through the animation, as shown in Figure 4-34. This creates the flip animation going from the surfButton to the authorInfoBox whenever the project goes from the surfArticle state to the surfFlipped state.

    Note

    Don't worry if you set up your action incorrectly, it's a simple thing to fix. In order to remove an action from the Timelines panel, select it and then click on the trash can icon at the bottom of the panel. You can then add the action again.

    Fade in for the authorInfoBox moved to halfway in the transitions

    Figure 4-34. Fade in for the authorInfoBox moved to halfway in the transitions

  10. Use the same technique to create the animation for the reverse flip (from authorInfoBox to surfButton) when the project goes from the surfFlipped state to the surfArticle state. The only difference is that this time, the surfButton needs to flip from 180 to 360 degrees (flip back), and the authorInfoBox goes from 0 to 180 degrees (flips over).

  11. Create similar movements for the surfFlipped to surfArticle state transition using the same technique.

Controlling the Flip

To control the project's movement from the surfArticle state to the surfFlipped state and back, you need a button. This button is available in the Library; use the same technique you used to create the three main buttons. Then, follow these steps:

  1. In the surfFlipped state, drag an instance of the Rotate button onto the authorInfoBox, as shown in Figure 4-35.

    Rotation button on top of the authorInfoBox

    Figure 4-35. Rotation button on top of the authorInfoBox

  2. In the Interactions panel, set the interaction for this button to On Click, Play Transition to State, surfArticle, When in surfFlipped (see Figure 4-36). Note the addition of When in surfFlipped. You do this because the button has a slightly different interaction when clicked in the surfArticle state, allowing the same button to jump back and forth between the two states. Run the project to test the effect by selecting File

    Rotation button on top of the authorInfoBox
    First interaction for the Rotate button

    Figure 4-36. First interaction for the Rotate button

  3. To have the same button flip the button back, share the button with the surfArticle state and, in the Interactions panel, add the interaction: On Click, Play Transition to State, surfFlipped, When in surfArticle (see Figure 4-37).

    Second interaction for the Rotate button

    Figure 4-37. Second interaction for the Rotate button

Action Sequences

A final kind of movement that is possible in Catalyst is the action sequence. An action sequence is an animation or action that happens in a single state as opposed to between two states. Action sequences are triggered by some form of event, usually a click or the completion of the application load, but they don't need a change of state. Because of this, they can be useful in minimizing the number of states in a project.

An example of this kind of action sequence is the initial build of the navigation on load. To create any kind of action sequence, you first need to create the interaction that triggers it. The interaction that triggers the action sequence in this example is On Application Start, meaning that as soon as the application finishes loading, this action sequence begins.

Follow these steps:

  1. Click anywhere on the application's background. This makes sure the application as a whole is the selected object in the Interactions panel. The Interactions panel now provides the options for adding an interaction to the application. The application can trigger only one kind of event: On Application Start. This event is triggered when all the application elements have been loaded.

  2. In the Interactions panel, click Add Interaction to create the interaction. Define the interaction as being On Application Start, Play Action Sequence, as shown in Figure 4-38. This creates an empty action sequence below the list of state transitions in the Timelines panel (see Figure 4-39). You can place actions in this action sequence using the same technique you used to create the flip effect earlier in the chapter.

    Interaction settings for the application

    Figure 4-38. Interaction settings for the application

    Empty action sequence created for On Application Start

    Figure 4-39. Empty action sequence created for On Application Start

  3. The action sequence you create in this example is a fade in of the three buttons. To create the fades, in the cover state, select all three buttons (Surf, Bike, and Snake) and click Add Action (see Figure 4-40).

    Adding an action to the three buttons

    Figure 4-40. Adding an action to the three buttons

  4. From the options that are presented, select Fade, as shown in Figure 4-41.

    Adding the Fade action

    Figure 4-41. Adding the Fade action

  5. By default, the Fade action fades out the selected objects. To have them fade in, use the Properties panel to set the Opacity of each button's fade to be from 0 to 100 (see Figure 4-42). This creates a fade effect for each of the three buttons when the application finishes loading.

Properties for the fades

Figure 4-42. Properties for the fades

Conclusion

This chapter's example demonstrates the primary ways that animation works in Catalyst. You've seen how most animation in Catalyst is in the form of transitions, with elements changing from one state to the next. Catalyst is very effective at this kind of animation, allowing you to create appropriate transitions quickly using the Smooth Transition button in the Timelines panel. After you create animations, you can tweak them quite a bit.

This chapter also looked at another form of animation: additional actions and action sequences. Additional actions add a movement to an existing transition, and action sequences allow for animation without changing states.

The next chapter looks at how to best organize your assets when you're creating a Catalyst project.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset