Package | com.greensock.core |
Class | public class SimpleTimeline |
Inheritance | SimpleTimeline Animation Object |
Subclasses | TimelineLite |
Copyright 2008-2013, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for Club GreenSock members, the software agreement that was issued with the membership.
Property | Defined By | ||
---|---|---|---|
autoRemoveChildren : Boolean If true, child tweens/timelines will be removed as soon as they complete. | SimpleTimeline | ||
data : * A place to store any data you want (initially populated with vars.data if it exists). | Animation | ||
smoothChildTiming : Boolean
Controls whether or not child tweens/timelines are repositioned automatically (changing their startTime)
in order to maintain smooth playback when properties are changed on-the-fly. | SimpleTimeline | ||
ticker : Shape [static]
The object that dispatches a "tick" event each time the engine updates, making it easy for
you to add your own listener(s) to run custom logic after each update (great for game developers). | Animation | ||
timeline : SimpleTimeline [Read-only] Parent timeline. | Animation | ||
vars : Object The vars object passed into the constructor which stores configuration variables like onComplete, onUpdate, etc. | Animation |
Method | Defined By | ||
---|---|---|---|
SimpleTimeline(vars:Object = null)
Constructor
| SimpleTimeline | ||
add(child:*, position:* = +=0, align:String = normal, stagger:Number = 0):*
Adds a TweenLite, TweenMax, TimelineLite, or TimelineMax instance to the timeline at a specific time. | SimpleTimeline | ||
delay(value:Number):*
Gets or sets the animation's initial delay which is the length of time in seconds
(or frames for frames-based tweens) before the animation should begin. | Animation | ||
duration(value:Number):*
Gets or sets the animation's duration, not including any repeats or repeatDelays
(which are only available in TweenMax and TimelineMax). | Animation | ||
eventCallback(type:String, callback:Function = null, params:Array = null):*
Gets or sets an event callback like "onComplete", "onUpdate", "onStart", "onReverseComplete"
or "onRepeat" (onRepeat only applies to TweenMax or TimelineMax instances)
along with any parameters that should be passed to that callback. | Animation | ||
invalidate():*
Clears any initialization data (like starting/ending values in tweens) which can be useful if, for example,
you want to restart a tween without reverting to any previously recorded starting values. | Animation | ||
isActive():Boolean
Indicates whether or not the animation is currently active (meaning the virtual playhead is actively moving across
this instance's time span and it is not paused, nor are any of its ancestor timelines). | Animation | ||
kill(vars:Object = null, target:Object = null):*
Kills the animation entirely or in part depending on the parameters. | Animation | ||
pause(atTime:* = null, suppressEvents:Boolean = true):*
Pauses the instance, optionally jumping to a specific time. | Animation | ||
paused(value:Boolean = false):*
Gets or sets the animation's paused state which indicates whether or not the animation
is currently paused. | Animation | ||
play(from:* = null, suppressEvents:Boolean = true):*
Begins playing forward, optionally from a specific time (by default playback begins from
wherever the playhead currently is). | Animation | ||
progress(value:Number, suppressEvents:Boolean = false):*
Gets or sets the animations's progress which is a value between 0 and 1 indicating the position
of the virtual playhead (excluding repeats) where 0 is at the beginning, 0.5 is at the halfway point,
and 1 is at the end (complete). | Animation | ||
render(time:Number, suppressEvents:Boolean = false, force:Boolean = false):void [override] | SimpleTimeline | ||
restart(includeDelay:Boolean = false, suppressEvents:Boolean = true):*
Restarts and begins playing forward from the beginning. | Animation | ||
resume(from:* = null, suppressEvents:Boolean = true):*
Resumes playing without altering direction (forward or reversed), optionally jumping to a specific time first. | Animation | ||
reverse(from:* = null, suppressEvents:Boolean = true):*
Reverses playback so that all aspects of the animation are oriented backwards including, for example,
a tween's ease. | Animation | ||
reversed(value:Boolean = false):*
Gets or sets the animation's reversed state which indicates whether or not the animation
should be played backwards. | Animation | ||
seek(time:*, suppressEvents:Boolean = true):*
Jumps to a specific time without affecting whether or not the instance is paused or reversed. | Animation | ||
startTime(value:Number):*
Gets or sets the time at which the animation begins on its parent timeline (after any delay
that was defined). | Animation | ||
time(value:Number, suppressEvents:Boolean = false):*
Gets or sets the local position of the playhead (essentially the current time),
described in seconds (or frames for frames-based animations) which
will never be less than 0 or greater than the animation's duration. | Animation | ||
timeScale(value:Number):*
Factor that's used to scale time in the animation where 1 = normal speed (the default),
0.5 = half speed, 2 = double speed, etc. | Animation | ||
totalDuration(value:Number):*
Gets or sets the animation's total duration including
any repeats or repeatDelays (which are only available in TweenMax and TimelineMax). | Animation | ||
totalProgress(value:Number, suppressEvents:Boolean = false):*
Gets or sets the animation's total progress which is a value between 0 and 1 indicating the position
of the virtual playhead (including repeats) where 0 is at the beginning, 0.5 is
at the halfway point, and 1 is at the end (complete). | Animation | ||
totalTime(time:Number, suppressEvents:Boolean = false, uncapped:Boolean = false):*
Gets or sets the position of the playhead according to the totalDuration
which includes any repeats and repeatDelays (only available
in TweenMax and TimelineMax). | Animation |
autoRemoveChildren | property |
public var autoRemoveChildren:Boolean
If true
, child tweens/timelines will be removed as soon as they complete. (false
by default except on the root timeline(s))
smoothChildTiming | property |
public var smoothChildTiming:Boolean
Controls whether or not child tweens/timelines are repositioned automatically (changing their startTime
)
in order to maintain smooth playback when properties are changed on-the-fly. For example, imagine that
the timeline's playhead is on a child tween that is 75% complete, moving mc.x from 0 to 100 and then
that tween's reverse()
method is called. If smoothChildTiming
is false
(the default except for the root timelines), the tween would flip in place, keeping its startTime
consistent. Therefore the playhead of the timeline would now be at the tween's 25% completion point instead
of 75%. Remember, the timeline's playhead position and direction are unaffected by child tween/timeline changes.
mc.x would jump from 75 to 25, but the tween's position in the timeline would remain consistent.
However, if smoothChildTiming
is true
, that child tween's startTime
would
be adjusted so that the timeline's playhead intersects with the same spot on the tween (75% complete) as it had
immediately before reverse()
was called, thus playback appears perfectly smooth. mc.x would
still be 75 and it would continue from there as the playhead moves on, but since the tween is reversed now
mc.x will travel back towards 0 instead of 100. Ultimately it's a decision between prioritizing smooth
on-the-fly playback (true
) or consistent position(s) of child tweens/timelines (false
).
Some examples of on-the-fly changes to child tweens/timelines that could cause their startTime
to change when smoothChildTiming
is true
are: reversed, timeScale, progress,
totalProgress, time, totalTime, delay, pause, resume, duration,
and totalDuration
.
SimpleTimeline | () | Constructor |
public function SimpleTimeline(vars:Object = null)
Constructor
Parametersvars:Object (default = null ) — Object containing configuration variables like onComplete, onUpdate, onStart, data, etc.
|
add | () | method |
public function add(child:*, position:* = +=0, align:String = normal, stagger:Number = 0):*
Adds a TweenLite, TweenMax, TimelineLite, or TimelineMax instance to the timeline at a specific time. In classes like TimelineLite and TimelineMax that override this method, it allows things like callbacks, labels, and arrays of tweens/timelines/callbacks/labels to be inserted too. They also allow the position to be defined in terms of either a numeric time or a label (String).
Parameters
child:* — TweenLite, TweenMax, TimelineLite, or TimelineMax instance to insert
| |
position:* (default = +=0 ) — The position at which the tween/timeline should be inserted which can be expressed as a number (for an absolute time as seconds or frames for frames-based timelines) or a string, using "+=" or "-=" prefix to indicate a relative value (relative to the END of the timeline). For example, myTimeline.insert(myTween, 3) would insert myTween 3 seconds into the timeline.
| |
align:String (default = normal ) — Determines how the tweens/timelines/callbacks/labels will be aligned in relation to each other before getting inserted. Options are: "sequence" (aligns them one-after-the-other in a sequence), "start" (aligns the start times of all of the objects (ignoring delays)), and "normal" (aligns the start times of all the tweens (honoring delays)). The default is "normal" .
| |
stagger:Number (default = 0 ) — Staggers the inserted objects by a set amount of time (in seconds) (or in frames for frames-based timelines). For example, if the stagger value is 0.5 and the "align" parameter is set to "start" , the second one will start 0.5 seconds after the first one starts, then 0.5 seconds later the third one will start, etc. If the align property is "sequence" , there would be 0.5 seconds added between each tween. Default is 0.
|
* — this timeline instance (useful for chaining like myTimeline.add(...).add(...) )
|
render | () | method |
override public function render(time:Number, suppressEvents:Boolean = false, force:Boolean = false):void
Parameters
time:Number | |
suppressEvents:Boolean (default = false )
| |
force:Boolean (default = false )
|