Prompt specification
Build or customize the Three.js 3D scene "Reflex route versus conscious report" 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: Reflex route versus conscious report
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/reflex-route-versus-conscious-report-x1018
Scene Description Prompt:
I'd like to see this as a cutaway Three.js scene: reflex route versus conscious report. Animate two symbolic paths from one harmless touch input, one to a motor response and another to higher processing; label timing illustrative rather than physiological measurement. Use cdnjs and return one self-contained HTML file.
Working Three.js Starter (reflex-route-versus-conscious-report-x1018):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>One Touch, Two Processing Routes</title>
<style>
:root {
--bg: #071018;
--panel: rgba(11, 23, 33, 0.78);
--panel-border: rgba(190, 222, 235, 0.16);
--text: #e8f4f7;
--muted: #93aab4;
--cyan: #61e5e8;
--amber: #ffb45b;
--white: #f4fbff;
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body {
background:
radial-gradient(circle at 48% 40%, rgba(31, 80, 94, 0.2), transparent 42%),
linear-gradient(145deg, #071018 0%, #09151e 55%, #061017 100%);
}
#scene {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
}
#scene:active { cursor: grabbing; }
.hero {
position: fixed;
top: 26px;
left: 28px;
width: min(430px, calc(100vw - 56px));
pointer-events: none;
z-index: 4;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 11px;
color: #a9c1cb;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 22px;
height: 1px;
background: var(--cyan);
box-shadow: 0 0 12px rgba(97, 229, 232, 0.7);
}
h1 {
margin: 0;
max-width: 420px;
font-size: clamp(30px, 4vw, 54px);
line-height: 0.98;
letter-spacing: -0.045em;
font-weight: 660;
text-wrap: balance;
text-shadow: 0 4px 28px rgba(0, 0, 0, 0.28);
}
.intro {
max-width: 390px;
margin: 16px 0 0;
color: #a9bbc4;
font-size: 13px;
line-height: 1.55;
}
.timing-note {
display: inline-flex;
align-items: center;
gap: 8px;
margin-top: 15px;
padding: 8px 11px;
border: 1px solid rgba(255, 180, 91, 0.28);
border-radius: 999px;
background: rgba(255, 180, 91, 0.07);
color: #ffd5a4;
font-size: 11px;
letter-spacing: 0.025em;
}
.timing-note::before {
content: "";
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--amber);
box-shadow: 0 0 10px rgba(255, 180, 91, 0.8);
}
.rail {
position: fixed;
top: 26px;
right: 26px;
width: 248px;
display: grid;
gap: 12px;
z-index: 5;
}
.panel {
border: 1px solid var(--panel-border);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
}
.legend { padding: 16px; }
.panel-title {
margin: 0 0 13px;
color: #8ca3ad;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.legend-row {
display: grid;
grid-template-columns: 10px 1fr;
gap: 10px;
margin-top: 12px;
}
.legend-row:first-of-type { margin-top: 0; }
.legend-line {
width: 7px;
height: 7px;
margin-top: 4px;
border-radius: 50%;
}
.legend-line.amber {
background: var(--amber);
box-shadow: 0 0 12px rgba(255, 180, 91, 0.65);
}
.legend-line.cyan {
background: var(--cyan);
box-shadow: 0 0 12px rgba(97, 229, 232, 0.65);
}
.legend-name {
display: block;
font-size: 12px;
font-weight: 700;
}
.legend-copy {
display: block;
margin-top: 3px;
color: #8fa5af;
font-size: 11px;
line-height: 1.45;
}
.report {
min-height: 112px;
padding: 16px;
opacity: 0;
transform: translateY(10px) scale(0.97);
transform-origin: top center;
transition: opacity 0.25s ease, transform 0.25s ease;
overflow: hidden;
}
.report::before {
content: "";
display: block;
width: 28px;
height: 2px;
margin-bottom: 13px;
background: var(--cyan);
box-shadow: 0 0 12px rgba(97, 229, 232, 0.65);
}
.report-kicker {
color: var(--cyan);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.report-quote {
margin: 8px 0 6px;
color: #f1fbfd;
font-size: 17px;
line-height: 1.28;
font-weight: 560;
}
.report-note {
color: #829aa5;
font-size: 10px;
line-height: 1.4;
}
#labels {
position: fixed;
inset: 0;
pointer-events: none;
z-index: 3;
}
.world-label {
position: absolute;
min-width: 108px;
padding: 8px 10px 8px 12px;
border: 1px solid rgba(222, 240, 246, 0.17);
border-radius: 10px;
background: rgba(7, 17, 25, 0.82);
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
transform: translate(-50%, -50%);
opacity: 0;
transition: opacity 0.25s ease;
will-change: left, top, opacity;
}
.world-label::before {
content: "";
position: absolute;
left: 13px;
top: 100%;
width: 1px;
height: 16px;
background: linear-gradient(rgba(220, 240, 245, 0.42), transparent);
}
.world-label .label-title {
display: block;
color: #eef8fa;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.02em;
}
.world-label .label-sub {
display: block;
margin-top: 2px;
color: #829aa5;
font-size: 9px;
white-space: nowrap;
}
.world-label.touch { border-color: rgba(244, 251, 255, 0.28); }
.world-label.touch .label-title { color: var(--white); }
.world-label.amber { border-color: rgba(255, 180, 91, 0.32); }
.world-label.amber .label-title { color: #ffd19a; }
.world-label.cyan { border-color: rgba(97, 229, 232, 0.32); }
.world-label.cyan .label-title { color: #9af4f5; }
.transport {
position: fixed;
left: 50%;
bottom: 24px;
width: min(720px, calc(100vw - 48px));
padding: 14px 16px 13px;
transform: translateX(-50%);
z-index: 6;
}
.transport-top {
display: flex;
align-items: center;
gap: 12px;
}
button {
appearance: none;
border: 1px solid rgba(220, 240, 246, 0.17);
border-radius: 9px;
background: rgba(226, 244, 248, 0.08);
color: var(--text);
padding: 9px 13px;
font: inherit;
font-size: 11px;
font-weight: 700;
cursor: pointer;
transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
button:hover {
background: rgba(226, 244, 248, 0.13);
border-color: rgba(220, 240, 246, 0.3);
}
button:active { transform: translateY(1px); }
button.primary {
min-width: 76px;
border-color: rgba(97, 229, 232, 0.35);
background: rgba(97, 229, 232, 0.13);
color: #b9fbfc;
}
#scrubber {
appearance: none;
flex: 1;
height: 4px;
border-radius: 99px;
outline: none;
background:
linear-gradient(to right,
var(--cyan) 0%,
var(--cyan) var(--progress, 0%),
rgba(225, 242, 247, 0.13) var(--progress, 0%),
rgba(225, 242, 247, 0.13) 100%);
cursor: pointer;
}
#scrubber::-webkit-slider-thumb {
appearance: none;
width: 13px;
height: 13px;
border: 2px solid #d9fbff;
border-radius: 50%;
background: #16333b;
box-shadow: 0 0 0 4px rgba(97, 229, 232, 0.11), 0 0 13px rgba(97, 229, 232, 0.5);
}
#scrubber::-moz-range-thumb {
width: 11px;
height: 11px;
border: 2px solid #d9fbff;
border-radius: 50%;
background: #16333b;
box-shadow: 0 0 0 4px rgba(97, 229, 232, 0.11), 0 0 13px rgba(97, 229, 232, 0.5);
}
#status {
min-width: 180px;
color: #a8bcc5;
font-size: 10px;
text-align: right;
white-space: nowrap;
}
.transport-note {
display: flex;
justify-content: space-between;
gap: 18px;
margin-top: 10px;
color: #718994;
font-size: 9px;
line-height: 1.35;
}
.transport-note strong {
color: #a9bdc6;
font-weight: 650;
}
.orbit-hint {
position: fixed;
right: 28px;
bottom: 30px;
color: rgba(166, 190, 200, 0.55);
font-size: 9px;
letter-spacing: 0.04em;
pointer-events: none;
z-index: 2;
}
.cutaway-tag {
position: fixed;
left: 50%;
top: 22px;
transform: translateX(-50%);
padding: 7px 11px;
border: 1px solid rgba(210, 234, 241, 0.12);
border-radius: 999px;
background: rgba(7, 16, 24, 0.48);
color: rgba(204, 226, 234, 0.65);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.16em;
text-transform: uppercase;
pointer-events: none;
z-index: 2;
}
@media (max-width: 900px) {
.hero { width: 360px; }
.intro { max-width: 330px; }
.rail { width: 220px; }
.orbit-hint { display: none; }
}
@media (max-width: 700px) {
.hero {
top: 18px;
left: 18px;
width: calc(100vw - 36px);
}
h1 { max-width: 300px; font-size: 34px; }
.intro { max-width: 310px; font-size: 12px; }
.timing-note { margin-top: 10px; }
.rail {
top: auto;
right: 18px;
bottom: 154px;
width: 190px;
}
.legend { display: none; }
.report { min-height: 0; padding: 13px; }
.report-quote { font-size: 14px; }
.report-note { display: none; }
.cutaway-tag { display: none; }
.transport {
bottom: 14px;
width: calc(100vw - 28px);
padding: 12px;
}
.transport-top { flex-wrap: wrap; }
#status {
order: 3;
width: 100%;
text-align: left;
margin-top: 2px;
}
.transport-note { font-size: 8px; }
.transport-note span:last-child { display: none; }
.world-label { transform: translate(-50%, -50%) scale(0.88); }
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Animated cutaway showing a reflex route and a conscious report route from one touch"></canvas>
<header class="hero">
<div class="eyebrow">Symbolic neuroscience cutaway</div>
<h1>One touch.<br>Two processing routes.</h1>
<p class="intro">
A harmless touch begins a spinal shortcut toward a motor response and a longer
ascending route toward higher processing and conscious report.
</p>
<div class="timing-note">Timing is illustrative—not physiological measurement</div>
</header>
<div class="cutaway-tag">Cutaway view · symbolic pathways</div>
<aside class="rail" aria-label="Route legend and conscious report">
<section class="panel legend">
<h2 class="panel-title">Pathway key</h2>
<div class="legend-row">
<span class="legend-line amber"></span>
<div>
<span class="legend-name">Reflex route</span>
<span class="legend-copy">Touch → spinal processing → motor response</span>
</div>
</div>
<div class="legend-row">
<span class="legend-line cyan"></span>
<div>
<span class="legend-name">Conscious route</span>
<span class="legend-copy">Touch → higher processing → conscious report</span>
</div>
</div>
</section>
<section id="report" class="panel report" aria-live="polite">
<div class="report-kicker">Conscious report</div>
<div class="report-quote">“I felt a gentle touch.”</div>
<div class="report-note">A symbolic report formed after higher processing.</div>
</section>
</aside>
<div id="labels" aria-hidden="true"></div>
<section class="panel transport" aria-label="Animation controls">
<div class="transport-top">
<button id="play" class="primary" type="button">Pause</button>
<button id="replay" type="button">Replay</button>
<input id="scrubber" type="range" min="0" max="1000" value="0" aria-label="Animation progress">
<div id="status" aria-live="polite">Input arrives</div>
</div>
<div class="transport-note">
<span><strong>Relative sequence only:</strong> route order is schematic, not measured latency.</span>
<span>Paths are explanatory abstractions.</span>
</div>
</section>
<div class="orbit-hint">Drag to orbit · scroll to zoom · double-click to reset</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.getElementById("scene");
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
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.15;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071018);
scene.fog = new THREE.Fog(0x071018, 9.5, 17);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
40
);
const cameraState = {
yaw: 0.38,
pitch: 0.08,
radius: 7.8,
target: new THREE.Vector3(0, 1.95, 0)
};
function updateCamera() {
const { yaw, pitch, radius, target } = cameraState;
camera.position.set(
target.x + radius * Math.sin(yaw) * Math.cos(pitch),
target.y + radius * Math.sin(pitch),
target.z + radius * Math.cos(yaw) * Math.cos(pitch)
);
camera.lookAt(target);
}
updateCamera();
scene.add(new THREE.HemisphereLight(0xbdefff, 0x14202b, 1.65));
const keyLight = new THREE.DirectionalLight(0xe7f7ff, 2.4);
keyLight.position.set(4.5, 7, 6);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 16;
keyLight.shadow.camera.left = -5;
keyLight.shadow.camera.right = 5;
keyLight.shadow.camera.top = 6;
keyLight.shadow.camera.bottom = -3;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x65dce5, 1.3);
rimLight.position.set(-4, 3.5, -3);
scene.add(rimLight);
const warmLight = new THREE.PointLight(0xffb45b, 1.1, 6, 2);
warmLight.position.set(1.6, 1.8, 1.4);
scene.add(warmLight);
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(22, 22),
new THREE.ShadowMaterial({ color: 0x000000, opacity: 0.24 })
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.52;
floor.receiveShadow = true;
scene.add(floor);
const grid = new THREE.GridHelper(16, 28, 0x284451, 0x132630);
grid.position.y = -0.505;
grid.material.transparent = true;
grid.material.opacity = 0.28;
scene.add(grid);
const bodyGroup = new THREE.Group();
scene.add(bodyGroup);
const ghostMaterial = new THREE.MeshPhysicalMaterial({
color: 0x9ac3d0,
transparent: true,
opacity: 0.115,
roughness: 0.28,
metalness: 0.02,
transmission: 0.12,
side: THREE.DoubleSide,
depthWrite: false
});
const rimMaterial = new THREE.MeshBasicMaterial({
color: 0xa6d3df,
transparent: true,
opacity: 0.22,
side: THREE.DoubleSide,
depthWrite: false
});
const tissueMaterial = new THREE.MeshStandardMaterial({
color: 0x8aa8b4,
roughness: 0.62,
metalness: 0.05,
transparent: true,
opacity: 0.56
});
const nerveMaterial = new THREE.MeshStandardMaterial({
color: 0xc1e0e8,
roughness: 0.55,
transparent: true,
opacity: 0.52
});
function halfEllipsoid(rx, ry, rz, position) {
const geometry = new THREE.SphereGeometry(1, 48, 32, Math.PI, Math.PI);
const mesh = new THREE.Mesh(geometry, ghostMaterial);
mesh.scale.set(rx, ry, rz);
mesh.position.copy(position);
bodyGroup.add(mesh);
return mesh;
}
function ellipseOutline(rx, ry, center, opacity = 0.22) {
const points = [];
for (let i = 0; i < 96; i++) {
const a = (i / 96) * Math.PI * 2;
points.push(new THREE.Vector3(
center.x + Math.cos(a) * rx,
center.y + Math.sin(a) * ry,
center.z
));
}
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({
color: 0xa6d3df,
transparent: true,
opacity
});
const line = new THREE.LineLoop(geometry, material);
bodyGroup.add(line);
return line;
}
// Back half of the body is shown, leaving the front open as a cutaway.
const torso = halfEllipsoid(0.84, 1.25, 0.58, new THREE.Vector3(0, 1.12, 0));
const pelvis = halfEllipsoid(0.72, 0.53, 0.48, new THREE.Vector3(0, 0.03, 0));
const head = halfEllipsoid(0.83, 0.96, 0.72, new THREE.Vector3(0.04, 3.43, 0));
ellipseOutline(0.83, 0.96, new THREE.Vector3(0.04, 3.43, 0.01), 0.29);
ellipseOutline(0.84, 1.25, new THREE.Vector3(0, 1.12, 0.01), 0.20);
ellipseOutline(0.72, 0.53, new THREE.Vector3(0, 0.03, 0.01), 0.16);
const neckGeometry = new THREE.CylinderGeometry(
0.27, 0.31, 0.7, 36, 1, true, Math.PI / 2, Math.PI
);
const neck = new THREE.Mesh(neckGeometry, ghostMaterial);
neck.position.set(0.02, 2.5, 0);
bodyGroup.add(neck);
// Stylized ribs inside the torso.
const ribMaterial = new THREE.MeshStandardMaterial({
color: 0x91b6c2,
transparent: true,
opacity: 0.25,
roughness: 0.7
});
[1.68, 1.42, 1.16, 0.9].forEach((y, index) => {
const width = 0.57 - index * 0.035;
const curve = new THREE.CatmullRomCurve3([
new THREE.Vector3(-width, y, -0.05),
new THREE.Vector3(-width * 0.55, y + 0.08, -0.34),
new THREE.Vector3(0, y + 0.11, -0.43),
new THREE.Vector3(width * 0.55, y + 0.08, -0.34),
new THREE.Vector3(width, y, -0.05)
]);
const rib = new THREE.Mesh(
new THREE.TubeGeometry(curve, 40, 0.014, 7, false),
ribMaterial
);
bodyGroup.add(rib);
});
// Spinal cord.
const spinalCurve = new THREE.CatmullRomCurve3([
new THREE.Vector3(0.02, 2.54, -0.12),
new THREE.Vector3(0.08, 2.12, -0.14),
new THREE.Vector3(0.05, 1.63, -0.15),
new THREE.Vector3(0.08, 1.27, -0.15),
new THREE.Vector3(0.00, 0.68, -0.14),
new THREE.Vector3(-0.06, 0.18, -0.10)
]);
const spinalCord = new THREE.Mesh(
new THREE.TubeGeometry(spinalCurve, 80, 0.035, 10, false),
nerveMaterial
);
bodyGroup.add(spinalCord);
const vertebraMaterial = new THREE.MeshStandardMaterial({
color: 0xb5d0d8,
transparent: true,
opacity: 0.42,
roughness: 0.68
});
for (let i = 0; i < 10; i++) {
const p = spinalCurve.getPointAt(i / 9);
const vertebra = new THREE.Mesh(
new THREE.SphereGeometry(0.072, 16, 10),
vertebraMaterial
);
vertebra.position.copy(p);
vertebra.scale.set(1, 0.75, 0.8);
bodyGroup.add(vertebra);
}
// Brain: clustered forms suggest a folded, cut-open cerebrum.
const brainGroup = new THREE.Group();
brainGroup.position.set(0.02, 3.43, -0.24);
bodyGroup.add(brainGroup);
const brainMaterials = [
new THREE.MeshStandardMaterial({
color: 0xb9a6ef,
roughness: 0.66,
metalness: 0.03,
emissive: 0x392866,
emissiveIntensity: 0.12
}),
new THREE.MeshStandardMaterial({
color: 0xd0c3f4,
roughness: 0.7,
metalness: 0.02,
emissive: 0x433777,
emissiveIntensity: 0.1
})
];
const brainLobes = [
[-0.20, 0.03, 0.00, 0.31, 0.25, 0.26],
[0.20, 0.04, -0.01, 0.30, 0.24, 0.25],
[-0.08, 0.22, -0.02, 0.29, 0.20, 0.24],
[0.10, -0.17, -0.01, 0.28, 0.20, 0.23],
[-0.33, -0.09, 0.03, 0.20, 0.17, 0.18],
[0.34, -0.07, 0.03, 0.19, 0.16, 0.18]
];
brainLobes.forEach((values, index) => {
const [x, y, z, sx, sy, sz] = values;
const lobe = new THREE.Mesh(
new THREE.SphereGeometry(1, 28, 20),
brainMaterials[index % brainMaterials.length]
);
lobe.position.set(x, y, z);
lobe.scale.set(sx, sy, sz);
lobe.rotation.set(index * 0.2, index * 0.13, index * 0.17);
brainGroup.add(lobe);
});
const brainStem = new THREE.Mesh(
new THREE.CylinderGeometry(0.07, 0.10, 0.48, 18),
new THREE.MeshStandardMaterial({
color: 0xa7c8d2,
roughness: 0.72,
transparent: true,
opacity: 0.72
})
);
brainStem.position.set(0.02, -0.36, -0.05);
brainStem.rotation.z = -0.10;
brainGroup.add(brainStem);
// Arm and hand.
function cylinderBetween(parent, a, b, radius, material, radialSegments = 18) {
const direction = new THREE.Vector3().subVectors(b, a);
const length = direction.length();
const geometry = new THREE.CylinderGeometry(
radius, radius * 0.94, length, radialSegments, 1
);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.copy(a).add(b).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
mesh.castShadow = true;
parent.add(mesh);
return mesh;
}
function sphereJoint(parent, position, radius, material) {
const mesh = new THREE.Mesh(
new THREE.SphereGeometry(radius, 20, 14),
material
);
mesh.position.copy(position);
mesh.castShadow = true;
parent.add(mesh);
return mesh;
}
const shoulder = new THREE.Vector3(0.74, 2.28, 0.02);
const elbow = new THREE.Vector3(1.48, 1.84, 0.03);
const wrist = new THREE.Vector3(2.12, 1.92, 0.04);
cylinderBetween(bodyGroup, shoulder, elbow, 0.14, tissueMaterial);
sphereJoint(bodyGroup, shoulder, 0.17, tissueMaterial);
sphereJoint(bodyGroup, elbow, 0.12, tissueMaterial);
cylinderBetween(bodyGroup, elbow, wrist, 0.095, tissueMaterial);
const handGroup = new THREE.Group();
handGroup.position.copy(wrist);
bodyGroup.add(handGroup);
const palm = new THREE.Mesh(
new THREE.SphereGeometry(1, 24, 16),
tissueMaterial
);
palm.position.set(0.17, -0.01, 0);
palm.scale.set(0.22, 0.115, 0.085);
palm.castShadow = true;
handGroup.add(palm);
const fingerMaterial = tissueMaterial.clone();
fingerMaterial.opacity = 0.68;
const indexGroup = new THREE.Group();
indexGroup.position.set(0.31, -0.045, 0);
handGroup.add(indexGroup);
cylinderBetween(
indexGroup,
new THREE.Vector3(0, 0, 0),
new THREE.Vector3(0.24, -0.17, 0),
0.036,
fingerMaterial
);
sphereJoint(indexGroup, new THREE.Vector3(0.24, -0.17, 0), 0.039, fingerMaterial);
const otherFingers = [
[new THREE.Vector3(0.34, -0.025, 0), new THREE.Vector3(0.56, -0.10, 0)],
[new THREE.Vector3(0.32, 0.015, 0), new THREE.Vector3(0.53, -0.01, 0)],
[new THREE.Vector3(0.28, 0.05, 0), new THREE.Vector3(0.46, 0.07, 0)]
];
otherFingers.forEach(([a, b]) => {
cylinderBetween(handGroup, a, b, 0.034, fingerMaterial);
sphereJoint(handGroup, b, 0.036, fingerMaterial);
});
cylinderBetween(
handGroup,
new THREE.Vector3(0.12, -0.02, 0),
new THREE.Vector3(0.20, -0.18, 0),
0.041,
fingerMaterial
);
// The touch marker is attached to the index fingertip.
const touchMarker = new THREE.Group();
touchMarker.position.set(0.24, -0.17, 0);
indexGroup.add(touchMarker);
const touchCore = new THREE.Mesh(
new THREE.SphereGeometry(0.065, 20, 14),
new THREE.MeshBasicMaterial({ color: 0xf4fbff })
);
touchMarker.add(touchCore);
const touchRingMaterial = new THREE.MeshBasicMaterial({
color: 0xeafcff,
transparent: true,
opacity: 0.8,
depthWrite: false
});
const touchRing = new THREE.Mesh(
new THREE.TorusGeometry(0.11, 0.009, 8, 48),
touchRingMaterial
);
touchMarker.add(touchRing);
const touchLight = new THREE.PointLight(0xd9faff, 1.4, 2.2, 2);
touchMarker.add(touchLight);
// Processing nodes.
function makeProcessingNode(position, color) {
const group = new THREE.Group();
group.position.copy(position);
bodyGroup.add(group);
const core = new THREE.Mesh(
new THREE.SphereGeometry(0.105, 22, 16),
new THREE.MeshStandardMaterial({
color,
emissive: color,
emissiveIntensity: 0.3,
roughness: 0.4
})
);
group.add(core);
const ringMaterial = new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.75,
depthWrite: false
});
const ring = new THREE.Mesh(
new THREE.TorusGeometry(0.18, 0.012, 8, 48),
ringMaterial
);
group.add(ring);
return { group, core, ring };
}
const spinalNode = makeProcessingNode(
new THREE.Vector3(0.08, 1.27, -0.15),
0xffb45b
);
const brainNode = makeProcessingNode(
new THREE.Vector3(-0.07, 3.40, -0.22),
0x61e5e8
);
const colors = {
amber: 0xffb45b,
cyan: 0x61e5e8
};
function makeCurve(points) {
return new THREE.CatmullRomCurve3(
points.map(p => new THREE.Vector3(...p)),
false,
"centripetal"
);
}
const touchPoint = new THREE.Vector3(2.68, 1.71, 0.07);
const reflexIncoming = makeCurve([
[2.68, 1.71, 0.07],
[2.38, 1.87, 0.06],
[1.48, 1.84, 0.04],
[0.74, 2.28, 0.03],
[0.34, 1.87, -0.05],
[0.08, 1.27, -0.15]
]);
const reflexMotor = makeCurve([
[0.08, 1.27, -0.15],
[0.39, 1.85, -0.05],
[0.74, 2.28, 0.03],
[1.48, 1.84, 0.04],
[2.24, 1.91, 0.06],
[2.43, 1.87, 0.06]
]);
const consciousRoute = makeCurve([
[2.68, 1.71, 0.07],
[2.39, 1.88, 0.08],
[1.49, 1.86, 0.06],
[0.76, 2.30, 0.05],
[0.31, 2.75, -0.03],
[0.06, 3.13, -0.13],
[-0.07, 3.40, -0.22]
]);
const flowGeometry = new THREE.SphereGeometry(0.055, 16, 12);
const arrowGeometry = new THREE.ConeGeometry(0.065, 0.18, 10);
const upAxis = new THREE.Vector3(0, 1, 0);
function makeRoute(curve, color, start, end) {
const group = new THREE.Group();
scene.add(group);
const tubeMaterial = new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.065,
depthWrite: false
});
const tube = new THREE.Mesh(
new THREE.TubeGeometry(curve, 100, 0.022, 8, false),
tubeMaterial
);
group.add(tube);
const points = curve.getPoints(180);
const lineGeometry = new THREE.BufferGeometry().setFromPoints(points);
const lineMaterial = new THREE.LineBasicMaterial({
color,
transparent: true,
opacity: 0.95,
depthWrite: false
});
const line = new THREE.Line(lineGeometry, lineMaterial);
line.geometry.setDrawRange(0, 0);
group.add(line);
const pulses = [];
for (let i = 0; i < 5; i++) {
const pulse = new THREE.Mesh(
flowGeometry,
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.95 - i * 0.12,
depthWrite: false
})
);
pulse.visible = false;
group.add(pulse);
pulses.push(pulse);
}
const arrow = new THREE.Mesh(
arrowGeometry,
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.9,
depthWrite: false
})
);
arrow.visible = false;
group.add(arrow);
return {
group,
curve,
color,
start,
end,
line,
tubeMaterial,
pulses,
arrow,
pointCount: points.length
};
}
const routes = [
makeRoute(reflexIncoming, colors.amber, 0.15, 1.25),
makeRoute(reflexMotor, colors.amber, 1.50, 2.55),
makeRoute(consciousRoute, colors.cyan, 0.22, 2.15)
];
const labelContainer = document.getElementById("labels");
const labels = [];
function makeWorldLabel(title, subtitle, className, positionFn, visibleFn) {
const element = document.createElement("div");
element.className = `world-label ${className}`;
element.innerHTML = `
<span class="label-title">${title}</span>
<span class="label-sub">${subtitle}</span>
`;
labelContainer.appendChild(element);
labels.push({ element, positionFn, visibleFn });
}
const worldPosition = new THREE.Vector3();
makeWorldLabel(
"Harmless touch",
"single input",
"touch",
() => touchMarker.getWorldPosition(worldPosition),
t => t < 4.2
);
makeWorldLabel(
"Spinal processing",
"reflex shortcut",
"amber",
() => spinalNode.group.getWorldPosition(worldPosition),
t => t > 0.95
);
makeWorldLabel(
"Higher processing",
"conscious route",
"cyan",
() => brainNode.group.getWorldPosition(worldPosition),
t => t > 1.75
);
makeWorldLabel(
"Motor response",
"symbolic withdrawal",
"amber",
() => handGroup.localToWorld(worldPosition.set(0.32, -0.03, 0)),
t => t > 2.38
);
const labelOffsets = {
touch: [68, -30],
amber: [-92, 30],
cyan: [-86, -38]
};
function projectLabel(label) {
const position = label.positionFn();
const projected = position.clone().project(camera);
const visible = projected.z > -1 && projected.z < 1;
if (!visible) {
label.element.style.opacity = "0";
return;
}
const x = (projected.x * 0.5 + 0.5) * window.innerWidth;
const y = (-projected.y * 0.5 + 0.5) * window.innerHeight;
const classOffset = label.element.classList.contains("touch")
? labelOffsets.touch
: label.element.classList.contains("amber")
? labelOffsets.amber
: labelOffsets.cyan;
label.element.style.left = `${x + classOffset[0]}px`;
label.element.style.top = `${y + classOffset[1]}px`;
label.element.style.opacity = label.visibleFn(timeline) ? "1" : "0";
}
const clamp01 = value => Math.max(0, Math.min(1, value));
const smooth = value => {
const x = clamp01(value);
return x * x * (3 - 2 * x);
};
function updateRoute(route, time) {
const progress = clamp01((time - route.start) / (route.end - route.start));
const revealed = Math.max(2, Math.floor(progress * (route.pointCount - 1)));
route.line.geometry.setDrawRange(0, revealed);
route.tubeMaterial.opacity = 0.055 + progress * 0.055;
route.pulses.forEach((pulse, index) => {
const p = progress - index * 0.07;
if (p <= 0 || p >= 1) {
pulse.visible = false;
return;
}
pulse.visible = true;
pulse.position.copy(route.curve.getPointAt(p));
pulse.scale.setScalar(1 - index * 0.07);
});
if (progress > 0 && progress < 1) {
route.arrow.visible = true;
route.arrow.position.copy(route.curve.getPointAt(progress));
const tangent = route.curve.getTangentAt(progress).normalize();
route.arrow.quaternion.setFromUnitVectors(upAxis, tangent);
} else {
route.arrow.visible = false;
}
}
function updateProcessingNode(node, time, start, end) {
const activity = Math.sin(clamp01((time - start) / (end - start)) * Math.PI);
const settled = time >= end ? 0.2 : 0;
const scale = 1 + activity * 0.52 + settled * 0.12;
node.core.scale.setScalar(scale);
node.ring.scale.setScalar(1 + activity * 0.7);
node.ring.material.opacity = 0.38 + activity * 0.55;
node.core.rotation.y += 0.008;
node.ring.rotation.z += 0.012;
}
const reportElement = document.getElementById("report");
const statusElement = document.getElementById("status");
const playButton = document.getElementById("play");
const replayButton = document.getElementById("replay");
const scrubber = document.getElementById("scrubber");
const duration = 6.0;
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
let timeline = 0;
let playing = !reducedMotion;
let previousTime = performance.now();
function updatePlayButton() {
playButton.textContent = playing ? "Pause" : "Play";
playButton.setAttribute("aria-label", playing ? "Pause animation" : "Play animation");
}
function getStatus(time) {
if (time < 0.2) return "Input arrives";
if (time < 1.25) return "Signals travel";
if (time < 1.55) return "Spinal processing";
if (time < 2.15) return "Motor return • ascent";
if (time < 2.55) return "Motor response";
if (time < 3.2) return "Conscious report forms";
return "Both routes complete";
}
function updateScene(time) {
routes.forEach(route => updateRoute(route, time));
updateProcessingNode(spinalNode, time, 1.20, 1.58);
updateProcessingNode(brainNode, time, 2.08, 2.48);
const touchPhase = clamp01(time / 0.70);
const touchWave = (touchPhase * 2.4) % 1;
touchRing.scale.setScalar(1 + touchWave * 2.1);
touchRingMaterial.opacity = (1 - touchWave) * (time < 0.7 ? 0.85 : 0.12);
touchCore.scale.setScalar(1 + Math.sin(time * 7) * 0.08 * (time < 0.7 ? 1 : 0));
touchLight.intensity = time < 0.7 ? 1.8 * (1 - touchWave * 0.55) : 0.55;
const response = smooth((time - 2.52) / 0.74);
handGroup.rotation.z = -0.14 * response;
handGroup.rotation.x = 0.025 * response;
const reportReveal = smooth((time - 2.38) / 0.58);
reportElement.style.opacity = reportReveal.toFixed(3);
reportElement.style.transform = `translateY(${(1 - reportReveal) * 10}px) scale(${0.97 + reportReveal * 0.03})`;
reportElement.style.pointerEvents = reportReveal > 0.5 ? "auto" : "none";
scrubber.value = Math.round((time / duration) * 1000);
scrubber.style.setProperty("--progress", `${(time / duration) * 100}%`);
statusElement.textContent = getStatus(time);
scene.updateMatrixWorld(true);
labels.forEach(projectLabel);
}
playButton.addEventListener("click", () => {
if (timeline >= duration) timeline = 0;
playing = !playing;
updatePlayButton();
});
replayButton.addEventListener("click", () => {
timeline = 0;
playing = true;
updatePlayButton();
});
scrubber.addEventListener("input", () => {
timeline = (scrubber.value / 1000) * duration;
playing = false;
updatePlayButton();
});
window.addEventListener("keydown", event => {
if (event.code === "Space" && event.target === document.body) {
event.preventDefault();
if (timeline >= duration) timeline = 0;
playing = !playing;
updatePlayButton();
}
});
// Camera interaction implemented directly, without external controls.
let dragging = false;
let lastPointerX = 0;
let lastPointerY = 0;
canvas.addEventListener("pointerdown", event => {
dragging = true;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", event => {
if (!dragging) return;
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
cameraState.yaw = THREE.MathUtils.clamp(
cameraState.yaw + dx * 0.005,
-0.95,
0.95
);
cameraState.pitch = THREE.MathUtils.clamp(
cameraState.pitch + dy * 0.004,
-0.12,
0.72
);
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined && canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener("wheel", event => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius + event.deltaY * 0.006,
5.3,
10.8
);
}, { passive: false });
canvas.addEventListener("dblclick", () => {
cameraState.yaw = 0.38;
cameraState.pitch = 0.08;
cameraState.radius = 7.8;
});
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
});
updatePlayButton();
function animate(now) {
requestAnimationFrame(animate);
const delta = Math.min((now - previousTime) / 1000, 0.05);
previousTime = now;
if (playing) {
timeline += delta;
if (timeline >= duration) {
timeline = duration;
playing = false;
updatePlayButton();
}
}
updateCamera();
updateScene(timeline);
renderer.render(scene, camera);
}
requestAnimationFrame(animate);
</script>
</body>
</html>
```