Packagecom.greensock
Classpublic class TweenLite
InheritanceTweenLite Inheritance TweenCore
SubclassesTweenMax

TweenLite is an extremely fast, lightweight, and flexible tweening engine that serves as the foundation of the GreenSock Tweening Platform. A TweenLite instance handles tweening one or more numeric properties of any object over time, updating them on every frame. Sounds simple, but there's a wealth of capabilities and conveniences at your fingertips with TweenLite. With plenty of other tweening engines to choose from, here's why you might want to consider TweenLite:
SPECIAL PROPERTIES (no plugins required):

Any of the following special properties can optionally be passed in through the vars object (the third parameter): PLUGINS:

There are many plugins that add capabilities through other special properties. Some examples are "tint", "volume", "frame", "frameLabel", "bezier", "blurFilter", "colorMatrixFilter", "hexColors", and many more. Adding the capabilities is as simple as activating the plugin with a single line of code, like TweenPlugin.activate([TintPlugin]); Get information about all the plugins at http://www.TweenLite.com

EXAMPLES:

Please see http://www.tweenlite.com for examples, tutorials, and interactive demos.

NOTES / TIPS:

Copyright 2009, 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
 PropertyDefined by
 InheritedcurrentTime : Number
Most recently rendered time (or frame for frames-based tweens/timelines) according to its duration.
TweenCore
 Inheriteddata : *
Place to store any data you want.
TweenCore
  defaultEase : Function
[static] Provides an easy way to change the default easing equation.
TweenLite
 Inheriteddelay : Number
Length of time in seconds (or frames for frames-based tweens/timelines) before the tween should begin.
TweenCore
 Inheritedduration : Number
Duration of the tween in seconds (or frames for frames-based tweens/timelines) not including any repeats or repeatDelays.
TweenCore
 Inheritedpaused : Boolean
Indicates the paused state of the tween/timeline.
TweenCore
 Inheritedreversed : Boolean
Indicates the reversed state of the tween/timeline.
TweenCore
 InheritedstartTime : 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
 Inheritedtimeline : SimpleTimeline
The parent timeline on which the tween/timeline is placed.
TweenCore
 InheritedtotalDuration : Number
Duration of the tween in seconds (or frames for frames-based tweens/timelines) including any repeats or repeatDelays (which are only available on TweenMax and TimelineMax).
TweenCore
 InheritedtotalTime : Number
Most recently rendered time (or frame for frames-based tweens/timelines) according to its totalDuration.
TweenCore
 Inheritedvars : Object
Stores variables (things like alpha, y or whatever we're tweening as well as special properties like "onComplete").
TweenCore
Public Methods
 MethodDefined by
  
TweenLite(target:Object, duration:Number, vars:Object)
Constructor
TweenLite
 Inherited
complete(skipRender:Boolean = false, suppressEvents:Boolean = false):void
Forces the tween/timeline to completion.
TweenCore
  
delayedCall(delay:Number, onComplete:Function, onCompleteParams:Array = null, useFrames:Boolean = false):TweenLite
[static] Provides a simple way to call a function after a set amount of time (or frames).
TweenLite
  
from(target:Object, duration:Number, vars:Object):TweenLite
[static] Static method for creating a TweenLite instance that tweens in the opposite direction compared to a TweenLite.to() tween.
TweenLite
  
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.
TweenLite
 Inherited
kill():void
Kills the tween/timeline, stopping it immediately.
TweenCore
  
killTweensOf(target:Object, complete:Boolean = false):void
[static] Kills all the tweens 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
 Inherited
pause():void
Pauses the tween/timeline
TweenCore
 Inherited
play():void
Starts playing forward from the current position.
TweenCore
 Inherited
restart(includeDelay:Boolean = false, suppressEvents:Boolean = true):void
Restarts and begins playing forward.
TweenCore
 Inherited
resume():void
Starts playing from the current position without altering direction (forward or reversed).
TweenCore
 Inherited
reverse(forceResume:Boolean = true):void
Reverses smoothly, adjusting the startTime to avoid any skipping.
TweenCore
  
to(target:Object, duration:Number, vars:Object):TweenLite
[static] Static method for creating a TweenLite instance.
TweenLite
Property detail
defaultEaseproperty
public static var defaultEase:Function

Provides an easy way to change the default easing equation.

targetproperty 
public var target:Object

Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.

Constructor detail
TweenLite()constructor
public function TweenLite(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
delayedCall()method
public static function delayedCall(delay:Number, onComplete:Function, onCompleteParams:Array = null, useFrames:Boolean = false):TweenLite

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:

TweenLite.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) — If the delay should be measured in frames instead of seconds, set useFrames to true (default is false)

Returns
TweenLite — TweenLite instance
from()method 
public static function from(target:Object, duration:Number, vars:Object):TweenLite

Static method for creating a TweenLite instance that tweens in the opposite direction compared to a TweenLite.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 TweenLite.from() calls to animate them into place. NOTE: By default, immediateRender is true in 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:

TweenLite.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 if the tween's timing mode is frames-based)
 
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
TweenLite — TweenLite instance
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.

killTweensOf()method 
public static function killTweensOf(target:Object, complete:Boolean = false):void

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

Parameters
target:Object — Object whose tweens should be immediately killed
 
complete:Boolean (default = false) — Indicates whether or not the tweens should be forced to completion before being killed.
killVars()method 
public function killVars(vars:Object, permanent:Boolean = true):Boolean

Allows particular properties of the tween to be killed. For example, if a tween is affecting the "x", "y", and "alpha" properties and you want to kill just the "x" and "y" parts of the tween, you'd do myTween.killVars({x:true, y:true});

Parameters
vars:Object — An object containing a corresponding property for each one that should be killed. The values don't really matter. For example, to kill the x and y property tweens, do myTween.killVars({x:true, y:true});
 
permanent:Boolean (default = true) — If true, the properties specified in the vars object will be permanently disallowed in the tween. Typically the only time false might be used is while the tween is in the process of initting and a plugin needs to make sure tweens of a particular property (or set of properties) is killed.

Returns
Boolean — Boolean value indicating whether or not properties may have changed on the target when any of the vars were disabled. For example, when a motionBlur (plugin) is disabled, it swaps out a BitmapData for the target and may alter the alpha. We need to know this in order to determine whether or not a new tween that is overwriting this one should be re-initted() with the changed properties.
to()method 
public static function to(target:Object, duration:Number, vars:Object):TweenLite

Static method for creating a TweenLite 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:TweenLite = new TweenLite(mc, 1, {x:100});
TweenLite.to(mc, 1, {x:100});
var myTween:TweenLite = TweenLite.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 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.

Returns
TweenLite — TweenLite instance