Prompt specification
Build or customize the Three.js 3D scene "Claim Card and Evidence Tray" 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: Claim Card and Evidence Tray
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/claim-card-and-evidence-tray-x3273
Scene Description Prompt:
Claim card and evidence tray. Model a claim card beside empty evidence slots and a separate uncertainty marker. Distinguish an assertion from supporting observations through geometry and placement. Please build this with Three.js from cdnjs in one self-contained HTML file, using low-poly forms.
Working Three.js Starter (claim-card-and-evidence-tray-x3273):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Claim, Evidence & Uncertainty</title>
<style>
:root {
color-scheme: dark;
--bg: #10151d;
--panel: rgba(19, 25, 34, 0.82);
--line: rgba(210, 225, 239, 0.14);
--text: #edf3f7;
--muted: #93a3b3;
--cyan: #63d4d1;
--amber: #ffb45b;
--paper: #f1eadc;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
color: var(--text);
}
#stage {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
outline: none;
}
.hud {
position: fixed;
inset: 0;
z-index: 2;
pointer-events: none;
}
.intro {
position: absolute;
top: clamp(22px, 4vw, 48px);
left: clamp(22px, 4vw, 52px);
width: min(430px, calc(100vw - 44px));
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 14px;
color: var(--cyan);
font-size: 11px;
font-weight: 750;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
width: 28px;
height: 2px;
content: "";
background: currentColor;
}
h1 {
max-width: 420px;
margin: 0;
font-size: clamp(34px, 5vw, 64px);
font-weight: 720;
letter-spacing: -0.055em;
line-height: 0.97;
}
.intro p {
max-width: 390px;
margin: 18px 0 0;
color: var(--muted);
font-size: 14px;
line-height: 1.65;
}
.controls {
position: absolute;
top: clamp(22px, 4vw, 48px);
right: clamp(22px, 4vw, 52px);
display: flex;
gap: 9px;
pointer-events: auto;
}
button {
min-height: 40px;
padding: 0 15px;
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(19, 25, 34, 0.76);
color: var(--text);
font: inherit;
font-size: 12px;
font-weight: 650;
cursor: pointer;
backdrop-filter: blur(12px);
transition:
border-color 160ms ease,
background 160ms ease,
transform 160ms ease;
}
button:hover {
border-color: rgba(99, 212, 209, 0.58);
background: rgba(32, 43, 54, 0.9);
transform: translateY(-1px);
}
button[aria-pressed="true"] {
border-color: var(--cyan);
color: var(--cyan);
}
.inspector {
position: absolute;
right: clamp(22px, 4vw, 52px);
bottom: clamp(22px, 4vw, 44px);
width: min(330px, calc(100vw - 44px));
padding: 20px;
border: 1px solid var(--line);
border-radius: 18px;
background: var(--panel);
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
backdrop-filter: blur(18px);
}
.inspector-top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 14px;
color: var(--muted);
font-size: 10px;
font-weight: 750;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.object-number {
display: grid;
width: 30px;
height: 30px;
place-items: center;
border: 1px solid rgba(99, 212, 209, 0.35);
border-radius: 9px;
color: var(--cyan);
letter-spacing: 0.04em;
}
.inspector h2 {
margin: 0 0 9px;
font-size: 23px;
letter-spacing: -0.035em;
}
.inspector p {
min-height: 64px;
margin: 0;
color: var(--muted);
font-size: 13px;
line-height: 1.6;
}
.metric {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 17px;
padding-top: 14px;
border-top: 1px solid var(--line);
color: var(--muted);
font-size: 11px;
}
.metric strong {
color: var(--text);
font-size: 12px;
letter-spacing: 0.08em;
}
.legend {
position: absolute;
bottom: clamp(24px, 4vw, 48px);
left: clamp(22px, 4vw, 52px);
display: flex;
flex-wrap: wrap;
gap: 18px;
color: var(--muted);
font-size: 11px;
}
.legend span {
display: flex;
align-items: center;
gap: 8px;
}
.swatch {
width: 9px;
height: 9px;
border-radius: 2px;
background: var(--paper);
}
.swatch.evidence {
border: 1px solid var(--cyan);
background: rgba(99, 212, 209, 0.12);
}
.swatch.uncertainty {
border-radius: 50%;
background: var(--amber);
transform: rotate(45deg);
}
.hint {
position: absolute;
right: 50%;
bottom: 25px;
color: rgba(147, 163, 179, 0.65);
font-size: 10px;
letter-spacing: 0.06em;
transform: translateX(50%);
white-space: nowrap;
}
#loading {
position: fixed;
inset: 0;
z-index: 5;
display: grid;
place-items: center;
background: var(--bg);
color: var(--muted);
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
transition: opacity 300ms ease;
}
#loading.ready {
opacity: 0;
pointer-events: none;
}
@media (max-width: 760px) {
.intro {
top: 20px;
left: 20px;
}
.intro p,
.hint {
display: none;
}
h1 {
max-width: 290px;
font-size: 38px;
}
.controls {
top: auto;
right: 18px;
bottom: 18px;
flex-direction: column;
}
button {
min-height: 36px;
font-size: 11px;
}
.inspector {
right: auto;
bottom: 18px;
left: 18px;
width: min(280px, calc(100vw - 36px));
padding: 15px;
}
.inspector p {
min-height: 0;
}
.legend {
display: none;
}
}
</style>
</head>
<body>
<div id="stage"></div>
<div class="hud">
<header class="intro">
<div class="eyebrow">Epistemic map / 01</div>
<h1>A claim needs evidence.</h1>
<p>
The statement, its potential supporting observations, and uncertainty
are modeled as distinct objects—not as interchangeable facts.
</p>
</header>
<div class="controls">
<button id="reset" type="button">Reset view</button>
<button id="orbit" type="button" aria-pressed="false">Auto orbit</button>
</div>
<aside class="inspector" aria-live="polite">
<div class="inspector-top">
<span id="selection-kind">Assertion</span>
<span class="object-number" id="selection-number">01</span>
</div>
<h2 id="selection-title">Claim card</h2>
<p id="selection-copy"></p>
<div class="metric">
<span id="selection-label">Evidence links</span>
<strong id="selection-value">0</strong>
</div>
</aside>
<div class="legend" aria-hidden="true">
<span><i class="swatch"></i> Assertion</span>
<span><i class="swatch evidence"></i> Evidence well</span>
<span><i class="swatch uncertainty"></i> Uncertainty</span>
</div>
<div class="hint">Drag to orbit · Scroll to zoom · Click an object</div>
</div>
<div id="loading">Building epistemic map</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const stage = document.getElementById("stage");
const loading = document.getElementById("loading");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x10151d);
scene.fog = new THREE.Fog(0x10151d, 13, 25);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
50
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
stage.appendChild(renderer.domElement);
const maxAnisotropy = Math.min(
4,
renderer.capabilities.getMaxAnisotropy()
);
const palette = {
stage: 0x18212c,
stageEdge: 0x2a3948,
paper: 0xf1eadc,
navy: 0x26394d,
navyDark: 0x111c27,
cyan: 0x63d4d1,
cyanDark: 0x2c8e91,
amber: 0xffb45b,
amberDark: 0xb85d29,
gray: 0x7f91a2,
line: 0x91a9ba
};
const material = (color, options = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.78,
metalness: 0.04,
flatShading: true,
...options
});
const paperMat = material(palette.paper, { roughness: 0.88 });
const navyMat = material(palette.navy);
const darkMat = material(palette.navyDark, { roughness: 0.94 });
const cyanMat = material(palette.cyan, {
roughness: 0.52,
metalness: 0.08
});
const amberMat = material(palette.amber, {
roughness: 0.54,
metalness: 0.06
});
function makeTexture(width, height, paint) {
const canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
const context = canvas.getContext("2d");
paint(context, canvas);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = maxAnisotropy;
return texture;
}
function addEdges(mesh, color = 0x91a9ba, opacity = 0.42) {
const edges = new THREE.EdgesGeometry(mesh.geometry, 28);
const line = new THREE.LineSegments(
edges,
new THREE.LineBasicMaterial({
color,
transparent: true,
opacity
})
);
line.renderOrder = 2;
mesh.add(line);
return line;
}
function makeLabelPlane(texture, width, height) {
return new THREE.Mesh(
new THREE.PlaneGeometry(width, height),
new THREE.MeshBasicMaterial({
map: texture,
transparent: true,
depthWrite: false,
side: THREE.DoubleSide
})
);
}
// Lighting
scene.add(new THREE.HemisphereLight(0xc8ddff, 0x18202a, 1.8));
const keyLight = new THREE.DirectionalLight(0xffefd7, 3.2);
keyLight.position.set(4.5, 9, 6);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -9;
keyLight.shadow.camera.right = 9;
keyLight.shadow.camera.top = 8;
keyLight.shadow.camera.bottom = -6;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 25;
keyLight.shadow.bias = -0.0008;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x62cddd, 1.25);
rimLight.position.set(-7, 4, -6);
scene.add(rimLight);
const warmLight = new THREE.PointLight(0xffa957, 13, 8, 2);
warmLight.position.set(4.5, 2.6, 1);
scene.add(warmLight);
// Low-poly presentation plinth
const plinth = new THREE.Mesh(
new THREE.CylinderGeometry(7.4, 7.65, 0.28, 32),
material(palette.stage, { roughness: 0.94 })
);
plinth.position.y = -0.18;
plinth.receiveShadow = true;
scene.add(plinth);
addEdges(plinth, palette.stageEdge, 0.28);
const outerRing = new THREE.Mesh(
new THREE.RingGeometry(7.12, 7.15, 64),
new THREE.MeshBasicMaterial({
color: palette.cyan,
transparent: true,
opacity: 0.13,
side: THREE.DoubleSide
})
);
outerRing.rotation.x = -Math.PI / 2;
outerRing.position.y = -0.032;
scene.add(outerRing);
const innerRing = new THREE.Mesh(
new THREE.RingGeometry(5.9, 5.915, 64),
new THREE.MeshBasicMaterial({
color: 0x6e8294,
transparent: true,
opacity: 0.12,
side: THREE.DoubleSide
})
);
innerRing.rotation.x = -Math.PI / 2;
innerRing.position.y = -0.03;
scene.add(innerRing);
// ------------------------------------------------------------
// 1. ASSERTION: an upright, elevated card
// ------------------------------------------------------------
const claimRoot = new THREE.Group();
claimRoot.position.set(-3.15, 0, 0.1);
claimRoot.rotation.y = 0.12;
claimRoot.userData.kind = "claim";
scene.add(claimRoot);
const claimBase = new THREE.Mesh(
new THREE.BoxGeometry(2.9, 0.18, 1.15),
navyMat
);
claimBase.position.set(0, 0.11, 0.05);
claimBase.castShadow = true;
claimBase.receiveShadow = true;
claimRoot.add(claimBase);
addEdges(claimBase, 0x88a1b4, 0.34);
for (const x of [-0.94, 0.94]) {
const post = new THREE.Mesh(
new THREE.CylinderGeometry(0.055, 0.075, 1.45, 8),
darkMat
);
post.position.set(x, 0.88, -0.03);
post.castShadow = true;
claimRoot.add(post);
}
const card = new THREE.Mesh(
new THREE.BoxGeometry(2.75, 2.95, 0.16),
paperMat
);
card.position.set(0, 2.03, 0);
card.castShadow = true;
card.receiveShadow = true;
claimRoot.add(card);
addEdges(card, 0x5b7180, 0.48);
const claimTexture = makeTexture(900, 1000, (ctx) => {
ctx.fillStyle = "#f1eadc";
ctx.fillRect(0, 0, 900, 1000);
ctx.fillStyle = "#63d4d1";
ctx.fillRect(0, 0, 20, 1000);
ctx.fillStyle = "#24384b";
ctx.font = "700 27px Arial, sans-serif";
ctx.letterSpacing = "5px";
ctx.fillText("ASSERTION / 01", 72, 91);
ctx.fillStyle = "#63d4d1";
ctx.fillRect(72, 126, 758, 5);
ctx.fillStyle = "#1c2c3b";
ctx.font = "800 73px Arial, sans-serif";
ctx.fillText("A proposition", 72, 270);
ctx.fillText("awaiting", 72, 352);
ctx.fillText("corroboration.", 72, 434);
ctx.fillStyle = "#607080";
ctx.font = "400 29px Arial, sans-serif";
ctx.fillText("An isolated statement.", 74, 545);
ctx.fillText("No observations are linked yet.", 74, 588);
ctx.strokeStyle = "#9ca9b3";
ctx.lineWidth = 2;
ctx.strokeRect(72, 704, 310, 78);
ctx.fillStyle = "#2b3d4e";
ctx.font = "700 22px Arial, sans-serif";
ctx.fillText("STATUS / OPEN", 98, 753);
ctx.fillStyle = "#71818e";
ctx.font = "400 20px Arial, sans-serif";
ctx.fillText("STATEMENT", 72, 930);
ctx.textAlign = "right";
ctx.fillText("01 / 03", 758, 930);
});
const cardFace = new THREE.Mesh(
new THREE.PlaneGeometry(2.67, 2.87),
new THREE.MeshStandardMaterial({
map: claimTexture,
roughness: 0.9,
metalness: 0
})
);
cardFace.position.set(0, 2.03, 0.086);
claimRoot.add(cardFace);
const claimClip = new THREE.Mesh(
new THREE.BoxGeometry(0.52, 0.18, 0.2),
cyanMat
);
claimClip.position.set(0, 3.56, 0.01);
claimClip.castShadow = true;
claimRoot.add(claimClip);
// ------------------------------------------------------------
// 2. EVIDENCE: a shallow horizontal tray with three empty wells
// ------------------------------------------------------------
const evidenceRoot = new THREE.Group();
evidenceRoot.position.set(0.25, 0, 0.42);
evidenceRoot.userData.kind = "evidence";
scene.add(evidenceRoot);
const trayBase = new THREE.Mesh(
new THREE.BoxGeometry(3.75, 0.34, 2.5),
navyMat
);
trayBase.position.y = 0.22;
trayBase.castShadow = true;
trayBase.receiveShadow = true;
evidenceRoot.add(trayBase);
addEdges(trayBase, 0x91a9ba, 0.42);
const trayTop = new THREE.Mesh(
new THREE.BoxGeometry(3.56, 0.08, 2.31),
material(0x30485c)
);
trayTop.position.y = 0.41;
trayTop.castShadow = true;
trayTop.receiveShadow = true;
evidenceRoot.add(trayTop);
const wellWidth = 0.94;
const wellDepth = 1.55;
const wellXs = [-1.08, 0, 1.08];
wellXs.forEach((x, index) => {
const well = new THREE.Group();
well.position.x = x;
evidenceRoot.add(well);
const bottom = new THREE.Mesh(
new THREE.BoxGeometry(wellWidth, 0.035, wellDepth),
darkMat
);
bottom.position.y = 0.465;
bottom.receiveShadow = true;
well.add(bottom);
const wallHeight = 0.19;
const wallThickness = 0.075;
for (const side of [-1, 1]) {
const sideWall = new THREE.Mesh(
new THREE.BoxGeometry(
wallThickness,
wallHeight,
wellDepth + wallThickness
),
navyMat
);
sideWall.position.set(
side * (wellWidth / 2 + wallThickness / 2),
0.54,
0
);
sideWall.castShadow = true;
well.add(sideWall);
const endWall = new THREE.Mesh(
new THREE.BoxGeometry(
wellWidth + wallThickness * 2,
wallHeight,
wallThickness
),
navyMat
);
endWall.position.set(
0,
0.54,
side * (wellDepth / 2 + wallThickness / 2)
);
endWall.castShadow = true;
well.add(endWall);
}
// Dashed outline emphasizes that this is an empty receptacle.
const outlineGeometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(-wellWidth / 2, 0.487, -wellDepth / 2),
new THREE.Vector3(wellWidth / 2, 0.487, -wellDepth / 2),
new THREE.Vector3(wellWidth / 2, 0.487, wellDepth / 2),
new THREE.Vector3(-wellWidth / 2, 0.487, wellDepth / 2)
]);
const dashedOutline = new THREE.LineLoop(
outlineGeometry,
new THREE.LineDashedMaterial({
color: palette.cyan,
dashSize: 0.075,
gapSize: 0.065,
transparent: true,
opacity: 0.46
})
);
dashedOutline.computeLineDistances();
well.add(dashedOutline);
const slotTexture = makeTexture(512, 128, (ctx) => {
ctx.clearRect(0, 0, 512, 128);
ctx.fillStyle = "#9edbd9";
ctx.font = "700 43px Arial, sans-serif";
ctx.textAlign = "center";
ctx.fillText(`0${index + 1} / EMPTY`, 256, 78);
});
const slotLabel = makeLabelPlane(slotTexture, 0.75, 0.19);
slotLabel.rotation.x = -Math.PI / 2;
slotLabel.position.set(0, 0.458, 1.0);
well.add(slotLabel);
});
const trayLabelTexture = makeTexture(1400, 120, (ctx) => {
ctx.clearRect(0, 0, 1400, 120);
ctx.fillStyle = "#dce8ed";
ctx.font = "700 39px Arial, sans-serif";
ctx.fillText("EVIDENCE TRAY", 25, 61);
ctx.fillStyle = "#63d4d1";
ctx.font = "700 30px Arial, sans-serif";
ctx.textAlign = "right";
ctx.fillText("0 OF 3 OBSERVATIONS", 1370, 61);
});
const trayLabel = makeLabelPlane(trayLabelTexture, 3.2, 0.27);
trayLabel.position.set(0, 0.22, 1.256);
evidenceRoot.add(trayLabel);
const trayHandle = new THREE.Mesh(
new THREE.BoxGeometry(1.2, 0.12, 0.18),
cyanMat
);
trayHandle.position.set(0, 0.47, 1.14);
trayHandle.castShadow = true;
evidenceRoot.add(trayHandle);
// ------------------------------------------------------------
// 3. UNCERTAINTY: separate, elevated amber marker
// ------------------------------------------------------------
const uncertaintyRoot = new THREE.Group();
uncertaintyRoot.position.set(3.65, 0, -0.12);
uncertaintyRoot.userData.kind = "uncertainty";
scene.add(uncertaintyRoot);
const uncertaintyBase = new THREE.Mesh(
new THREE.CylinderGeometry(0.88, 1.02, 0.23, 8),
darkMat
);
uncertaintyBase.position.y = 0.13;
uncertaintyBase.castShadow = true;
uncertaintyBase.receiveShadow = true;
uncertaintyRoot.add(uncertaintyBase);
addEdges(uncertaintyBase, palette.amber, 0.3);
const uncertaintyPost = new THREE.Mesh(
new THREE.CylinderGeometry(0.055, 0.085, 1.18, 8),
navyMat
);
uncertaintyPost.position.y = 0.78;
uncertaintyPost.castShadow = true;
uncertaintyRoot.add(uncertaintyPost);
const markerFloat = new THREE.Group();
markerFloat.position.y = 1.62;
uncertaintyRoot.add(markerFloat);
const marker = new THREE.Mesh(
new THREE.OctahedronGeometry(0.66, 0),
amberMat
);
marker.castShadow = true;
marker.receiveShadow = true;
markerFloat.add(marker);
addEdges(marker, 0xffd4a0, 0.42);
const markerRing = new THREE.Mesh(
new THREE.TorusGeometry(0.86, 0.032, 4, 18),
material(palette.amberDark, {
roughness: 0.55,
metalness: 0.18
})
);
markerRing.rotation.set(0.68, 0.1, 0.28);
markerRing.castShadow = true;
markerFloat.add(markerRing);
const exclamationTexture = makeTexture(256, 256, (ctx) => {
ctx.clearRect(0, 0, 256, 256);
ctx.fillStyle = "#2c2118";
ctx.font = "800 188px Arial, sans-serif";
ctx.textAlign = "center";
ctx.fillText("!", 128, 194);
});
const exclamation = new THREE.Sprite(
new THREE.SpriteMaterial({
map: exclamationTexture,
transparent: true,
depthTest: false
})
);
exclamation.position.set(0, 0, 0.57);
exclamation.scale.set(0.38, 0.38, 0.38);
markerFloat.add(exclamation);
const uncertaintyLabelTexture = makeTexture(900, 150, (ctx) => {
ctx.clearRect(0, 0, 900, 150);
ctx.fillStyle = "#ffbd70";
ctx.font = "700 43px Arial, sans-serif";
ctx.textAlign = "center";
ctx.fillText("UNCERTAINTY", 450, 75);
});
const uncertaintyLabel = makeLabelPlane(
uncertaintyLabelTexture,
1.55,
0.26
);
uncertaintyLabel.position.set(0, 0.37, 0.91);
uncertaintyRoot.add(uncertaintyLabel);
// Selection halos
const claimHalo = new THREE.Mesh(
new THREE.RingGeometry(1.64, 1.68, 36),
new THREE.MeshBasicMaterial({
color: palette.cyan,
transparent: true,
opacity: 0.48,
side: THREE.DoubleSide
})
);
claimHalo.rotation.x = -Math.PI / 2;
claimHalo.position.y = 0.005;
claimRoot.add(claimHalo);
const evidenceHalo = new THREE.LineSegments(
new THREE.EdgesGeometry(
new THREE.BoxGeometry(3.9, 0.48, 2.65)
),
new THREE.LineBasicMaterial({
color: palette.cyan,
transparent: true,
opacity: 0.62
})
);
evidenceHalo.position.y = 0.28;
evidenceRoot.add(evidenceHalo);
const uncertaintyHalo = new THREE.Mesh(
new THREE.RingGeometry(1.04, 1.08, 36),
new THREE.MeshBasicMaterial({
color: palette.cyan,
transparent: true,
opacity: 0.52,
side: THREE.DoubleSide
})
);
uncertaintyHalo.rotation.x = -Math.PI / 2;
uncertaintyHalo.position.y = 0.005;
uncertaintyRoot.add(uncertaintyHalo);
// ------------------------------------------------------------
// Camera controls, implemented without Three.js addons
// ------------------------------------------------------------
const target = new THREE.Vector3(0, 1.2, 0);
let radius = 11.2;
let theta = 0.48;
let phi = 1.05;
let autoOrbit = false;
function updateCamera() {
const sinPhi = Math.sin(phi);
camera.position.set(
target.x + radius * sinPhi * Math.sin(theta),
target.y + radius * Math.cos(phi),
target.z + radius * sinPhi * Math.cos(theta)
);
camera.lookAt(target);
}
updateCamera();
const canvas = renderer.domElement;
let dragging = false;
let pointerId = null;
let lastX = 0;
let lastY = 0;
let travel = 0;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
pointerId = event.pointerId;
lastX = event.clientX;
lastY = event.clientY;
travel = 0;
canvas.setPointerCapture(pointerId);
canvas.style.cursor = "grabbing";
});
canvas.addEventListener("pointermove", (event) => {
if (dragging && event.pointerId === pointerId) {
const dx = event.clientX - lastX;
const dy = event.clientY - lastY;
lastX = event.clientX;
lastY = event.clientY;
travel += Math.abs(dx) + Math.abs(dy);
theta -= dx * 0.0055;
phi = THREE.MathUtils.clamp(phi - dy * 0.0045, 0.42, 1.43);
autoOrbit = false;
updateOrbitButton();
updateCamera();
} else {
const hit = pick(event);
canvas.style.cursor = hit ? "pointer" : "grab";
}
});
function endDrag(event) {
if (!dragging || event.pointerId !== pointerId) return;
dragging = false;
canvas.style.cursor = "grab";
if (canvas.hasPointerCapture(pointerId)) {
canvas.releasePointerCapture(pointerId);
}
if (travel < 6) {
const hit = pick(event);
if (hit) selectObject(hit);
}
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
radius = THREE.MathUtils.clamp(
radius + event.deltaY * 0.007,
7.3,
15.5
);
updateCamera();
},
{ passive: false }
);
// Selection and inspection
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
const selectableRoots = [claimRoot, evidenceRoot, uncertaintyRoot];
const selectionData = {
claim: {
number: "01",
kind: "Assertion",
title: "Claim card",
copy:
"The upright card carries the proposition itself. Its raised, vertical placement makes it a statement—not a measurement.",
label: "Evidence links",
value: "0"
},
evidence: {
number: "02",
kind: "Evidence",
title: "Evidence tray",
copy:
"The shallow horizontal tray contains three recessed wells for supporting observations. Every well is empty, so no support is implied.",
label: "Occupied wells",
value: "0 / 3"
},
uncertainty: {
number: "03",
kind: "Uncertainty",
title: "Uncertainty marker",
copy:
"The isolated amber faceted marker records uncertainty separately. It is deliberately not placed inside an evidence well.",
label: "Representation",
value: "SEPARATE"
}
};
const selectionKind = document.getElementById("selection-kind");
const selectionNumber = document.getElementById("selection-number");
const selectionTitle = document.getElementById("selection-title");
const selectionCopy = document.getElementById("selection-copy");
const selectionLabel = document.getElementById("selection-label");
const selectionValue = document.getElementById("selection-value");
function selectObject(kind) {
const data = selectionData[kind];
if (!data) return;
selectionKind.textContent = data.kind;
selectionNumber.textContent = data.number;
selectionTitle.textContent = data.title;
selectionCopy.textContent = data.copy;
selectionLabel.textContent = data.label;
selectionValue.textContent = data.value;
claimHalo.visible = kind === "claim";
evidenceHalo.visible = kind === "evidence";
uncertaintyHalo.visible = kind === "uncertainty";
}
function pick(event) {
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 intersections = raycaster.intersectObjects(
selectableRoots,
true
);
if (!intersections.length) return null;
let object = intersections[0].object;
while (object && !object.userData.kind) {
object = object.parent;
}
return object?.userData.kind ?? null;
}
selectObject("claim");
// Buttons
const resetButton = document.getElementById("reset");
const orbitButton = document.getElementById("orbit");
function updateOrbitButton() {
orbitButton.setAttribute("aria-pressed", String(autoOrbit));
orbitButton.textContent = autoOrbit ? "Pause orbit" : "Auto orbit";
}
resetButton.addEventListener("click", () => {
radius = 11.2;
theta = 0.48;
phi = 1.05;
autoOrbit = false;
updateOrbitButton();
updateCamera();
});
orbitButton.addEventListener("click", () => {
autoOrbit = !autoOrbit;
updateOrbitButton();
});
// Resize
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
// Render loop
const clock = new THREE.Clock();
function animate() {
const elapsed = clock.getElapsedTime();
if (autoOrbit && !dragging) {
theta += 0.0024;
updateCamera();
}
markerFloat.position.y = 1.62 + Math.sin(elapsed * 1.05) * 0.045;
markerFloat.rotation.y = elapsed * 0.18;
markerRing.rotation.z = 0.28 + Math.sin(elapsed * 0.55) * 0.06;
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
loading.classList.add("ready");
setTimeout(() => loading.remove(), 350);
animate();
</script>
</body>
</html>
```