Package | com.greensock |
Class | public class TweenLite |
Inheritance | TweenLite TweenCore |
Subclasses | TweenMax |
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.Elastic.easeOut
. The Default is Quad.easeOut.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.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 immediateRender
to false.OverwriteManager.init()
has been called (please see
http://www.greensock.com/overwritemanager/
for details and a full explanation of the various modes):
TweenLite.to(mc, 2, {x:"-20"});
it'll move the mc.x to the left 20 pixels which is the same as doing
TweenLite.to(mc, 2, {x:mc.x - 20});
You could also cast it like: TweenLite.to(mc, 2, {x:String(myVariable)});
TweenLite.defaultEase
function if you prefer something other than Regular.easeOut
.TweenLite.killTweensOf(mc);
TweenLite.killDelayedCallsTo(myFunction);
This can be helpful if you want to preempt a call.TweenLite.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).Property | Defined by | ||
---|---|---|---|
currentTime : Number
Most recently rendered time (or frame for frames-based tweens/timelines) according to its
duration . | TweenCore | ||
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 | ||
paused : Boolean Indicates the paused state of the tween/timeline.
| TweenCore | ||
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 | ||
totalDuration : 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 | ||
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 |
Method | Defined by | ||
---|---|---|---|
TweenLite(target:Object, duration:Number, vars:Object)
Constructor
| TweenLite | ||
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 | ||
[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 | ||
kill():void
Kills the tween/timeline, stopping it immediately.
| TweenCore | ||
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 | ||
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 | ||
reverse(forceResume:Boolean = true):void
Reverses smoothly, adjusting the startTime to avoid any skipping.
| TweenCore | ||
[static]
Static method for creating a TweenLite instance.
| TweenLite |
defaultEase | property |
public static var defaultEase:Function
Provides an easy way to change the default easing equation.
target | property |
public var target:Object
Target object whose properties this tween affects. This can be ANY object, not just a DisplayObject.
TweenLite | () | constructor |
public function TweenLite(target:Object, duration:Number, vars:Object)
Constructor
Parameterstarget: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.
|
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);
}
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)
|
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});
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.
|
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, vars:Object = null):void
Kills all the tweens (or certain tweening properties) of a particular object, optionally completing them first.
If, for example, you want to kill all tweens of the "mc" object, you'd do:
TweenLite.killTweensOf(mc);
But if you only want to kill all the "alpha" and "x" portions of mc's tweens, you'd do:
TweenLite.killTweensOf(mc, false, {alpha:true, x:true});
killTweensOf()
affects tweens that haven't begun yet too. If, for example,
a tween of object "mc" has a delay of 5 seconds and TweenLite.killTweensOf(mc)
is called
2 seconds after the tween was created, it will still be killed even though it hasn't started yet.
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.
|
|
vars:Object (default = null ) — An object defining which tweening properties should be killed (null causes all properties to be killed). For example, if you only want to kill "alpha" and "x" tweens of object "mc", you'd do myTimeline.killTweensOf(mc, true, {alpha:true, x:true}) . If there are no tweening properties remaining in a tween after the indicated properties are killed, the entire tween is killed, meaning any onComplete, onUpdate, onStart, etc. won't fire.
|
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});
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.
|
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});
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.
|
TweenLite —
TweenLite instance
|