Prompt specification
Build or customize the Three.js 3D scene "Two Objects One Comparison Display" 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: Two Objects One Comparison Display
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/two-objects-one-comparison-display-x3310
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing museum objects, provenance, and interpretation. Create a display comparing two fictional tools by material, shape, and function. Let users rotate them and inspect differences directly instead of relying on adjectives. Voxel style.
Working Three.js Starter (two-objects-one-comparison-display-x3310):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Museum of Imagined Tools — Comparative Study</title>
<style>
:root {
--paper: #eee9df;
--paper-deep: #ded7ca;
--ink: #17201e;
--muted: #65706b;
--line: rgba(23, 32, 30, 0.17);
--gallery: #111716;
--gallery-soft: #1a2220;
--a: #d56c50;
--b: #d4a64d;
--teal: #68c6bd;
--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
--sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
min-height: 100%;
background: var(--gallery);
color: var(--ink);
font-family: var(--sans);
}
body {
overflow: hidden;
}
button {
font: inherit;
}
button:focus-visible,
canvas:focus-visible {
outline: 3px solid var(--teal);
outline-offset: 3px;
}
.app {
height: 100dvh;
display: grid;
grid-template-rows: 76px 1fr;
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
padding: 0 26px;
color: var(--paper);
background: #0d1211;
border-bottom: 1px solid rgba(255, 255, 255, 0.09);
z-index: 20;
}
.brand {
display: flex;
align-items: center;
gap: 14px;
min-width: 0;
}
.brand-mark {
width: 37px;
height: 37px;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(4, 1fr);
gap: 3px;
transform: rotate(-4deg);
}
.brand-mark i {
display: block;
background: var(--paper);
}
.brand-mark i:nth-child(3n) {
background: var(--a);
}
.brand-mark i:nth-child(5n) {
background: var(--b);
}
.brand-mark i:nth-child(7n) {
background: var(--teal);
}
.brand-kicker,
.eyebrow {
margin: 0;
font-family: var(--mono);
font-size: 10px;
line-height: 1.3;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.brand-kicker {
color: #a9b3ae;
}
.brand-name {
margin: 3px 0 0;
font-size: 16px;
font-weight: 650;
letter-spacing: 0.015em;
white-space: nowrap;
}
.header-center {
text-align: center;
}
.header-center strong {
display: block;
font-size: 13px;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.header-center span {
display: block;
margin-top: 4px;
color: #8f9a95;
font-family: var(--mono);
font-size: 10px;
}
.fiction-badge {
flex: 0 0 auto;
padding: 8px 11px;
color: #bdc6c1;
border: 1px solid #39413e;
border-radius: 3px;
font-family: var(--mono);
font-size: 10px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.main {
min-height: 0;
display: grid;
grid-template-columns: 360px 1fr;
}
.sidebar {
min-height: 0;
overflow-y: auto;
background:
linear-gradient(rgba(23, 32, 30, 0.025) 1px, transparent 1px),
linear-gradient(90deg, rgba(23, 32, 30, 0.025) 1px, transparent 1px),
var(--paper);
background-size: 24px 24px;
border-right: 1px solid #323a37;
scrollbar-width: thin;
scrollbar-color: #9d978b transparent;
}
.intro {
padding: 28px 26px 21px;
border-bottom: 1px solid var(--line);
}
.intro .eyebrow {
color: #68736d;
}
.intro h1 {
margin: 10px 0 9px;
font-size: clamp(25px, 2.2vw, 33px);
line-height: 1.05;
letter-spacing: -0.035em;
font-weight: 680;
}
.intro p {
margin: 0;
color: #59635f;
font-size: 13px;
line-height: 1.6;
}
.specimen-tabs {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
padding: 15px 18px;
border-bottom: 1px solid var(--line);
background: rgba(222, 215, 202, 0.46);
}
.specimen-tab {
min-width: 0;
padding: 10px 11px;
text-align: left;
color: var(--ink);
background: rgba(255, 255, 255, 0.32);
border: 1px solid transparent;
border-radius: 3px;
cursor: pointer;
transition: 160ms ease;
}
.specimen-tab:hover {
background: rgba(255, 255, 255, 0.68);
}
.specimen-tab[aria-selected="true"] {
background: var(--ink);
color: var(--paper);
border-color: var(--ink);
}
.specimen-tab .tab-code {
display: inline-grid;
place-items: center;
width: 19px;
height: 19px;
margin-right: 7px;
border: 1px solid currentColor;
font-family: var(--mono);
font-size: 10px;
}
.specimen-tab strong {
font-size: 12px;
}
.object-panel {
padding: 23px 25px 30px;
}
.object-heading {
display: grid;
grid-template-columns: 38px 1fr;
gap: 12px;
align-items: start;
}
.object-index {
display: grid;
place-items: center;
width: 38px;
height: 38px;
color: var(--paper);
background: var(--a);
font-family: var(--mono);
font-weight: 700;
}
.object-panel[data-specimen="B"] .object-index {
background: var(--b);
color: #242018;
}
.object-heading h2 {
margin: 0;
font-size: 23px;
line-height: 1.1;
letter-spacing: -0.025em;
}
.object-heading p {
margin: 5px 0 0;
color: var(--muted);
font-size: 12px;
line-height: 1.45;
}
.metadata {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 13px 16px;
margin: 22px 0;
padding: 16px 0;
border-top: 1px solid var(--line);
border-bottom: 1px solid var(--line);
}
.metadata dt {
margin-bottom: 4px;
color: #727b76;
font-family: var(--mono);
font-size: 9px;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.metadata dd {
margin: 0;
font-size: 12px;
line-height: 1.35;
}
.section-title {
display: flex;
align-items: center;
gap: 10px;
margin: 0 0 13px;
font-family: var(--mono);
font-size: 10px;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.section-title::after {
content: "";
height: 1px;
flex: 1;
background: var(--line);
}
.provenance {
margin: 0;
padding: 0;
list-style: none;
}
.provenance li {
position: relative;
margin: 0;
padding: 0 0 16px 21px;
font-size: 12px;
line-height: 1.5;
}
.provenance li::before {
content: "";
position: absolute;
left: 0;
top: 4px;
width: 8px;
height: 8px;
background: var(--paper);
border: 2px solid #68746e;
}
.provenance li:not(:last-child)::after {
content: "";
position: absolute;
left: 5px;
top: 12px;
bottom: 0;
width: 1px;
background: #b8b2a7;
}
.provenance strong {
display: block;
margin-bottom: 2px;
font-size: 11px;
}
.provenance span {
color: #66706b;
}
.interpretation {
margin-top: 25px;
}
.interpretation p {
margin: 0 0 13px;
color: #3f4945;
font-size: 12.5px;
line-height: 1.65;
}
.evidence-note {
padding: 12px 13px;
background: rgba(104, 198, 189, 0.1);
border-left: 3px solid var(--teal);
color: #43514d;
font-size: 11.5px;
line-height: 1.55;
}
.evidence-note strong {
color: #253a35;
}
.inspector {
margin-top: 27px;
padding: 16px;
background: rgba(255, 255, 255, 0.47);
border: 1px solid rgba(23, 32, 30, 0.13);
}
.inspector-heading {
display: flex;
align-items: center;
gap: 10px;
}
.part-swatch {
width: 29px;
height: 29px;
flex: 0 0 auto;
background: #c8a574;
border: 3px solid #fff;
box-shadow: 0 0 0 1px rgba(23, 32, 30, 0.25);
}
.inspector-heading small {
display: block;
margin-bottom: 2px;
color: #77807c;
font-family: var(--mono);
font-size: 9px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.inspector-heading strong {
display: block;
font-size: 13px;
}
.inspector dl {
margin: 14px 0 0;
}
.inspector dt {
margin: 12px 0 4px;
color: #727b76;
font-family: var(--mono);
font-size: 9px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.inspector dd {
margin: 0;
color: #46514d;
font-size: 11.5px;
line-height: 1.55;
}
.part-buttons {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 15px;
padding-top: 13px;
border-top: 1px solid var(--line);
}
.part-button {
padding: 6px 8px;
color: #39433f;
background: transparent;
border: 1px solid #aaa69c;
border-radius: 2px;
cursor: pointer;
font-family: var(--mono);
font-size: 9px;
}
.part-button:hover,
.part-button[aria-pressed="true"] {
color: var(--paper);
background: var(--ink);
border-color: var(--ink);
}
.stage {
min-width: 0;
min-height: 0;
display: grid;
grid-template-rows: minmax(0, 1fr) 186px;
background: var(--gallery);
}
.viewport {
position: relative;
min-height: 0;
overflow: hidden;
background:
radial-gradient(circle at 50% 40%, rgba(89, 105, 97, 0.14), transparent 45%),
var(--gallery);
}
canvas {
display: block;
width: 100%;
height: 100%;
cursor: grab;
touch-action: none;
}
canvas:active {
cursor: grabbing;
}
.toolbar {
position: absolute;
top: 16px;
right: 16px;
z-index: 8;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 6px;
max-width: calc(100% - 32px);
}
.tool-button {
display: inline-flex;
align-items: center;
gap: 6px;
min-height: 32px;
padding: 7px 9px;
color: #c9d0cc;
background: rgba(15, 21, 19, 0.86);
border: 1px solid #3b4642;
border-radius: 3px;
cursor: pointer;
backdrop-filter: blur(8px);
font-family: var(--mono);
font-size: 9px;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.tool-button:hover {
color: white;
border-color: #77857e;
}
.tool-button[aria-pressed="true"] {
color: #10201d;
background: var(--teal);
border-color: var(--teal);
}
.tool-dot {
width: 6px;
height: 6px;
background: currentColor;
}
.scene-heading {
position: absolute;
top: 19px;
left: 20px;
z-index: 5;
pointer-events: none;
}
.scene-heading p {
margin: 0;
color: #839089;
font-family: var(--mono);
font-size: 9px;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.scene-heading h2 {
margin: 5px 0 0;
color: #e6e7e1;
font-size: 14px;
font-weight: 500;
}
.object-tag {
position: absolute;
z-index: 4;
display: flex;
align-items: center;
gap: 8px;
padding: 7px 9px;
color: #e7e9e3;
background: rgba(12, 17, 16, 0.78);
border: 1px solid rgba(255, 255, 255, 0.17);
border-radius: 2px;
pointer-events: none;
transform: translate(-50%, -100%);
white-space: nowrap;
backdrop-filter: blur(7px);
}
.object-tag b {
display: grid;
place-items: center;
width: 20px;
height: 20px;
color: #171d1b;
background: var(--a);
font-family: var(--mono);
font-size: 10px;
}
.object-tag[data-id="B"] b {
background: var(--b);
}
.object-tag span {
font-size: 10px;
}
.hotspot {
position: absolute;
z-index: 7;
display: flex;
align-items: center;
gap: 7px;
padding: 0;
color: #e9ece7;
background: transparent;
border: 0;
cursor: pointer;
transform: translate(-13px, -13px);
}
.hotspot .dot {
position: relative;
display: grid;
place-items: center;
width: 25px;
height: 25px;
background: rgba(12, 18, 16, 0.84);
border: 1px solid #d6ded8;
border-radius: 50%;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.38);
font-family: var(--mono);
font-size: 9px;
}
.hotspot .dot::after {
content: "";
position: absolute;
inset: -5px;
border: 1px solid rgba(104, 198, 189, 0.38);
border-radius: 50%;
}
.hotspot .hot-label {
padding: 5px 7px;
color: #e9ece7;
background: rgba(12, 18, 16, 0.83);
border: 1px solid rgba(255, 255, 255, 0.15);
font-size: 10px;
opacity: 0;
transform: translateX(-4px);
transition: 140ms ease;
pointer-events: none;
}
.hotspot:hover .hot-label,
.hotspot:focus-visible .hot-label {
opacity: 1;
transform: translateX(0);
}
.hotspot.active .dot {
color: #10201d;
background: var(--teal);
border-color: var(--teal);
}
.interaction-help {
position: absolute;
left: 18px;
bottom: 17px;
z-index: 5;
max-width: 390px;
color: #aab5ae;
font-family: var(--mono);
font-size: 9px;
line-height: 1.7;
pointer-events: none;
}
.interaction-help strong {
color: #e1e6e1;
font-weight: 500;
}
.zoom-controls {
position: absolute;
right: 17px;
bottom: 17px;
z-index: 6;
display: grid;
gap: 4px;
}
.zoom-controls button {
width: 31px;
height: 31px;
color: #dce3de;
background: rgba(13, 19, 17, 0.85);
border: 1px solid #3c4743;
cursor: pointer;
font-size: 17px;
}
.zoom-controls button:hover {
border-color: var(--teal);
}
.legend {
position: absolute;
left: 18px;
bottom: 62px;
z-index: 5;
display: none;
gap: 8px;
padding: 9px 11px;
color: #b6c0ba;
background: rgba(12, 18, 16, 0.83);
border: 1px solid #34403b;
font-family: var(--mono);
font-size: 8px;
}
.legend.visible {
display: flex;
flex-wrap: wrap;
}
.legend span {
display: inline-flex;
align-items: center;
gap: 5px;
}
.legend i {
width: 8px;
height: 8px;
}
.action-status {
position: absolute;
left: 50%;
bottom: 18px;
z-index: 6;
max-width: min(460px, 65%);
padding: 8px 12px;
color: #dbe2dd;
background: rgba(13, 19, 17, 0.88);
border: 1px solid #36433e;
border-radius: 2px;
transform: translateX(-50%);
font-family: var(--mono);
font-size: 9px;
line-height: 1.45;
text-align: center;
pointer-events: none;
transition: opacity 180ms ease;
}
.comparison {
min-width: 0;
display: grid;
grid-template-columns: 180px repeat(3, minmax(210px, 1fr));
overflow: auto;
color: #dbe0dc;
background: #0d1211;
border-top: 1px solid #303936;
}
.comparison-intro,
.compare-card {
min-width: 0;
padding: 16px 17px;
border-right: 1px solid #2c3532;
}
.comparison-intro {
position: sticky;
left: 0;
z-index: 2;
background: #0d1211;
}
.comparison-intro .eyebrow {
color: #7e8c85;
}
.comparison-intro h2 {
margin: 8px 0;
font-size: 17px;
letter-spacing: -0.02em;
}
.comparison-intro p {
margin: 0;
color: #7f8c85;
font-size: 10px;
line-height: 1.55;
}
.compare-card h3 {
margin: 0 0 11px;
color: #8e9a94;
font-family: var(--mono);
font-size: 9px;
font-weight: 500;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.compare-pair {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
align-items: start;
}
.compare-item {
min-width: 0;
}
.compare-code {
display: inline-block;
margin-bottom: 7px;
color: var(--a);
font-family: var(--mono);
font-size: 9px;
font-weight: 700;
}
.compare-item:last-child .compare-code {
color: var(--b);
}
.material-list {
display: flex;
flex-direction: column;
gap: 5px;
}
.material-line {
display: flex;
align-items: center;
gap: 6px;
color: #adb7b1;
font-size: 9px;
white-space: nowrap;
}
.material-line i {
width: 10px;
height: 10px;
flex: 0 0 auto;
border: 1px solid rgba(255, 255, 255, 0.24);
}
.shape-pair {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 9px;
}
.shape-view {
height: 80px;
display: flex;
align-items: center;
justify-content: center;
background: #151c1a;
border: 1px solid #29332f;
}
.shape-view svg {
width: 46px;
height: 66px;
}
.shape-value {
margin-top: 5px;
color: #c4cdc7;
font-family: var(--mono);
font-size: 9px;
}
.run-button {
width: 100%;
min-height: 34px;
padding: 8px 7px;
color: #dbe1dc;
background: #18201e;
border: 1px solid #3a4540;
cursor: pointer;
font-family: var(--mono);
font-size: 9px;
text-transform: uppercase;
}
.run-button:hover {
color: #111816;
background: var(--teal);
border-color: var(--teal);
}
.run-button:disabled {
opacity: 0.45;
cursor: wait;
}
.run-note {
margin: 8px 0 0;
color: #77847d;
font-size: 9px;
line-height: 1.45;
}
@media (max-width: 1050px) {
.main {
grid-template-columns: 320px 1fr;
}
.comparison {
grid-template-columns: 150px repeat(3, minmax(190px, 1fr));
}
.toolbar {
max-width: 280px;
}
}
@media (max-width: 820px) {
body {
overflow: auto;
}
.app {
height: auto;
min-height: 100dvh;
grid-template-rows: 68px auto;
}
.header {
padding: 0 16px;
}
.header-center {
display: none;
}
.main {
display: flex;
flex-direction: column;
}
.stage {
order: 0;
height: 76dvh;
min-height: 650px;
grid-template-rows: minmax(0, 1fr) 184px;
}
.sidebar {
order: 1;
overflow: visible;
border-right: 0;
}
.intro {
padding-top: 23px;
}
.toolbar {
top: 13px;
right: 13px;
max-width: calc(100% - 26px);
}
.scene-heading {
top: 15px;
left: 14px;
}
.scene-heading h2 {
display: none;
}
.interaction-help {
left: 13px;
bottom: 13px;
max-width: 260px;
}
.action-status {
bottom: 14px;
max-width: 48%;
}
.comparison {
grid-template-columns: 145px repeat(3, 200px);
}
}
@media (max-width: 520px) {
.brand-name {
font-size: 13px;
}
.fiction-badge {
padding: 7px;
font-size: 8px;
}
.stage {
height: 82dvh;
min-height: 690px;
}
.tool-button {
min-height: 29px;
padding: 6px 7px;
font-size: 8px;
}
.interaction-help {
max-width: 205px;
font-size: 8px;
}
.action-status {
display: none;
}
.object-tag span {
display: none;
}
.hotspot .hot-label {
display: none;
}
}
</style>
</head>
<body>
<div class="app">
<header class="header">
<div class="brand">
<div class="brand-mark" aria-hidden="true">
<i></i><i></i><i></i><i></i>
<i></i><i></i><i></i><i></i>
<i></i><i></i><i></i><i></i>
<i></i><i></i><i></i><i></i>
</div>
<div>
<p class="brand-kicker">Museum of Imagined Tools</p>
<p class="brand-name">Comparative Collection / Cycle 812</p>
</div>
</div>
<div class="header-center">
<strong>Form, Matter & Use</strong>
<span>Two fictional objects / one interactive study</span>
</div>
<div class="fiction-badge">Fictional collection</div>
</header>
<main class="main">
<aside class="sidebar" aria-label="Object information">
<section class="intro">
<p class="eyebrow">Comparative study · Gallery 04</p>
<h1>Two ways to move a load.</h1>
<p>
Rotate the objects at true relative scale. Inspect the numbered
components, change their material colors, separate their layers,
and run each working motion.
</p>
</section>
<div class="specimen-tabs" role="tablist" aria-label="Select specimen">
<button
class="specimen-tab"
id="tab-A"
role="tab"
aria-selected="true"
aria-controls="object-panel"
data-specimen="A"
>
<span class="tab-code">A</span><strong>Morrow Lever</strong>
</button>
<button
class="specimen-tab"
id="tab-B"
role="tab"
aria-selected="false"
aria-controls="object-panel"
data-specimen="B"
>
<span class="tab-code">B</span><strong>Cinder Hook</strong>
</button>
</div>
<article class="object-panel" id="object-panel" data-specimen="A" role="tabpanel"></article>
</aside>
<section class="stage" aria-label="Interactive 3D comparison">
<div class="viewport" id="viewport">
<canvas
id="scene"
tabindex="0"
aria-label="Interactive 3D museum display. Drag an object to rotate it, drag the gallery to orbit, and scroll to zoom."
></canvas>
<div class="scene-heading">
<p>Gallery 04 / Comparative mounting</p>
<h2>True relative scale · interactive reconstruction</h2>
</div>
<div class="toolbar" aria-label="Display controls">
<button class="tool-button" id="sync-button" aria-pressed="true">
<span class="tool-dot"></span>Sync turns
</button>
<button class="tool-button" id="material-button" aria-pressed="false">
<span class="tool-dot"></span>Material map
</button>
<button class="tool-button" id="explode-button" aria-pressed="false">
<span class="tool-dot"></span>Exploded
</button>
<button class="tool-button" id="overlay-button" aria-pressed="false">
<span class="tool-dot"></span>Overlay B
</button>
<button class="tool-button" id="reset-button">Reset all</button>
</div>
<div class="object-tag" id="tag-A" data-id="A">
<b>A</b><span>Morrow Lever · MIT-812.A</span>
</div>
<div class="object-tag" id="tag-B" data-id="B">
<b>B</b><span>Cinder Hook · MIT-812.B</span>
</div>
<div class="legend" id="legend" aria-label="Material map legend">
<span><i style="background:#f2c14e"></i>Timber</span>
<span><i style="background:#f06a54"></i>Ceramic</span>
<span><i style="background:#79d68c"></i>Fiber</span>
<span><i style="background:#7c78f2"></i>Stone</span>
<span><i style="background:#52d4d2"></i>Alloy</span>
<span><i style="background:#ef7bb7"></i>Resin</span>
</div>
<div class="interaction-help">
<strong>Drag an object</strong> to turn it · <strong>drag the gallery</strong>
to orbit · <strong>scroll</strong> to zoom · select a numbered part
</div>
<div class="action-status" id="action-status" aria-live="polite">
Choose a function below to see the working end move against a test block.
</div>
<div class="zoom-controls" aria-label="Zoom controls">
<button id="zoom-in" aria-label="Zoom in">+</button>
<button id="zoom-out" aria-label="Zoom out">−</button>
</div>
</div>
<div class="comparison" aria-label="Direct comparison">
<div class="comparison-intro">
<p class="eyebrow">Compare the evidence</p>
<h2>Same scale.<br />Different mechanics.</h2>
<p>
Color identifies material, silhouette preserves proportion, and
the final motion tests function without relying on labels alone.
</p>
</div>
<section class="compare-card">
<h3>01 / Material register</h3>
<div class="compare-pair">
<div class="compare-item">
<span class="compare-code">A</span>
<div class="material-list">
<span class="material-line"><i style="background:#c8a574"></i>Ash haft</span>
<span class="material-line"><i style="background:#a95742"></i>Fired clay</span>
<span class="material-line"><i style="background:#8a9a74"></i>Linen cord</span>
</div>
</div>
<div class="compare-item">
<span class="compare-code">B</span>
<div class="material-list">
<span class="material-line"><i style="background:#3c454b"></i>Basalt grip</span>
<span class="material-line"><i style="background:#b9823e"></i>Copper alloy</span>
<span class="material-line"><i style="background:#242829"></i>Pitch seam</span>
</div>
</div>
</div>
</section>
<section class="compare-card">
<h3>02 / Shape at scale</h3>
<div class="shape-pair">
<div class="compare-item">
<div class="shape-view">
<svg viewBox="0 0 60 100" role="img" aria-label="Tall lever with offset wedge silhouette">
<path
d="M21 93h13V27h-13zM19 20h17v10H19zM35 17h13v15H35zM47 13h9v13h-9z"
fill="#d56c50"
stroke="#e8d5c9"
stroke-width="1"
/>
</svg>
</div>
<div class="shape-value">A · 2.7 units tall</div>
</div>
<div class="compare-item">
<div class="shape-view">
<svg viewBox="0 0 60 100" role="img" aria-label="Compact hook silhouette">
<path
d="M19 89h24V55H19zM20 48h19v12H20zM37 40h15v14H37zM45 22h14v22H45zM34 17h14v10H34z"
fill="#d4a64d"
stroke="#f0dfb7"
stroke-width="1"
/>
</svg>
</div>
<div class="shape-value">B · 1.9 units tall</div>
</div>
</div>
</section>
<section class="compare-card">
<h3>03 / Working motion</h3>
<div class="compare-pair">
<div class="compare-item">
<span class="compare-code">A · Lever</span>
<button class="run-button" id="run-A">Run specimen A</button>
</div>
<div class="compare-item">
<span class="compare-code">B · Hook</span>
<button class="run-button" id="run-B">Run specimen B</button>
</div>
</div>
<p class="run-note">A displaces a broad test block. B lifts a narrow test block.</p>
</section>
</div>
</section>
</main>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const viewport = document.getElementById("viewport");
const canvas = document.getElementById("scene");
const objectPanel = document.getElementById("object-panel");
const actionStatus = document.getElementById("action-status");
const legend = document.getElementById("legend");
const specimens = {
A: {
code: "A",
title: "Morrow Lever",
type: "Lever / wedge adze",
accession: "MIT-812.A",
chronology: "Cycle 812",
provenance: [
{
title: "Fabrication record",
text: "Ash-wood blank and fired-clay nose; Basin workshop."
},
{
title: "Find context",
text: "Sealed in the Bracken Silt Cache, trench E, deposit 3."
},
{
title: "Acquisition",
text: "Gift of the Orra Foundation, 2119."
}
],
interpretation:
"Crescent abrasion on the clay nose and compression polish on the upper shaft are consistent with a lever lifting broad, low-resistance loads. The reconstruction makes the working edge meet a test block, raises it, and shifts it laterally.",
limits:
"The linen binding is reconstructed. No maker’s mark survives, so the workshop attribution remains provisional.",
parts: {
haft: {
number: 1,
label: "Ash haft",
material: "Timber",
materialKey: "timber",
color: "#c8a574",
evidence: "Compression polish is concentrated at the upper shoulder rather than along the entire shaft.",
reading: "Supports a hand placed close to the working end, where a longer grip would reduce leverage."
},
clay: {
number: 2,
label: "Fired-clay wedge",
material: "Ceramic",
materialKey: "clay",
color: "#a95742",
evidence: "A shallow crescent is abraded across the projecting nose.",
reading: "The crescent records repeated contact with a wide edge, consistent with lifting and lateral displacement."
},
cord: {
number: 3,
label: "Linen lashing",
material: "Fiber",
materialKey: "fiber",
color: "#8a9a74",
evidence: "Impressed fibers survive in the lower shaft groove; the present binding is a reconstruction.",
reading: "Secures the wooden components while allowing limited flex at the joint."
}
}
},
B: {
code: "B",
title: "Cinder Hook",
type: "Hook / pull tool",
accession: "MIT-812.B",
chronology: "Cycle 804",
provenance: [
{
title: "Fabrication record",
text: "Volcanic aggregate grip and cast copper-alloy hook; East Kiln workshop."
},
{
title: "Find context",
text: "Recovered beside the Ash-glass shaft field, gallery 4."
},
{
title: "Acquisition",
text: "Transferred from the North Collection, 2124."
}
],
interpretation:
"Continuous polishing along the inner hook curve and red cuprite deposits on its reverse suggest repeated pulling through a narrow opening. The reconstruction lifts a test block vertically and then draws it toward the hand.",
limits:
"The pitch seam may have been renewed during use. The find position identifies a workshop district, not the maker.",
parts: {
basalt: {
number: 1,
label: "Basalt grip",
material: "Stone",
materialKey: "basalt",
color: "#3c454b",
evidence: "The grip has a rounded central wear zone and no broad impact scars.",
reading: "Indicates a controlled pulling grip rather than a two-handed striking handle."
},
alloy: {
number: 2,
label: "Copper-alloy hook",
material: "Metal",
materialKey: "alloy",
color: "#b9823e",
evidence: "The inner curve is polished while the reverse retains reddish corrosion products.",
reading: "Shows sustained tensile contact at one narrow working surface."
},
pitch: {
number: 3,
label: "Pitch seam",
material: "Resin",
materialKey: "pitch",
color: "#242829",
evidence: "Dark resin remains in a joint between the stone and alloy components.",
reading: "Bonds the hook to the grip while permitting replacement of the working element."
}
}
}
};
const materialMapColors = {
timber: "#f2c14e",
clay: "#f06a54",
fiber: "#79d68c",
basalt: "#7c78f2",
alloy: "#52d4d2",
pitch: "#ef7bb7"
};
const scene = new THREE.Scene();
scene.background = new THREE.Color("#111716");
scene.fog = new THREE.Fog("#111716", 11, 24);
const camera = new THREE.PerspectiveCamera(38, 1, 0.1, 60);
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
const cameraTarget = new THREE.Vector3(0, 1.85, 0);
let cameraAzimuth = 0.08;
let cameraPolar = 1.15;
let cameraDistance = 8.45;
function updateCamera() {
const sinPolar = Math.sin(cameraPolar);
camera.position.set(
cameraTarget.x + cameraDistance * sinPolar * Math.sin(cameraAzimuth),
cameraTarget.y + cameraDistance * Math.cos(cameraPolar),
cameraTarget.z + cameraDistance * sinPolar * Math.cos(cameraAzimuth)
);
camera.lookAt(cameraTarget);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(0xd8e4dc, 0x28211d, 1.65);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffefda, 3.2);
keyLight.position.set(-4.5, 7, 5.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -7;
keyLight.shadow.camera.right = 7;
keyLight.shadow.camera.top = 7;
keyLight.shadow.camera.bottom = -2;
keyLight.shadow.bias = -0.0005;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x8ac9c3, 1.55);
rimLight.position.set(5, 4, -2);
scene.add(rimLight);
const galleryLight = new THREE.PointLight(0xffd6a3, 15, 12, 2);
galleryLight.position.set(0, 4.8, 1.8);
scene.add(galleryLight);
function staticBox(parent, size, position, color, roughness = 0.86, metalness = 0) {
const geometry = new THREE.BoxGeometry(size[0], size[1], size[2]);
const material = new THREE.MeshStandardMaterial({
color,
roughness,
metalness
});
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(position[0], position[1], position[2]);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// Gallery architecture.
staticBox(scene, [18, 0.18, 18], [0, -0.12, 0], "#1a201e");
staticBox(scene, [18, 8, 0.3], [0, 3.8, -5.1], "#1b2321");
staticBox(scene, [0.35, 8, 14], [-8.5, 3.8, 0], "#161d1b");
staticBox(scene, [0.35, 8, 14], [8.5, 3.8, 0], "#161d1b");
staticBox(scene, [17, 0.28, 0.5], [0, 6.8, -4.8], "#303936");
staticBox(scene, [3.8, 2.5, 0.12], [0, 3.7, -4.87], "#202926");
const grid = new THREE.GridHelper(18, 36, 0x34403b, 0x252e2b);
grid.position.y = -0.015;
grid.material.transparent = true;
grid.material.opacity = 0.48;
scene.add(grid);
function addPedestal(x, accent) {
staticBox(scene, [1.48, 0.16, 1.48], [x, 0.08, 0], "#111615");
staticBox(scene, [1.32, 0.92, 1.32], [x, 0.56, 0], "#2a302d");
staticBox(scene, [1.43, 0.13, 1.43], [x, 1.06, 0], "#414844", 0.7);
staticBox(scene, [1.03, 0.035, 0.04], [x, 0.66, 0.677], accent, 0.55, 0.12);
}
addPedestal(-1.55, "#d56c50");
addPedestal(1.55, "#d4a64d");
// Scale rods make the different proportions legible.
function addScaleRod(x, color) {
const points = [
new THREE.Vector3(x, 1.1, -0.38),
new THREE.Vector3(x, 4.1, -0.38)
];
for (let y = 1.1; y <= 4.11; y += 0.5) {
points.push(new THREE.Vector3(x - 0.07, y, -0.38));
points.push(new THREE.Vector3(x + 0.07, y, -0.38));
}
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({
color,
transparent: true,
opacity: 0.38
});
scene.add(new THREE.LineSegments(geometry, material));
}
addScaleRod(-2.42, "#d56c50");
addScaleRod(0.68, "#d4a64d");
const pickMeshes = [];
const artifacts = {};
const hotspotEntries = [];
function createArtifact(id, homeX) {
const root = new THREE.Group();
root.position.set(homeX, 1.12, 0);
scene.add(root);
const pivot = new THREE.Group();
pivot.rotation.y = -0.12;
root.add(pivot);
const artifact = {
id,
root,
pivot,
homeX,
parts: {},
partEntries: [],
anchor: new THREE.Object3D()
};
artifacts[id] = artifact;
return artifact;
}
const artifactA = createArtifact("A", -1.55);
const artifactB = createArtifact("B", 1.55);
const edgeMaterial = new THREE.LineBasicMaterial({
color: 0x101514,
transparent: true,
opacity: 0.58
});
function createPart(artifact, key, blocks, explodeVector, anchorPosition) {
const definition = specimens[artifact.id].parts[key];
const material = new THREE.MeshStandardMaterial({
color: definition.color,
roughness: key === "alloy" ? 0.38 : 0.8,
metalness: key === "alloy" ? 0.68 : key === "pitch" ? 0.08 : 0,
emissive: 0x000000,
emissiveIntensity: 0
});
material.userData.baseColor = new THREE.Color(definition.color);
material.userData.materialKey = definition.materialKey;
const group = new THREE.Group();
group.userData = {
artifactId: artifact.id,
key,
definition,
material,
basePosition: new THREE.Vector3(),
explodeVector: new THREE.Vector3(...explodeVector)
};
artifact.pivot.add(group);
for (const block of blocks) {
const geometry = new THREE.BoxGeometry(block[0], block[1], block[2]);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(block[3], block[4], block[5]);
mesh.castShadow = true;
mesh.receiveShadow = true;
mesh.userData.partGroup = group;
const edges = new THREE.LineSegments(new THREE.EdgesGeometry(geometry), edgeMaterial);
mesh.add(edges);
group.add(mesh);
pickMeshes.push(mesh);
}
const anchor = new THREE.Object3D();
anchor.position.set(...anchorPosition);
group.add(anchor);
const button = document.createElement("button");
button.className = "hotspot";
button.type = "button";
button.setAttribute(
"aria-label",
`${definition.number}: ${definition.label}, ${definition.material}`
);
button.innerHTML = `<span class="dot">${definition.number}</span><span class="hot-label">${definition.label}</span>`;
button.addEventListener("click", () => selectPart(artifact.id, key));
viewport.appendChild(button);
const hotspot = { artifactId: artifact.id, key, anchor, button };
hotspotEntries.push(hotspot);
artifact.parts[key] = group;
artifact.partEntries.push(group);
}
// Specimen A: tall ash shaft, offset clay wedge, and fiber binding.
createPart(
artifactA,
"haft",
[
[0.42, 0.18, 0.42, -0.20, 0.09, 0],
[0.32, 0.34, 0.32, -0.20, 0.35, 0],
[0.32, 0.34, 0.32, -0.20, 0.68, 0],
[0.32, 0.34, 0.32, -0.20, 1.01, 0],
[0.32, 0.34, 0.32, -0.20, 1.34, 0],
[0.32, 0.34, 0.32, -0.20, 1.67, 0],
[0.34, 0.34, 0.34, -0.14, 2.00, 0],
[0.40, 0.28, 0.40, -0.05, 2.28, 0]
],
[0, -0.18, 0],
[-0.22, 1.42, 0.23]
);
createPart(
artifactA,
"clay",
[
[0.46, 0.42, 0.48, 0.14, 2.42, 0],
[0.36, 0.34, 0.44, 0.48, 2.42, 0],
[0.22, 0.24, 0.38, 0.72, 2.42, 0],
[0.22, 0.12, 0.38, 0.86, 2.42, 0]
],
[0.83, 0.06, 0],
[0.49, 2.42, 0.26]
);
createPart(
artifactA,
"cord",
[
[0.39, 0.11, 0.39, -0.20, 0.54, 0],
[0.39, 0.10, 0.39, -0.20, 0.70, 0],
[0.39, 0.09, 0.39, -0.20, 0.86, 0]
],
[-0.55, 0, 0],
[-0.22, 0.69, 0.25]
);
// Specimen B: compact basalt grip and copper-alloy hook.
createPart(
artifactB,
"basalt",
[
[0.60, 0.24, 0.60, 0, 0.13, 0],
[0.54, 0.34, 0.54, 0, 0.42, 0],
[0.49, 0.34, 0.49, 0, 0.76, 0],
[0.55, 0.28, 0.55, 0, 1.07, 0]
],
[0, -0.37, 0],
[-0.02, 0.64, 0.31]
);
createPart(
artifactB,
"alloy",
[
[0.64, 0.17, 0.64, 0, 1.19, 0],
[0.42, 0.26, 0.40, 0.28, 1.29, 0],
[0.34, 0.42, 0.38, 0.58, 1.48, 0],
[0.34, 0.25, 0.38, 0.58, 1.76, 0],
[0.24, 0.22, 0.38, 0.40, 1.84, 0]
],
[0.72, 0.05, 0],
[0.58, 1.55, 0.23]
);
createPart(
artifactB,
"pitch",
[
[0.61, 0.07, 0.61, 0, 1.31, 0],
[0.20, 0.08, 0.62, 0.18, 1.31, 0]
],
[0, 0.42, 0],
[0.02, 1.31, 0.34]
);
artifactA.anchor.position.set(0, 2.96, 0);
artifactB.anchor.position.set(0, 2.20, 0);
artifactA.pivot.add(artifactA.anchor);
artifactB.pivot.add(artifactB.anchor);
// Function-test blocks and directional arrows.
function createTestBlock(id, x, z, color) {
const group = new THREE.Group();
group.position.set(x, 1.13, z);
scene.add(group);
staticBox(group, [0.58, 0.045, 0.58], [0, -0.035, 0], "#101513", 0.96);
const sample = staticBox(group, [0.34, 0.28, 0.34], [0, 0.14, 0], color, 0.74);
return { group, sample, baseX: x, baseY: 1.13 };
}
const testA = createTestBlock("A", -1.09, 0.43, "#b85c45");
const testB = createTestBlock("B", 2.08, 0.39, "#b9823e");
const arrowA = new THREE.ArrowHelper(
new THREE.Vector3(1, 0, 0),
new THREE.Vector3(-1.05, 1.42, 0.44),
0.9,
0xd56c50,
0.15,
0.10
);
arrowA.visible = false;
scene.add(arrowA);
const arrowB = new THREE.ArrowHelper(
new THREE.Vector3(0, 1, 0),
new THREE.Vector3(2.08, 1.39, 0.40),
0.85,
0xd4a64d,
0.15,
0.10
);
arrowB.visible = false;
scene.add(arrowB);
// UI state.
let activeSpecimen = "A";
let selectedPart = "haft";
let syncTurns = true;
let materialMap = false;
let exploded = false;
let overlay = false;
let explodeAmount = 0;
let currentAction = null;
const tabs = [...document.querySelectorAll(".specimen-tab")];
const syncButton = document.getElementById("sync-button");
const materialButton = document.getElementById("material-button");
const explodeButton = document.getElementById("explode-button");
const overlayButton = document.getElementById("overlay-button");
const runAButton = document.getElementById("run-A");
const runBButton = document.getElementById("run-B");
function renderSpecimen() {
const specimen = specimens[activeSpecimen];
objectPanel.dataset.specimen = activeSpecimen;
const part = specimen.parts[selectedPart];
const displayedColor = materialMap
? materialMapColors[part.materialKey]
: part.color;
objectPanel.innerHTML = `
<div class="object-heading">
<div class="object-index">${specimen.code}</div>
<div>
<h2>${specimen.title}</h2>
<p>${specimen.type} · reconstructed from fictional evidence</p>
</div>
</div>
<dl class="metadata">
<div>
<dt>Accession</dt>
<dd>${specimen.accession}</dd>
</div>
<div>
<dt>Chronology</dt>
<dd>${specimen.chronology}</dd>
</div>
<div>
<dt>Provenance</dt>
<dd>Recorded, fictional chain</dd>
</div>
<div>
<dt>Reconstruction</dt>
<dd>Measured parts; inferred motion</dd>
</div>
</dl>
<h3 class="section-title">Provenance</h3>
<ol class="provenance">
${specimen.provenance
.map(item => `<li><strong>${item.title}</strong><span>${item.text}</span></li>`)
.join("")}
</ol>
<section class="interpretation">
<h3 class="section-title">Interpretation</h3>
<p>${specimen.interpretation}</p>
<div class="evidence-note">
<strong>Interpretive limit.</strong> ${specimen.limits}
</div>
</section>
<section class="inspector" aria-live="polite">
<div class="inspector-heading">
<span class="part-swatch" id="inspector-swatch" style="background:${displayedColor}"></span>
<div>
<small>Selected component / ${part.number}</small>
<strong>${part.label}</strong>
</div>
</div>
<dl>
<dt>Material</dt>
<dd>${part.material}${materialMap ? " · mapped category color" : ""}</dd>
<dt>Visible evidence</dt>
<dd>${part.evidence}</dd>
<dt>Interpretive reading</dt>
<dd>${part.reading}</dd>
</dl>
<div class="part-buttons" aria-label="Select a component">
${Object.entries(specimen.parts)
.map(([key, item]) => `
<button
class="part-button"
data-part="${key}"
aria-pressed="${key === selectedPart}"
>${item.number} · ${item.label}</button>
`)
.join("")}
</div>
</section>
`;
objectPanel.querySelectorAll(".part-button").forEach(button => {
button.addEventListener("click", () => {
selectPart(activeSpecimen, button.dataset.part);
});
});
tabs.forEach(tab => {
const selected = tab.dataset.specimen === activeSpecimen;
tab.setAttribute("aria-selected", String(selected));
});
hotspotEntries.forEach(entry => {
entry.button.classList.toggle(
"active",
entry.artifactId === activeSpecimen && entry.key === selectedPart
);
});
updatePartHighlight();
}
function updatePartHighlight() {
for (const artifact of Object.values(artifacts)) {
for (const part of artifact.partEntries) {
const selected =
artifact.id === activeSpecimen && part.userData.key === selectedPart;
part.userData.material.emissive.set(selected ? 0x23483f : 0x000000);
part.userData.material.emissiveIntensity = selected ? 0.38 : 0;
}
}
}
function selectPart(artifactId, key) {
activeSpecimen = artifactId;
selectedPart = key;
renderSpecimen();
}
function updateMaterialColors() {
for (const artifact of Object.values(artifacts)) {
for (const part of artifact.partEntries) {
const material = part.userData.material;
const color = materialMap
? materialMapColors[material.userData.materialKey]
: material.userData.baseColor;
material.color.set(color);
material.needsUpdate = true;
}
}
legend.classList.toggle("visible", materialMap);
renderSpecimen();
}
function updateOverlayMaterials() {
for (const artifact of Object.values(artifacts)) {
for (const part of artifact.partEntries) {
const material = part.userData.material;
const isGhost = overlay && artifact.id === "B";
material.transparent = isGhost;
material.opacity = isGhost ? 0.27 : 1;
material.depthWrite = !isGhost;
material.needsUpdate = true;
}
}
}
tabs.forEach(tab => {
tab.addEventListener("click", () => {
activeSpecimen = tab.dataset.specimen;
selectedPart = Object.keys(specimens[activeSpecimen].parts)[0];
renderSpecimen();
});
});
syncButton.addEventListener("click", () => {
syncTurns = !syncTurns;
syncButton.setAttribute("aria-pressed", String(syncTurns));
if (syncTurns) {
artifactB.pivot.rotation.x = artifactA.pivot.rotation.x;
artifactB.pivot.rotation.y = artifactA.pivot.rotation.y;
}
});
materialButton.addEventListener("click", () => {
materialMap = !materialMap;
materialButton.setAttribute("aria-pressed", String(materialMap));
updateMaterialColors();
});
explodeButton.addEventListener("click", () => {
exploded = !exploded;
explodeButton.setAttribute("aria-pressed", String(exploded));
});
overlayButton.addEventListener("click", () => {
overlay = !overlay;
overlayButton.setAttribute("aria-pressed", String(overlay));
updateOverlayMaterials();
if (overlay) {
artifactB.pivot.rotation.x = artifactA.pivot.rotation.x;
artifactB.pivot.rotation.y = artifactA.pivot.rotation.y;
}
testB.group.visible = !overlay;
});
document.getElementById("reset-button").addEventListener("click", () => {
cameraAzimuth = 0.08;
cameraPolar = 1.15;
cameraDistance = 8.45;
syncTurns = true;
materialMap = false;
exploded = false;
overlay = false;
currentAction = null;
artifactA.pivot.rotation.set(0, -0.12, 0);
artifactB.pivot.rotation.set(0, -0.12, 0);
syncButton.setAttribute("aria-pressed", "true");
materialButton.setAttribute("aria-pressed", "false");
explodeButton.setAttribute("aria-pressed", "false");
overlayButton.setAttribute("aria-pressed", "false");
testA.sample.position.set(0, 0.14, 0);
testB.sample.position.set(0, 0.14, 0);
testB.group.visible = true;
arrowA.visible = false;
arrowB.visible = false;
actionStatus.textContent =
"Choose a function below to see the working end move against a test block.";
runAButton.disabled = false;
runBButton.disabled = false;
updateMaterialColors();
updateOverlayMaterials();
});
function startAction(id) {
if (currentAction) return;
activeSpecimen = id;
selectedPart = id === "A" ? "clay" : "alloy";
renderSpecimen();
currentAction = {
id,
start: performance.now(),
duration: 3600
};
runAButton.disabled = true;
runBButton.disabled = true;
arrowA.visible = id === "A";
arrowB.visible = id === "B";
}
runAButton.addEventListener("click", () => startAction("A"));
runBButton.addEventListener("click", () => startAction("B"));
const actionOffsets = {
A_clay: new THREE.Vector3(),
B_alloy: new THREE.Vector3()
};
function easeInOut(value) {
const t = THREE.MathUtils.clamp(value, 0, 1);
return t * t * (3 - 2 * t);
}
function updateAction(now) {
actionOffsets.A_clay.set(0, 0, 0);
actionOffsets.B_alloy.set(0, 0, 0);
if (!currentAction) {
testA.sample.position.set(0, 0.14, 0);
testB.sample.position.set(0, 0.14, 0);
return;
}
const raw = (now - currentAction.start) / currentAction.duration;
const progress = THREE.MathUtils.clamp(raw, 0, 1);
let pull = 0;
let phase = "";
if (progress < 0.24) {
pull = 0;
phase = currentAction.id === "A"
? "A · the clay wedge enters the test block"
: "B · the hook enters the lifting aperture";
} else if (progress < 0.72) {
pull = easeInOut((progress - 0.24) / 0.48);
phase = currentAction.id === "A"
? "A · leverage raises and displaces the broad block"
: "B · the narrow hook raises the block vertically";
} else {
pull = 1 - easeInOut((progress - 0.72) / 0.28);
phase = currentAction.id === "A"
? "A · the working end returns to its starting position"
: "B · the load is returned to the aperture";
}
if (currentAction.id === "A") {
testA.sample.position.x = pull * 0.72;
testA.sample.position.y = 0.14 + Math.sin(progress * Math.PI) * 0.16;
actionOffsets.A_clay.x = pull * 0.20;
} else {
testB.sample.position.y = 0.14 + pull * 0.82;
testB.sample.position.x = pull * 0.16;
actionOffsets.B_alloy.y = pull * 0.12;
}
actionStatus.textContent = phase;
if (progress >= 1) {
currentAction = null;
arrowA.visible = false;
arrowB.visible = false;
testA.sample.position.set(0, 0.14, 0);
testB.sample.position.set(0, 0.14, 0);
actionStatus.textContent =
"Motion complete. Change the angle or overlay the second object to compare where force enters.";
runAButton.disabled = false;
runBButton.disabled = false;
}
}
// Direct manipulation: objects rotate individually; background drag orbits camera.
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
let dragMode = null;
let dragArtifact = null;
let previousX = 0;
let previousY = 0;
function setPointer(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;
}
function findPart(event) {
setPointer(event);
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(pickMeshes, false);
return hits.length ? hits[0].object.userData.partGroup : null;
}
canvas.addEventListener("pointerdown", event => {
if (event.button !== 0) return;
previousX = event.clientX;
previousY = event.clientY;
const part = findPart(event);
if (part) {
dragMode = "object";
dragArtifact = artifacts[part.userData.artifactId];
selectPart(part.userData.artifactId, part.userData.key);
} else {
dragMode = "camera";
}
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", event => {
if (!dragMode) {
const hovered = findPart(event);
canvas.style.cursor = hovered ? "pointer" : "grab";
return;
}
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
if (dragMode === "object") {
dragArtifact.pivot.rotation.y += dx * 0.009;
dragArtifact.pivot.rotation.x = THREE.MathUtils.clamp(
dragArtifact.pivot.rotation.x + dy * 0.006,
-0.75,
0.75
);
if (syncTurns) {
const otherId = dragArtifact.id === "A" ? "B" : "A";
const other = artifacts[otherId];
other.pivot.rotation.x = dragArtifact.pivot.rotation.x;
other.pivot.rotation.y = dragArtifact.pivot.rotation.y;
}
} else {
cameraAzimuth -= dx * 0.006;
cameraPolar = THREE.MathUtils.clamp(
cameraPolar - dy * 0.005,
0.62,
1.48
);
}
});
function endPointer(event) {
dragMode = null;
dragArtifact = null;
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener(
"wheel",
event => {
event.preventDefault();
cameraDistance = THREE.MathUtils.clamp(
cameraDistance + event.deltaY * 0.007,
5.1,
12.5
);
},
{ passive: false }
);
document.getElementById("zoom-in").addEventListener("click", () => {
cameraDistance = Math.max(5.1, cameraDistance - 0.65);
});
document.getElementById("zoom-out").addEventListener("click", () => {
cameraDistance = Math.min(12.5, cameraDistance + 0.65);
});
window.addEventListener("keydown", event => {
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
const direction = event.key === "ArrowLeft" ? -1 : 1;
const artifact = artifacts[activeSpecimen];
artifact.pivot.rotation.y += direction * 0.08;
if (syncTurns) {
const other = artifacts[activeSpecimen === "A" ? "B" : "A"];
other.pivot.rotation.y = artifact.pivot.rotation.y;
other.pivot.rotation.x = artifact.pivot.rotation.x;
}
event.preventDefault();
}
if (event.key === "+" || event.key === "=") {
cameraDistance = Math.max(5.1, cameraDistance - 0.5);
}
if (event.key === "-") {
cameraDistance = Math.min(12.5, cameraDistance + 0.5);
}
});
const projected = new THREE.Vector3();
function projectElement(element, worldPosition, hide = false) {
if (hide) {
element.style.display = "none";
return;
}
projected.copy(worldPosition).project(camera);
const visible =
projected.z > -1 &&
projected.z < 1 &&
projected.x > -1.15 &&
projected.x < 1.15 &&
projected.y > -1.15 &&
projected.y < 1.15;
element.style.display = visible ? "flex" : "none";
if (!visible) return;
const x = (projected.x * 0.5 + 0.5) * viewport.clientWidth;
const y = (-projected.y * 0.5 + 0.5) * viewport.clientHeight;
element.style.left = `${x}px`;
element.style.top = `${y}px`;
}
const worldPoint = new THREE.Vector3();
function updateLabels() {
for (const id of ["A", "B"]) {
const artifact = artifacts[id];
artifact.anchor.getWorldPosition(worldPoint);
projectElement(
document.getElementById(`tag-${id}`),
worldPoint,
overlay && id === "B"
);
}
for (const entry of hotspotEntries) {
entry.anchor.getWorldPosition(worldPoint);
const hide =
entry.artifactId !== activeSpecimen ||
(overlay && entry.artifactId === "B");
projectElement(entry.button, worldPoint, hide);
}
}
function resize() {
const width = viewport.clientWidth;
const height = viewport.clientHeight;
renderer.setSize(width, height, false);
camera.aspect = width / Math.max(height, 1);
camera.updateProjectionMatrix();
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(viewport);
resize();
renderSpecimen();
const clock = new THREE.Clock();
function animate(now) {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const smoothing = 1 - Math.pow(0.001, delta);
explodeAmount = THREE.MathUtils.lerp(
explodeAmount,
exploded ? 1 : 0,
smoothing
);
const targetBX = overlay ? artifactA.homeX : artifactB.homeX;
const targetBZ = overlay ? 0.18 : 0;
artifactB.root.position.x = THREE.MathUtils.lerp(
artifactB.root.position.x,
targetBX,
smoothing
);
artifactB.root.position.z = THREE.MathUtils.lerp(
artifactB.root.position.z,
targetBZ,
smoothing
);
updateAction(now);
for (const artifact of Object.values(artifacts)) {
for (const part of artifact.partEntries) {
const data = part.userData;
const offset = data.explodeVector.clone().multiplyScalar(explodeAmount);
if (artifact.id === "A" && data.key === "clay") {
offset.add(actionOffsets.A_clay);
}
if (artifact.id === "B" && data.key === "alloy") {
offset.add(actionOffsets.B_alloy);
}
part.position.copy(data.basePosition).add(offset);
}
}
updateCamera();
scene.updateMatrixWorld();
camera.updateMatrixWorld();
updateLabels();
renderer.render(scene, camera);
}
requestAnimationFrame(animate);
</script>
</body>
</html>
```