In this tutorial, we show how to use the AS3 Tween class and its access to the built-in AS3 collection of 'easing' functions to produce interesting rotation effects for 3D objects. To illustrate the idea, we use the following example in which a hexagonal cylinder, drawn at runtime, is being rotated. Our usage of the Tween class is somewhat non-standard. We are tweening a property of an object that does not directly produce a visual change.
- Download all 'fla', and 'as' files corresponding to this tutorial: tween3d.zip
The AS3 Tween class is most often used to change over a time interval a property of a display object that affects the object's appearance directly. For example, the x or the y coordinate of the object, or the alpha property of the object. The constructor of the Tween class takes as a parameter one of many built-in easing functions that accelerate or deccelerate changes in the property and thus producing interesting animation effects. To see more straightforward examples of the Tween class usage, visit our tutorial Using the Tween Class in Flash CS3 and AS3
In this tutorial, we use the Tween class to change an object's property that does not directly produce a visual change. It does so indirectly in combination with a listener to the TweenEvent.MOTION_CHANGE. We explain the idea on the next page.