Skip to content

Sphere

The Sphere is a 3D primitive generated from configurable ring and segment counts. Higher values produce smoother surfaces at the cost of more faces. 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 {
    createSphere,
} from '@ripl/3d';

const sphere = createSphere({
    radius: 1,
    segments: 16,
    rings: 12,
    fill: '#44cc88',
});

Properties

  • radius — Radius of the sphere
  • segments — Number of horizontal segments (default 16)
  • rings — Number of vertical rings (default 12)
  • x / y / z — Position in world space (default 0)
  • rotationX / rotationY / rotationZ — Rotation around each axis in radians (default 0)