Packageorg.as3lib.kitchensync.action
Classpublic class KSTween
InheritanceKSTween Inheritance AbstractAction Inheritance flash.events.EventDispatcher

A tween will change an object's numeric value over time. Uses a TweenTarget object to determine what to tween. This can be handled automatically or declared explicitly. Rule of thumb: KSTween is the action that handles the timing and starting and stopping the tween while ITweenTargets control the values of the tween.

See also

org.as3lib.kitchensync.action.tweentarget.ITweenTarget


Public Properties
 PropertyDefined by
 InheritedautoDelete : Boolean
autoDelete is a flag that indicates whether the action should be deleted when it is done executing.
AbstractAction
 Inheriteddelay : int
delay is the time that will pass after the start() method is called before the action begins.
AbstractAction
 Inheritedduration : int
duration is the length of time that the action will run.
AbstractAction
 InheriteddurationHasElapsed : Boolean
Checks to see whether the duration of the action has elapsed and if the _startTime is defined.
AbstractAction
  easingFunction : Function
The function used to interpolated the values between the start and end points.
KSTween
  easingMod1 : Number
Used to modify the results of the easing function.
KSTween
  easingMod2 : Number
Used to modify the results of the easing function.
KSTween
 InheritedisPaused : Boolean
Will return true if the action is paused (after pause() has been called).
AbstractAction
 InheritedisRunning : Boolean
Will return true when the action is running (after start() has been called).
AbstractAction
 Inheritedname : String
The human-readable name of this action.
AbstractAction
 Inheritedoffset : int
legacy accessors.
AbstractAction
 InheritedpauseTime : Timestamp
The time at which the action was last paused.
AbstractAction
  snapToValueOnComplete : Boolean
Indicates whether the final value for the easing function should snap to the target _toValue.
KSTween
 InheritedstartTime : Timestamp
The time at which the action was last started.
AbstractAction
 InheritedstartTimeHasElapsed : Boolean
Checks to see whether the start time delay has elapsed and if the _startTime is defined.
AbstractAction
 Inheritedsync : Boolean
Setting sync to true will cause the action to sync up with real time even if framerate drops.
AbstractAction
 InheritedtimeStringParser : ITimeStringParser
[static] The timeStringParser will determine how strings are parsed into valid time values.
AbstractAction
  tweenTarget : ITweenTarget
KSTween
Protected Properties
 PropertyDefined by
 Inherited_autoDelete : Boolean
AbstractAction
 Inherited_delay : int = 0
AbstractAction
 Inherited_duration : int = 0
AbstractAction
  _easingFunction : Function
KSTween
  _easingMod1 : Number
KSTween
  _easingMod2 : Number
KSTween
 Inherited_name : String
AbstractAction
 Inherited_paused : Boolean = false
AbstractAction
 Inherited_pauseTime : Timestamp
AbstractAction
 Inherited_running : Boolean = false
AbstractAction
  _snapToValueOnComplete : Boolean
KSTween
 Inherited_startTime : Timestamp
AbstractAction
 Inherited_sync : Boolean
AbstractAction
  _tweenTarget : ITweenTarget
Represents the values that will be tweened by the tween.
KSTween
Public Methods
 MethodDefined by
  
KSTween(target:Object = null, property:String = "", startValue:Number, endValue:Number = 0, duration:Function = 0, delay:* = 0, easingFunction:* = null)
Indicates whether tweened values should snap to whole value numbers or use decimals.
KSTween
 Inherited
addEventTrigger(dispatcher:IEventDispatcher, eventType:String):void
Causes the action to start playing when a specified event is fired.
AbstractAction
 Inherited
addTrigger(trigger:AbstractAction):void
Causes the action to start playing when another event completes.
AbstractAction
  
KSTween
  
cloneReversed(target:Object = null, property:String = null):KSTween
Creates a new Tween and reverses the start and end values of the target property.
KSTween
  
cloneWithTarget(target:Object, property:String):KSTween
Creates a copy of this Tween which targets a different object and / or property.
KSTween
  
Clones the tween with a new tweenTarget.
KSTween
  
jumpToTime(time:*, ignoreDelay:Boolean = false):void
Moves the playhead to a specified time in the action.
KSTween
  
kill():void
Clean up references to target
KSTween
  
newWithTweenTarget(tweenTarget:ITweenTarget, duration:Function = 0, delay:* = 0, easingFunction:* = null):KSTween
[static] Alternative constructor: creates a new KSTween using an ITweenTarget that you pass into it.
KSTween
 Inherited
pause():void
Causes the action to be paused.
AbstractAction
 Inherited
register():void
Adds the action as a listener to the Synchronizer's update event.
AbstractAction
 Inherited
removeEventTrigger(dispatcher:IEventDispatcher, eventType:String):void
Removes an event trigger added by addEventTrigger().
AbstractAction
 Inherited
Removes a trigger added with addTrigger().
AbstractAction
  
reset():void
Stops the tween and sets the target property to the start value.
KSTween
  
reverse():void
Flips the values for to and from values.
KSTween
  
Starts the Tween.
KSTween
 Inherited
stop():void
Stops the action from running and resets the timer.
AbstractAction
  
toString():String
Returns either the _id or a description of the tween.
KSTween
 Inherited
unpause():void
Resumes the action at the point where it was paused.
AbstractAction
 Inherited
unregister():void
Removes the action as a listener to the Synchronizer's update event.
AbstractAction
Protected Methods
 MethodDefined by
 Inherited
complete():void
Call this when the action has completed.
AbstractAction
 Inherited
forceUpdate():void
Foreces the onUpdate() method to fire without being triggered by Synchronizer.
AbstractAction
 Inherited
onTrigger(event:Event):void
Handler that starts playing the action that is called by a trigger event.
AbstractAction
  
Executes the tween.
KSTween
Events
 EventSummaryDefined by
 Inherited  AbstractAction
 Inherited  AbstractAction
 Inherited  AbstractAction
 Inherited  AbstractAction
Public Constants
 ConstantDefined by
  EXISTING_FROM_VALUE : Number = -Infinity
[static] Use this property to cause the tween to start from whatever the targetProperty is set to at the time the tween executes.
KSTween
Property detail
_easingFunctionproperty
protected var _easingFunction:Function
easingFunctionproperty 
easingFunction:Function  [read-write]

The function used to interpolated the values between the start and end points.

Implementation
    public function get easingFunction():Function
    public function set easingFunction(value:Function):void

See also

_easingMod1property 
protected var _easingMod1:Number
easingMod1property 
easingMod1:Number  [read-write]

Used to modify the results of the easing function. This is only used on some functions such as Elastic.

Implementation
    public function get easingMod1():Number
    public function set easingMod1(value:Number):void
_easingMod2property 
protected var _easingMod2:Number
easingMod2property 
easingMod2:Number  [read-write]

Used to modify the results of the easing function. This is only used on some functions such as Elastic.

Implementation
    public function get easingMod2():Number
    public function set easingMod2(value:Number):void
_snapToValueOnCompleteproperty 
protected var _snapToValueOnComplete:Boolean
snapToValueOnCompleteproperty 
snapToValueOnComplete:Boolean  [read-write]

Indicates whether the final value for the easing function should snap to the target _toValue. If set to true, the target property will equal _toValue regardless of the results of the easing function.

The default value is true.

Implementation
    public function get snapToValueOnComplete():Boolean
    public function set snapToValueOnComplete(value:Boolean):void
_tweenTargetproperty 
protected var _tweenTarget:ITweenTarget

Represents the values that will be tweened by the tween. KSTween will use a TargetProperty by default.

See also

tweenTargetproperty 
tweenTarget:ITweenTarget  [read-write]Implementation
    public function get tweenTarget():ITweenTarget
    public function set tweenTarget(value:ITweenTarget):void
Constructor detail
KSTween()constructor
public function KSTween(target:Object = null, property:String = "", startValue:Number, endValue:Number = 0, duration:Function = 0, delay:* = 0, easingFunction:* = null)

Indicates whether tweened values should snap to whole value numbers or use decimals. If set to true, the results of the easing functions on the target property will be rounded to the nearest integer.

Parameters
target:Object (default = null)
 
property:String (default = "")
 
startValue:Number
 
endValue:Number (default = 0)
 
duration:Function (default = 0)
 
delay:* (default = 0)
 
easingFunction:* (default = null)

See also

// todo rename to snapToInteger public function get snapToWholeNumber():Boolean { return _snapToWholeNumber; } public function set snapToWholeNumber(snapToWholeNumber:Boolean):void { _snapToWholeNumber = snapToWholeNumber; } protected var _snapToWholeNumber:Boolean;
Method detail
clone()method
public override function clone():AbstractAction

Returns
AbstractAction
cloneReversed()method 
public function cloneReversed(target:Object = null, property:String = null):KSTween

Creates a new Tween and reverses the start and end values of the target property.

Parameters
target:Object (default = null) — - The optional target object of the new Tween
 
property:String (default = null) — - The optional property to tween with the new Tween.

Returns
KSTween

See also

cloneWithTarget()method 
public function cloneWithTarget(target:Object, property:String):KSTween

Creates a copy of this Tween which targets a different object and / or property. This is mostly used as a convenient way to reuse a tween, e.g. in a sequence.

Parameters
target:Object — - The new object to target. Defaults to the same target as this.
 
property:String — - The new target object's property to target. Defaults to the same property as this.

Returns
KSTween — Tween - a copy of this tween with a new target/property.

See also

cloneWithTweenTarget()method 
public function cloneWithTweenTarget(tweenTarget:ITweenTarget):KSTween

Clones the tween with a new tweenTarget.

Parameters
tweenTarget:ITweenTarget

Returns
KSTween
jumpToTime()method 
public function jumpToTime(time:*, ignoreDelay:Boolean = false):void

Moves the playhead to a specified time in the action. If this method is called while the action is paused, it will not appear to jump until after the action is unpaused.

Parameters
time:* — The time parameter can either be a number or a parsable time string. If the time to jump to is greater than the total duration of the action, it will throw an IllegalOperationError.
 
ignoreDelay:Boolean (default = false) — If set to true, the delay will be ignored and the action will jump to the specified time in relation to the duration.

Throws
— If the time to jump to is longer than the total time for the action.
kill()method 
public override function kill():void

Clean up references to target

newWithTweenTarget()method 
public static function newWithTweenTarget(tweenTarget:ITweenTarget, duration:Function = 0, delay:* = 0, easingFunction:* = null):KSTween

Alternative constructor: creates a new KSTween using an ITweenTarget that you pass into it.

Parameters
tweenTarget:ITweenTarget — An explicitly defined tweenTarget object that contains the values you want to tween.
 
duration:Function (default = 0) — - the time in frames that this tween will take to execute.
 
delay:* (default = 0) — - the time to wait before starting the tween.
 
easingFunction:* (default = null) — - the function to use to interpolate the values between fromValue and toValue.

Returns
KSTween — A new KSTween object.
onUpdate()method 
protected override function onUpdate(event:KitchenSyncEvent):void

Executes the tween.

Parameters
event:KitchenSyncEvent
reset()method 
public function reset():void

Stops the tween and sets the target property to the start value.

reverse()method 
public function reverse():void

Flips the values for to and from values. Essentially, causes the animation to run backwards.

See also

start()method 
public override function start():AbstractAction

Starts the Tween.

Returns
AbstractAction
toString()method 
public override function toString():String

Returns either the _id or a description of the tween.

Returns
String
Constant detail
EXISTING_FROM_VALUEconstant
public static const EXISTING_FROM_VALUE:Number = -Infinity

Use this property to cause the tween to start from whatever the targetProperty is set to at the time the tween executes.