Skip to content

Plane

The Plane is a flat rectangle in 3D, sized by width and height. Lay it down with rotationX for a ground surface or leave it upright for a wall or backdrop; either way its single face is flat shaded.

NOTE

For the full API, see the 3D API Reference.

Demo

Usage

ts
import {
    createPlane,
} from '@ripl/3d';

const plane = createPlane({
    width: 4,
    height: 3,
    fill: '#88cc44',
});

Properties

  • width: width of the plane
  • height: height of the plane
  • x / y / z: position in world space (default 0)
  • rotationX / rotationY / rotationZ: rotation around each axis in radians (default 0)
  • scaleX / scaleY / scaleZ: scale along each axis (default 1), or scale for all three
  • material: how the surface responds to light — see Materials

Type Guard

ts
import {
    elementIsPlane,
} from '@ripl/3d';

if (elementIsPlane(element)) {
    console.log(element.width);
}