Last updated

API / geotoolkit3d / scene / animation / AnimationManager / AnimationManager

Class: AnimationManager

animation.AnimationManager.AnimationManager

This class manage animations in the scene.

It provides an easy way to insert animations and can handle several animations at a time.
Note that this AnimationMechanism is focused on providing smooth animation while keeping the resources usage as low as possible.
Therefore the animation intermediate steps count is not guaranteed.

Once added, an animation will be started and will be executed for each frame until it returns 'true'.
Then it will be discarded.

This manager will optimize the animations to run around 60 fps (if possible), it may pause animation when the plot is not visible.

To use this AnimationManager, insert it into the scene like a regular node.
Then push an animation function in it.

Note that this class is not responsible for actually interpolating values between steps.
Client code should implement the logic to compute intermediate steps.

Hierarchy

Table of contents

Constructors
Methods

Contents

Constructors

new AnimationManager(options)

new AnimationManager(options?)

Parameters

Name Type
Optional optionsOptions

Overrides

Object3D.constructor

Methods

add

add(object): AnimationManager

Adds object as child of this object.

Parameters

Name Type Description
objectObject3D<Object3DEventMap> | Object3D<Object3DEventMap>[]object

Returns

AnimationManager

this

Inherited from

Object3D.add


addAnimation

addAnimation(animation): AnimationManager

Add an animation function that will be called to update the animation state.

It will be called before the rendering occurs.
The provided function is responsible for animating one or several objects.

If the animation has ended, the function should return True to notify the AnimationManager to remove/discard this animation.
Otherwise it will be called indefinitely.

Parameters

Name Type Description
animationAbstractAnimationgeotoolkit3d.scene.animation.AbstractAnimation.

Returns

AnimationManager

this


afterRender

afterRender(scene, camera, plot, renderer): AnimationManager

This function is called after rendering and can update this object's content.

It should not trigger any invalidateObject though.
Note that it is not necessary nor recommended to explicitly call afterRender on this object's children as beforeRender will be called on all nodes present in the scene.

This will be executed after the transformations simplification.

See

Plot for more details on the render steps

Parameters

Name Type Description
sceneSceneThe scene
cameraCameraThe camera used for this render phase.
plotPlotThe 3D plot
rendererWebGLRendererThe renderer

Returns

AnimationManager

Inherited from

Object3D.afterRender


beforeRender

beforeRender(scene, camera, plot, renderer): AnimationManager

This function is called prior to rendering and can update this object's content.

It should not trigger any invalidateObject though.
Note that it is not necessary nor recommended to explicitly call beforeRender on this object's children as beforeRender will be called on all nodes present in the scene.

This will be executed after the transformations simplification.

See

Plot for more details on the render steps

Parameters

Name Type Description
sceneSceneThe scene
cameraCameraThe camera used for this render phase.
plotPlotThe 3D plot
rendererWebGLRendererThe renderer

Returns

AnimationManager

Inherited from

Object3D.beforeRender


checkAnimation

checkAnimation(animation): boolean

Check for an animation in the manager

Parameters

Name Type Description
animationAbstractAnimationgeotoolkit3d.scene.animation.AbstractAnimation.

Returns

boolean

animation if an animation is already in the manager


dispose

dispose(): void

Dispose object

Returns

void

Inherited from

Object3D.dispose


getClassName

getClassName(): string

Returns

string

Inherited from

Object3D.getClassName


getOptions

getOptions(): Required<Options>

Get options

Returns

Required<Options>

options object

Inherited from

Object3D.getOptions


getVisible

getVisible(): boolean

Get visible

Returns

boolean

true, if object is visible

Inherited from

Object3D.getVisible


invalidateObject

invalidateObject<T>(event?): AnimationManager

Notifies this object and its parent that this object has been invalidated.
If this object is in a Plot, it will be marked as dirty and will trigger a rendering cycle.

Type parameters

Name
T

Parameters

Name Type Description
Optional eventEvent<T>The event to fire

Returns

AnimationManager

Inherited from

Object3D.invalidateObject


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

Object3D.isDisposed


isSelectable

isSelectable(): boolean

Return if this object can be picked/selected (see RendererPicking).

Returns

boolean

Inherited from

Object3D.isSelectable


notify

notify(type, source, args?): AnimationManager

Notify listeners

Parameters

Name Type Description
typestringevent types
sourceanyof the event
Optional argsanyarguments of the event

Returns

AnimationManager

this

Inherited from

Object3D.notify


off

off(type?, callback?): AnimationManager

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Parameters

Name Type Description
Optional typestringtype of the event
Optional callbackEventListenerfunction to be called

Returns

AnimationManager

this

Inherited from

Object3D.off

off<E>(type, callback): AnimationManager

Type parameters

NameType
Eextends string

Parameters

Name Type
typeE
callback(eventType: E, sender: AnimationManager, args: EventMap[E]) => void

Returns

AnimationManager

Inherited from

Object3D.off


on

on(type, callback, options?): AnimationManager

Attach listener on event that will be called whenever the specified event is delivered to the target

If the callback function is already in the list of event listeners for this target, the function is not added a second time.

If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.

Parameters

Name Type Description
typestringtype of event or property
callbackEventListenerto be called
Optional optionsOptionsoptions of subscription

Returns

AnimationManager

this

Inherited from

Object3D.on

on<E>(type, callback, options?): AnimationManager

Type parameters

NameType
Eextends string

Parameters

Name Type
typeE
callback(eventType: E, sender: AnimationManager, args: EventMap[E]) => void
Optional optionsOptions

Returns

AnimationManager

Inherited from

Object3D.on


onStatsUpdated

onStatsUpdated(metrics): AnimationManager

This function is called when the plot has updated performance metric.
It will be called every set number of frames.
The number of frame is customizable in the plot options advancedrendering.performancemetrics.updateframeperiod and is 100 by default.

Parameters

Name Type Description
metricsPerformanceMetricsThe performance metrics.

Returns

AnimationManager

Inherited from

Object3D.onStatsUpdated


onVisibilityChanged

Protected onVisibilityChanged(): void

This method is called if visibility is changed. Send event Events.VisibilityChanged

Returns

void

Inherited from

Object3D.onVisibilityChanged


remove

remove(object): AnimationManager

Removes object as child of this object.

Parameters

Name Type Description
objectObject3D<Object3DEventMap> | Object3D<Object3DEventMap>[]object

Returns

AnimationManager

this

Inherited from

Object3D.remove


removeAnimation

removeAnimation(animation): void

remove an animation from the manager

Parameters

Name Type Description
animationAbstractAnimationgeotoolkit3d.scene.animation.AbstractAnimation

Returns

void


setOptions

setOptions(options?): AnimationManager

Set options

Parameters

Name Type Description
Optional optionsOptionsoptions object

Returns

AnimationManager

this

Inherited from

Object3D.setOptions


setPosition

setPosition(position): AnimationManager

Set Object's local position.

Parameters

Name Type Description
positionObjectlocal position
Optional position.xnumber
Optional position.ynumber
Optional position.znumber

Returns

AnimationManager

this

Inherited from

Object3D.setPosition


setRotation

setRotation(x, y, z, order?): AnimationManager

Set Object's local rotation (Euler angles), in radians.

Parameters

Name Type Description
xnumberx angle
ynumbery angle
znumberz angle
Optional orderEulerOrdereuler order

Returns

AnimationManager

this

Inherited from

Object3D.setRotation


setSelectable

setSelectable(selectable): void

Set if this object can be picked/selected (see RendererPicking).

Parameters

Name Type Description
selectablebooleanif can be selected

Returns

void

Inherited from

Object3D.setSelectable


setVisible

setVisible(visible, silent?): AnimationManager

Set visible

Parameters

Name Type Description
visiblebooleantrue, if object is visible
Optional silentbooleantrue, if object shouldn't be invalidated

Returns

AnimationManager

this

Inherited from

Object3D.setVisible


updateObject

updateObject(scene, camera): AnimationManager

This function is called prior to rendering and can update this object's content.

It should not trigger any invalidateObject though.
Note that it is not necessary nor recommended to explicitly call updateObject on this object's children as updateObject will be called on all nodes present in the scene.

This will be executed before the transformations simplification.

See

Plot for more details on the render steps

Parameters

Name Type Description
sceneSceneThe scene
cameraCameraThe camera

Returns

AnimationManager

Inherited from

Object3D.updateObject


useOwnHighlight

useOwnHighlight(): boolean

Returns true if this object make its own highlight effect (like geotoolkit3d.scene.reservoir.hexahedral.ReservoirGrid) This is to prevent unnecessary executions of the costly highlight passes.

Returns

boolean

Inherited from

Object3D.useOwnHighlight


getClassName

Static getClassName(): string

Returns

string

Inherited from

Object3D.getClassName


register

Static register(): void

Register object for special processing through a callback function

Example

geotoolkit3d.util.ObjectProcessor.getDefaultInstance().registerObject(this.getClassName(), callback);

Deprecated

since 5.0, to allow custom object highlighting, please instead make your Object implement the interface geotoolkit3d/scene/ICustomHighlight.

Returns

void

Inherited from

Object3D.register