| Package | com.desuade.motion.tweens |
| Class | public class Tween |
| Inheritance | Tween BasicTween BaseBasic flash.events.EventDispatcher |
| Subclasses | MultiTween |
| Language Version : | ActionScript 3 |
| Since : | 02.05.2009 |
| Runtime Versions : | AIR 1.0, Flash Player 9.0.0 |
| Property | Defined By | ||
|---|---|---|---|
![]() | active : Boolean [read-only]
If the primitive is currently active and running. | BaseBasic | |
| completed : Boolean [read-only]
If the tween finished or not. | Tween | ||
![]() | config : Object [read-only]
Gets the config object that was passed in the constructor. | BaseBasic | |
![]() | pid : int [read-only]
The primitive's id
| BaseBasic | |
| position : Number [read-only]
Gets the current position 0-1 of the tween. | Tween | ||
![]() | target : Object
The target object
| BaseBasic | |
| Method | Defined By | ||
|---|---|---|---|
Tween(target:Object, configObject:Object = null)
The constructor accepts an object that has all the paramaters needed to create a new tween.
Paramaters for the tween object:
property:String – the property to tween
value:– the new (end) value. | Tween | ||
![]() | fromXML(xml:XML):*
Configures the object based on the values provided by the XML.
Most properties can assigned in the attributes using the same names.
The values of the attributes will be converted to Numbers if they're not NaN. | BaseBasic | |
reset():void
Resets the tween back to the beginning. | Tween | ||
run(target:Object, property:String, value:*, duration:Number, ease:* = linear, position:Number = 0, endfunc:Function = null):int [static]
This let's you run a tween that's unmanaged and bypasses events, using just a callback function on end.
The syntax is just a strict function call, so there's no configObject.
While there's little speed improvement with this over creating an tween object, it does use about half the memory.
| Tween | ||
start(delay:Number = -1, position:Number = -1):* [override]
This starts the tween. | Tween | ||
stop():Boolean [override]
This stops the currently playing tween at it's current position. | Tween | ||
![]() | toXML():XML
This creates an XML object that represents the object, based on it's config object. | BaseBasic | |
| completed | property |
completed:Boolean [read-only] If the tween finished or not.
public function get completed():Boolean| position | property |
position:Number [read-only] Gets the current position 0-1 of the tween. Does not include delay.
public function get position():Number| Tween | () | Constructor |
public function Tween(target:Object, configObject:Object = null)
The constructor accepts an object that has all the paramaters needed to create a new tween.
Paramaters for the tween object:
{value: 100} or {value:"200"}Example: var mt:Tween = new Tween(myobj, {property:'x', value:50, duration:2, ease:'easeInBounce', delay:2, position:0, round:false, relative:true, bezier:[60, '200, -10]})
target:Object — The target object to have it's property tweened
| |
configObject:Object (default = null) — The config object that has all the values for the tween
|
See also
| reset | () | method |
public function reset():voidResets the tween back to the beginning.
| run | () | method |
public static function run(target:Object, property:String, value:*, duration:Number, ease:* = linear, position:Number = 0, endfunc:Function = null):int
This let's you run a tween that's unmanaged and bypasses events, using just a callback function on end.
The syntax is just a strict function call, so there's no configObject.
While there's little speed improvement with this over creating an tween object, it does use about half the memory.
Parameters
target:Object — The target object to have it's property tweened
| |
property:String — The property to tween
| |
value:* — The new (end) value. Passing a Number will tween it to that absolute value, passing a String will use a relative value (target.property + value) - ie: {value: 100} or {value:"200"}
| |
duration:Number — How long in seconds for the tween to last
| |
ease:* (default = linear) — The easing to use. Default is 'linear'. Can pass a Function, but will not work with XML
| |
position:Number (default = 0) — The position to start the tween at. Defaults 0.
| |
endfunc:Function (default = null) — A function to call when the tween ends
|
int — The id of the PrimitiveTween
|
| start | () | method |
override public function start(delay:Number = -1, position:Number = -1):*This starts the tween. If the tween was previously stopped, this will resume it.
Parameters
delay:Number (default = -1) — Overrides the tween's delay and uses the passed one.
| |
position:Number (default = -1) — Starts the tween at a given position 0-1.
|
* — The tween object (for chaining)
|
| stop | () | method |
override public function stop():BooleanThis stops the currently playing tween at it's current position. Starting the tween will resume it.
ReturnsBoolean — True if could be stopped, false if the tween is not active or has ended.
|