Skip to content

Cylinder

A 3D cylinder with configurable top and bottom radii (set different values for a truncated cone).

Usage

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

const cylinder = createCylinder({
    radiusTop: 1,
    radiusBottom: 1,
    height: 2,
    segments: 16,
    fillStyle: '#cc8844',
});

Properties

PropertyTypeDefaultDescription
radiusTopnumberRadius of the top cap
radiusBottomnumberRadius of the bottom cap
heightnumberHeight of the cylinder
segmentsnumber16Number of radial segments
xnumber0X position
ynumber0Y position
znumber0Z position
rotationXnumber0Rotation around X axis (radians)
rotationYnumber0Rotation around Y axis (radians)
rotationZnumber0Rotation around Z axis (radians)

Demo