Recipe 4.3. Applying Acceleration and Deceleration with Easing


Problem

You want to apply acceleration or deceleration to a motion or shape tween.

Solution

Use easing.

Discussion

When you apply a motion or shape tween, Flash animates the change at a constant rate by default. However, you may want to apply acceleration or deceleration. For example, to mimic the effects of gravity on a falling ball, you'll want it to accelerate as it falls. If the ball bounces back up, you'll want to apply deceleration. You can add acceleration or deceleration by adjusting the easing.

Easing is applied to the same keyframe as the tween. To apply it, select the keyframe where the tween begins (or any frame before the last frame in the tween). In the Property inspector, enter a value in the Ease field, or drag the slider that appears beside it. Values range from100 to 100. The default, 0, tweens at a constant rate. To apply acceleration, enter a negative number. To apply deceleration, enter a positive number. Negative values, or acceleration, are referred to as easing in, and the word in appears beside the easing slider when a negative number is entered. Likewise, positive numbers are referred to as easing out, and the word out appears beside the slider when a positive number is entered.

The value you specify in the Ease field is applied to the entire tween. With the value in the Ease field, you cannot ease the first half of a tween at one setting and switch a different setting for the second half. For complex and advanced easing, you can use the Custom Ease In/Ease Out utility as discussed in Recipe 4.4.

See Also

Recipe 4.1, Recipe 4.10




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net