Reference plane()

plane()

Draws a plane.

A plane is a four-sided, flat shape with every angle measuring 90˚. It’s similar to a rectangle and offers advanced drawing features in WebGL mode.

The first parameter, width, is optional. If a Number is passed, as in plane(20), it sets the plane’s width and height. By default, width is 50.

The second parameter, height, is also optional. If a Number is passed, as in plane(20, 30), it sets the plane’s height. By default, height is set to the plane’s width.

The third parameter, detailX, is also optional. If a Number is passed, as in plane(20, 30, 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 fourth parameter, detailY, is also optional. If a Number is passed, as in plane(20, 30, 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: plane() can only be used in WebGL mode.

Examples

Syntax

plane([width], [height], [detailX], [detailY])

Parameters

width
Number:

width of the plane.

height
Number:

height of the plane.

detailX
Integer:

number of triangle subdivisions along the x-axis.

detailY
Integer:

number of triangle subdivisions along the y-axis.

Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/3d_primitives.js and open a pull request!

Related References