Packagegs.plugins
Classpublic class TweenPlugin
SubclassesAutoAlphaPlugin, BezierPlugin, EndArrayPlugin, FilterPlugin, FramePlugin, HexColorsPlugin, RoundPropsPlugin, ShortRotationPlugin, TintPlugin, VisiblePlugin, VolumePlugin

Public Properties
 PropertyDefined by
  changeFactor : Number
TweenPlugin
  onComplete : Function
Called when the tween is complete.
TweenPlugin
  overwriteProps : Array
Array containing the names of the properties that should be overwritten in OverwriteManager's AUTO mode.
TweenPlugin
  propName : String
Name of the special property that the plugin should intercept/handle
TweenPlugin
  round : Boolean
If the values should be rounded to the nearest integer, set this to true.
TweenPlugin
Protected Properties
 PropertyDefined by
  _changeFactor : Number = 0
TweenPlugin
  _tweens : Array
TweenPlugin
Public Methods
 MethodDefined by
  
TweenPlugin
  
activate($plugins:Array):Boolean
[static] Handles integrating the plugin into the GreenSock tweening platform.
TweenPlugin
  
killProps($lookup:Object):void
Gets called on plugins that have multiple overwritable properties by OverwriteManager when in AUTO mode.
TweenPlugin
  
onInitTween($target:Object, $value:TweenLite, $tween:*):Boolean
Gets called when any tween of the special property begins.
TweenPlugin
Protected Methods
 MethodDefined by
  
addTween($object:Object, $propName:String, $start:Number, $end:String, $overwriteProp:* = null):void
Offers a simple way to add tweening values to the plugin.
TweenPlugin
  
updateTweens($changeFactor:Number):void
Updates all the tweens in the _tweens Array.
TweenPlugin
Public Constants
 ConstantDefined by
  API : Number = 1.0
[static]
TweenPlugin
  VERSION : Number = 1.03
[static]
TweenPlugin
Property detail
_changeFactorproperty
protected var _changeFactor:Number = 0
changeFactorproperty 
changeFactor:Number  [read-write]Implementation
    public function get changeFactor():Number
    public function set changeFactor(value:Number):void
onCompleteproperty 
public var onComplete:Function

Called when the tween is complete.

overwritePropsproperty 
public var overwriteProps:Array

Array containing the names of the properties that should be overwritten in OverwriteManager's AUTO mode. Typically the only value in this Array is the propName, but there are cases when it may be different. For example, a bezier tween's propName is "bezier" but it can manage many different properties like x, y, etc. depending on what's passed in to the tween.

propNameproperty 
public var propName:String

Name of the special property that the plugin should intercept/handle

roundproperty 
public var round:Boolean

If the values should be rounded to the nearest integer, set this to true.

_tweensproperty 
protected var _tweens:Array
Constructor detail
TweenPlugin()constructor
public function TweenPlugin() Init Parameters
Method detail
activate()method
public static function activate($plugins:Array):Boolean

Handles integrating the plugin into the GreenSock tweening platform.

Parameters
$plugins:Array — An Array of Plugin classes (that all extend TweenPlugin) to be activated. For example, TweenPlugin.activate([FrameLabelPlugin, ShortRotationPlugin, TintPlugin]);

Returns
Boolean
addTween()method 
protected function addTween($object:Object, $propName:String, $start:Number, $end:String, $overwriteProp:* = null):void

Offers a simple way to add tweening values to the plugin. You don't need to use this, but it is convenient because the tweens get updated in the updateTweens() method which also handles rounding. killProps() nicely integrates with most tweens added via addTween() as well, but if you prefer to handle this manually in your plugin, you're welcome to.

Parameters
$object:Object — target object whose property you'd like to tween. (i.e. myClip)
 
$propName:String — the property name that should be tweened. (i.e. "x")
 
$start:Number — starting value
 
$end:String — end value (can be either numeric or a string value. If it's a string, it will be interpreted as relative to the starting value)
 
$overwriteProp:* (default = null) — name of the property that should be associated with the tween for overwriting purposes. Normally, it's the same as $propName, but not always. For example, you may tween the "changeFactor" property of a VisiblePlugin, but the property that it's actually controling in the end is "visible", so if a new overlapping tween of the target object is created that affects its "visible" property, this allows the plugin to kill the appropriate tween(s) when killProps() is called.
killProps()method 
public function killProps($lookup:Object):void

Gets called on plugins that have multiple overwritable properties by OverwriteManager when in AUTO mode. Basically, it instructs the plugin to overwrite certain properties. For example, if a bezier tween is affecting x, y, and width, and then a new tween is created while the bezier tween is in progress, and the new tween affects the "x" property, we need a way to kill just the "x" part of the bezier tween.

Parameters
$lookup:Object — An object containing properties that should be overwritten. We don't pass in an Array because looking up properties on the object is usually faster because it gives us random access. So to overwrite the "x" and "y" properties, a {x:true, y:true} object would be passed in.
onInitTween()method 
public function onInitTween($target:Object, $value:TweenLite, $tween:*):Boolean

Gets called when any tween of the special property begins. Store any initial values and/or variables that will be used in the "changeFactor" setter when this method runs.

Parameters
$target:Object — target object of the TweenLite instance using this plugin
 
$value:TweenLite — The value that is passed in through the special property in the tween.
 
$tween:* — The TweenLite or TweenMax instance using this plugin.

Returns
Boolean — If the initialization failed, it returns false. Otherwise true. It may fail if, for example, the plugin requires that the target be a DisplayObject or has some other unmet criteria in which case the plugin is skipped and a normal property tween is used inside TweenLite
updateTweens()method 
protected function updateTweens($changeFactor:Number):void

Updates all the tweens in the _tweens Array.

Parameters
$changeFactor:Number — Multiplier describing the amount of change that should be 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 tween would cause the value to shoot past 1 and back again before the end of the tween)
Constant detail
APIconstant
public static const API:Number = 1.0
VERSIONconstant 
public static const VERSION:Number = 1.03
Wiki link
Click to go to the wiki page for 'gs.plugins.TweenPlugin'

Code examples

Comments