Skip to content

Ribbon3DRenderer

Renders time-series or profile data as continuous 3D lit ribbons.

Constructor

typescript
const renderer = new Ribbon3DRenderer(options: Ribbon3DRendererOptions);

Options

PropertyTypeDefaultDescription
canvasHTMLCanvasElementRequiredThe target canvas element.
opacitynumber0.9Global transparency.
showAxesbooleantrueShow coordinate system.

Methods

setData(series: RibbonSeriesData[]): void

Submits multiple series to be rendered as ribbons.

fitToData(): void

Fits the camera to encompass all ribbons.

Interfaces

RibbonSeriesData

typescript
interface RibbonSeriesData {
  xValues: Float32Array;   // Path X coordinates
  yValues: Float32Array;   // Path Y coordinates
  z: number;               // Fixed depth for this slice
  width?: number;          // Ribbon width (thickness)
  color?: [number, number, number]; // RGB fill
}

Geometry

Each ribbon is dynamically generated as a triangular strip. Surface normals are computed for each segment to ensure smooth directional lighting and a premium 3D look.

Released under the MIT License.