Table Of Contents

Previous topic

21.2. The Animation Objects

Next topic

21.4. The AssetTracker Object

This Page

21.3. The AnimationManager Object

Provides loading and managing of keyframe animations.

This object keeps a map of loaded animations stored by name, allowing reuse and avoiding duplication.

Required scripts

The AnimationManager object requires:

/*{{ javascript("jslib/animationmanager.js") }}*/

It also requires that a MathDevice has been created before calling the AnimationManager constructor.

21.3.1. Constructor

21.3.1.1. create

Summary

Syntax

var animationManager = AnimationManager.create(errorCallback);
errorCallback (Optional)
The callback function to be called when any error occurs during manager operations.

21.3.2. Method

21.3.2.1. loadData

Summary

Requests loading of animation data from an already requested JSON object. Any animations stored in the animations property of the data object passed in will be stored in the animation manager by their dictionary name.

Syntax

animationManager.loadData(jsonData);
jsonData
An object which has already been loaded via asynchronous requests.

21.3.2.2. loadFile

Summary

Requests loading of animation data from an asset with a given path. Any animations stored in the animations property of the asset loaded will be stored in the animation manager by their dictionary name. The assets will be loaded asynchronously and may not be immediately available via the get method.

Syntax

animationManager.loadFile(assetPath);
assetPath
The path to the asset containing the animations to be loaded.

21.3.2.3. get

Summary

Returns the animation stored on the manager with the given name.

Syntax

var animation = animationManager.get(name);
name
The name of the animations to get.

Returns undefined if the named animation is not yet loaded.

21.3.2.4. getAll

Summary

Returns a dictionary of all the animations stored in the manager.

Syntax

var animations = animationManager.getAll();

Returns the dictionary of animations, an empty dictionary will be returned if no animations are loaded.

21.3.2.5. remove

Summary

Deletes the animation stored with the given name.

Syntax

animationManager.remove(name);
name
The name of the animation to remove.

21.3.2.6. setPathRemapping

Summary

Enables remapping of loading paths.

The remapping only affects the loading URLs. The animation will be stored under the names stored inside the requested data object.

Syntax

animationManager.setPathRemapping(mappingDictionary, prefix);

// example usage:
var mappingTableReceived = function mappingTableReceivedFn(mappingTable)
{
    animationManager.setPathRemapping(mappingTable.urlMapping, mappingTable.assetPrefix);
};
mappingTable = TurbulenzServices.createMappingTable(gameSession,
                                                    mappingTableReceived);
mappingDictionary
A JavaScript object. A mapping table dictionary that can be used to map the game’s logical asset paths to physical paths.
prefix
A string that will be appended to all paths, useful for global redirections.

Both arguments for setPathRemapping are properties on the MappingTable object.

21.3.3. Properties

21.3.3.1. version

Summary

The version number of the AnimationManager implementation.

Syntax

var versionNumber = animationManager.version;