Packagecom.gskinner.motion
Classpublic class MultiTween

MultiTween ©2008 Grant Skinner, gskinner.com. Visit www.gskinner.com/blog for documentation, updates and more free code. Licensed under the MIT license. See the source file header for more information.
MultiTween is a concept class to allow tweening multiple objects and properties with a single GTween instance. It is not thoroughly tested, and probably will exhibit some weird behaviours.

It is mostly provided in response to demand from users, and to give an example for building other extensions to GTween. I generally would recommend using a single GTween instance per target, or GTweenTimeline over using this class.

It works by setting itself as a target for the tween, and using it to tween the position property of MultiTween between 0 and 1. The position value is then used to calculate property values for all of the MultiTween's targets. In theory, this means that you can take advantage of most of the features of GTween (like delay and reflect).

Note that unlike GTween, which copies initProperties each time it inits (ie. starts tweening), MultiTween only copies those properties once the first time its associated GTween instance inits. This is in order to support features like autoReverse.



Public Properties
 PropertyDefined by
  position : Number
The property that is tweened by the GTween instance.
MultiTween
  tween : GTween
[read-only] Read-only access to the tween that is associated with this MultiTween instance.
MultiTween
Public Methods
 MethodDefined by
  
MultiTween(targets:Array, properties:Object, tween:GTween)
Constructs a new MultiTween instance.
MultiTween
Property detail
positionproperty
position:Number  [read-write]

The property that is tweened by the GTween instance. This can also be set directly through code. For example, a position of 0.5 will tween all the target properties to halfway between their initial value and their destination value.

Implementation
    public function get position():Number
    public function set position(value:Number):void
tweenproperty 
tween:GTween  [read-only]

Read-only access to the tween that is associated with this MultiTween instance.

Implementation
    public function get tween():GTween
Constructor detail
MultiTween()constructor
public function MultiTween(targets:Array, properties:Object, tween:GTween)

Constructs a new MultiTween instance.

Parameters
targets:Array — An array of target objects whose properties will be tweened.
 
properties:Object — Either an object describing the destination values for the tween that will be applied to all targets, or an array of those objects to apply to each of the targets independently.
 
tween:GTween — The GTween instance that will be controlling this MultiTween. This allows the MultiTween to set itself as the target of the tween, set up its position property for tweening, and listen for the init event.