While options are available for animating two-dimensional SVG graphics, it is currently simpler just to render the graphic repeatedly with updated parameters. This aspect of the library is left for possible future revision.
The situation with three-dimensional graphics is quite the opposite, since there is already significant overhead in initially loading scenes with current rendering options. The following animation options and suboptions are available for individual objects with the Three.js renderer:
rotation |
axis | three-dimensional array of normal vector |
angle | number setting rotation rate |
translation |
path | vector function or its string representation |
step | number setting translation rate |
Suboptions are input as JavaScript dictionaries under the given option.
The vector determining the translation path can be entered either as a function of arbitrary argument or a string containing the function definition. The latter is useful for including dynamic constants via template strings.
Functions that are not part of standard JavaScript can be included with this command after evaluate() in the cell template:
injectFunctions( id, { name1: function1, name2: function2, … } )
The name keys are the function names used in the context window of the visualization and their values are references to the function implementations. Only functions explicitly called need to be included: JavaScript automatically handles internal dependencies. For multiple outputs a third argument can specify the number of the target output.
Animations are initiated by setting animate equal to true in the output configuration. Animations by default pause for five seconds when the user interacts with the scene, but this can be overridden by setting animateOnInteraction to true.
Objects and surfaces can be assigned a group name in their options dictionaries for common animation operations.