GODPAPER | All Packages | All Classes | Index | Frames No Frames |
GTweenTimeline

Package | com.gskinner.motion
Class | public class GTweenTimeline
Inheritance | GTweenTimeline GTween flash.events.EventDispatcher

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | autoPlay : Boolean = true Indicates whether the tween should automatically play when an end value is changed. | GTween
|  | calculatedPosition : Number The current calculated position of the tween. | GTween
|  | calculatedPositionOld : Number The previous calculated position of the tween. | GTween
|  | data : * Allows you to associate arbitrary data with your tween. | GTween
|  | defaultDispatchEvents : Boolean = false [static] Sets the default value of dispatchEvents for new instances. | GTween
|  | defaultEase : Function [static] Specifies the default easing function to use with new tweens. | GTween
|  | delay : Number The length of the delay in frames or seconds (depending on .useFrames). | GTween
|  | dispatchEvents : Boolean If true, it will dispatch init, change, and complete events in addition to calling the onInit, onChange, and onComplete callbacks. | GTween
|  | duration : Number The length of the tween in frames or seconds (depending on the timingMode). | GTween
|  | ease : Function The easing function to use for calculating the tween. | GTween
|  | nextTween : GTween Specifies another GTween instance that will have paused=false set on it when this tween completes. | GTween
|  | onChange : Function Callback for the change event. | GTween
|  | onComplete : Function Callback for the complete event. | GTween
|  | onInit : Function Callback for the init event. | GTween
|  | pauseAll : Boolean = false [static] Setting this to true pauses all tween instances. | GTween
|  | paused : Boolean Plays or pauses a tween. | GTween
|  | pluginData : Object Stores data for plugins specific to this instance. | GTween
|  | position : Number [override] | GTweenTimeline
|  | positionOld : Number The position of the tween at the previous change. | GTween
|  | proxy : TargetProxy [read-only] The proxy object allows you to work with the properties and methods of the target object directly through GTween. | GTween
|  | ratio : Number The eased ratio (generally between 0-1) of the tween at the current position. | GTween
|  | ratioOld : Number The eased ratio (generally between 0-1) of the tween at the previous position. | GTween
|  | reflect : Boolean Indicates whether the tween should use the reflect mode when repeating. | GTween
|  | repeatCount : int = 1 The number of times this tween will run. | GTween
|  | suppressCallbacks : Boolean If true, callbacks added with addCallback will not be called. | GTweenTimeline
|  | suppressEvents : Boolean If true, events/callbacks will not be called. | GTween
|  | target : Object The target object to tween. | GTween
|  | timeScale : Number = 1 Allows you to scale the passage of time for a tween. | GTween
|  | timeScaleAll : Number = 1 [static] Sets the time scale for all tweens. | GTween
|  | useFrames : Boolean If true, durations and positions can be set in frames. | GTween
|  | version : Number = 2.01 [static] Indicates the version number for this build. | GTween

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | GTweenTimeline(target:Object = null, duration:Number = 1, values:Object = null, props:Object = null, pluginData:Object = null, tweens:Array = null) Constructs a new GTweenTimeline instance. | GTweenTimeline
|  | addCallback(labelOrPosition:*, forwardCallback:Function, forwardParameters:Array = null, reverseCallback:Function = null, reverseParameters:Array = null):void Adds a callback function at the specified position. | GTweenTimeline
|  | addLabel(position:Number, label:String):void Adds a label at the specified position. | GTweenTimeline
|  | addTween(position:Number, tween:GTween):void Adds a tween to the timeline, which will start playing at the specified start position. | GTweenTimeline
|  | addTweens(tweens:Array):void Shortcut method for adding a number of tweens at once. | GTweenTimeline
|  | beginning():void Jumps the tween to its beginning and pauses it. | GTween
|  | calculateDuration():void Calculates and sets the duration of the timeline based on the tweens and callbacks that have been added to it. | GTweenTimeline
|  | deleteValue(name:String):Boolean Removes a end value from the tween. | GTween
|  | end():void Jumps the tween to its end and pauses it. | GTween
|  | getInitValue(name:String):Number Returns the initial value for the specified property. | GTween
|  | getValue(name:String):Number Returns the end value for the specified property if one exists. | GTween
|  | getValues():Object Returns the hash table of all end properties and their values. | GTween
|  | goto(labelOrPosition:*):void Jumps the timeline to the specified label or numeric position without affecting its paused state. | GTweenTimeline
|  | gotoAndPlay(labelOrPosition:*):void Jumps the timeline to the specified label or numeric position and plays it. | GTweenTimeline
|  | gotoAndStop(labelOrPosition:*):void Jumps the timeline to the specified label or numeric position and pauses it. | GTweenTimeline
|  | init():void Reads all of the initial values from target and calls the onInit callback. | GTween
|  | installPlugin(plugin:Object, propertyNames:Array, highPriority:Boolean = false):void [static] Installs a plugin for the specified property. | GTween
|  | linearEase(a:Number, b:Number, c:Number, d:Number):Number [static] The default easing function used by GTween. | GTween
|  | removeCallback(labelOrPosition:*):void Removes the callback(s) at the specified label or position. | GTweenTimeline
|  | removeLabel(label:String):void Removes the specified label. | GTweenTimeline
|  | removeTween(tween:GTween):void Removes the specified tween. | GTweenTimeline
|  | resetValues(values:Object = null):void Similar to .setValues(), but clears all previous end values before setting the new ones. | GTween
|  | resolveLabelOrPosition(labelOrPosition:*):Number Returns the position for the specified label. | GTweenTimeline
|  | setPropertyValue(target:Object, propertyName:String, value:*):void [static] Sets a property value on a specified target object. | GTweenTimeline
|  | setValue(name:String, value:Number):void Sets the numeric end value for a property on the target object that you would like to tween. | GTween
|  | setValues(values:Object):void Shorthand method for making multiple setProperty calls quickly. | GTween
|  | swapValues():void Swaps the init and end values for the tween, effectively reversing it. | GTween

Property Detail

position | property

`position:Number`[override]

Implementation
`public function get position():Number`
`public function set position(value:Number):void`

suppressCallbacks | property |

`public var suppressCallbacks:Boolean`

If true, callbacks added with addCallback will not be called. This does not affect event callbacks like onChange, which can be disabled with suppressEvents. This can be handy for preventing large numbers of callbacks from being called when manually changing the position of a timeline (ex. calling `.end()`).

Constructor Detail

GTweenTimeline | () | Constructor

`public function GTweenTimeline(target:Object = null, duration:Number = 1, values:Object = null, props:Object = null, pluginData:Object = null, tweens:Array = null)`

Constructs a new GTweenTimeline instance. Note that because GTweenTimeline extends GTween, it can be used to tween a target directly, in addition to using its timeline features (for example, to synch tweening an animation with a timeline sequence).

Parameters

| `target:Object` (default = `null`)`` — The object whose properties will be tweened. Defaults to null.
| `duration:Number` (default = `1`)`` — The length of the tween in frames or seconds depending on the timingMode. Defaults to 10.
| `values:Object` (default = `null`)`` — An object containing destination property values. For example, to tween to x=100, y=100, you could pass `{x:100, y:100}` as the props object.
| `props:Object` (default = `null`)`` — An object containing properties to set on this tween. For example, you could pass {ease:myEase} to set the ease property of the new instance. It also supports a single special property "swapValues" that will cause `.swapValues` to be called after the values specified in the values parameter are set.
| `pluginData:Object` (default = `null`)`` — An object containing data for installed plugins to use with this tween. See `.pluginData` for more information.
| `tweens:Array` (default = `null`)`` — An array of alternating start positions and tween instances. For example, the following array would add 3 tweens starting at positions 2, 6, and 8: `[2, tween1, 6, tween2, 8, tween3]`

Method Detail

addCallback | () | method

`public function addCallback(labelOrPosition:*, forwardCallback:Function, forwardParameters:Array = null, reverseCallback:Function = null, reverseParameters:Array = null):void`

Adds a callback function at the specified position. When the timeline's playhead passes over or lands on the position while playing the callback will be called with the parameters specified. You can also optionally specify a callback and parameters to use if the timeline is playing in reverse (when reflected for example). You can add multiple callbacks at a specified position, however it is important to note that they will be played in the same order (most recently added first) playing both forwards and in reverse. You can enforce the order they are called in by offsetting the callbacks' positions by a tiny amount (ex. one at 2s, and one at 2.001s). Note that this can be used in conjunction with the static `setPropertyValue` method to easily set properties on objects in the timeline.

Parameters

| `labelOrPosition:*` — The position or label to add the callback at in frames or seconds (as per the timing mode of this tween).
| `forwardCallback:Function` — The function to call when playing forwards.
| `forwardParameters:Array` (default = `null`)`` — Optional array of parameters to pass to the callback when it is called when playing forwards.
| `reverseCallback:Function` (default = `null`)`` — The function to call when playing in reverse.
| `reverseParameters:Array` (default = `null`)`` — Optional array of parameters to pass to the callback when it is called when playing in reverse.

addLabel | () | method |

`public function addLabel(position:Number, label:String):void`

Adds a label at the specified position. You can use `gotoAndPlay` or `gotoAndStop` to jump to labels.

Parameters

| `position:Number` — The position to add the label at in frames or seconds (as per the timing mode of this tween).
| `label:String` — The label to add.

addTween | () | method |

`public function addTween(position:Number, tween:GTween):void`

Adds a tween to the timeline, which will start playing at the specified start position. The tween will play synchronized with the timeline, with all of its behaviours intact (ex. `repeat`, `reflect`) except for `delay` (which is accomplished with the `position` parameter instead).

Parameters

| `position:Number` — The starting position for this tween in frames or seconds (as per the timing mode of this tween).
| `tween:GTween` — The GTween instance to add. Note that this can be any subclass of GTween, including another GTweenTimeline.

addTweens | () | method |

`public function addTweens(tweens:Array):void`

Shortcut method for adding a number of tweens at once.

Parameters

| `tweens:Array` — An array of alternating positions and tween instances. For example, the following array would add 3 tweens starting at positions 2, 6, and 8: `[2, tween1, 6, tween2, 8, tween3]`

calculateDuration | () | method |

`public function calculateDuration():void`

Calculates and sets the duration of the timeline based on the tweens and callbacks that have been added to it.

goto | () | method |

`public function goto(labelOrPosition:*):void`

Jumps the timeline to the specified label or numeric position without affecting its paused state.

Parameters

| `labelOrPosition:*` — The label name or numeric position in frames or seconds (as per the timing mode of this tween) to jump to.

gotoAndPlay | () | method |

`public function gotoAndPlay(labelOrPosition:*):void`

Jumps the timeline to the specified label or numeric position and plays it.

Parameters

| `labelOrPosition:*` — The label name or numeric position in frames or seconds (as per the timing mode of this tween) to jump to.

gotoAndStop | () | method |

`public function gotoAndStop(labelOrPosition:*):void`

Jumps the timeline to the specified label or numeric position and pauses it.

Parameters

| `labelOrPosition:*` — The label name or numeric position in frames or seconds (as per the timing mode of this tween) to jump to.

removeCallback | () | method |

`public function removeCallback(labelOrPosition:*):void`

Removes the callback(s) at the specified label or position.

Parameters

| `labelOrPosition:*` — The position of the callback(s) to remove in frames or seconds (as per the timing mode of this tween).

removeLabel | () | method |

`public function removeLabel(label:String):void`

Removes the specified label.

Parameters

| `label:String` — The label to remove.

removeTween | () | method |

`public function removeTween(tween:GTween):void`

Removes the specified tween. Note that this will remove all instances of the tween if has been added multiple times to the timeline.

Parameters

| `tween:GTween` — The GTween instance to remove.

resolveLabelOrPosition | () | method |

`public function resolveLabelOrPosition(labelOrPosition:*):Number`

Returns the position for the specified label. If a numeric position is specified, it is returned unchanged.

Parameters

| `labelOrPosition:*` — The label name or numeric position in frames or seconds (as per the timing mode of this tween) to resolve.

Returns

| `Number`

setPropertyValue | () | method |

`public static function setPropertyValue(target:Object, propertyName:String, value:*):void`

Sets a property value on a specified target object. This is provided to make it easy to set properties in a GTweenTimeline using `addCallback`. For example, to set the `visible` property to true on a movieclip "foo" at 3 seconds into the timeline, you could use the following code: `myTimeline.addCallback(3,GTweenTimeline.setPropertyValue,[foo,"visible",true]);`

Parameters

| `target:Object` — The object to set the property value on.
| `propertyName:String` — The name of the property to set.
| `value:*` — The value to assign to the property.

Thu Jan 16 2014, 01:11 PM +08:00