Skip to content

Cylinder

The Cylinder is a 3D primitive with configurable top and bottom radii — set different values to create a truncated cone. Segment count controls the smoothness of the circular cross-section. Like all 3D shapes, it supports positioning, rotation, and automatic flat shading.

NOTE

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

Demo

Usage

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

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

Properties

  • radiusTop — Radius of the top cap
  • radiusBottom — Radius of the bottom cap
  • height — Height of the cylinder
  • segments — Number of radial segments (default 16)
  • x / y / z — Position in world space (default 0)
  • rotationX / rotationY / rotationZ — Rotation around each axis in radians (default 0)