GreenSock JavaScript API Docs | All Packages | All Classes | Index | Frames No Frames |
SimpleTimeline

Package | com.greensock.core
Class | public class SimpleTimeline
Inheritance | SimpleTimeline Animation Object
Subclasses | TimelineLite

SimpleTimeline is the base class for TimelineLite and TimelineMax, providing the most basic timeline functionality and it is used for the root timelines in TweenLite but is only intended for internal use in the GreenSock tweening platform. It is meant to be very fast and lightweight.

Copyright 2008-2012, 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.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| 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

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | SimpleTimeline(vars:Object = null) Constructor | 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, scope:* = 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
|  | insert(tween:*, time:* = 0):* Inserts a TweenLite, TweenMax, TimelineLite, or TimelineMax instance into the timeline at a specific time. | SimpleTimeline
|  | 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
|  | 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
|  | 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
|  | totalTime(time:Number, suppressEvents: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

Property Detail

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`.

Constructor Detail

SimpleTimeline | () | Constructor

`public function SimpleTimeline(vars:Object = null)`

Constructor

Parameters

| `vars:Object` (default = `null`)`` — Object containing configuration variables like onComplete, onUpdate, onStart, data, etc.

Method Detail

insert | () | method

`public function insert(tween:*, time:* = 0):*`

Inserts a TweenLite, TweenMax, TimelineLite, or TimelineMax instance into 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 time to be defined in terms of either a numeric time or a label (String).

Parameters

| `tween:*` — TweenLite, TweenMax, TimelineLite, or TimelineMax instance to insert
| `time:*` (default = `0`)`` — The time in seconds (or frames for frames-based timelines) at which the tween/timeline should be inserted. For example, `myTimeline.insert(myTween, 3)` would insert myTween 3 seconds into the timeline.

Returns

| `*` — this timeline instance (useful for chaining like `myTimeline.insert(...).insert(...)`)

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`)``

Thu Dec 20 2012, 04:30 PM -06:00