Options for graphics objects are specified as JavaScript dictionaries. Unless stated otherwise, common default options are
color | rgb(0,127,255) - rich azure blue |
opacity | 1 |
Colors are specified using standard HTML color code strings. Predefined colormaps are also available.
Objects composed of lines have an additional option of thickness
that defaults to 1.5 in two dimensions. Due to limitations of WebGL, in three dimensions it renders as 1 on most platforms regardless of the setting: a numeric option of radius
should be used instead.
The axis
for three-dimensional objects is rotated from the z-axis. This can produce unexpected behavior for objects that do not have rotational symmetry. The utility function rotateObject
is available for further adjustment.
Additional object-specific options are listed below each.
arrow( begin, end, options ) — two- or three-dimensional arrow from beginning to end
size | 1 |
box( width, depth, height, options ) — box of specified dimensions
axis | arbitrary vector direction, default [0,0,1] |
center | vector position, default [0,0,0] |
cone( radius, height, options ) — cone of specified dimensions
axis | arbitrary vector direction, default [0,0,1] |
center | vector position, default [0,0,0] |
steps | integer determining surface smoothness, default 20 |
cylinder( radius, height, options ) — cylinder of specified dimensions
axis | arbitrary vector direction, default [0,0,1] |
center | vector position, default [0,0,0] |
openEnded | Boolean to draw cylinder ends, default true
|
steps | integer determining surface smoothness, default 20 |
ellipsoid( a, b, c, options ) — ellipsoid of specified parameters
axis | arbitrary vector direction, default [0,0,1] |
center | vector position, default [0,0,0] |
steps | integer determining surface smoothness, default 20 |
line( points, options ) — two- or three-dimensional line joining an array of points
endcaps | Boolean to include spheres to smooth joints, default false
|
radius | float for drawing the line as an extended cylinder |
plane( width, depth, options ) — plane of specified dimensions
normal | arbitrary vector direction, default [0,0,1] |
center | vector position, default [0,0,0] |
point( point, options ) — two- or three-dimensional point
size | 1 |
sphere( radius, options ) — sphere of specified radius
center | vector position, default [0,0,0] |
steps | integer determining surface smoothness, default 20 |
text( string, point, options ) — string of text at the two- or three-dimensional point
color | black |
fontSize | 14 |