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 either form of this command after evaluate() in the cell template:
injectFunctions( id, [ function1, function2, … ] )
injectFunctions( id, { name1: function1, name2: function2, … } )
Only functions explicitly called need to be included: JavaScript automatically handles internal dependencies. The second form must be used when injecting arrays of functions, since JavaScript does not have names for objects and these need to be stated explicitly. 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.