NGL@1.0.0-beta.7 Home Manual Reference Source Gallery
import AnimationControls from 'ngl/src/controls/animation-controls.js'
public class | source

AnimationControls

Animation controls

Constructor Summary

Public Constructor
public

constructor(stage: Stage)

Create animation controls

Member Summary

Public Members
public
public
public
public get

True when all animations are paused

public
public

Method Summary

Public Methods
public

add(animation: Animation): Animation

Add an animation

public

Clear all animations

public
public

move(moveTo: Vector3, duration: Number): MoveAnimation

Add a move animation

public

moveComponent(component: Component, moveTo: Vector3, duration: Number): MoveAnimation

Add a component move animation

public

orient(orientTo: OrientationMatrix | Array, duration: Number): Array

Add an orient animation

public

Pause all animations

public

remove(animation: Animation): undefined

Remove an animation

public

Resume all animations

public

rock(axis: Vector3, angle: Number, end: Number, duration: Number): SpinAnimation

Add a rock animation

public

rockComponent(component: Component, axis: Vector3, angle: Number, end: Number, duration: Number): SpinAnimation

Add a component rock animation

public

rotate(rotateTo: Quaternion, duration: Number): RotateAnimation

Add a rotate animation

public

run(stats: Stats): undefined

Run all animations

public

spin(axis: Vector3, angle: Number, duration: Number): SpinAnimation

Add a spin animation

public

spinComponent(component: Component, axis: Vector3, angle: Number, duration: Number): SpinAnimation

Add a component spin animation

public

timeout(callback: Function, duration: Number): TimeoutAnimation

Add a timeout animation

public

Toggle all animations

public

value(valueFrom: Number, valueTo: Number, callback: Function, duration: Number): ValueAnimation

Add a value animation

public

zoom(zoomTo: Number, duration: Number): ZoomAnimation

Add a zoom animation

public

zoomMove(moveTo: Vector3, zoomTo: Number, duration: Number): Array

Add a zoom and a move animation

Public Constructors

public constructor(stage: Stage) source

Create animation controls

Params:

NameTypeAttributeDescription
stage Stage

the stage object

Public Members

public animationList source

public controls source

public finishedList source

public get paused: Boolean source

True when all animations are paused

public stage source

public viewer source

Public Methods

public add(animation: Animation): Animation source

Add an animation

Params:

NameTypeAttributeDescription
animation Animation

the animation

Return:

Animation

the animation

public clear(): undefined source

Clear all animations

Return:

undefined

public dispose() source

public move(moveTo: Vector3, duration: Number): MoveAnimation source

Add a move animation

Params:

NameTypeAttributeDescription
moveTo Vector3

target position

duration Number

animation time in milliseconds

Return:

MoveAnimation

the animation

public moveComponent(component: Component, moveTo: Vector3, duration: Number): MoveAnimation source

Add a component move animation

Params:

NameTypeAttributeDescription
component Component

object to move

moveTo Vector3

target position

duration Number

animation time in milliseconds

Return:

MoveAnimation

the animation

public orient(orientTo: OrientationMatrix | Array, duration: Number): Array source

Add an orient animation

Params:

NameTypeAttributeDescription
orientTo OrientationMatrix | Array

target orientation

duration Number

animation time in milliseconds

Return:

Array

the animations

public pause(): undefined source

Pause all animations

Return:

undefined

public remove(animation: Animation): undefined source

Remove an animation

Params:

NameTypeAttributeDescription
animation Animation

the animation

Return:

undefined

public resume(): undefined source

Resume all animations

Return:

undefined

public rock(axis: Vector3, angle: Number, end: Number, duration: Number): SpinAnimation source

Add a rock animation

Params:

NameTypeAttributeDescription
axis Vector3

axis to rock around

angle Number

amount to spin per frame, radians

end Number

maximum extend of motion, radians

duration Number

animation time in milliseconds

Return:

SpinAnimation

the animation

public rockComponent(component: Component, axis: Vector3, angle: Number, end: Number, duration: Number): SpinAnimation source

Add a component rock animation

Params:

NameTypeAttributeDescription
component Component

object to move

axis Vector3

axis to rock around

angle Number

amount to spin per frame, radians

end Number

maximum extend of motion, radians

duration Number

animation time in milliseconds

Return:

SpinAnimation

the animation

public rotate(rotateTo: Quaternion, duration: Number): RotateAnimation source

Add a rotate animation

Params:

NameTypeAttributeDescription
rotateTo Quaternion

target rotation

duration Number

animation time in milliseconds

Return:

RotateAnimation

the animation

public run(stats: Stats): undefined source

Run all animations

Params:

NameTypeAttributeDescription
stats Stats

a viewer stats objects

Return:

undefined

public spin(axis: Vector3, angle: Number, duration: Number): SpinAnimation source

Add a spin animation

Params:

NameTypeAttributeDescription
axis Vector3

axis to spin around

angle Number

amount to spin per frame, radians

duration Number

animation time in milliseconds

Return:

SpinAnimation

the animation

public spinComponent(component: Component, axis: Vector3, angle: Number, duration: Number): SpinAnimation source

Add a component spin animation

Params:

NameTypeAttributeDescription
component Component

object to move

axis Vector3

axis to spin around

angle Number

amount to spin per frame, radians

duration Number

animation time in milliseconds

Return:

SpinAnimation

the animation

public timeout(callback: Function, duration: Number): TimeoutAnimation source

Add a timeout animation

Params:

NameTypeAttributeDescription
callback Function

called after duration

duration Number

timeout in milliseconds

Return:

TimeoutAnimation

the animation

public toggle(): undefined source

Toggle all animations

Return:

undefined

public value(valueFrom: Number, valueTo: Number, callback: Function, duration: Number): ValueAnimation source

Add a value animation

Params:

NameTypeAttributeDescription
valueFrom Number

start value

valueTo Number

target value

callback Function

called on every tick

duration Number

animation time in milliseconds

Return:

ValueAnimation

the animation

public zoom(zoomTo: Number, duration: Number): ZoomAnimation source

Add a zoom animation

Params:

NameTypeAttributeDescription
zoomTo Number

target distance

duration Number

animation time in milliseconds

Return:

ZoomAnimation

the animation

public zoomMove(moveTo: Vector3, zoomTo: Number, duration: Number): Array source

Add a zoom and a move animation

Params:

NameTypeAttributeDescription
moveTo Vector3

target position

zoomTo Number

target distance

duration Number

animation time in milliseconds

Return:

Array

the animations