Packs / threejs-public
scroll-driven-camera
Drive a three.js camera along a spline from page scroll (one stop per section) with eased damping and a static frame under reduced motion
Install
logicpacks pack use threejs-public/scroll-driven-cameraget_pack threejs-public/scroll-driven-cameraThe second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.
Keys it needs (names only)
None.
Playbooks included
- Spec:
spec/SPEC.md(goal, steps, edge cases, don’ts) - Routes:
static-local - Checks: 1 in
outcome/checks.yaml - Code:
boot.jsindex.htmlmain.js - Tools: python3, playwright-python, chromium
Usage, last 8 weeks
New: no recorded use yet.
Purpose (from spec/SPEC.md)
Goal
Scroll position maps to a camera path through a 3D scene behind normal HTML sections; smooth, reversible, accessible.
Steps
- Copy
code/; editSTOPS(camera position + look-at per section). - The canvas is fixed behind the content; sections stay real HTML (SEO, a11y).
- Progress = scrollY / (scrollHeight - innerHeight), damped each frame.
- Check scroll moves the camera:
python3 ../tools/webgl_check.py code --steps outcome/fixtures/scroll.json.
Edge cases
- iOS address-bar resize changes innerHeight: use the template's resize debounce.
- prefers-reduced-motion: jump between stops without easing.
Don'ts
- Don't hijack scroll (no preventDefault on wheel).
- Don't put text into the canvas; keep it in HTML.