Package | away3d.animators |
Class | public class PathAnimator |
Inheritance | PathAnimator flash.events.EventDispatcher |
Property | Defined By | ||
---|---|---|---|
alignToPath : Boolean
defines if the object animated along the path must be aligned to the path. | PathAnimator | ||
index : uint
Set the pointer to a given segment along the path
| PathAnimator | ||
lookAtObject : Object3D
sets the object that the animated object will be looking at along the path
| PathAnimator | ||
orientation : Vector3D [read-only]
returns the actual interpolated rotation along the path. | PathAnimator | ||
path : IPath
defines the path to follow
| PathAnimator | ||
position : Vector3D [read-only]
returns the current interpolated position on the path with no optional offset applied
| PathAnimator | ||
progress : Number
Represents the progress of the animation playhead from the start (0) to the end (1) of the animation. | PathAnimator | ||
rotations : Vector.<Vector3D> [write-only]
sets an optional Vector.<Vector3D> of rotations. | PathAnimator | ||
target : Object3D
sets the object to be animated along the path. | PathAnimator | ||
upAxis : Vector3D | PathAnimator |
Method | Defined By | ||
---|---|---|---|
PathAnimator(path:IPath = null, target:Object3D = null, offset:Vector3D = null, alignToPath:Boolean = true, lookAtTarget:Object3D = null, rotations:Vector.<Vector3D> = null)
Creates a new PathAnimator
| PathAnimator | ||
addOnChangeSegment(listener:Function):void
Default method for adding a segmentchange event listener. | PathAnimator | ||
addOnCycle(listener:Function):void
Default method for adding a cycle event listener. | PathAnimator | ||
addOnRange(listener:Function, from:Number = 0, to:Number = 0):void
Default method for adding a range event listener. | PathAnimator | ||
getPositionOnPath(t:Number, out:Vector3D):Vector3D
Updates a position Vector3D on the path at a given time. | PathAnimator | ||
getPositionOnPathMS(ms:Number, duration:Number, out:Vector3D):Vector3D
Returns a position on the path according to duration/elapsed time. | PathAnimator | ||
getTimeSegment(t:Number):Number
returns the segment index that is used at a given time;
| PathAnimator | ||
removeOnChangeSegment(listener:Function):void
Default method for removing a range event listener
| PathAnimator | ||
removeOnCycle(listener:Function):void
Default method for removing a cycle event listener
| PathAnimator | ||
removeOnRange(listener:Function):void
Default method for removing a range event listener
| PathAnimator | ||
setOffset(x:Number = 0, y:Number = 0, z:Number = 0):void
sets an optional offset to the position on the path, ideal for cameras or reusing the same Path object for parallel animations
| PathAnimator | ||
updateProgress(t:Number):void
Calculates the new position and set the object on the path accordingly
| PathAnimator |
alignToPath | property |
alignToPath:Boolean
defines if the object animated along the path must be aligned to the path.
public function get alignToPath():Boolean
public function set alignToPath(value:Boolean):void
index | property |
index:uint
Set the pointer to a given segment along the path
public function get index():uint
public function set index(value:uint):void
lookAtObject | property |
lookAtObject:Object3D
sets the object that the animated object will be looking at along the path
public function get lookAtObject():Object3D
public function set lookAtObject(value:Object3D):void
orientation | property |
orientation:Vector3D
[read-only] returns the actual interpolated rotation along the path.
public function get orientation():Vector3D
path | property |
path:IPath
defines the path to follow
public function get path():IPath
public function set path(value:IPath):void
See also
position | property |
position:Vector3D
[read-only] returns the current interpolated position on the path with no optional offset applied
public function get position():Vector3D
progress | property |
progress:Number
Represents the progress of the animation playhead from the start (0) to the end (1) of the animation.
public function get progress():Number
public function set progress(value:Number):void
rotations | property |
rotations:Vector.<Vector3D>
[write-only] sets an optional Vector.<Vector3D> of rotations. if the object3d is animated along a PathExtrude object, use the very same vector to follow the "curves".
public function set rotations(value:Vector.<Vector3D>):void
target | property |
target:Object3D
sets the object to be animated along the path.
public function get target():Object3D
public function set target(value:Object3D):void
upAxis | property |
upAxis:Vector3D
public function get upAxis():Vector3D
public function set upAxis(value:Vector3D):void
PathAnimator | () | Constructor |
public function PathAnimator(path:IPath = null, target:Object3D = null, offset:Vector3D = null, alignToPath:Boolean = true, lookAtTarget:Object3D = null, rotations:Vector.<Vector3D> = null)
Creates a new PathAnimator
path:IPath (default = null ) — path The QuadraticPath to animate onto.
| |
target:Object3D (default = null ) — target An Object3D, the object to animate along the path. It can be Mesh, Camera, ObjectContainer3D...
| |
offset:Vector3D (default = null ) — offset A Vector3D to define the target offset to its location on the path.
| |
alignToPath:Boolean (default = true ) — alignToPath Defines if the object animated along the path is orientated to the path. Default is true.
| |
lookAtTarget:Object3D (default = null ) — lookAtTarget An Object3D that the target will constantly look at during animation.
| |
rotations:Vector.<Vector3D> (default = null ) — rotations A Vector.<Vector3D> to define rotations per pathsegments. If PathExtrude is used to simulate the "road", use the very same rotations vector.
|
addOnChangeSegment | () | method |
public function addOnChangeSegment(listener:Function):void
Default method for adding a segmentchange event listener. Event fired when the time pointer enters another PathSegment.
Parameters
listener:Function — The listener function
|
addOnCycle | () | method |
public function addOnCycle(listener:Function):void
Default method for adding a cycle event listener. Event fired when the time reaches 1.
Parameters
listener:Function — The listener function
|
addOnRange | () | method |
public function addOnRange(listener:Function, from:Number = 0, to:Number = 0):void
Default method for adding a range event listener. Event fired when the time is >= from and <= to variables.
Parameters
listener:Function — The listener function
| |
from:Number (default = 0 )
| |
to:Number (default = 0 )
|
getPositionOnPath | () | method |
public function getPositionOnPath(t:Number, out:Vector3D):Vector3D
Updates a position Vector3D on the path at a given time. Do not use this handler to animate, it's in there to add dummy's or place camera before or after the animated object. Use the update() or the automatic tweened animateOnPath() handlers instead.
Parameters
t:Number — Number. A Number from 0 to 1
| |
out:Vector3D — Vector3D. The Vector3D to update according to the "t" time parameter.
|
Vector3D |
getPositionOnPathMS | () | method |
public function getPositionOnPathMS(ms:Number, duration:Number, out:Vector3D):Vector3D
Returns a position on the path according to duration/elapsed time. Duration variable must be set.
Parameters
ms:Number — Number. A number representing milliseconds.
| |
duration:Number — Number. The total duration in milliseconds.
| |
out:Vector3D — [optional] Vector3D. A Vector3D that will be used to return the position. If none provided, method returns a new Vector3D with this data.
An example of use of this handler would be cases where a given "lap" must be done in a given amount of time and you would want to retrieve the "ideal" time
based on elapsed time since start of the race. By comparing actual progress to ideal time, you could extract their classement, calculate distance/time between competitors,
abort the race if goal is impossible to be reached in time etc...
returns Vector3D The position at a given elapsed time, compared to total duration.
|
Vector3D |
getTimeSegment | () | method |
public function getTimeSegment(t:Number):Number
returns the segment index that is used at a given time;
Parameters
t:Number (default = NaN ) — [Number]. A Number between 0 and 1. If no params, actual pathanimator time segment index is returned.
|
Number |
removeOnChangeSegment | () | method |
public function removeOnChangeSegment(listener:Function):void
Default method for removing a range event listener
Parameters
listener:Function — The listener function
|
removeOnCycle | () | method |
public function removeOnCycle(listener:Function):void
Default method for removing a cycle event listener
Parameters
listener:Function — The listener function
|
removeOnRange | () | method |
public function removeOnRange(listener:Function):void
Default method for removing a range event listener
Parameters
listener:Function — The listener function
|
setOffset | () | method |
public function setOffset(x:Number = 0, y:Number = 0, z:Number = 0):void
sets an optional offset to the position on the path, ideal for cameras or reusing the same Path
object for parallel animations
Parameters
x:Number (default = 0 )
| |
y:Number (default = 0 )
| |
z:Number (default = 0 )
|
updateProgress | () | method |
public function updateProgress(t:Number):void
Calculates the new position and set the object on the path accordingly
Parameters
t:Number — A Number from 0 to 1 (less than one to allow alignToPath)
|