Prompt specification
Build or customize the Three.js 3D scene "Changing Reach Changes Available Routes" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Changing Reach Changes Available Routes
Category: Games & Play · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/changing-reach-changes-available-routes-x3612
Scene Description Prompt:
I'd like to see this as a low-poly Three.js scene: changing reach changes available routes. Create a tabletop reach puzzle with adjustable schematic limb lengths. Recompute reachable-hold connections and distinguish geometric accessibility from strength, technique, or real climbing ability. Use cdnjs and return one self-contained HTML file.
Working Three.js Starter (changing-reach-changes-available-routes-x3612):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Reach / Lab — Tabletop Reach Puzzle</title>
<style>
:root {
--paper: #f7f4ec;
--paper-strong: #fffdf8;
--ink: #17383b;
--muted: #657675;
--line: rgba(23, 56, 59, 0.13);
--teal: #18a99b;
--teal-soft: #dff3ee;
--amber: #d69b35;
--amber-soft: #f8ecd5;
--coral: #e96f54;
--violet: #8970ce;
--red: #d94b43;
--shadow: 0 18px 50px rgba(31, 54, 51, 0.13);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e9e6dc;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button,
input {
font: inherit;
}
button {
color: inherit;
}
#scene {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
outline: none;
}
.topbar {
position: fixed;
z-index: 10;
top: 0;
left: 0;
right: 0;
height: 76px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
pointer-events: none;
background: linear-gradient(
to bottom,
rgba(233, 230, 220, 0.98),
rgba(233, 230, 220, 0.75) 68%,
rgba(233, 230, 220, 0)
);
}
.brand {
display: flex;
align-items: center;
gap: 12px;
}
.brand-mark {
width: 38px;
height: 38px;
display: grid;
place-items: center;
color: #fff;
background: var(--ink);
border-radius: 11px 4px 11px 4px;
font-size: 17px;
font-weight: 900;
box-shadow: 0 8px 24px rgba(23, 56, 59, 0.2);
}
.brand-copy {
display: grid;
gap: 1px;
}
.brand-copy strong {
font-size: 15px;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.brand-copy span {
color: var(--muted);
font-size: 11px;
letter-spacing: 0.09em;
text-transform: uppercase;
}
.top-actions {
display: flex;
align-items: center;
gap: 10px;
pointer-events: auto;
}
.geometry-badge {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 9px 13px;
border: 1px solid rgba(23, 56, 59, 0.12);
border-radius: 999px;
background: rgba(255, 253, 248, 0.78);
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
backdrop-filter: blur(12px);
}
.geometry-badge::before {
content: "";
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--teal);
box-shadow: 0 0 0 4px rgba(24, 169, 155, 0.12);
}
.icon-button {
height: 36px;
padding: 0 13px;
border: 1px solid rgba(23, 56, 59, 0.14);
border-radius: 999px;
background: rgba(255, 253, 248, 0.84);
cursor: pointer;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.06em;
text-transform: uppercase;
transition: transform 160ms ease, background 160ms ease;
}
.icon-button:hover {
transform: translateY(-1px);
background: #fffdf8;
}
.panel {
position: fixed;
z-index: 8;
top: 88px;
width: 316px;
max-height: calc(100vh - 116px);
overflow: auto;
border: 1px solid rgba(23, 56, 59, 0.13);
border-radius: 20px;
background: rgba(250, 248, 241, 0.92);
box-shadow: var(--shadow);
backdrop-filter: blur(18px);
scrollbar-width: thin;
scrollbar-color: rgba(23, 56, 59, 0.18) transparent;
}
#controlPanel {
left: 20px;
padding: 20px;
}
#routePanel {
right: 20px;
width: 340px;
padding: 20px;
}
.eyebrow {
margin-bottom: 5px;
color: var(--muted);
font-size: 10px;
font-weight: 900;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1,
h2,
h3,
p {
margin: 0;
}
.panel h2 {
margin-bottom: 4px;
font-size: 22px;
line-height: 1.1;
letter-spacing: -0.03em;
}
.panel-intro {
color: var(--muted);
font-size: 12px;
line-height: 1.55;
}
.divider {
height: 1px;
margin: 18px 0;
background: var(--line);
}
.range-block + .range-block {
margin-top: 18px;
}
.range-label {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 9px;
}
.range-label span {
font-size: 12px;
font-weight: 800;
}
.range-label small {
color: var(--muted);
font-size: 10px;
}
.range-value {
color: var(--ink) !important;
font-size: 13px !important;
font-variant-numeric: tabular-nums;
}
input[type="range"] {
--pct: 50%;
--range-color: var(--teal);
width: 100%;
height: 6px;
margin: 3px 0 7px;
border: 0;
border-radius: 999px;
appearance: none;
cursor: pointer;
background: linear-gradient(
to right,
var(--range-color) 0%,
var(--range-color) var(--pct),
rgba(23, 56, 59, 0.12) var(--pct),
rgba(23, 56, 59, 0.12) 100%
);
}
input[type="range"]::-webkit-slider-thumb {
width: 18px;
height: 18px;
border: 3px solid #fff;
border-radius: 50%;
appearance: none;
background: var(--range-color);
box-shadow: 0 2px 8px rgba(23, 56, 59, 0.25);
}
input[type="range"]::-moz-range-thumb {
width: 13px;
height: 13px;
border: 3px solid #fff;
border-radius: 50%;
background: var(--range-color);
box-shadow: 0 2px 8px rgba(23, 56, 59, 0.25);
}
#armRange {
--range-color: var(--teal);
}
#legRange {
--range-color: var(--amber);
}
.range-ends {
display: flex;
justify-content: space-between;
color: #8b9693;
font-size: 9px;
font-variant-numeric: tabular-nums;
}
.preset-label {
margin: 17px 0 8px;
color: var(--muted);
font-size: 9px;
font-weight: 900;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.presets {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 7px;
}
.preset {
min-height: 48px;
padding: 7px 5px;
border: 1px solid var(--line);
border-radius: 11px;
background: rgba(255, 253, 248, 0.68);
cursor: pointer;
text-align: center;
transition: 160ms ease;
}
.preset:hover,
.preset.active {
border-color: rgba(24, 169, 155, 0.5);
background: var(--teal-soft);
}
.preset strong,
.preset span {
display: block;
}
.preset strong {
margin-bottom: 2px;
font-size: 10px;
}
.preset span {
color: var(--muted);
font-size: 9px;
}
.span-card {
margin-top: 17px;
padding: 13px;
border: 1px solid rgba(24, 169, 155, 0.18);
border-radius: 14px;
background: linear-gradient(135deg, #e8f5f0, #f5f0e5);
}
.span-row {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 10px;
}
.span-row span {
font-size: 11px;
font-weight: 800;
}
.span-row strong {
font-size: 19px;
font-variant-numeric: tabular-nums;
}
.span-meter {
height: 5px;
margin-top: 9px;
overflow: hidden;
border-radius: 999px;
background: rgba(23, 56, 59, 0.11);
}
.span-meter i {
display: block;
width: 50%;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, var(--teal), var(--amber));
transition: width 180ms ease;
}
.rule-title {
margin-bottom: 9px;
font-size: 11px;
font-weight: 900;
}
.rules {
display: grid;
gap: 7px;
}
.rule {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
color: var(--muted);
font-size: 10px;
}
.rule b {
color: var(--ink);
font-size: 10px;
font-variant-numeric: tabular-nums;
}
.toggle {
display: flex;
align-items: center;
gap: 9px;
margin-top: 17px;
color: var(--muted);
cursor: pointer;
font-size: 11px;
font-weight: 700;
}
.toggle input {
position: absolute;
opacity: 0;
pointer-events: none;
}
.toggle-ui {
position: relative;
width: 34px;
height: 19px;
border-radius: 999px;
background: rgba(23, 56, 59, 0.18);
transition: 160ms ease;
}
.toggle-ui::after {
content: "";
position: absolute;
top: 3px;
left: 3px;
width: 13px;
height: 13px;
border-radius: 50%;
background: white;
box-shadow: 0 1px 4px rgba(23, 56, 59, 0.24);
transition: transform 160ms ease;
}
.toggle input:checked + .toggle-ui {
background: var(--teal);
}
.toggle input:checked + .toggle-ui::after {
transform: translateX(15px);
}
.stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 7px;
margin: 17px 0 14px;
}
.stat {
min-width: 0;
padding: 10px 8px;
border: 1px solid var(--line);
border-radius: 11px;
background: rgba(255, 253, 248, 0.6);
text-align: center;
}
.stat strong,
.stat span {
display: block;
}
.stat strong {
margin-bottom: 3px;
font-size: 17px;
font-variant-numeric: tabular-nums;
}
.stat span {
overflow: hidden;
color: var(--muted);
font-size: 8px;
font-weight: 800;
letter-spacing: 0.08em;
text-overflow: ellipsis;
text-transform: uppercase;
white-space: nowrap;
}
.route-list {
display: grid;
gap: 9px;
}
.route-card {
--route: var(--teal);
position: relative;
width: 100%;
padding: 13px 13px 12px 15px;
overflow: hidden;
border: 1px solid var(--line);
border-radius: 14px;
background: rgba(255, 253, 248, 0.66);
cursor: pointer;
text-align: left;
transition: transform 150ms ease, border-color 150ms ease,
background 150ms ease;
}
.route-card::before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 4px;
background: var(--route);
opacity: 0.45;
}
.route-card:hover {
transform: translateY(-1px);
border-color: rgba(23, 56, 59, 0.26);
}
.route-card.selected {
border-color: color-mix(in srgb, var(--route) 55%, transparent);
background: color-mix(in srgb, var(--route) 8%, #fffdf8);
}
.route-card.selected::before {
opacity: 1;
}
.route-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}
.route-name {
display: flex;
align-items: center;
gap: 8px;
}
.route-dot {
width: 8px;
height: 8px;
border-radius: 2px;
background: var(--route);
transform: rotate(45deg);
}
.route-name strong {
font-size: 13px;
}
.route-badge {
flex: 0 0 auto;
padding: 4px 7px;
border-radius: 999px;
background: #ece9e1;
color: var(--muted);
font-size: 8px;
font-weight: 900;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.route-card.open .route-badge {
background: var(--teal-soft);
color: #117c72;
}
.route-card.blocked .route-badge {
background: #f6dfda;
color: #ad493b;
}
.route-description {
margin: 6px 0 9px 16px;
color: var(--muted);
font-size: 10px;
}
.requirements {
display: flex;
flex-wrap: wrap;
gap: 5px;
margin-left: 16px;
}
.requirement {
padding: 4px 6px;
border: 1px solid var(--line);
border-radius: 6px;
background: rgba(255, 255, 255, 0.46);
color: var(--muted);
font-size: 8px;
font-weight: 800;
font-variant-numeric: tabular-nums;
}
.blocker {
margin: 8px 0 0 16px;
color: #a64c40;
font-size: 9px;
line-height: 1.4;
}
.reality-card {
margin-top: 15px;
padding: 13px;
border: 1px solid rgba(233, 111, 84, 0.22);
border-radius: 14px;
background: #f7e8df;
}
.reality-title {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 7px;
color: #9c4838;
font-size: 10px;
font-weight: 900;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.reality-title::before {
content: "!";
display: grid;
width: 17px;
height: 17px;
place-items: center;
border-radius: 50%;
background: var(--coral);
color: white;
font-size: 10px;
}
.reality-card p {
color: #765d54;
font-size: 10px;
line-height: 1.5;
}
.reality-card strong {
color: #704b42;
}
.footer-hint {
position: fixed;
z-index: 5;
left: 50%;
bottom: 18px;
display: flex;
align-items: center;
gap: 10px;
padding: 9px 13px;
border: 1px solid rgba(23, 56, 59, 0.1);
border-radius: 999px;
background: rgba(250, 248, 241, 0.78);
color: var(--muted);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.03em;
pointer-events: none;
transform: translateX(-50%);
backdrop-filter: blur(10px);
white-space: nowrap;
}
.footer-hint span {
color: var(--ink);
}
.toast {
position: fixed;
z-index: 20;
left: 50%;
bottom: 66px;
max-width: min(430px, calc(100vw - 30px));
padding: 11px 15px;
border-radius: 999px;
background: var(--ink);
color: white;
box-shadow: 0 12px 35px rgba(23, 56, 59, 0.24);
font-size: 11px;
font-weight: 700;
opacity: 0;
pointer-events: none;
transform: translate(-50%, 10px);
transition: opacity 180ms ease, transform 180ms ease;
text-align: center;
}
.toast.visible {
opacity: 1;
transform: translate(-50%, 0);
}
.toast.unlock {
background: #137f75;
}
@media (max-width: 1040px) {
.panel {
width: 286px;
}
#routePanel {
width: 304px;
}
.geometry-badge {
display: none;
}
}
@media (max-width: 760px) {
.topbar {
height: 62px;
padding: 0 12px;
}
.brand-copy span {
display: none;
}
.panel {
top: auto;
right: 10px;
bottom: 10px;
left: 10px;
width: auto;
max-height: 40vh;
padding: 15px;
border-radius: 16px;
}
#controlPanel {
bottom: 10px;
}
#routePanel {
top: 68px;
bottom: auto;
max-height: 29vh;
}
.footer-hint {
display: none;
}
.toast {
bottom: auto;
top: 68px;
}
}
@media (max-width: 430px) {
#controlPanel {
max-height: 43vh;
}
#routePanel {
max-height: 25vh;
}
.brand-mark {
width: 34px;
height: 34px;
}
.brand-copy strong {
font-size: 12px;
}
}
</style>
</head>
<body>
<canvas
id="scene"
aria-label="Interactive low-poly tabletop reach puzzle. Drag to orbit, scroll to zoom, and click holds for information."
></canvas>
<header class="topbar">
<div class="brand">
<div class="brand-mark">R</div>
<div class="brand-copy">
<strong>Reach / Lab</strong>
<span>Tabletop geometry puzzle 01</span>
</div>
</div>
<div class="top-actions">
<div class="geometry-badge">Geometry model only</div>
<button class="icon-button" id="resetView" type="button">
Reset view
</button>
</div>
</header>
<section class="panel" id="controlPanel" aria-labelledby="limbTitle">
<div class="eyebrow">Length model</div>
<h2 id="limbTitle">Schematic limbs</h2>
<p class="panel-intro">
Adjust the limb lengths. Every hold connection is recomputed from the
geometric edge rules below.
</p>
<div class="divider"></div>
<div class="range-block">
<label class="range-label" for="armRange">
<span>Arm length</span>
<b class="range-value" id="armValue">1.45 m</b>
</label>
<input id="armRange" type="range" min="0.8" max="2.4" step="0.05" value="1.45">
<div class="range-ends"><span>0.80 m</span><span>2.40 m</span></div>
</div>
<div class="range-block">
<label class="range-label" for="legRange">
<span>Leg length</span>
<b class="range-value" id="legValue">1.15 m</b>
</label>
<input id="legRange" type="range" min="0.8" max="2.4" step="0.05" value="1.15">
<div class="range-ends"><span>0.80 m</span><span>2.40 m</span></div>
</div>
<div class="preset-label">Model presets</div>
<div class="presets">
<button class="preset" type="button" data-preset="compact">
<strong>Compact</strong><span>1.00 / 0.90</span>
</button>
<button class="preset active" type="button" data-preset="balanced">
<strong>Balanced</strong><span>1.45 / 1.15</span>
</button>
<button class="preset" type="button" data-preset="extended">
<strong>Extended</strong><span>2.00 / 1.80</span>
</button>
</div>
<div class="span-card">
<div class="span-row">
<span>Combined reach envelope</span>
<strong id="spanValue">2.60 m</strong>
</div>
<div class="span-meter"><i id="spanMeter"></i></div>
</div>
<div class="divider"></div>
<div class="rule-title">Geometric edge rules</div>
<div class="rules">
<div class="rule"><span>Hand ↔ hand</span><b>2 × arm</b></div>
<div class="rule"><span>Foot ↔ foot</span><b>2 × leg</b></div>
<div class="rule"><span>Hand ↔ foot</span><b>arm + leg</b></div>
</div>
<label class="toggle">
<input id="showLinks" type="checkbox" checked>
<span class="toggle-ui"></span>
<span>Show all active hold links</span>
</label>
</section>
<section class="panel" id="routePanel" aria-labelledby="routeTitle">
<div class="eyebrow">Recomputed connections</div>
<h2 id="routeTitle">Route geometry</h2>
<p class="panel-intro">
A route passes only when every modeled edge fits the current lengths.
</p>
<div class="stats">
<div class="stat">
<strong id="linkedStat">0/16</strong>
<span>Linked holds</span>
</div>
<div class="stat">
<strong id="edgeStat">0</strong>
<span>Active edges</span>
</div>
<div class="stat">
<strong id="routeStat">0/3</strong>
<span>Geometry pass</span>
</div>
</div>
<div class="route-list" id="routeList"></div>
<div class="reality-card">
<div class="reality-title">Geometry is not ability</div>
<p>
<strong>“Pass” means only that the edge-length model succeeds.</strong>
It does not assess grip strength, friction, fatigue, body tension,
technique, foothold quality, injury, or real climbing ability.
A person may still fail a geometrically valid route.
</p>
</div>
</section>
<div class="footer-hint">
<span>Drag</span> orbit · <span>Scroll</span> zoom ·
<span>Click a hold</span> inspect
</div>
<div class="toast" id="toast" role="status" aria-live="polite"></div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const canvas = document.querySelector("#scene");
const armRange = document.querySelector("#armRange");
const legRange = document.querySelector("#legRange");
const armValue = document.querySelector("#armValue");
const legValue = document.querySelector("#legValue");
const spanValue = document.querySelector("#spanValue");
const spanMeter = document.querySelector("#spanMeter");
const linkedStat = document.querySelector("#linkedStat");
const edgeStat = document.querySelector("#edgeStat");
const routeStat = document.querySelector("#routeStat");
const routeList = document.querySelector("#routeList");
const showLinks = document.querySelector("#showLinks");
const toast = document.querySelector("#toast");
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight, false);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe9e6dc);
scene.fog = new THREE.Fog(0xe9e6dc, 24, 42);
const camera = new THREE.OrthographicCamera(
-10, 10, 6, -6, 0.1, 100
);
const cameraTarget = new THREE.Vector3(0, 1.05, 0);
const defaultView = {
yaw: 0.72,
pitch: 0.78,
radius: 17.5
};
const view = {
yaw: defaultView.yaw,
pitch: defaultView.pitch,
radius: defaultView.radius,
targetYaw: defaultView.yaw,
targetPitch: defaultView.pitch,
targetRadius: defaultView.radius
};
function updateCamera() {
const cp = Math.cos(view.pitch);
camera.position.set(
cameraTarget.x + view.radius * cp * Math.sin(view.yaw),
cameraTarget.y + view.radius * Math.sin(view.pitch),
cameraTarget.z + view.radius * cp * Math.cos(view.yaw)
);
camera.lookAt(cameraTarget);
}
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
const viewHeight = Math.max(10.3, 19.4 / aspect);
camera.left = (-viewHeight * aspect) / 2;
camera.right = (viewHeight * aspect) / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
}
window.addEventListener("resize", resize);
resize();
updateCamera();
const hemisphere = new THREE.HemisphereLight(0xfff7df, 0x66736a, 2.25);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff2d2, 3.5);
keyLight.position.set(-7, 13, 7);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -14;
keyLight.shadow.camera.right = 14;
keyLight.shadow.camera.top = 12;
keyLight.shadow.camera.bottom = -12;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 32;
keyLight.shadow.bias = -0.0007;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xc5e8e5, 1.15);
fillLight.position.set(9, 7, -8);
scene.add(fillLight);
function material(color, options = {}) {
return new THREE.MeshStandardMaterial({
color,
roughness: options.roughness ?? 0.82,
metalness: options.metalness ?? 0,
flatShading: options.flatShading ?? true,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1,
side: options.side ?? THREE.FrontSide
});
}
function addBox(parent, size, position, mat, cast = true, receive = true) {
const mesh = new THREE.Mesh(
new THREE.BoxGeometry(size[0], size[1], size[2]),
mat
);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = cast;
mesh.receiveShadow = receive;
parent.add(mesh);
return mesh;
}
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(80, 80),
material(0xdfddd4, { roughness: 1 })
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.025;
floor.receiveShadow = true;
scene.add(floor);
const table = new THREE.Group();
scene.add(table);
const wood = material(0x8a5a3d, { roughness: 0.92 });
const woodDark = material(0x70442f, { roughness: 0.96 });
const tableTop = addBox(
table,
[19.6, 0.45, 12.4],
[0, 0.8, 0],
wood
);
const legGeometry = new THREE.CylinderGeometry(0.32, 0.4, 0.58, 6);
[
[-8.7, 0.29, -5.1],
[8.7, 0.29, -5.1],
[-8.7, 0.29, 5.1],
[8.7, 0.29, 5.1]
].forEach((position) => {
const leg = new THREE.Mesh(legGeometry, woodDark);
leg.position.set(...position);
leg.castShadow = true;
leg.receiveShadow = true;
table.add(leg);
});
const board = new THREE.Group();
scene.add(board);
const boardMat = material(0x294347, { roughness: 0.94 });
const boardEdge = material(0x20383c, { roughness: 0.96 });
const frameMat = material(0xb07a4e, { roughness: 0.88 });
addBox(
board,
[17.25, 0.29, 9.35],
[0, 1.105, 0],
boardMat,
true,
true
);
addBox(
board,
[0.31, 0.17, 9.62],
[-8.45, 1.29, 0],
frameMat
);
addBox(
board,
[0.31, 0.17, 9.62],
[8.45, 1.29, 0],
frameMat
);
addBox(
board,
[16.92, 0.17, 0.31],
[0, 1.29, -4.62],
frameMat
);
addBox(
board,
[16.92, 0.17, 0.31],
[0, 1.29, 4.62],
frameMat
);
const gridPositions = [];
for (let x = -7.5; x <= 7.5; x += 1) {
gridPositions.push(x, 1.258, -4.35, x, 1.258, 4.35);
}
for (let z = -4; z <= 4; z += 1) {
gridPositions.push(-8.15, 1.258, z, 8.15, 1.258, z);
}
const gridGeometry = new THREE.BufferGeometry();
gridGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(gridPositions, 3)
);
const grid = new THREE.LineSegments(
gridGeometry,
new THREE.LineBasicMaterial({
color: 0xb4d0c7,
transparent: true,
opacity: 0.075
})
);
board.add(grid);
function roundedRect(ctx, x, y, w, h, r) {
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.arcTo(x + w, y, x + w, y + h, r);
ctx.arcTo(x + w, y + h, x, y + h, r);
ctx.arcTo(x, y + h, x, y, r);
ctx.arcTo(x, y, x + w, y, r);
ctx.closePath();
}
function makeLabel(text, background = "#17383b", foreground = "#ffffff") {
const labelCanvas = document.createElement("canvas");
labelCanvas.width = 512;
labelCanvas.height = 128;
const ctx = labelCanvas.getContext("2d");
roundedRect(ctx, 8, 10, 496, 108, 24);
ctx.fillStyle = background;
ctx.fill();
ctx.fillStyle = foreground;
ctx.font = "800 42px system-ui, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(text, 256, 65);
const texture = new THREE.CanvasTexture(labelCanvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.renderOrder = 20;
return sprite;
}
const titleLabel = makeLabel("TOPO / REACH", "#17383b", "#f8f4e9");
titleLabel.position.set(0.4, 1.9, -4.18);
titleLabel.scale.set(2.45, 0.61, 1);
scene.add(titleLabel);
const holds = [
{ id: "H0", type: "hand", x: -6.2, z: 2.35, start: true },
{ id: "H1", type: "hand", x: -4.9, z: 2.90 },
{ id: "H2", type: "hand", x: -3.3, z: 2.05 },
{ id: "H3", type: "hand", x: -2.0, z: 2.90 },
{ id: "H4", type: "hand", x: -0.2, z: 1.90 },
{ id: "H5", type: "hand", x: 1.3, z: 2.80 },
{ id: "H6", type: "hand", x: 2.8, z: 1.70 },
{ id: "H7", type: "hand", x: 4.3, z: 2.30 },
{ id: "H8", type: "hand", x: 6.2, z: 1.40, goal: true },
{ id: "F1", type: "foot", x: -4.3, z: 0.75 },
{ id: "F2", type: "foot", x: -3.0, z: 0.25 },
{ id: "F3", type: "foot", x: -1.4, z: 0.85 },
{ id: "F4", type: "foot", x: 0.2, z: 0.35 },
{ id: "F5", type: "foot", x: 1.7, z: 0.25 },
{ id: "F6", type: "foot", x: 3.1, z: -0.35 },
{ id: "F7", type: "foot", x: 4.5, z: 0.25 },
{ id: "F8", type: "foot", x: 5.8, z: -0.55 }
];
const holdById = new Map();
const holdMeshes = [];
const handMat = material(0x22b6a6, { roughness: 0.7 });
const handTopMat = material(0x55d2c2, { roughness: 0.62 });
const footMat = material(0xd79b3b, { roughness: 0.78 });
const footTopMat = material(0xf0ba62, { roughness: 0.66 });
const goalMat = material(0xe96f79, { roughness: 0.62 });
const goalTopMat = material(0xff8c94, { roughness: 0.58 });
holds.forEach((hold) => {
holdById.set(hold.id, hold);
const isHand = hold.type === "hand";
const radius = isHand ? 0.29 : 0.34;
const height = isHand ? 0.20 : 0.17;
const segments = isHand ? 8 : 6;
const outerMat = hold.goal
? goalMat
: isHand
? handMat
: footMat;
const topMat = hold.goal
? goalTopMat
: isHand
? handTopMat
: footTopMat;
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(radius, radius * 1.08, height, segments),
outerMat
);
mesh.position.set(hold.x, 1.365, hold.z);
mesh.rotation.y = isHand ? Math.PI / 8 : Math.PI / 6;
mesh.castShadow = true;
mesh.receiveShadow = true;
mesh.userData.holdId = hold.id;
board.add(mesh);
holdMeshes.push(mesh);
const top = new THREE.Mesh(
new THREE.CylinderGeometry(
radius * 0.66,
radius * 0.73,
0.055,
segments
),
topMat
);
top.position.set(hold.x, 1.365 + height * 0.5 + 0.012, hold.z);
top.rotation.y = mesh.rotation.y;
top.castShadow = true;
board.add(top);
});
function makeRing(color, radius, tube) {
const ring = new THREE.Mesh(
new THREE.TorusGeometry(radius, tube, 6, 28),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.95,
depthTest: false
})
);
ring.rotation.x = Math.PI / 2;
ring.renderOrder = 15;
return ring;
}
const startRing = makeRing(0xffffff, 0.45, 0.035);
startRing.position.set(-6.2, 1.49, 2.35);
scene.add(startRing);
const goalRing = makeRing(0xff6f7e, 0.48, 0.045);
goalRing.position.set(6.2, 1.49, 1.4);
scene.add(goalRing);
const startLabel = makeLabel("START", "#ffffff", "#17383b");
startLabel.position.set(-6.2, 2.05, 2.35);
startLabel.scale.set(1.45, 0.36, 1);
scene.add(startLabel);
const goalLabel = makeLabel("GOAL", "#e96f79", "#ffffff");
goalLabel.position.set(6.2, 2.05, 1.4);
goalLabel.scale.set(1.35, 0.34, 1);
scene.add(goalLabel);
const selectionRing = makeRing(0xfff3ae, 0.51, 0.03);
selectionRing.visible = false;
scene.add(selectionRing);
// Small physical length schematic in the unused lower-left corner.
const rig = new THREE.Group();
rig.position.set(-6.55, 1.285, -2.62);
scene.add(rig);
const rigBodyMat = material(0xe9e4d8, { roughness: 0.9 });
const rigJointMat = material(0x496567, { roughness: 0.84 });
const rigArmMat = material(0x2aaba0, { roughness: 0.72 });
const rigLegMat = material(0xd09a43, { roughness: 0.78 });
const torso = addBox(
rig,
[0.42, 0.14, 0.72],
[0, 0.08, 0],
rigBodyMat
);
const head = new THREE.Mesh(
new THREE.CylinderGeometry(0.23, 0.25, 0.15, 6),
rigBodyMat
);
head.position.set(0, 0.10, 0.58);
head.castShadow = true;
rig.add(head);
const rigLimbs = new THREE.Group();
rig.add(rigLimbs);
const rigLabel = makeLabel("LENGTH MODEL", "#e9e4d8", "#17383b");
rigLabel.position.set(-6.55, 1.9, -3.75);
rigLabel.scale.set(1.75, 0.38, 1);
scene.add(rigLabel);
const upAxis = new THREE.Vector3(0, 1, 0);
function cylinderBetween(parent, a, b, radius, mat, radialSegments = 6) {
const direction = new THREE.Vector3().subVectors(b, a);
const length = direction.length();
const mesh = new THREE.Mesh(
new THREE.CylinderGeometry(radius, radius, length, radialSegments),
mat
);
mesh.position.copy(a).add(b).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(upAxis, direction.normalize());
mesh.castShadow = true;
parent.add(mesh);
return mesh;
}
function joint(parent, position, radius, mat) {
const mesh = new THREE.Mesh(
new THREE.IcosahedronGeometry(radius, 0),
mat
);
mesh.position.copy(position);
mesh.castShadow = true;
parent.add(mesh);
return mesh;
}
function updateRig(arm, leg) {
rigLimbs.clear();
for (const side of [-1, 1]) {
const shoulder = new THREE.Vector3(side * 0.23, 0.12, 0.25);
const elbow = new THREE.Vector3(
side * (0.25 + arm * 0.15),
0.12,
0.31 + arm * 0.08
);
const hand = new THREE.Vector3(
side * (0.24 + arm * 0.32),
0.12,
0.25 + arm * 0.15
);
cylinderBetween(rigLimbs, shoulder, elbow, 0.065, rigArmMat);
cylinderBetween(rigLimbs, elbow, hand, 0.065, rigArmMat);
joint(rigLimbs, elbow, 0.085, rigJointMat);
joint(rigLimbs, hand, 0.09, rigArmMat);
const hip = new THREE.Vector3(side * 0.12, 0.08, -0.29);
const knee = new THREE.Vector3(
side * (0.16 + leg * 0.13),
0.08,
-0.30 - leg * 0.13
);
const foot = new THREE.Vector3(
side * (0.18 + leg * 0.24),
0.08,
-0.28 - leg * 0.28
);
cylinderBetween(rigLimbs, hip, knee, 0.075, rigLegMat);
cylinderBetween(rigLimbs, knee, foot, 0.075, rigLegMat);
joint(rigLimbs, knee, 0.09, rigJointMat);
const footMesh = addBox(
rigLimbs,
[0.19, 0.12, 0.28],
[foot.x, 0.09, foot.z],
rigLegMat
);
footMesh.rotation.y = side * 0.12;
}
}
const routeDefinitions = [
{
id: "flow",
name: "Flowline",
description: "Even rhythm · mostly mixed-limb spans",
color: "#18a99b",
path: ["H0", "F1", "H2", "F3", "H4", "F5", "H6", "F7", "H8"]
},
{
id: "palm",
name: "Palm Arc",
description: "Long hand spans · elevated line",
color: "#e96f54",
path: ["H0", "H1", "F2", "H3", "H4", "H5", "F6", "H7", "H8"]
},
{
id: "foot",
name: "Footwork",
description: "Precise foot transitions · deep reach",
color: "#8970ce",
path: ["H0", "F1", "F2", "H3", "F4", "F5", "H6", "F8", "H8"]
}
];
const activeLinksGroup = new THREE.Group();
const routeGraphicsGroup = new THREE.Group();
scene.add(activeLinksGroup, routeGraphicsGroup);
let activeEdges = [];
let routeStates = [];
let selectedRoute = 0;
let initialized = false;
let lastOpenCount = 0;
let toastTimer;
function distanceBetween(a, b) {
return Math.hypot(a.x - b.x, a.z - b.z);
}
function edgeThreshold(a, b, arm, leg) {
if (a.type === b.type) {
return a.type === "hand" ? 2 * arm : 2 * leg;
}
return arm + leg;
}
function routeRequirement(a, b) {
const distance = distanceBetween(a, b);
if (a.type === b.type) {
return a.type === "hand"
? { arm: distance / 2 }
: { leg: distance / 2 };
}
return { sum: distance };
}
function combineRequirement(current, next) {
return {
arm: Math.max(current.arm, next.arm || 0),
leg: Math.max(current.leg, next.leg || 0),
sum: Math.max(current.sum, next.sum || 0)
};
}
function computeRoutes(arm, leg) {
return routeDefinitions.map((route, index) => {
const requirement = { arm: 0, leg: 0, sum: 0 };
let failedEdges = 0;
const edges = route.path.slice(1).map((id, edgeIndex) => {
const a = holdById.get(route.path[edgeIndex]);
const b = holdById.get(id);
const distance = distanceBetween(a, b);
const edgeReq = routeRequirement(a, b);
Object.assign(requirement, combineRequirement(requirement, edgeReq));
const threshold = edgeThreshold(a, b, arm, leg);
const passes = distance <= threshold + 1e-8;
if (!passes) failedEdges += 1;
return { a, b, distance, threshold, passes };
});
const available =
arm + 1e-8 >= requirement.arm &&
leg + 1e-8 >= requirement.leg &&
arm + leg + 1e-8 >= requirement.sum;
const deficits = [];
if (requirement.arm > arm + 1e-8) {
deficits.push(`arm +${(requirement.arm - arm).toFixed(2)} m`);
}
if (requirement.leg > leg + 1e-8) {
deficits.push(`leg +${(requirement.leg - leg).toFixed(2)} m`);
}
if (requirement.sum > arm + leg + 1e-8) {
deficits.push(`mixed span +${(requirement.sum - arm - leg).toFixed(2)} m`);
}
return {
...route,
index,
requirement,
edges,
available,
failedEdges,
deficitText: deficits.join(" · ")
};
});
}
function computeActiveEdges(arm, leg) {
const edges = [];
for (let i = 0; i < holds.length; i += 1) {
for (let j = i + 1; j < holds.length; j += 1) {
const a = holds[i];
const b = holds[j];
const distance = distanceBetween(a, b);
const threshold = edgeThreshold(a, b, arm, leg);
if (distance <= threshold + 1e-8) {
edges.push({ a, b, distance, threshold });
}
}
}
return edges;
}
function linkedHoldCount(edges) {
const adjacency = new Map(holds.map((hold) => [hold.id, []]));
edges.forEach((edge) => {
adjacency.get(edge.a.id).push(edge.b.id);
adjacency.get(edge.b.id).push(edge.a.id);
});
const visited = new Set(["H0"]);
const queue = ["H0"];
while (queue.length) {
const current = queue.shift();
for (const neighbor of adjacency.get(current)) {
if (!visited.has(neighbor)) {
visited.add(neighbor);
queue.push(neighbor);
}
}
}
return visited;
}
function clearGroup(group, disposeMaterials = true) {
while (group.children.length) {
const child = group.children.pop();
child.traverse((object) => {
if (object.geometry) object.geometry.dispose();
if (
disposeMaterials &&
object.material &&
!Array.isArray(object.material)
) {
object.material.dispose();
}
});
}
}
function drawActiveLinks() {
clearGroup(activeLinksGroup);
const positions = [];
activeEdges.forEach((edge) => {
positions.push(
edge.a.x, 1.276, edge.a.z,
edge.b.x, 1.276, edge.b.z
);
});
const geometry = new THREE.BufferGeometry();
geometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(positions, 3)
);
const lines = new THREE.LineSegments(
geometry,
new THREE.LineBasicMaterial({
color: 0x91c3b9,
transparent: true,
opacity: 0.25,
depthWrite: false
})
);
activeLinksGroup.add(lines);
activeLinksGroup.visible = showLinks.checked;
}
function drawRoutes() {
clearGroup(routeGraphicsGroup);
routeStates.forEach((route, routeIndex) => {
const isSelected = routeIndex === selectedRoute;
const routeColor = new THREE.Color(route.color);
if (!isSelected) {
const points = route.path.map((id) => {
const hold = holdById.get(id);
return new THREE.Vector3(hold.x, 1.294, hold.z);
});
const geometry = new THREE.BufferGeometry().setFromPoints(points);
let lineMaterial;
if (route.available) {
lineMaterial = new THREE.LineBasicMaterial({
color: route.color,
transparent: true,
opacity: 0.52,
depthWrite: false
});
} else {
lineMaterial = new THREE.LineDashedMaterial({
color: route.color,
transparent: true,
opacity: 0.34,
dashSize: 0.18,
gapSize: 0.13,
depthWrite: false
});
}
const line = new THREE.Line(geometry, lineMaterial);
if (!route.available) line.computeLineDistances();
routeGraphicsGroup.add(line);
return;
}
route.edges.forEach((edge) => {
const a = new THREE.Vector3(edge.a.x, 1.315, edge.a.z);
const b = new THREE.Vector3(edge.b.x, 1.315, edge.b.z);
const edgeColor = edge.passes ? routeColor : new THREE.Color(0xe0443e);
const edgeMat = new THREE.MeshStandardMaterial({
color: edgeColor,
emissive: edgeColor,
emissiveIntensity: edge.passes ? 0.16 : 0.3,
roughness: 0.62,
transparent: true,
opacity: edge.passes ? 0.96 : 1
});
cylinderBetween(
routeGraphicsGroup,
a,
b,
edge.passes ? 0.055 : 0.07,
edgeMat,
6
);
});
});
}
function requirementChips(requirement) {
const chips = [];
if (requirement.arm > 0) {
chips.push(`arm ≥ ${requirement.arm.toFixed(2)} m`);
}
if (requirement.leg > 0) {
chips.push(`leg ≥ ${requirement.leg.toFixed(2)} m`);
}
if (requirement.sum > 0) {
chips.push(`arm + leg ≥ ${requirement.sum.toFixed(2)} m`);
}
return chips
.map(
(chip) => `<span class="requirement">${chip}</span>`
)
.join("");
}
function renderRouteList() {
routeList.innerHTML = routeStates
.map((route) => {
const selected = route.index === selectedRoute ? " selected" : "";
const status = route.available ? "open" : "blocked";
const badge = route.available
? "Geometry pass"
: `${route.failedEdges} edge${route.failedEdges === 1 ? "" : "s"} long`;
const blocker = route.available
? ""
: `<div class="blocker">Short: ${route.deficitText}</div>`;
return `
<button
class="route-card ${status}${selected}"
style="--route:${route.color}"
type="button"
data-route="${route.index}"
aria-pressed="${route.index === selectedRoute}"
>
<div class="route-head">
<div class="route-name">
<span class="route-dot"></span>
<strong>${route.name}</strong>
</div>
<span class="route-badge">${badge}</span>
</div>
<div class="route-description">${route.description}</div>
<div class="requirements">${requirementChips(route.requirement)}</div>
${blocker}
</button>
`;
})
.join("");
}
function updateRangeFill(input) {
const min = Number(input.min);
const max = Number(input.max);
const value = Number(input.value);
const percentage = ((value - min) / (max - min)) * 100;
input.style.setProperty("--pct", `${percentage}%`);
}
function showToast(message, type = "") {
clearTimeout(toastTimer);
toast.textContent = message;
toast.className = `toast visible ${type}`;
toastTimer = setTimeout(() => {
toast.className = "toast";
}, 2800);
}
function recompute() {
const arm = Number(armRange.value);
const leg = Number(legRange.value);
armValue.textContent = `${arm.toFixed(2)} m`;
legValue.textContent = `${leg.toFixed(2)} m`;
spanValue.textContent = `${(arm + leg).toFixed(2)} m`;
spanMeter.style.width = `${Math.min(100, ((arm + leg) / 4.8) * 100)}%`;
updateRangeFill(armRange);
updateRangeFill(legRange);
activeEdges = computeActiveEdges(arm, leg);
routeStates = computeRoutes(arm, leg);
const linked = linkedHoldCount(activeEdges);
const openCount = routeStates.filter((route) => route.available).length;
linkedStat.textContent = `${linked.size}/${holds.length}`;
edgeStat.textContent = activeEdges.length;
routeStat.textContent = `${openCount}/${routeStates.length}`;
drawActiveLinks();
drawRoutes();
renderRouteList();
updateRig(arm, leg);
document.querySelectorAll(".preset").forEach((button) => {
const preset = button.dataset.preset;
let active = false;
if (preset === "compact") {
active = Math.abs(arm - 1) < 0.001 && Math.abs(leg - 0.9) < 0.001;
} else if (preset === "balanced") {
active = Math.abs(arm - 1.45) < 0.001 && Math.abs(leg - 1.15) < 0.001;
} else if (preset === "extended") {
active = Math.abs(arm - 2) < 0.001 && Math.abs(leg - 1.8) < 0.001;
}
button.classList.toggle("active", active);
});
if (initialized && openCount > lastOpenCount) {
const newlyOpen = routeStates.filter(
(route) => route.available && !route.wasPreviouslyAvailable
);
const names = newlyOpen.length
? newlyOpen.map((route) => route.name).join(", ")
: routeStates
.filter((route) => route.available)
.map((route) => route.name)
.join(", ");
showToast(`Geometry pass unlocked: ${names}`, "unlock");
}
routeStates.forEach((route) => {
route.wasPreviouslyAvailable = route.available;
});
lastOpenCount = openCount;
initialized = true;
}
armRange.addEventListener("input", recompute);
legRange.addEventListener("input", recompute);
showLinks.addEventListener("change", () => {
activeLinksGroup.visible = showLinks.checked;
});
routeList.addEventListener("click", (event) => {
const card = event.target.closest("[data-route]");
if (!card) return;
selectedRoute = Number(card.dataset.route);
drawRoutes();
renderRouteList();
});
const presets = {
compact: { arm: 1.0, leg: 0.9 },
balanced: { arm: 1.45, leg: 1.15 },
extended: { arm: 2.0, leg: 1.8 }
};
document.querySelectorAll("[data-preset]").forEach((button) => {
button.addEventListener("click", () => {
const preset = presets[button.dataset.preset];
armRange.value = preset.arm;
legRange.value = preset.leg;
recompute();
});
});
document.querySelector("#resetView").addEventListener("click", () => {
view.targetYaw = defaultView.yaw;
view.targetPitch = defaultView.pitch;
view.targetRadius = defaultView.radius;
});
// Direct camera controls: no examples/addons are imported.
const pointer = new THREE.Vector2();
const raycaster = new THREE.Raycaster();
let dragging = false;
let pointerStart = { x: 0, y: 0 };
let previousPointer = { x: 0, y: 0 };
let pointerTravel = 0;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
pointerStart = { x: event.clientX, y: event.clientY };
previousPointer = { ...pointerStart };
pointerTravel = 0;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - previousPointer.x;
const dy = event.clientY - previousPointer.y;
pointerTravel += Math.hypot(dx, dy);
view.targetYaw -= dx * 0.005;
view.targetPitch = THREE.MathUtils.clamp(
view.targetPitch + dy * 0.004,
0.28,
1.28
);
previousPointer.x = event.clientX;
previousPointer.y = event.clientY;
});
canvas.addEventListener("pointerup", (event) => {
dragging = false;
if (pointerTravel < 6) {
const rect = canvas.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointer, camera);
const intersection = raycaster.intersectObjects(holdMeshes, false)[0];
if (intersection) {
const holdId = intersection.object.userData.holdId;
const hold = holdById.get(holdId);
const linkCount = activeEdges.filter(
(edge) => edge.a.id === holdId || edge.b.id === holdId
).length;
selectionRing.position.set(hold.x, 1.5, hold.z);
selectionRing.visible = true;
showToast(
`${holdId} · ${hold.type} hold · ${linkCount} active geometric link${linkCount === 1 ? "" : "s"}`
);
}
}
});
canvas.addEventListener("pointercancel", () => {
dragging = false;
});
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
view.targetRadius = THREE.MathUtils.clamp(
view.targetRadius * Math.exp(event.deltaY * 0.001),
10,
28
);
},
{ passive: false }
);
canvas.addEventListener("dblclick", () => {
view.targetYaw = defaultView.yaw;
view.targetPitch = defaultView.pitch;
view.targetRadius = defaultView.radius;
});
function animate(time) {
requestAnimationFrame(animate);
view.yaw += (view.targetYaw - view.yaw) * 0.1;
view.pitch += (view.targetPitch - view.pitch) * 0.1;
view.radius += (view.targetRadius - view.radius) * 0.1;
updateCamera();
const pulse = 1 + Math.sin(time * 0.0024) * 0.045;
goalRing.scale.setScalar(pulse);
if (selectionRing.visible) {
selectionRing.scale.setScalar(1 + Math.sin(time * 0.005) * 0.035);
}
renderer.render(scene, camera);
}
recompute();
requestAnimationFrame(animate);
</script>
</body>
</html>
```