Draws a box (rectangular prism).
A box is a 3D shape with six faces. Each face makes a 90˚ with four neighboring faces.
The first parameter, width, is optional. If a Number is passed, as in box(20), it sets the box’s width and height. By default, width is 50.
The second parameter, height, is also optional. If a Number is passed, as in box(20, 30), it sets the box’s height. By default, height is set to the box’s width.
The third parameter, depth, is also optional. If a Number is passed, as in box(20, 30, 40), it sets the box’s depth. By default, depth is set to the box’s height.
The fourth parameter, detailX, is also optional. If a Number is passed, as in box(20, 30, 40, 5), it sets the number of triangle subdivisions to use along the x-axis. All 3D shapes are made by connecting triangles to form their surfaces. By default, detailX is 1.
The fifth parameter, detailY, is also optional. If a number is passed, as in box(20, 30, 40, 5, 7), it sets the number of triangle subdivisions to use along the y-axis. All 3D shapes are made by connecting triangles to form their surfaces. By default, detailY is 1.
Note: box() can only be used in WebGL mode.
Examples
Syntax
box([width], [height], [depth], [detailX], [detailY])
Parameters
width of the box.
height of the box.
depth of the box.
number of triangle subdivisions along the x-axis.
number of triangle subdivisions along the y-axis.