Skip to content

Sphere

A 3D sphere generated from configurable ring and segment counts.

Usage

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

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

Properties

PropertyTypeDefaultDescription
radiusnumberRadius of the sphere
segmentsnumber16Number of horizontal segments
ringsnumber12Number of vertical rings
xnumber0X position
ynumber0Y position
znumber0Z position
rotationXnumber0Rotation around X axis (radians)
rotationYnumber0Rotation around Y axis (radians)
rotationZnumber0Rotation around Z axis (radians)

Demo