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.
Summary
Syntax
var animationManager = AnimationManager.create(errorCallback);
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);
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);
Summary
Returns the animation stored on the manager with the given name.
Syntax
var animation = animationManager.get(name);
Returns undefined if the named animation is not yet loaded.
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.
Summary
Deletes the animation stored with the given name.
Syntax
animationManager.remove(name);
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);
Both arguments for setPathRemapping are properties on the MappingTable object.