Skip to content

Quickstart

Terminal window
npm install @glyphcss/react
import { GlyphCamera, GlyphScene, GlyphOrbitControls, GlyphMesh, GlyphHotspot } from "@glyphcss/react";
export function App() {
return (
<GlyphCamera rotX={25} zoom={50}>
<GlyphScene>
<GlyphOrbitControls drag wheel />
<GlyphMesh geometry="cuboctahedron">
<GlyphHotspot at={[1, 0, 0]} onClick={() => alert("vertex")} />
</GlyphMesh>
</GlyphScene>
</GlyphCamera>
);
}
  • A single <pre> rendered as ASCII glyphs, animating a full rotation in ~6 seconds.
  • One absolutely-positioned <div role="button"> for each <GlyphHotspot>, tracking the rotating mesh exactly (per-frame keyframes synced via steps(N)).
  • Drag-to-rotate and scroll-to-zoom out of the box via <GlyphOrbitControls>.
import { GlyphCamera, GlyphScene, GlyphOrbitControls, GlyphMesh } from "@glyphcss/react";
import { icosahedronPolygons } from "@glyphcss/core";
const icosa = icosahedronPolygons({ center: [0, 0, 0], size: 1, color: "#44ffcc" });
export function IcosahedronDemo() {
return (
<GlyphCamera rotX={25} zoom={50}>
<GlyphScene mode="solid">
<GlyphOrbitControls />
<GlyphMesh polygons={icosa} />
</GlyphScene>
</GlyphCamera>
);
}

Next: Core Concepts to understand what’s happening under the hood.