Packagecom.flashdynamix.motion
Classpublic class Tweensy

The Tweensy Class contains a collection of tweens specified by property tweens for an Object instance. Using the TweensyGroup Class though is the recommended implementation for property tweening, while the Tweensy Class offers most of the functionality of TweensyGroup via a list of static methods and properties for coding convenience.

A tween can be executed in one of the following manners:

See also

com.flashdynamix.motion.TweensyGroup
com.flashdynamix.motion.TweensyTimeline


Public Properties
 PropertyDefined by
  hasTimelines : Boolean
[static][read-only] Whether the Tweensy Class has any TweensyTimeline animations.
Tweensy
  paused : Boolean
[static][read-only] Whether the Tweensy Class is currently paused.
Tweensy
  refreshType : String
[static] Sets the timing system currently in use by the Tweensy Class.
Tweensy
  secondsPerFrame : Number
[static] Defines how many seconds per frame are added to to each on an ENTER_FRAME when TweensyGroup Class's refreshType is of the Tweensy.FRAME mode.
This property and feature is intended as an alternative to the Tweensy.TIME (time based animation) mode which can result in jumpy effects.
Tweensy
  snapToClosest : Boolean
[static] Whether the timelines contained within the TweensyGroup class will snap tweened properties to the closest whole number.
Tweensy
  timelines : int
[static][read-only] Total number of animations in progress for the Tweensy class.
Tweensy
  useSmartRotate : Boolean
[static] Whether the timelines contained within the TweensyGroup class will use smart rotation or not.
Using smart rotation will ensure that when tweening the 'rotation' property it will turn in the shortest rotation direction.
This fixes what may otherwise appear as a visual glitch even though mathimatically it is correct.
Tweensy
Public Methods
 MethodDefined by
  
[static] Adds a TweensyTimeline to the Tweensy class.
Tweensy
  
from(instance:Object, from:Object, duration:Number = 0.5, ease:Function = null, delayStart:Number = 0, update:Object = null, onComplete:Function = null, onCompleteParams:Array = null):TweensyTimeline
[static] Adds a from based tween using the properties defined in the from Object.
Tweensy
  
fromTo(instance:Object, from:Object, to:Object, duration:Number = 0.5, ease:Function = null, delayStart:Number = 0, update:Object = null, onComplete:Function = null, onCompleteParams:Array = null):TweensyTimeline
[static] Adds a from to based tween using the properties defined in the from and to Objects.
Tweensy
  
gc():void
[static] Prepares the Tweensy Library for garbage collection by disposing its Object Pools and making it no longer usable in the Flash application.
Tweensy
  
pause():void
[static] Pauses all tweens which have been executed by the Tweensy Class.
Tweensy
  
remove(timeline:TweensyTimeline):void
[static] Removes a TweensyTimeline from the Tweensy class.
Tweensy
  
resume():void
[static] Resumes all tweens which have been executed by the Tweensy Class.
Tweensy
  
stop(instance:* = null, ... props):void
[static] Allows for removing tweens which have been executed by the Tweensy Class.
Tweensy
  
stopAll():void
[static] Stops all tweens which have been executed by the Tweensy Class.
Tweensy
  
to(instance:Object, to:Object, duration:Number = 0.5, ease:Function = null, delayStart:Number = 0, update:Object = null, onComplete:Function = null, onCompleteParams:Array = null):TweensyTimeline
[static] Adds a to based tween using the properties defined in the target Object.
Tweensy
  
toString():String
Tweensy
  
updateTo(instance:Object, to:Object):void
[static] Updates a tween for the instance Object to the new target positions defined in the to Object.
Tweensy
Public Constants
 ConstantDefined by
  FRAME : String = "frame"
[static] Sets the refreshType to use the current seconds per frame on each ENTER_FRAME allowing for frame based animations.
Tweensy
  TIME : String = "time"
[static] Sets the refreshType to use the current frames per second of the SWF allowing for time based animations.
Tweensy
  version : Number = 0.2
[static]
Tweensy
Property detail
hasTimelinesproperty
hasTimelines:Boolean  [read-only]

Whether the Tweensy Class has any TweensyTimeline animations.

Implementation
    public static function get hasTimelines():Boolean
pausedproperty 
paused:Boolean  [read-only]

Whether the Tweensy Class is currently paused.

Implementation
    public static function get paused():Boolean
refreshTypeproperty 
refreshType:String  [read-write]

Sets the timing system currently in use by the Tweensy Class.

Implementation
    public static function get refreshType():String
    public function set refreshType(value:String):void

See also

secondsPerFrameproperty 
secondsPerFrame:Number  [read-write]

Defines how many seconds per frame are added to to each on an ENTER_FRAME when TweensyGroup Class's refreshType is of the Tweensy.FRAME mode.
This property and feature is intended as an alternative to the Tweensy.TIME (time based animation) mode which can result in jumpy effects. This is because by using Tweensy.Time rfreshType it ensures that your animation will accurately finish in the time you specify. Instead Tweensy.FRAME ensures that every frame is rendered for the duration of your animation. e.g. If your FLA frame rate is 30 frames per second then set secondsPerFrame to 1 second for every 30 frames (1/30).

Implementation
    public static function get secondsPerFrame():Number
    public function set secondsPerFrame(value:Number):void

See also

snapToClosestproperty 
snapToClosest:Boolean  [read-write]

Whether the timelines contained within the TweensyGroup class will snap tweened properties to the closest whole number.

Implementation
    public static function get snapToClosest():Boolean
    public function set snapToClosest(value:Boolean):void
timelinesproperty 
timelines:int  [read-only]

Total number of animations in progress for the Tweensy class.

Implementation
    public static function get timelines():int
useSmartRotateproperty 
useSmartRotate:Boolean  [read-write]

Whether the timelines contained within the TweensyGroup class will use smart rotation or not.
Using smart rotation will ensure that when tweening the 'rotation' property it will turn in the shortest rotation direction.
This fixes what may otherwise appear as a visual glitch even though mathimatically it is correct.

Implementation
    public static function get useSmartRotate():Boolean
    public function set useSmartRotate(value:Boolean):void
Method detail
add()method
public static function add(timeline:TweensyTimeline):TweensyTimeline

Adds a TweensyTimeline to the Tweensy class. This can be useful if you want to prepare an animation and the items in it but not necessarily have it Tweening straight away.

Parameters
timeline:TweensyTimeline

Returns
TweensyTimeline — An instance to the TweensyTimeline.
from()method 
public static function from(instance:Object, from:Object, duration:Number = 0.5, ease:Function = null, delayStart:Number = 0, update:Object = null, onComplete:Function = null, onCompleteParams:Array = null):TweensyTimeline

Adds a from based tween using the properties defined in the from Object.

Parameters
instance:Object — The instance Object to be tweened or multiple instances if using the type Array e.g. [item1, item2]
 
from:Object — An Object containing the properties you would like to tween from e.g. {x:50, y:25} or this can be relative e.g. {x:'50', y:'-25'} or can be a random position e.g. {x:'-50, 50', y:'-25, 25'}
 
duration:Number (default = 0.5) — The time in secs you would like the tween to run.
 
ease:Function (default = null) — The ease equation you would like to use, by default this is Quintic.easeOut or the ease equation defined in TweensyTimeline.defaultTween.
 
delayStart:Number (default = 0) — The delay you would like to use at the beginning of the tween and every subsequent REPLAY of a tween.
 
update:Object (default = null) — This param is used when tweening a property in a Object which needs to be applied onto another Object each time the tween occurs.This occurs with tweening ColorTransforms, Matrices, SoundTransforms, BitmapFilters.
For example Tweensy.from(new DropShadowFilter(), {alpha:0}, 0.5, null, 0, myDisplayItem);
Will apply the tweening DropShadowFilter onto the DisplayObject 'myDisplayItem'.
 
onComplete:Function (default = null) — The onComplete event handler you would like to fire once the tween is complete.
 
onCompleteParams:Array (default = null) — The params applied to the onComplete handler.

Returns
TweensyTimeline — An instance of the TweensyTimeline which can used to manage this tween.

See also

fromTo()method 
public static function fromTo(instance:Object, from:Object, to:Object, duration:Number = 0.5, ease:Function = null, delayStart:Number = 0, update:Object = null, onComplete:Function = null, onCompleteParams:Array = null):TweensyTimeline

Adds a from to based tween using the properties defined in the from and to Objects.

Parameters
instance:Object — The instance Object to be tweened or multiple instances if using the type Array e.g. [item1, item2]
 
from:Object — An Object containing the properties you would like to tween from e.g. {x:50, y:25} or this can be relative e.g. {x:'50', y:'-25'} or can be a random position e.g. {x:'-50, 50', y:'-25, 25'}
 
to:Object — An Object containing the properties you would like to tween to e.g. {x:50, y:25} or this can be relative e.g. {x:'50', y:'-25'} or can be a random position e.g. {x:'-50, 50', y:'-25, 25'}
 
duration:Number (default = 0.5) — The time in secs you would like the tween to run.
 
ease:Function (default = null) — The ease equation you would like to use, by default this is Quintic.easeOut or the ease equation defined in TweensyTimeline.defaultTween.
 
delayStart:Number (default = 0) — The delay you would like to use at the beginning of the tween and every subsequent REPLAY of a tween.
 
update:Object (default = null) — This param is used when tweening a property in a Object which needs to be applied onto another Object each time the tween occurs.This occurs with tweening ColorTransforms, Matrices, SoundTransforms, BitmapFilters.
For example Tweensy.fromTo(new DropShadowFilter(), {alpha:1}, {alpha:0}, 0.5, null, 0, myDisplayItem);
Will apply the tweening DropShadowFilter onto the DisplayObject 'myDisplayItem'.
 
onComplete:Function (default = null) — The onComplete event handler you would like to fire once the tween is complete.
 
onCompleteParams:Array (default = null) — The params applied to the onComplete handler.

Returns
TweensyTimeline — An instance of the TweensyTimeline which can used to manage this tween.

See also

gc()method 
public static function gc():void

Prepares the Tweensy Library for garbage collection by disposing its Object Pools and making it no longer usable in the Flash application.

pause()method 
public static function pause():void

Pauses all tweens which have been executed by the Tweensy Class.

remove()method 
public static function remove(timeline:TweensyTimeline):void

Removes a TweensyTimeline from the Tweensy class. This will stop this timeline from being updated but can be re-added to the Tweensy class resuming that animation.

Parameters
timeline:TweensyTimeline
resume()method 
public static function resume():void

Resumes all tweens which have been executed by the Tweensy Class.

stop()method 
public static function stop(instance:* = null, ... props):void

Allows for removing tweens which have been executed by the Tweensy Class.
Tweens can be stopped via an instance or tween props by the following methods :

Parameters
instance:* (default = null)
 
... props
stopAll()method 
public static function stopAll():void

Stops all tweens which have been executed by the Tweensy Class.

to()method 
public static function to(instance:Object, to:Object, duration:Number = 0.5, ease:Function = null, delayStart:Number = 0, update:Object = null, onComplete:Function = null, onCompleteParams:Array = null):TweensyTimeline

Adds a to based tween using the properties defined in the target Object.

Parameters
instance:Object — The instance Object to be tweened or multiple instances if using the type Array e.g. [item1, item2]
 
to:Object — An Object containing the properties you would like to tween to e.g. {x:50, y:25} or this can be relative e.g. {x:'50', y:'-25'} or can be a random position e.g. {x:'-50, 50', y:'-25, 25'}
 
duration:Number (default = 0.5) — The time in secs you would like the tween to run.
 
ease:Function (default = null) — The ease equation you would like to use, by default this is Quintic.easeOut or the ease equation defined in TweensyTimeline.defaultTween.
 
delayStart:Number (default = 0) — The delay you would like to use at the beginning of the tween and every subsequent REPLAY of a tween.
 
update:Object (default = null) — This param is used when tweening a property in a Object which needs to be applied onto another Object each time the tween occurs. This occurs with tweening ColorTransforms, Matrices, SoundTransforms, BitmapFilters.
For example Tweensy.to(new DropShadowFilter(), {alpha:0}, 0.5, null, 0, myDisplayItem);
Will apply the tweening DropShadowFilter onto the DisplayObject 'myDisplayItem'.
 
onComplete:Function (default = null) — The onComplete event handler you would like to fire once the tween is complete.
 
onCompleteParams:Array (default = null) — The params applied to the onComplete handler.

Returns
TweensyTimeline — An instance to the TweensyTimeline which can used to manage this tween.

See also

toString()method 
public function toString():String

Returns
String
updateTo()method 
public static function updateTo(instance:Object, to:Object):void

Updates a tween for the instance Object to the new target positions defined in the to Object.

Parameters
instance:Object
 
to:Object
Constant detail
FRAMEconstant
public static const FRAME:String = "frame"

Sets the refreshType to use the current seconds per frame on each ENTER_FRAME allowing for frame based animations.

See also

TIMEconstant 
public static const TIME:String = "time"

Sets the refreshType to use the current frames per second of the SWF allowing for time based animations.

See also

versionconstant 
public static const version:Number = 0.2