Declarative Three.js for Foldkit

Scenes
from
state.

Describe a 3D scene as plain data derived from your Model. Foldkit renders it, keyed updates keep every object in place, and Effect owns every GPU lifetime. Pointer input comes back as your own typed Messages.

Live: hover a shape, click to repaint it.

Live examples

Change the state. Watch the scene follow.

Read the guide

Built with effect-three

A tech radar you can fly through.

Open the tech radar

A whole site on effect-three and Foldkit: a 3D tech radar written as markdown. It steps back through earlier editions, every view is a shareable link, and each entry opens a page of its own.

Scenes are data

No closures, no three.js objects in your Model. Derive the scene in your view; keyed updates change only what changed.

Effect owns lifetimes

Renderers, GPU resources, frame loops and listeners live in a Scope. Unmount, fail or interrupt, and everything is released.

Explicit interaction

Clicks and hovers arrive as your typed Messages. Animation runs in the frame loop and never touches update.

From Model to mesh.

Describe it once. Change the Model. The scene follows.

Read the quick start
const sceneFor = (model: Model) =>
  scene({
    children: [
      mesh({
        key: 'cube',
        geometry: box(),
        material: standard({ color: model.colour }),
        rotation: spin({ axis: 'y', radiansPerSecond: 1 }),
        interactive: true,
      }),
    ],
  });