tick() | Re-render all the objects on the canvas. Essentially this method should be called at every frame, and can be used to control the animation ticks. | |
cameraPosition([{x,y,z}], [lookAt], [ms]) | Getter/setter for the camera position, in terms of x , y , z coordinates. Each of the coordinates is optional, allowing for motion in just some dimensions. The optional second argument can be used to define the direction that the camera should aim at, in terms of an {x,y,z} point in the 3D space at the distance of 1000 away from the camera. The 3rd optional argument defines the duration of the transition (in ms) to animate the camera motion. A value of 0 (default) moves the camera immediately to the final position. | By default the camera will face the center of the graph at a z distance of 1000 . |
zoomToFit([ms], [px], [objFilterFn]) | Automatically moves the camera so that all of the objects in the scene become visible within its field of view, while aiming at the scene center (0,0,0). If no objects are found no action is taken. It accepts three optional arguments: the first defines the duration of the transition (in ms) to animate the camera motion (default: 0ms). The second argument is the amount of padding (in px) between the edge of the canvas and the outermost object position (default: 10px). The third argument specifies a custom object filter: obj => <boolean> , which should return a truthy value if the object is to be included. This can be useful for focusing on a portion of the scene. | (0, 10, obj => true) |
fitToBbox(bbox, [ms], [px], [objFilterFn]) | Automatically moves the camera to fit the specified bounding box within its field of view, while aiming at the scene center (0,0,0). The bounding box should follow the syntax { x: [<num>, <num>], y: [<num>, <num>], z: [<num>, <num>] } . If no bounding box is specified no action is taken. It accepts two optional arguments: the first defines the duration of the transition (in ms) to animate the camera motion (default: 0ms). The second argument is the amount of padding (in px) between the edge of the canvas and the outermost object position (default: 10px). | (0, 10) |
postProcessingComposer() | Access the post-processing composer. Use this to add post-processing rendering effects to the scene. By default the composer has a single pass (RenderPass) that directly renders the scene without any effects. | |
renderer() | Access the WebGL renderer object. | |
camera() | Access the perspective camera object. | |
scene() | Access the Scene object. | |
controls() | Access the camera controls object. | |