API Documentation | All Packages | All Classes | Index | Frames No Frames |
Class TweenPlugin

Package | com.greensock.plugins
Class | public class TweenPlugin
Subclasses | AutoAlphaPlugin, BezierPlugin, CacheAsBitmapPlugin, CirclePath2DPlugin, DynamicPropsPlugin, EndArrayPlugin, EndVectorPlugin, FrameForwardPlugin, FramePlugin, HexColorsPlugin, LiquidPositionPlugin, MotionBlurPlugin, Physics2DPlugin, PhysicsPropsPlugin, QuaternionsPlugin, RoundPropsPlugin, ScalePlugin, ScrollRectPlugin, SetActualSizePlugin, SetSizePlugin, ShortRotationPlugin, SoundTransformPlugin, StageQualityPlugin, ThrowPropsPlugin, TintPlugin, TransformAroundPointPlugin, TransformMatrixPlugin, VisiblePlugin, VolumePlugin

TweenPlugin is the base class for all TweenLite/TweenMax plugins.
USAGE:
To create your own plugin, extend TweenPlugin and override whichever methods you need. Typically, you only need to override onInitTween() and the changeFactor setter. I'd recommend looking at a simple plugin like FramePlugin or ScalePlugin and using it as a template of sorts. There are a few key concepts to keep in mind:

1. In the constructor, set this.propName to whatever special property you want your plugin to handle.
2. When a tween that uses your plugin initializes its tween values (normally when it starts), a new instance of your plugin will be created and the onInitTween() method will be called. That's where you'll want to store any initial values and prepare for the tween. onInitTween() should return a Boolean value that essentially indicates whether or not the plugin initted successfully. If you return false, TweenLite/Max will just use a normal tween for the value, ignoring the plugin for that particular tween.
3. The changeFactor setter will be updated on every frame during the course of the tween with a multiplier that describes the amount of change based on how far along the tween is and the ease applied. It will be zero at the beginning of the tween and 1 at the end, but inbetween it could be any value based on the ease applied (for example, an Elastic.easeOut tween would cause the value to shoot past 1 and back again before the end of the tween). So if the tween uses the Linear.easeNone easing equation, when it's halfway finished, the changeFactor will be 0.5.
4. The overwriteProps is an Array that should contain the properties that your plugin should overwrite when OverwriteManager's mode is AUTO and a tween of the same object is created. For example, the autoAlpha plugin controls the "visible" and "alpha" properties of an object, so if another tween is created that controls the alpha of the target object, your plugin's killProps() will be called which should handle killing the "alpha" part of the tween. It is your responsibility to populate (and depopulate) the overwriteProps Array. Failure to do so properly can cause odd overwriting behavior.
5. Note that there's a "round" property that indicates whether or not values in your plugin should be rounded to the nearest integer (compatible with TweenMax only). If you use the _tweens Array, populating it through the addTween() method, rounding will happen automatically (if necessary) in the updateTweens() method, but if you don't use addTween() and prefer to manually calculate tween values in your changeFactor setter, just remember to accommodate the "round" flag if it makes sense in your plugin.
6. If you need to run a block of code when the tween has finished, point the onComplete property to a method you created inside your plugin.
7. If you need to run a function when the tween gets disabled, point the onDisable property to a method you created inside your plugin. Same for onEnable if you need to run code when a tween is enabled. (A tween gets disabled when it gets overwritten or finishes or when its timeline gets disabled)
8. Please use the same naming convention as the rest of the plugins, like MySpecialPropertyNamePlugin.
9. IMPORTANT: The plugin framework is brand new, so there is a chance that it will change slightly over time and you may need to adjust your custom plugins if the framework changes. I'll try to minimize the changes, but I'd highly recommend getting a membership to Club GreenSock to make sure you get update notifications. See http://blog.greensock.com/club/ for details.

Copyright 2011, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.

Public Properties

| Property | Defined by
--- | --- | ---
|  | changeFactor : Number | TweenPlugin

Public Methods

| Method | Defined by
--- | --- | ---
|  | TweenPlugin() | TweenPlugin

Public Constants

| Constant | Defined by
--- | --- | ---
|  | VERSION : Number = 1.4 [static] | TweenPlugin

Property detail

changeFactor | property

`changeFactor:Number` [read-write]Implementation
`public function get changeFactor():Number`
`public function set changeFactor(value:Number):void`
Constructor detail

TweenPlugin | () | constructor

`public function TweenPlugin()`
Constant detail

VERSION | constant

`public static const VERSION:Number = 1.4`