Home Pictures of 3D objects

The following statement will display a helix that is parallel to the x axis (the default axis direction), with length 5 and diameter 1:

var spring = helix( pos=vec(0,2,1),
                    size=vec(5,1,1) )

The attribute thickness is the diameter of the cross section of the curve used to draw the helix; default is diameter/10.

There is also a coils attribute, which is the number of coils; the default is 5.

Here is the rest of the attributes for a helix. All 3D objects have all of these attributes, other than arrow (which has axis_and_length instead of axis):

pos Position: the center of one end of the helix; default = vec(0,0,0).

size The length, width, and height of the helix; default = vec(1,1,1). Changing the size does not change the thickness.

axis The axis points in the direction of the length of the helix, default = vec(1,0,0). Only the direction of the axis is meaningful, not its magnitude. The length of the helix is size.x, not the magnitude of the axis.

color Color of object, as a red-green-blue (RGB) triple: vec(1,0,0) is the same as color.red, default = vec(1,1,1), which is color.white.

up Which side of the helix is "up"; default = vec(0,1,0).

visible If False, object is not displayed; e.g. spring.visible = False
Use spring.visible = True to make the object visible again.

End vs center: The pos attribute for arrow, cone, cylinder, helix, and pyramid corresponds to one end of the object, whereas for a box, ring, or sphere it corresponds to the center of the object.

No texture or opacity: Currently helixes, like curves, cannot be transparent, it is not possible to apply a texture, and it cannot be part of a compound object.

To display a trail or an arrow along the path of a moving object, see Attach a trail or arrow.

See Rotating an Object for an easy way to change the orientation of an object.

When you run a program, for convenience GlowScript creates a canvas on the web page and names it scene. Objects that you create are drawn on this canvas. If you have more than one canvas, you can specify in which canvas to place a new object, as in box(canvas=myscene); in JavaScript this would be box( {canvas:myscene} ). If you don't specify a canvas, the new object goes into the most recently created canvas, or the most recently selected canvas as specified by setting canvas.selected.


See the cylinder documentation for how to create an object in JavaScript.

Top of page