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

Package | com.greensock
Class | public class TweenMax
Inheritance | TweenMax TweenLite TweenCore
Implements | flash.events.IEventDispatcher

TweenMax extends the extremely lightweight, fast TweenLite engine, adding many useful features like timeScale, event dispatching, updateTo(), yoyo, repeat, repeatDelay, rounding, and more. It also activates many extra plugins by default, making it extremely full-featured. Since TweenMax extends TweenLite, it can do ANYTHING TweenLite can do plus much more. The syntax is identical. With plenty of other tweening engines to choose from, here's why you might want to consider TweenMax:

- SPEED - TweenMax has been highly optimized for maximum performance. See some speed comparisons yourself at http://www.greensock.com/tweening-speed-test/
- Feature set - In addition to tweening ANY numeric property of ANY object, TweenMax can tween filters, hex colors, volume, tint, frames, saturation, contrast, hue, colorization, brightness, and even do bezier tweening, orientToBezier, round values, jump to any point in the tween with the `currentTime` or `currentProgress` property, automatically rotate in the shortest direction, plus LOTS more. Overwrite management is an important consideration for a tweening engine as well which is another area where the GreenSock Tweening Platform shines. You have options for AUTO overwriting or you can manually define how each tween will handle overlapping tweens of the same object.
- Expandability - With its plugin architecture, you can activate as many (or as few) features as your project requires. Write your own plugin to handle particular special properties in custom ways. Minimize bloat, and maximize performance.
- Sequencing, grouping, and management features - TimelineLite and TimelineMax make it surprisingly simple to create complex sequences or groups of tweens that you can control as a whole. play(), pause(), restart(), or reverse(). You can even tween a timeline's `currentTime` or `currentProgress` property to fastforward or rewind the entire timeline. Add labels, gotoAndPlay(), change the timeline's timeScale, nest timelines within timelines, and lots more.
- Ease of use - Designers and Developers alike rave about how intuitive the platform is.
- Updates - Frequent updates and feature additions make the GreenSock Tweening Platform reliable and robust.
- AS2 and AS3 - Most other engines are only developed for AS2 or AS3 but not both.

SPECIAL PROPERTIES:
The following special properties can be defined in the `vars` parameter which can be either a generic Object or a `TweenMaxVars` instance:

- delay : Number Amount of delay in seconds (or frames for frames-based tweens) before the tween should begin.
- useFrames : Boolean If useFrames is set to true, the tweens's timing mode will be based on frames. Otherwise, it will be based on seconds/time. NOTE: a tween's timing mode is always determined by its parent timeline.
- ease : Function Use any standard easing equation to control the rate of change. For example, Elastic.easeOut. The Default is Quad.easeOut.
- easeParams : Array An Array of extra parameters to feed the easing equation (beyond the standard first 4). This can be useful when using an ease like Elastic and want to control extra parameters like the amplitude and period. Most easing equations, however, don't require extra parameters so you won't need to pass in any easeParams.
- onInit : Function A function that should be called just before the tween inits (renders for the first time). Since onInit runs before the start/end values are recorded internally, it is a good place to run code that affects the target's initial position or other tween-related properties. onStart, by contrast, runs AFTER the tween inits and the start/end values are recorded internally. onStart is called every time the tween begins which can happen more than once if the tween is restarted multiple times.
- onInitParams : Array An Array of parameters to pass the onInit function.
- onStart : Function A function that should be called when the tween begins (when its currentTime is at 0 and changes to some other value which can happen more than once if the tween is restarted multiple times).
- onStartParams : Array An Array of parameters to pass the onStart function.
- onUpdate : Function A function that should be called every time the tween's time/position is updated (on every frame while the timeline is active)
- onUpdateParams : Array An Array of parameters to pass the onUpdate function
- onComplete : Function A function that should be called when the tween has finished
- onCompleteParams : Array An Array of parameters to pass the onComplete function
- onReverseComplete : Function A function that should be called when the tween has reached its starting point again after having been reversed.
- onReverseCompleteParams : Array An Array of parameters to pass the onReverseComplete function.
- onRepeat : Function A function that should be called every time the tween repeats
- onRepeatParams : Array An Array of parameters to pass the onRepeat function
- immediateRender : Boolean Normally when you create a tween, it begins rendering on the very next frame (when the Flash Player dispatches an ENTER_FRAME event) unless you specify a `delay`. This allows you to insert tweens into timelines and perform other actions that may affect its timing. However, if you prefer to force the tween to render immediately when it is created, set `immediateRender` to true. Or to prevent a tween with a duration of zero from rendering immediately, set this to false.
- paused : Boolean If true, the tween will be paused initially.
- reversed : Boolean If true, the tween will be reversed initially. This does not swap the starting/ending values in the tween - it literally changes its orientation/direction. Imagine the playhead moving backwards instead of forwards. This does NOT force it to the very end and start playing backwards. It simply affects the orientation of the tween, so if reversed is set to true initially, it will appear not to play because it is already at the beginning. To cause it to play backwards from the end, set reversed to true and then set the `currentProgress` property to 1 immediately after creating the tween (or set the currentTime to the duration).
- overwrite : int Controls how (and if) other tweens of the same target are overwritten by this tween. There are several modes to choose from, and TweenMax automatically calls `OverwriteManager.init()` if you haven't already manually dones so, which means that by default `AUTO` mode is used (please see http://www.greensock.com/overwritemanager/ for details and a full explanation of the various modes):
  - NONE (0) (or false)
  - ALL_IMMEDIATE (1) (or true)
  - AUTO (2) - this is the default mode for TweenMax.
  - CONCURRENT (3)
  - ALL_ONSTART (4)
  - PREEXISTING (5)
- repeat : int Number of times that the tween should repeat. To repeat indefinitely, use -1.
- repeatDelay : Number Amount of time in seconds (or frames for frames-based tween) between repeats.
- yoyo : Boolean Works in conjunction with the repeat property, determining the behavior of each cycle. When yoyo is true, the tween will go back and forth, appearing to reverse every other cycle (this has no affect on the "reversed" property though). So if repeat is 2 and yoyo is false, it will look like: start - 1 - 2 - 3 - 1 - 2 - 3 - 1 - 2 - 3 - end. But if repeat is 2 and yoyo is true, it will look like: start - 1 - 2 - 3 - 3 - 2 - 1 - 1 - 2 - 3 - end.
- onStartListener : Function A function to which the TweenMax instance should dispatch a TweenEvent when it begins. This is the same as doing `myTween.addEventListener(TweenEvent.START, myFunction);`
- onUpdateListener : Function A function to which the TweenMax instance should dispatch a TweenEvent every time it updates values. This is the same as doing `myTween.addEventListener(TweenEvent.UPDATE, myFunction);`
- onCompleteListener : Function A function to which the TweenMax instance should dispatch a TweenEvent when it completes. This is the same as doing `myTween.addEventListener(TweenEvent.COMPLETE, myFunction);`
- onReverseCompleteListener : Function A function to which the TweenMax instance should dispatch a TweenEvent when it completes in the reverse direction. This is the same as doing `myTween.addEventListener(TweenEvent.REVERSE_COMPLETE, myFunction);`
- onRepeatListener : Function A function to which the TweenMax instance should dispatch a TweenEvent when it repeats. This is the same as doing `myTween.addEventListener(TweenEvent.REPEAT, myFunction);`
- startAt : Object Allows you to define the starting values for each property. Typically, TweenMax uses the current value (whatever it happens to be at the time the tween begins) as the start value, but startAt allows you to override that behavior. Simply pass an object in with whatever properties you'd like to set just before the tween begins. For example, if mc.x is currently 100, and you'd like to tween it from 0 to 500, do `TweenMax.to(mc, 2, {x:500, startAt:{x:0}});`

Note: Using a `TweenMaxVars` instance instead of a generic Object to define your `vars` is a bit more verbose but provides code hinting and improved debugging because it enforces strict data typing. Use whichever one you prefer.
PLUGINS:
There are many plugins that add capabilities through other special properties. Adding the capabilities is as simple as activating the plugin with a single line of code, like `TweenPlugin.activate([SetSizePlugin]);` Get information about all the plugins at http://www.TweenMax.com. The following plugins are activated by default in TweenMax (you can easily prevent them from activating, thus saving file size, by commenting out the associated activation lines towards the top of the class):

- autoAlpha : Number - Use it instead of the alpha property to gain the additional feature of toggling the visible property to false when alpha reaches 0. It will also toggle visible to true before the tween starts if the value of autoAlpha is greater than zero.
- visible : Boolean - To set a DisplayObject's "visible" property at the end of the tween, use this special property.
- volume : Number - Tweens the volume of an object with a soundTransform property (MovieClip/SoundChannel/NetStream, etc.)
- tint : Number - To change a DisplayObject's tint/color, set this to the hex value of the tint you'd like to end up at(or begin at if you're using TweenMax.from()). An example hex value would be 0xFF0000.
- removeTint : Boolean - If you'd like to remove the tint that's applied to a DisplayObject, pass true for this special property.
- frame : Number - Use this to tween a MovieClip to a particular frame.
- bezier : Array - Bezier tweening allows you to tween in a non-linear way. For example, you may want to tween a MovieClip's position from the origin (0,0) 500 pixels to the right (500,0) but curve downwards through the middle of the tween. Simply pass as many objects in the bezier array as you'd like, one for each "control point" (see documentation on Flash's curveTo() drawing method for more about how control points work). In this example, let's say the control point would be at x/y coordinates 250,50. Just make sure your my_mc is at coordinates 0,0 and then do: `TweenMax.to(my_mc, 3, {bezier:[{x:250, y:50}, {x:500, y:0}]});`
- bezierThrough : Array - Identical to bezier except that instead of passing bezier control point values, you pass points through which the bezier values should move. This can be more intuitive than using control points.
- orientToBezier : Array (or Boolean) - A common effect that designers/developers want is for a MovieClip/Sprite to orient itself in the direction of a Bezier path (alter its rotation). orientToBezier makes it easy. In order to alter a rotation property accurately, TweenMax needs 4 pieces of information:
  1. Position property 1 (typically "x")
  2. Position property 2 (typically "y")
  3. Rotational property (typically "rotation")
  4. Number of degrees to add (optional - makes it easy to orient your MovieClip properly)
  The orientToBezier property should be an Array containing one Array for each set of these values. For maximum flexibility, you can pass in any number of arrays inside the container array, one for each rotational property. This can be convenient when working in 3D because you can rotate on multiple axis. If you're doing a standard 2D x/y tween on a bezier, you can simply pass in a boolean value of true and TweenMax will use a typical setup, `[["x", "y", "rotation", 0]]`. Hint: Don't forget the container Array (notice the double outer brackets)
- hexColors : Object - Although hex colors are technically numbers, if you try to tween them conventionally, you'll notice that they don't tween smoothly. To tween them properly, the red, green, and blue components must be extracted and tweened independently. TweenMax makes it easy. To tween a property of your object that's a hex color to another hex color, use this special hexColors property of TweenMax. It must be an OBJECT with properties named the same as your object's hex color properties. For example, if your my_obj object has a "myHexColor" property that you'd like to tween to red (0xFF0000) over the course of 2 seconds, do:
  `TweenMax.to(my_obj, 2, {hexColors:{myHexColor:0xFF0000}});`
  You can pass in any number of hexColor properties.
- shortRotation : Object - To tween the rotation property of the target object in the shortest direction, use "shortRotation" instead of "rotation" as the property. For example, if `myObject.rotation` is currently 170 degrees and you want to tween it to -170 degrees, a normal rotation tween would travel a total of 340 degrees in the counter-clockwise direction, but if you use shortRotation, it would travel 20 degrees in the clockwise direction instead.
- roundProps : Array - If you'd like the inbetween values in a tween to always get rounded to the nearest integer, use the roundProps special property. Just pass in an Array containing the property names that you'd like rounded. For example, if you're tweening the x, y, and alpha properties of mc and you want to round the x and y values (not alpha) every time the tween is rendered, you'd do: `TweenMax.to(mc, 2, {x:300, y:200, alpha:0.5, roundProps:["x","y"]});`
- blurFilter : Object - To apply a BlurFilter, pass an object with one or more of the following properties: `blurX, blurY, quality, remove, addFilter, index`
- glowFilter : Object - To apply a GlowFilter, pass an object with one or more of the following properties: `alpha, blurX, blurY, color, strength, quality, inner, knockout, remove, addFilter, index`
- colorMatrixFilter : Object - To apply a ColorMatrixFilter, pass an object with one or more of the following properties: `colorize, amount, contrast, brightness, saturation, hue, threshold, relative, matrix, remove, addFilter, index`
- dropShadowFilter : Object - To apply a DropShadowFilter, pass an object with one or more of the following properties: `alpha, angle, blurX, blurY, color, distance, strength, quality, remove, addFilter, index`
- bevelFilter : Object - To apply a BevelFilter, pass an object with one or more of the following properties: `angle, blurX, blurY, distance, highlightAlpha, highlightColor, shadowAlpha, shadowColor, strength, quality, remove, addFilter, index`

EXAMPLES:
Please see http://www.tweenmax.com for examples, tutorials, and interactive demos.
NOTES / TIPS:

- Passing values as Strings will make the tween relative to the current value. For example, if you do `TweenMax.to(mc, 2, {x:"-20"});` it'll move the mc.x to the left 20 pixels which is the same as doing `TweenMax.to(mc, 2, {x:mc.x - 20});` You could also cast it like: `TweenMax.to(mc, 2, {x:String(myVariable)});`
- If you prefer, instead of using the onCompleteListener, onInitListener, onStartListener, and onUpdateListener special properties, you can set up listeners the typical way, like:
  `var myTween:TweenMax = new TweenMax(my_mc, 2, {x:200});
  myTween.addEventListener(TweenEvent.COMPLETE, myFunction);`
- You can kill all tweens of a particular object anytime with the `TweenMax.killTweensOf(myObject);`
- You can kill all delayedCalls to a particular function using `TweenMax.killDelayedCallsTo(myFunction);` This can be helpful if you want to preempt a call.
- Use the `TweenMax.from()` method to animate things into place. For example, if you have things set up on the stage in the spot where they should end up, and you just want to animate them into place, you can pass in the beginning x and/or y and/or alpha (or whatever properties you want).
- If you find this class useful, please consider joining Club GreenSock which not only helps to sustain ongoing development, but also gets you bonus plugins, classes and other benefits that are ONLY available to members. Learn more at http://www.greensock.com/club/

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
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined by
--- | --- | ---
|  | currentProgress : Number Value between 0 and 1 indicating the progress of the tween according to its `duration` where 0 is at the beginning, 0.5 is halfway finished, and 1 is finished. | TweenMax
|  | currentTime : Number [write-only] Most recently rendered time (or frame for frames-based timelines) according to the tween's duration. | TweenMax
|  | data : * Place to store any data you want. | TweenCore
|  | defaultEase : Function [static] Provides an easy way to change the default easing equation. | TweenLite
|  | delay : Number Length of time in seconds (or frames for frames-based tweens/timelines) before the tween should begin. | TweenCore
|  | duration : Number Duration of the tween in seconds (or frames for frames-based tweens/timelines) not including any repeats or repeatDelays. | TweenCore
|  | globalTimeScale : Number [static] Multiplier describing the speed of the root timelines where 1 is normal speed, 0.5 is half-speed, 2 is double speed, etc. | TweenMax
|  | killTweensOf : Function [static] Kills all the tweens of a particular object, optionally completing them first. | TweenMax
|  | paused : Boolean Indicates the paused state of the tween/timeline. | TweenCore
|  | repeat : int Number of times that the tween should repeat; -1 repeats indefinitely. | TweenMax
|  | repeatDelay : Number Amount of time in seconds (or frames for frames-based tweens) between repeats | TweenMax
|  | reversed : Boolean Indicates the reversed state of the tween/timeline. | TweenCore
|  | startTime : Number Start time in seconds (or frames for frames-based tweens/timelines), according to its position on its parent timeline | TweenCore
|  | target : Object Target object whose properties this tween affects. | TweenLite
|  | timeline : SimpleTimeline The parent timeline on which the tween/timeline is placed. | TweenCore
|  | timeScale : Number Multiplier affecting the speed of the timeline where 1 is normal speed, 0.5 is half-speed, 2 is double speed, etc. | TweenMax
|  | totalDuration : Number Duration of the tween in seconds (or frames for frames-based timelines) including any repeats or repeatDelays. | TweenMax
|  | totalProgress : Number Value between 0 and 1 indicating the overall progress of the tween according to its `totalDuration` where 0 is at the beginning, 0.5 is halfway finished, and 1 is finished. | TweenMax
|  | totalTime : Number Most recently rendered time (or frame for frames-based tweens/timelines) according to its `totalDuration`. | TweenCore
|  | vars : Object Stores variables (things like alpha, y or whatever we're tweening as well as special properties like "onComplete"). | TweenCore
|  | yoyo : Boolean Works in conjunction with the repeat property, determining the behavior of each cycle; when yoyo is true, the tween will go back and forth, appearing to reverse every other cycle (this has no affect on the "reversed" property though). | TweenMax

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined by
--- | --- | ---
|  | TweenMax(target:Object, duration:Number, vars:Object) Constructor | TweenMax
|  | allFrom(targets:Array, duration:Number, vars:Object, stagger:Number = 0, onCompleteAll:Function = null, onCompleteAllParams:Array = null):Array [static] Exactly the same as TweenMax.allTo(), but instead of tweening the properties from where they're at currently to whatever you define, this tweens them the opposite way - from where you define TO where ever they are when the tweens begin. | TweenMax
|  | allFromTo(targets:Array, duration:Number, fromVars:Object, toVars:Object, stagger:Number = 0, onCompleteAll:Function = null, onCompleteAllParams:Array = null):Array [static] Tweens multiple targets from a common set of starting values to a common set of ending values; exactly the same as TweenMax.allTo(), but adds the ability to define the starting values. | TweenMax
|  | allTo(targets:Array, duration:Number, vars:Object, stagger:Number = 0, onCompleteAll:Function = null, onCompleteAllParams:Array = null):Array [static] Tween multiple objects to the same end values. | TweenMax
|  | complete(skipRender:Boolean = false, suppressEvents:Boolean = false):void Forces the tween to completion. | TweenMax
|  | delayedCall(delay:Number, onComplete:Function, onCompleteParams:Array = null, useFrames:Boolean = false):TweenMax [static] Provides a simple way to call a function after a set amount of time (or frames). | TweenMax
|  | from(target:Object, duration:Number, vars:Object):TweenMax [static] Static method for creating a TweenMax instance that tweens in the opposite direction compared to a `TweenMax.to()` tween. | TweenMax
|  | fromTo(target:Object, duration:Number, fromVars:Object, toVars:Object):TweenMax [static] Static method for creating a TweenMax instance that tweens from a particular set of values to another set of values, as opposed to a normal to() or from() tween which are based on the target's current values. | TweenMax
|  | getAllTweens():Array [static] Returns all tweens that are in the masterList. | TweenMax
|  | getTweensOf(target:Object):Array [static] Gets all the tweens of a particular object. | TweenMax
|  | invalidate():void Clears any initialization data (like starting values in tweens) which can be useful if, for example, you want to restart it without reverting to any previously recorded starting values. | TweenMax
|  | isTweening(target:Object):Boolean [static] Determines whether or not a particular object is actively tweening. | TweenMax
|  | kill():void Kills the tween/timeline, stopping it immediately. | TweenCore
|  | killAll(complete:Boolean = false, tweens:Boolean = true, delayedCalls:Boolean = true):void [static] Kills all tweens and/or delayedCalls/callbacks, optionally forcing them to completion first. | TweenMax
|  | killChildTweensOf(parent:DisplayObjectContainer, complete:Boolean = false):void [static] Kills all tweens of the children of a particular DisplayObjectContainer, optionally forcing them to completion first. | TweenMax
|  | killProperties(names:Array):void Allows particular properties of the tween to be killed, much like the killVars() method except that killProperties() accepts an Array of property names. | TweenMax
|  | killTweensOf(target:Object, complete:Boolean = false, vars:Object = null):void [static] Kills all the tweens (or certain tweening properties) of a particular object, optionally completing them first. | TweenLite
|  | killVars(vars:Object, permanent:Boolean = true):Boolean Allows particular properties of the tween to be killed. | TweenLite
|  | pause():void Pauses the tween/timeline | TweenCore
|  | pauseAll(tweens:Boolean = true, delayedCalls:Boolean = true):void [static] Pauses all tweens and/or delayedCalls/callbacks. | TweenMax
|  | play():void Starts playing forward from the current position. | TweenCore
|  | restart(includeDelay:Boolean = false, suppressEvents:Boolean = true):void Restarts and begins playing forward. | TweenCore
|  | resume():void Starts playing from the current position without altering direction (forward or reversed). | TweenCore
|  | resumeAll(tweens:Boolean = true, delayedCalls:Boolean = true):void [static] Resumes all paused tweens and/or delayedCalls/callbacks. | TweenMax
|  | reverse(forceResume:Boolean = true):void Reverses smoothly, adjusting the startTime to avoid any skipping. | TweenCore
|  | setDestination(property:String, value:Boolean, adjustStartValues:* = true):void Adjusts a destination value on the fly, optionally adjusting the start values so that it appears to redirect seamlessly without skipping/jerking (this method has been deprecated in favor of `updateTo()`). | TweenMax
|  | to(target:Object, duration:Number, vars:Object):TweenMax [static] Static method for creating a TweenMax instance. | TweenMax
|  | updateTo(vars:Object, resetDuration:Boolean = false):void Updates tweening values on the fly so that they appear to seamlessly change course even if the tween is in-progress. | TweenMax

Property detail

currentProgress | property

`currentProgress:Number` [read-write]

Value between 0 and 1 indicating the progress of the tween according to its `duration` where 0 is at the beginning, 0.5 is halfway finished, and 1 is finished. `totalProgress`, by contrast, describes the overall progress according to the tween's `totalDuration` which includes repeats and repeatDelays (if there are any). For example, if a TweenMax instance is set to repeat once, at the end of the first cycle `totalProgress` would only be 0.5 whereas `currentProgress` would be 1. If you tracked both properties over the course of the tween, you'd see `currentProgress` go from 0 to 1 twice (once for each cycle) in the same time it takes the `totalProgress` property to go from 0 to 1 once.

Implementation
`public function get currentProgress():Number`
`public function set currentProgress(value:Number):void`

currentTime | property |

`currentTime:Number` [write-only]

Most recently rendered time (or frame for frames-based timelines) according to the tween's duration. `totalTime`, by contrast, is based on the `totalDuration` which includes repeats and repeatDelays. For example, if a TweenMax instance has a duration of 5 a repeat of 1 (meaning its `totalDuration` is 10), at the end of the second cycle, `currentTime` would be 5 whereas `totalTime` would be 10. If you tracked both properties over the course of the tween, you'd see `currentTime` go from 0 to 5 twice (one for each cycle) in the same time it takes `totalTime` go from 0 to 10.

Implementation
`public function set currentTime(value:Number):void`

globalTimeScale | property |

`globalTimeScale:Number` [read-write]

Multiplier describing the speed of the root timelines where 1 is normal speed, 0.5 is half-speed, 2 is double speed, etc. The lowest globalTimeScale possible is 0.0001.

Implementation
`public static function get globalTimeScale():Number`
`public function set globalTimeScale(value:Number):void`

killTweensOf | property |

`public static var killTweensOf:Function`

Kills all the tweens of a particular object, optionally completing them first.

repeat | property |

`repeat:int` [read-write]

Number of times that the tween should repeat; -1 repeats indefinitely.

Implementation
`public function get repeat():int`
`public function set repeat(value:int):void`

repeatDelay | property |

`repeatDelay:Number` [read-write]

Amount of time in seconds (or frames for frames-based tweens) between repeats

Implementation
`public function get repeatDelay():Number`
`public function set repeatDelay(value:Number):void`

timeScale | property |

`timeScale:Number` [read-write]

Multiplier affecting the speed of the timeline where 1 is normal speed, 0.5 is half-speed, 2 is double speed, etc.

Implementation
`public function get timeScale():Number`
`public function set timeScale(value:Number):void`

totalDuration | property |

`totalDuration:Number` [read-write]

Duration of the tween in seconds (or frames for frames-based timelines) including any repeats or repeatDelays. `duration`, by contrast, does NOT include repeats and repeatDelays.

Implementation
`public function get totalDuration():Number`
`public function set totalDuration(value:Number):void`

totalProgress | property |

`totalProgress:Number` [read-write]

Value between 0 and 1 indicating the overall progress of the tween according to its `totalDuration` where 0 is at the beginning, 0.5 is halfway finished, and 1 is finished. `currentProgress`, by contrast, describes the progress according to the tween's `duration` which does not include repeats and repeatDelays. For example, if a TweenMax instance is set to repeat once, at the end of the first cycle `totalProgress` would only be 0.5 whereas `currentProgress` would be 1. If you tracked both properties over the course of the tween, you'd see `currentProgress` go from 0 to 1 twice (once for each cycle) in the same time it takes the `totalProgress` property to go from 0 to 1 once.

Implementation
`public function get totalProgress():Number`
`public function set totalProgress(value:Number):void`

yoyo | property |

`public var yoyo:Boolean`

Works in conjunction with the repeat property, determining the behavior of each cycle; when yoyo is true, the tween will go back and forth, appearing to reverse every other cycle (this has no affect on the "reversed" property though). So if repeat is 2 and yoyo is false, it will look like: start - 1 - 2 - 3 - 1 - 2 - 3 - 1 - 2 - 3 - end. But if repeat is 2 and yoyo is true, it will look like: start - 1 - 2 - 3 - 3 - 2 - 1 - 1 - 2 - 3 - end.

Constructor detail

TweenMax | () | constructor

`public function TweenMax(target:Object, duration:Number, vars:Object)`

Constructor

Parameters

| `target:Object` — Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.
| `duration:Number` — Duration in seconds (or in frames if the tween's timing mode is frames-based)
| `vars:Object` — An object containing the end values of the properties you're tweening. For example, to tween to x=100, y=100, you could pass {x:100, y:100}. It can also contain special properties like "onComplete", "ease", "delay", etc.

Method detail

allFrom | () | method

`public static function allFrom(targets:Array, duration:Number, vars:Object, stagger:Number = 0, onCompleteAll:Function = null, onCompleteAllParams:Array = null):Array`

Exactly the same as TweenMax.allTo(), but instead of tweening the properties from where they're at currently to whatever you define, this tweens them the opposite way - from where you define TO where ever they are when the tweens begin. This is useful when things are set up on the stage the way they should end up and you just want to tween them into place. NOTE: By default, `immediateRender` is `true` for allFrom() tweens, meaning that they immediately render their starting state regardless of any delay or stagger that is specified. You can override this behavior by passing `immediateRender:false` in the `vars` object so that each tween will wait to render until any delay/stagger has passed (often the desired behavior when inserting into timelines). To illustrate the default behavior, the following code will immediately set the `alpha` of `mc1`, `mc2`, and `mc3` to 0 and then wait 2 seconds before tweening each `alpha` back to 1 over the course of 1.5 seconds with 0.1 seconds lapsing between the start times of each:
`TweenMax.allFrom([mc1, mc2, mc3], 1.5, {alpha:0, delay:2}, 0.1);`

Parameters

| `targets:Array` — An Array of objects to tween.
| `duration:Number` — Duration (in seconds) of the tween (or in frames for frames-based tweens)
| `vars:Object` — An object containing the start values of all the properties you'd like to have tweened.
| `stagger:Number` (default = `0`)`` — Staggers the start time of each tween. For example, you might want to have 5 MovieClips move down 100 pixels while fading from alpha:0, and stagger the start times slightly by 0.2 seconds, you could do: `TweenMax.allFromTo([mc1, mc2, mc3, mc4, mc5], 1, {y:"-100", alpha:0}, 0.2)`.
| `onCompleteAll:Function` (default = `null`)`` — A function to call when all of the tweens have completed.
| `onCompleteAllParams:Array` (default = `null`)`` — An Array of parameters to pass the onCompleteAll function when all the tweens have completed.

Returns

| `Array` — Array of TweenMax instances

allFromTo | () | method |

`public static function allFromTo(targets:Array, duration:Number, fromVars:Object, toVars:Object, stagger:Number = 0, onCompleteAll:Function = null, onCompleteAllParams:Array = null):Array`

Tweens multiple targets from a common set of starting values to a common set of ending values; exactly the same as TweenMax.allTo(), but adds the ability to define the starting values. NOTE: Only put starting values in the fromVars parameter - all special properties for the tween (like onComplete, onUpdate, delay, etc.) belong in the toVars parameter.

Parameters

| `targets:Array` — An Array of objects to tween.
| `duration:Number` — Duration (in seconds) of the tween (or in frames for frames-based tweens)
| `fromVars:Object` — An object containing the starting values of all the properties you'd like to have tweened.
| `toVars:Object` — An object containing the ending values of all the properties you'd like to have tweened.
| `stagger:Number` (default = `0`)`` — Staggers the start time of each tween. For example, you might want to have 5 MovieClips move down from y:0 to y:100 while fading from alpha:0 to alpha:1, and stagger the start times slightly by 0.2 seconds, you could do: `TweenMax.allFromTo([mc1, mc2, mc3, mc4, mc5], 1, {y:0, alpha:0}, {y:100, alpha:1}, 0.2)`.
| `onCompleteAll:Function` (default = `null`)`` — A function to call when all of the tweens have completed.
| `onCompleteAllParams:Array` (default = `null`)`` — An Array of parameters to pass the onCompleteAll function when all the tweens have completed.

Returns

| `Array` — Array of TweenMax instances

allTo | () | method |

`public static function allTo(targets:Array, duration:Number, vars:Object, stagger:Number = 0, onCompleteAll:Function = null, onCompleteAllParams:Array = null):Array`

Tween multiple objects to the same end values. The "stagger" parameter staggers the start time of each tween. For example, you might want to have 5 MovieClips move down 100 pixels while fading out, and stagger the start times slightly by 0.2 seconds:
`TweenMax.allTo([mc1, mc2, mc3, mc4, mc5], 1, {y:"100", alpha:0}, 0.2);
` Note: You can easily add a group of tweens to a TimelineLite/Max instance using allTo() in conjunction with the insertMultipe() method of a timeline, like:
`myTimeline.insertMultiple(TweenMax.allTo([mc1, mc2, mc3], 1, {alpha:0, y:"100"}, 0.1));`

Parameters

| `targets:Array` — An Array of objects to tween.
| `duration:Number` — Duration in seconds (or frames for frames-based tweens) of the tween
| `vars:Object` — An object containing the end values of all the properties you'd like to have tweened (or if you're using the TweenMax.allFrom() method, these variables would define the BEGINNING values).
| `stagger:Number` (default = `0`)`` — Staggers the start time of each tween. For example, you might want to have 5 MovieClips move down 100 pixels while fading out, and stagger the start times slightly by 0.2 seconds, you could do: `TweenMax.allTo([mc1, mc2, mc3, mc4, mc5], 1, {y:"100", alpha:0}, 0.2)`.
| `onCompleteAll:Function` (default = `null`)`` — A function to call when all of the tweens have completed.
| `onCompleteAllParams:Array` (default = `null`)`` — An Array of parameters to pass the onCompleteAll function when all the tweens have completed.

Returns

| `Array` — Array of TweenMax tweens

complete | () | method |

`public override function complete(skipRender:Boolean = false, suppressEvents:Boolean = false):void`

Forces the tween to completion.

Parameters

| `skipRender:Boolean` (default = `false`)`` — to skip rendering the final state of the tween, set skipRender to true.
| `suppressEvents:Boolean` (default = `false`)`` — If true, no events or callbacks will be triggered for this render (like onComplete, onUpdate, onReverseComplete, etc.)

delayedCall | () | method |

`public static function delayedCall(delay:Number, onComplete:Function, onCompleteParams:Array = null, useFrames:Boolean = false):TweenMax`

Provides a simple way to call a function after a set amount of time (or frames). You can optionally pass any number of parameters to the function too. For example:
`TweenMax.delayedCall(1, myFunction, ["param1", 2]);
function myFunction(param1:String, param2:Number):void {
trace("called myFunction and passed params: " + param1 + ", " + param2);
}
`

Parameters

| `delay:Number` — Delay in seconds (or frames if useFrames is true) before the function should be called
| `onComplete:Function` — Function to call
| `onCompleteParams:Array` (default = `null`)`` — An Array of parameters to pass the function.
| `useFrames:Boolean` (default = `false`)``

Returns

| `TweenMax` — TweenMax instance

from | () | method |

`public static function from(target:Object, duration:Number, vars:Object):TweenMax`

Static method for creating a TweenMax instance that tweens in the opposite direction compared to a `TweenMax.to()` tween. In other words, you define the START values in the vars object instead of the end values, and the tween will use the current values as the end values. This can be very useful for animating things into place on the stage because you can build them in their end positions and do some simple `TweenMax.from()` calls to animate them into place. NOTE: By default, `immediateRender` is `true` for from() tweens, meaning that they immediately render their starting state regardless of any delay that is specified. You can override this behavior by passing `immediateRender:false` in the `vars` object so that it will wait to render until the tween actually begins (often the desired behavior when inserting into timelines). To illustrate the default behavior, the following code will immediately set the `alpha` of `mc` to 0 and then wait 2 seconds before tweening the `alpha` back to 1 over the course of 1.5 seconds:
`TweenMax.from(mc, 1.5, {alpha:0, delay:2});`

Parameters

| `target:Object` — Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.
| `duration:Number` — Duration in seconds (or in frames for frames-based tweens)
| `vars:Object` — An object containing the start values of the properties you're tweening. For example, to tween from x=100, y=100, you could pass {x:100, y:100}. It can also contain special properties like "onComplete", "ease", "delay", etc.

Returns

| `TweenMax` — TweenMax instance

fromTo | () | method |

`public static function fromTo(target:Object, duration:Number, fromVars:Object, toVars:Object):TweenMax`

Static method for creating a TweenMax instance that tweens from a particular set of values to another set of values, as opposed to a normal to() or from() tween which are based on the target's current values. NOTE: Only put starting values in the fromVars parameter - all special properties for the tween (like onComplete, onUpdate, delay, etc.) belong in the toVars parameter.

Parameters

| `target:Object` — Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.
| `duration:Number` — Duration in seconds (or in frames for frames-based tweens)
| `fromVars:Object` — An object containing the starting values of the properties you're tweening. For example, to tween from x=0, y=0, you could pass {x:0, y:0}. Only put starting values in the fromVars parameter - all special properties for the tween (like onComplete, onUpdate, delay, etc.) belong in the toVars parameter.
| `toVars:Object` — An object containing the ending values of the properties you're tweening. For example, to tween to x=100, y=100, you could pass {x:100, y:100}. It can also contain special properties like "onComplete", "ease", "delay", etc.

Returns

| `TweenMax` — TweenMax instance

getAllTweens | () | method |

`public static function getAllTweens():Array`

Returns all tweens that are in the masterList. Tweens are automatically removed from the masterList when they complete and are not attached to a timeline that has autoRemoveChildren set to true.

Returns

| `Array` — Array of TweenLite and/or TweenMax instances

getTweensOf | () | method |

`public static function getTweensOf(target:Object):Array`

Gets all the tweens of a particular object.

Parameters

| `target:Object` — The target object whose tweens you want returned

Returns

| `Array` — Array of tweens (could be TweenLite and/or TweenMax instances)

invalidate | () | method |

`public override function invalidate():void`

Clears any initialization data (like starting values in tweens) which can be useful if, for example, you want to restart it without reverting to any previously recorded starting values. When you invalidate() a tween/timeline, it will be re-initialized the next time it renders and its `vars` object will be re-parsed. The timing of the tween/timeline (duration, startTime, delay) will NOT be affected. Another example would be if you have a `TweenMax(mc, 1, {x:100, y:100})` that ran when mc.x and mc.y were initially at 0, but now mc.x and mc.y are 200 and you want them tween to 100 again, you could simply `invalidate()` the tween and `restart()` it. Without invalidating first, restarting it would cause the values jump back to 0 immediately (where they started when the tween originally began). When you invalidate a timeline, it automatically invalidates all of its children.

isTweening | () | method |

`public static function isTweening(target:Object):Boolean`

Determines whether or not a particular object is actively tweening. If a tween is paused or hasn't started yet, it doesn't count as active.

Parameters

| `target:Object` — Target object whose tweens you're checking

Returns

| `Boolean` — Boolean value indicating whether or not any active tweens were found

killAll | () | method |

`public static function killAll(complete:Boolean = false, tweens:Boolean = true, delayedCalls:Boolean = true):void`

Kills all tweens and/or delayedCalls/callbacks, optionally forcing them to completion first. The various parameters provide a way to distinguish between delayedCalls and tweens, so if you want to kill EVERYTHING (tweens and delayedCalls), you'd do:
`TweenMax.killAll(false, true, true);
` But if you want to kill only the tweens but allow the delayedCalls to continue, you'd do:
`TweenMax.killAll(false, true, false);
` And if you want to kill only the delayedCalls but not the tweens, you'd do:
`TweenMax.killAll(false, false, true);
`

Parameters

| `complete:Boolean` (default = `false`)`` — Determines whether or not the tweens/delayedCalls/callbacks should be forced to completion before being killed.
| `tweens:Boolean` (default = `true`)`` — If true, all tweens will be killed
| `delayedCalls:Boolean` (default = `true`)`` — If true, all delayedCalls will be killed. TimelineMax callbacks are treated the same as delayedCalls.

killChildTweensOf | () | method |

`public static function killChildTweensOf(parent:DisplayObjectContainer, complete:Boolean = false):void`

Kills all tweens of the children of a particular DisplayObjectContainer, optionally forcing them to completion first.

Parameters

| `parent:DisplayObjectContainer` — The DisplayObjectContainer whose children should no longer be affected by any tweens.
| `complete:Boolean` (default = `false`)`` — Determines whether or not the tweens should be forced to completion before being killed.

killProperties | () | method |

`public function killProperties(names:Array):void`

Allows particular properties of the tween to be killed, much like the killVars() method except that killProperties() accepts an Array of property names.

Parameters

| `names:Array` — An Array of property names whose tweens should be killed immediately.

pauseAll | () | method |

`public static function pauseAll(tweens:Boolean = true, delayedCalls:Boolean = true):void`

Pauses all tweens and/or delayedCalls/callbacks.

Parameters

| `tweens:Boolean` (default = `true`)`` — If true, all tweens will be paused.
| `delayedCalls:Boolean` (default = `true`)`` — If true, all delayedCalls will be paused. TimelineMax callbacks are treated the same as delayedCalls.

resumeAll | () | method |

`public static function resumeAll(tweens:Boolean = true, delayedCalls:Boolean = true):void`

Resumes all paused tweens and/or delayedCalls/callbacks.

Parameters

| `tweens:Boolean` (default = `true`)`` — If true, all tweens will be resumed.
| `delayedCalls:Boolean` (default = `true`)`` — If true, all delayedCalls will be resumed. TimelineMax callbacks are treated the same as delayedCalls.

setDestination | () | method |

`public function setDestination(property:String, value:Boolean, adjustStartValues:* = true):void`

Adjusts a destination value on the fly, optionally adjusting the start values so that it appears to redirect seamlessly without skipping/jerking (this method has been deprecated in favor of `updateTo()`). If you plan to constantly update values, please look into using the DynamicPropsPlugin.

Parameters

| `property:String` — Name of the property that should be updated. For example, "x".
| `value:Boolean` — The new destination value
| `adjustStartValues:*` (default = `true`)`` — If true, the property's start value will be adjusted to make the tween appear to seamlessly/smoothly redirect without any skipping/jerking. Beware that if start values are adjusted, reversing the tween will not make it travel back to the original starting value.

to | () | method |

`public static function to(target:Object, duration:Number, vars:Object):TweenMax`

Static method for creating a TweenMax instance. This can be more intuitive for some developers and shields them from potential garbage collection issues that could arise when assigning a tween instance to a variable that persists. The following lines of code produce exactly the same result:
`var myTween:TweenMax = new TweenMax(mc, 1, {x:100});
TweenMax.to(mc, 1, {x:100});
var myTween:TweenMax = TweenMax.to(mc, 1, {x:100});
`

Parameters

| `target:Object` — Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.
| `duration:Number` — Duration in seconds (or in frames for frames-based tweens)
| `vars:Object` — An object containing the end values of the properties you're tweening. For example, to tween to x=100, y=100, you could pass {x:100, y:100}. It can also contain special properties like "onComplete", "ease", "delay", etc.

Returns

| `TweenMax` — TweenMax instance

updateTo | () | method |

`public function updateTo(vars:Object, resetDuration:Boolean = false):void`

Updates tweening values on the fly so that they appear to seamlessly change course even if the tween is in-progress. Think of it as dynamically updating the `vars` object that you passed in to the tween when it was originally created. You do NOT need to redefine all of the `vars` values - only the ones that you want to update. You can even define new properties that you didn't define in the original `vars` object. If the `resetDuration` parameter is `true` and the tween has already started (or finished), `updateTo()` will restart the tween. Otherwise, the tween's timing will be honored. And if `resetDuration` is `false` and the tween is in-progress, the starting values of each property will be adjusted so that the tween appears to seamlessly redirect to the new destination values. For example:
`//create the tween
var tween:TweenMax = new TweenMax(mc, 2, {x:100, y:200, alpha:0.5});
//then later, update the destination x and y values, restarting the tween
tween.updateTo({x:300, y:0}, true);
//or to update the values mid-tween while keeping the end time the same (don't restart the tween), do this:
tween.updateTo({x:300, y:0}, false);
` Note: If you plan to constantly update values, please look into using the `DynamicPropsPlugin`.

Parameters

| `vars:Object` — Object containing properties with the end values that should be udpated. You do NOT need to redefine all of the original `vars` values - only the ones that should be updated (although if you change a plugin value, you will need to fully define it). For example, to update the destination `x` value to 300 and the destination `y` value to 500, pass: `{x:300, y:500}`.
| `resetDuration:Boolean` (default = `false`)`` — If the tween has already started (or finished) and `resetDuration` is true, the tween will restart. If `resetDuration` is false, the tween's timing will be honored (no restart) and each tweening property's starting value will be adjusted so that it appears to seamlessly redirect to the new destination value.