Constructor

@:value({ rotations : null, lookAtTarget : null, alignToPath : true, offset : null, target : null, path : null })new(?path:IPath, ?target:Object3D, ?offset:Vector3D, alignToPath:Bool = true, ?lookAtTarget:Object3D, ?rotations:Vector<Vector3D>)

Creates a new PathAnimator

Parameters:

[optional]

path The QuadraticPath to animate onto.

[optional]

target An Object3D, the object to animate along the path. It can be Mesh, Camera, ObjectContainer3D...

[optional]

offset A Vector3D to define the target offset to its location on the path.

[optional]

alignToPath Defines if the object animated along the path is orientated to the path. Default is true.

[optional]

lookAtTarget An Object3D that the target will constantly look at during animation.

[optional]

rotations A Vector.<Vector3D> to define rotations per pathsegments. If PathExtrude is used to simulate the "road", use the very same rotations vector.

Variables

index:Int

read onlyorientation:Vector3D

read onlyposition:Vector3D

progress:Float

write onlyrotations:Vector<Vector3D>

upAxis:Vector3D

Methods

addOnChangeSegment(listener:Dynamic ‑> Void):Void

Default method for adding a segmentchange event listener. Event fired when the time pointer enters another PathSegment.

Parameters:

listener

The listener function

addOnCycle(listener:Dynamic ‑> Void):Void

Default method for adding a cycle event listener. Event fired when the time reaches 1.

Parameters:

listener

The listener function

@:value({ to : 0, from : 0 })addOnRange(listener:Dynamic ‑> Void, from:Float = 0, to:Float = 0):Void

Default method for adding a range event listener. Event fired when the time is >= from and <= to variables.

Parameters:

listener

The listener function

getPositionOnPath(t:Float, 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. A Number from 0 to 1

out

Vector3D. The Vector3D to update according to the "t" time parameter.

getPositionOnPathMS(ms:Float, duration:Float, out:Vector3D):Vector3D

Returns a position on the path according to duration/elapsed time. Duration variable must be set.

@ returns Vector3D The position at a given elapsed time, compared to total duration.

Parameters:

ms

Number. A number representing milliseconds.

duration

Number. The total duration in milliseconds.

out

[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...

@:value({ t : null })getTimeSegment(?t:Float):Float

returns the segment index that is used at a given time;

Parameters:

t

[Number]. A Number between 0 and 1. If no params, actual pathanimator time segment index is returned.

removeOnChangeSegment(listener:Dynamic ‑> Void):Void

Default method for removing a range event listener

Parameters:

listener

The listener function

removeOnCycle(listener:Dynamic ‑> Void):Void

Default method for removing a cycle event listener

Parameters:

listener

The listener function

removeOnRange(listener:Dynamic ‑> Void):Void

Default method for removing a range event listener

Parameters:

listener

The listener function

@:value({ z : 0, y : 0, x : 0 })setOffset(x:Float = 0, y:Float = 0, z:Float = 0):Void

sets an optional offset to the position on the path, ideal for cameras or reusing the same Path object for parallel animations

updateProgress(t:Float):Void

Calculates the new position and set the object on the path accordingly

Parameters:

t

A Number from 0 to 1 (less than one to allow alignToPath)