Package | com.greensock |
Class | public class TweenMax |
Inheritance | TweenMax TweenLite TweenCore |
Implements | flash.events.IEventDispatcher |
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.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.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.currentProgress
property to 1 immediately after creating the tween (or set the currentTime to the duration). 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):
myTween.addEventListener(TweenEvent.START, myFunction);
myTween.addEventListener(TweenEvent.UPDATE, myFunction);
myTween.addEventListener(TweenEvent.COMPLETE, myFunction);
myTween.addEventListener(TweenEvent.REVERSE_COMPLETE, myFunction);
myTween.addEventListener(TweenEvent.REPEAT, myFunction);
TweenMax.to(mc, 2, {x:500, startAt:{x:0}});
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):
TweenMax.to(my_mc, 3, {bezier:[{x:250, y:50}, {x:500, y:0}]});
[["x", "y", "rotation", 0]]
.
Hint: Don't forget the container Array (notice the double outer brackets)TweenMax.to(my_obj, 2, {hexColors:{myHexColor:0xFF0000}});
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.TweenMax.to(mc, 2, {x:300, y:200, alpha:0.5, roundProps:["x","y"]});
blurX, blurY, quality, remove, addFilter, index
alpha, blurX, blurY, color, strength, quality, inner, knockout, remove, addFilter, index
colorize, amount, contrast, brightness, saturation, hue, threshold, relative, matrix, remove, addFilter, index
alpha, angle, blurX, blurY, color, distance, strength, quality, remove, addFilter, index
angle, blurX, blurY, distance, highlightAlpha, highlightColor, shadowAlpha, shadowColor, strength, quality, remove, addFilter, index
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)});
var myTween:TweenMax = new TweenMax(my_mc, 2, {x:200});
myTween.addEventListener(TweenEvent.COMPLETE, myFunction);
TweenMax.killTweensOf(myObject);
TweenMax.killDelayedCallsTo(myFunction);
This can be helpful if you want to preempt a call.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).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 describing 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 |
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 | ||
[static]
Static method for creating a TweenMax instance that tweens in the opposite direction
compared to a
TweenMax.to() tween. | 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 | ||
[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 |
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.
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.
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 describing 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.
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.
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.
TweenMax | () | constructor |
public function TweenMax(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.
|
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);
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.
|
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.
Parameterstargets: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.
|
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));
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.
|
Array — Array of TweenMax tweens
|
complete | () | method |
public override function complete(skipRender:Boolean = false, suppressEvents:Boolean = false):void
Forces the tween to completion.
ParametersskipRender: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);
}
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 )
|
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});
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.
|
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.
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 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.
|
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.
ReturnsArray — Array of TweenLite and/or TweenMax instances
|
getTweensOf | () | method |
public static function getTweensOf(target:Object):Array
Gets all the tweens of a particular object.
Parameterstarget:Object — The target object whose tweens you want returned
|
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.
Parameterstarget:Object — Target object whose tweens you're checking
|
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, false, true);
And if you want to kill only the delayedCalls but not the tweens, you'd do:
TweenMax.killAll(false, true, false);
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.
Parametersparent: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.
Parametersnames: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.
Parameterstweens: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.
Parameterstweens: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.
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});
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.
|
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
Note: If you plan to constantly update values, please look into using the
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);DynamicPropsPlugin
.
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.
|