Monday, November 19, 2007

How to stack Order to simulate Relative Motion

How to stack Order to simulate Relative Motion

To stack Order to simulate Relative Motion

The stacking order, also known as the z-index, is a unique property of floating boxes. In animations with multiple objects, you can use this property to determine which object should appear on top when the paths of two or more floating boxes cross.

The following example is based on a simple animation that simulates relative motion. It is a palindrome that consists of two objects, a stationary floating box with a GIF image and an animated floating box with text content. Four key-frames, each on two time tracks, control the animation, subdividing it in four phases. The test box remains on top until the final phase, when it moves behind and is hidden by the image box.

To create an animation with one stationary object and an animated object revolving around it:

Step 1.

  • Insert two floating boxes and add content.

Step 2.

  • Select the image box and place four key-frames on its time track in the TimeLine Editor.

Step 3.

  • To make the image box stationary, select the first key-frame of the image box; and then drag the image box to a convenient location

Step 4.

  • The position should be the same for all four key-frames, and prevent the image box from jumping during playback. If in doubt, click all four key-frames to check the positions in the Top and Left text boxes of the Floating Box Inspector. If necessary, correct any pixel offset by hand editing the top and left coordinates or each key-frame.

Step 5.

  • Click the Loop and Palindrome buttons in the TimeLine Editor to play the animation in an endless loop.

Step 6.

  • Click the Play button to preview the stationary object. The image box shouldn’t be moved. If any motion occurs, return to step 4 and correct the Top and Left coordinates. Now, you’ll insert four key-frames and assign text box positions to them.

Step 7.

  • Select the text box and insert four key-frames on its time track in the TimeLine Editor. Place each key-frame directly below the image box key-frames to synchronize them, as the following illustration.

  • Two-time tracks will appear in the TimeLine Editor. Each holds four key-frames.

Step 8.

  • Position the text box relative to the image box:

    1. Select the first key-frame of the text box; then drag the text box to a position to the left of the image box, aligning it vertically with the center of the image box.

    2. Select the second key-frame of the text box; then drag the text box horizontally on top of the image box.

    3. Select the third key-frame of the text box; then drag the text box horizontally to the right of the image box.

    4. Select the last key-frame of the text box, and then drag the text box horizontally on top of the image box.

Step 9.

  • Define the stacking order for all four key-frames, both for the text box and image box.

    1. Select the first key-frame of the text box. In the Floating Box Inspector, enter 2 in the Depth text box.

    2. Select the first key-frame of the image box. In the Floating Box Inspector enter 1 in the Depth text box.

            1. Current coordinates

            2. Selects the shape of the animation path

            3. Selects a key-frame color

            4. Sets the stacking order

            5. Sets visibility

Step 10.

  • Repeat step 9 for the second and third key-frames to stack the text box on top of the image box.

Step 11.

  • Reverse the stacking order for the time span after the last key-frame:

    1. Select the last key-frame of the text box in the Floating Box Inspector and enter 1 in the Depth text box.

    2. Select the last key-frame of the image box. Enter 2 in the Depth text box of the Floating Box Inspector.

Step 12.

  • Click the Play button to preview your animation. On returning from the farthest right point of the animation path, the text box should disappear behind the image box.

No comments: