TimelineTween class

Note: This class is not intended to be used directly. It is needed by the 'Toolkit for Dart' to export from Flash Professional to Dart/StageXL.

A TimelineTween instance tweens properties for a single target.

Instance methods can be chained for easy construction and sequencing:

Example:

target.alpha = 1;
TimelineTween.get(target)
  .wait(500)
  .to({alpha:0, visible:false}, 1000)
  .call(() => print("complete"));

Multiple tweens can point to the same instance, however if they affect the same properties there could be unexpected behaviour. To stop all tweens on an object, use TimelineTween.removeTweens or pass override:true in the props argument.

TimelineTween.get(target, {override:true}).to({x:100});

Subscribe to the "change" event to get notified when a property of the target is changed.

  TimelineTween.get(target, {override:true})
    .to({x:100})
    .addEventListener("change", (event) => print("change"));

See the TimelineTween.get method for additional param documentation.

Constructors

TimelineTween(dynamic target, Map<String, dynamic> props)
@method initialize @param {Object} target @param {Object} props @protected

Properties

duration ↔ num
Read-only. Specifies the total duration of this tween in ticks. This value is automatically updated as you modify the tween. Changing it directly could result in unexpected behaviour.
read / write
ignoreGlobalPause ↔ bool
Causes this tween to continue playing when a global pause is active. For example, if TweenJS is using Ticker, then setting this to true (the default) will cause this tween to be paused when Ticker.setPaused(true) is called. See TimelineTween.tick() for more info. Can be set via the props param.
read / write
loop ↔ bool
If true, the tween will loop when it reaches the end. Can be set via the props param.
read / write
onChange ChangeHandler
Called whenever the tween's position changes with a single parameter referencing this tween instance. @property onChange @type {Function}
read / write
position ↔ num
Read-only. The current normalized position of the tween. This will always be a value between 0 and duration. Changing this property directly will have no effect.
read / write
target ↔ dynamic
Read-only. The target of this tween. This is the object on which the tweened properties will be changed. Changing this property after the tween is created will not have any effect. @property target @type {Object}
read / write
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

c(Function callback, [ List params ]) TimelineTween
call(Function callback, [ List params ]) TimelineTween
Queues an action to call the specified function. @example //would call myFunction() after 1s. myTween.wait(1000).call(myFunction); @method call @param {Function} callback The function to call. @param {Array} params Optional. The parameters to call the function with. If this is omitted, then the function will be called with a single param pointing to this tween. @param {Object} scope Optional. The scope to call the function in. If omitted, it will be called in the target's scope. @return {TimelineTween} This tween instance (for chaining calls).
pause(TimelineTween tween) TimelineTween
Queues an action to to pause the specified tween. @method pause @param {TimelineTween} tween The tween to play. If null, it pauses this tween. @return {TimelineTween} This tween instance (for chaining calls)
play(TimelineTween tween) TimelineTween
Queues an action to to play (unpause) the specified tween. This enables you to sequence multiple tweens. @example myTween.to({x:100},500).play(otherTween); @method play @param {TimelineTween} tween The tween to play. @return {TimelineTween} This tween instance (for chaining calls).
s(Map<String, dynamic> props, [ dynamic target ]) TimelineTween
set(Map<String, dynamic> props, [ dynamic target ]) TimelineTween
Queues an action to set the specified props on the specified target. If target is null, it will use this tween's target. @example myTween.wait(1000).set({visible:false},foo); @method set @param {Object} props The properties to set (ex. {visible:false}). @param {Object} target Optional. The target to set the properties on. If omitted, they will be set on the tween's target. @return {TimelineTween} This tween instance (for chaining calls).
setPaused(bool value) TimelineTween
Pauses or plays this tween. @method setPaused @param {Boolean} value Indicates whether the tween should be paused (true) or played (false). @return {TimelineTween} This tween instance (for chaining calls)
setPosition(num value, [ int actionsMode ]) → bool
Advances the tween to a specified position. @method setPosition @param {Number} value The position to seek to in ticks. @param {Number} actionsMode Optional parameter specifying how actions are handled (ie. call, set, play, pause): TimelineTween.NONE (0) - run no actions. TimelineTween.LOOP (1) - if new position is less than old, then run all actions between old and duration, then all actions between 0 and new. Defaults to LOOP. TimelineTween.REVERSE (2) - if new position is less than old, run all actions between them in reverse. @return {Boolean} Returns true if the tween is complete (ie. the full tween has run & loop is false).
t(Map<String, dynamic> props, [ num duration = 0, TransitionFunction ease ]) TimelineTween
tick(num delta) → void
Advances this tween by the specified amount of time in milliseconds (or ticks if useTicks is true). This is normally called automatically by the TimelineTween engine (via TimelineTween.tick), but is exposed for advanced uses. @method tick @param {Number} delta The time to advance in milliseconds (or ticks if useTicks is true).
to(Map<String, dynamic> props, [ num duration, TransitionFunction ease ]) TimelineTween
Queues a tween from the current values to the target properties. Set duration to 0 to jump to these value. Numeric properties will be tweened from their current value in the tween to the target value. Non-numeric properties will be set at the end of the specified duration. @example createjs.TimelineTween.get(target).to({alpha:0}, 1000); @method to @param {Object} props An object specifying property target values for this tween (Ex. {x:300} would tween the x property of the target to 300). @param {Number} duration Optional. The duration of the wait in milliseconds (or in ticks if useTicks is true). Defaults to 0. @param {Function} ease Optional. The easing function to use for this tween. Defaults to a linear ease. @return {TimelineTween} This tween instance (for chaining calls).
toString() → String
Returns a string representation of this object. @method toString @return {String} a string representation of the instance.
w(num duration) TimelineTween
wait(num duration) TimelineTween
Queues a wait (essentially an empty tween). @example //This tween will wait 1s before alpha is faded to 0. createjs.TimelineTween.get(target).wait(1000).to({alpha:0}, 1000); @method wait @param {Number} duration The duration of the wait in milliseconds (or in ticks if useTicks is true). @return {TimelineTween} This tween instance (for chaining calls).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited

Static Methods

get(dynamic target, [ Map<String, dynamic> props, bool override = false ]) TimelineTween
Returns a new tween instance. This is functionally identical to using "new TimelineTween(...)", but looks cleaner with the chained syntax of TweenJS. @example var tween = TimelineTween.get(target); @method get @static @param {Object} target The target object that will have its properties tweened. @param {Object} props The configuration properties to apply to this tween instance (ex. {loop:true, paused:true}). All properties default to false. Supported props are:

Constants

LOOP → const int
Constant defining the loop actionsMode for use with setPosition.
1
NONE → const int
Constant defining the none actionsMode for use with setPosition.
0
REVERSE → const int
Constant defining the reverse actionsMode for use with setPosition.
2