Tweener Documentation
Special properties are specialized pieces of code, made to help Tweener deal with aspects of ActionScript objects that are not normally acessible directly - by a normal property - or that can't simply be tweened. They act like code proxies, executing specific code blocks based on a metaphorical tweening value. For example, one can't change the current frame of a MovieClip
object, so it's not a tweenable property; however, since Tweener has a special property called _frame
, you can tween the current frame with code like this (on all ActionScript versions):
// Fast-forward a movieclip to frame 20, slowing down on the end myMovieClip.gotoAndStop(1); Tweener.addTween(myMovieClip, {_frame:20, time:1, transition:"easeOutExpo"});
Special properties work in a modular way. They're not available by default, so they have to be registered first before they can be used, by using the registerSpecialProperty
, registerSpecialPropertySplitter
, and registerSpecialPropertyModifier
methods.
Anyone can create new special properties by using these methods. However, Tweener comes with a collection of different special property classes, meant to do the most common tasks.
Keep in mind that, since they rely on specific methods of implementation, these classes and special properties are optional; it's perfectly possible to create tweenings of every aspect of an ActionScript object without these special properties - such as with getter/setter methods on a custom class, or successive calls to update functions. However, as a quick solution, special properties play an important role.
As the special property classes available on Tweener are separated, they aren't initialized by default, so their special properties aren't registered to the engine just by using Tweener. To properly use the special properties available on these classes, you have to first initialize them, like such:
// Import Tweener import caurina.transitions.Tweener; // Import the list of special properties we want: FilterShortcuts import caurina.transitions.properties.FilterShortcuts; // Initialize the FilterShortcuts class FilterShortcuts.init();
Or you can initialize the class directly, without importing, since you only have to refer to it once.
// Import Tweener import caurina.transitions.Tweener; // Initialize the list of special properties we want: FilterShortcuts caurina.transitions.properties.FilterShortcuts.init();
After that is done, all special properties made available by the FilterShortcuts
class will be available for Tweener (regardless of where the reference is made; the registration is global). Due to this, you only have to register (or initialize) the class once.
See the list below for a description of the collection of special properties already included in the Tweener files by default, and see the individual page of each class for a list of the special properties available inside it.
Class path and name | Description | Approximate addition to SWF size |
---|---|---|
caurina.transitions.properties.ColorShortcuts | Includes properties for manipulating the color of display objects, such as individual channel multiplier and offsets, and special coloring such as hue, saturation, brightness and contrast. | 2.2 kb |
caurina.transitions.properties.CurveModifiers | Modifiers that provide some kind of change for normal tweenings; right now, the bezier curve only. | 0.4 kb |
caurina.transitions.properties.DisplayShortcuts | Special properties for display objects such as Sprites , MovieClips , and TextField instances, include modifiers for visibility, frame position, and scrollRect size. |
0.8 kb |
caurina.transitions.properties.FilterShortcuts | A list of special properties that simplify the tweening of the built-in bitmap filters such as Blur, Glow, and many others. | 3.5 kb |
caurina.transitions.properties.SoundShortcuts | Special properties used when controlling sound. | 0.2 kb |
caurina.transitions.properties.TextShortcuts | Additional special properties used to change some specific TextField properties, such as TextFormat properties, and the text content itself. |
0.9 kb |