Prompt specification
Build or customize the Three.js 3D scene "Two Workshops Exchange a Technique" 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 Workshops Exchange a Technique
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/two-workshops-exchange-a-technique-x3294
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows craft techniques exchanged and adapted between communities. Animate fictional craftspeople demonstrating distinct joining techniques and adapting one to a new material. Label the exchange as imagined instead of a documented historical event. Stylized solid forms.
Working Three.js Starter (two-workshops-exchange-a-technique-x3294):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Threads Between Hands — An Imagined Craft Exchange</title>
<style>
:root {
--ink: #24383f;
--muted: #667678;
--paper: #f3eddf;
--panel: rgba(255, 252, 244, 0.91);
--line: rgba(36, 56, 63, 0.15);
--amber: #d79b3d;
--sage: #688574;
--clay: #bd694d;
--blue: #4e7180;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #eee7d8;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body {
overscroll-behavior: none;
}
#scene {
position: fixed;
inset: 0;
}
canvas {
display: block;
width: 100%;
height: 100%;
cursor: grab;
touch-action: none;
}
canvas:active {
cursor: grabbing;
}
.topbar {
position: fixed;
z-index: 10;
top: 0;
left: 0;
right: 0;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24px;
padding: 24px 28px;
pointer-events: none;
}
.title-block {
max-width: 440px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.eyebrow {
margin: 0 0 5px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.17em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(26px, 3.2vw, 48px);
font-weight: 500;
letter-spacing: -0.035em;
line-height: 0.98;
}
.subtitle {
margin: 9px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.4;
}
.disclaimer {
max-width: 300px;
padding: 12px 15px;
border: 1px solid rgba(36, 56, 63, 0.17);
border-radius: 12px;
background: rgba(255, 252, 244, 0.84);
box-shadow: 0 10px 30px rgba(50, 55, 48, 0.07);
backdrop-filter: blur(8px);
}
.disclaimer strong {
display: block;
margin-bottom: 3px;
color: #9c4f3d;
font-size: 12px;
letter-spacing: 0.02em;
}
.disclaimer span {
display: block;
color: var(--muted);
font-size: 11px;
line-height: 1.35;
}
#labels {
position: fixed;
z-index: 5;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.station-label {
position: absolute;
display: flex;
align-items: center;
gap: 9px;
min-width: 158px;
padding: 9px 11px;
border: 1px solid rgba(36, 56, 63, 0.14);
border-radius: 10px;
background: rgba(255, 252, 244, 0.86);
box-shadow: 0 8px 20px rgba(50, 55, 48, 0.06);
opacity: 0.67;
transform: translate(-50%, -50%);
transition:
opacity 240ms ease,
border-color 240ms ease,
box-shadow 240ms ease;
backdrop-filter: blur(7px);
}
.station-label.active {
opacity: 1;
border-color: rgba(36, 56, 63, 0.28);
box-shadow: 0 12px 25px rgba(50, 55, 48, 0.1);
}
.station-label i {
width: 9px;
height: 30px;
flex: 0 0 auto;
border-radius: 8px;
background: var(--dot);
}
.station-label b,
.station-label span {
display: block;
white-space: nowrap;
}
.station-label b {
font-family: Georgia, "Times New Roman", serif;
font-size: 14px;
font-weight: 600;
}
.station-label span {
margin-top: 2px;
color: var(--muted);
font-size: 10px;
}
.station-label em {
display: inline-block;
margin-left: 5px;
padding: 2px 4px;
border-radius: 4px;
background: rgba(189, 105, 77, 0.13);
color: #9c4f3d;
font-size: 8px;
font-style: normal;
font-weight: 800;
letter-spacing: 0.08em;
vertical-align: 1px;
}
#material-tag {
position: absolute;
padding: 6px 9px;
border-radius: 999px;
background: var(--ink);
color: #fff9ed;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.11em;
text-transform: uppercase;
opacity: 0;
transform: translate(-50%, -50%);
transition: opacity 220ms ease;
white-space: nowrap;
}
#material-tag.visible {
opacity: 1;
}
.bottom {
position: fixed;
z-index: 10;
left: 50%;
bottom: 22px;
width: min(860px, calc(100vw - 36px));
transform: translateX(-50%);
}
.control-panel {
overflow: hidden;
border: 1px solid rgba(36, 56, 63, 0.16);
border-radius: 15px;
background: var(--panel);
box-shadow: 0 16px 50px rgba(40, 50, 47, 0.14);
backdrop-filter: blur(12px);
}
.phase-row {
display: grid;
grid-template-columns: minmax(170px, 1fr) minmax(300px, 2fr) auto;
align-items: center;
gap: 18px;
padding: 14px 16px 12px;
}
.phase-number {
margin-bottom: 2px;
color: var(--amber);
font-size: 9px;
font-weight: 900;
letter-spacing: 0.16em;
text-transform: uppercase;
}
#phase-title {
font-family: Georgia, "Times New Roman", serif;
font-size: 16px;
font-weight: 600;
}
.phase-track {
position: relative;
height: 5px;
overflow: hidden;
border-radius: 999px;
background: rgba(36, 56, 63, 0.12);
}
#progress {
position: absolute;
inset: 0 auto 0 0;
width: 0;
border-radius: inherit;
background: linear-gradient(90deg, var(--blue), var(--amber), var(--clay));
}
.phase-buttons {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 7px;
margin-top: 9px;
}
.phase-buttons button,
.icon-button {
border: 0;
color: var(--ink);
background: transparent;
cursor: pointer;
font: inherit;
}
.phase-buttons button {
padding: 5px 7px;
border-radius: 6px;
color: var(--muted);
font-size: 9px;
font-weight: 750;
letter-spacing: 0.035em;
text-align: left;
}
.phase-buttons button:hover,
.phase-buttons button.active {
color: var(--ink);
background: rgba(36, 56, 63, 0.07);
}
.icon-button {
display: grid;
width: 37px;
height: 37px;
place-items: center;
border: 1px solid rgba(36, 56, 63, 0.15);
border-radius: 9px;
background: rgba(255, 255, 255, 0.45);
font-size: 14px;
}
.icon-button:hover {
background: white;
}
.button-row {
display: flex;
gap: 7px;
}
.footer-note {
display: flex;
justify-content: space-between;
gap: 12px;
padding: 0 17px 11px;
color: var(--muted);
font-size: 9px;
letter-spacing: 0.025em;
}
#loading {
position: fixed;
z-index: 30;
inset: 0;
display: grid;
place-items: center;
background: #eee7d8;
color: var(--ink);
font-family: Georgia, "Times New Roman", serif;
font-size: 20px;
transition: opacity 400ms ease;
}
#loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 760px) {
.topbar {
padding: 17px;
}
.subtitle {
display: none;
}
.disclaimer {
max-width: 205px;
padding: 9px 11px;
}
.disclaimer strong {
font-size: 10px;
}
.disclaimer span {
font-size: 9px;
}
.phase-row {
grid-template-columns: 1fr auto;
gap: 11px;
}
.phase-track {
grid-column: 1 / -1;
grid-row: 2;
}
.phase-buttons {
grid-column: 1 / -1;
}
.phase-buttons button {
font-size: 8px;
}
.station-label {
min-width: 0;
padding: 7px 8px;
}
.station-label span {
display: none;
}
.station-label b {
font-size: 11px;
}
.station-label i {
width: 6px;
height: 24px;
}
.footer-note span:last-child {
display: none;
}
}
</style>
</head>
<body>
<div id="scene"></div>
<div id="loading">Preparing the shared workbench…</div>
<header class="topbar">
<div class="title-block">
<p class="eyebrow">Fictional communities · animated craft study</p>
<h1>Threads Between Hands</h1>
<p class="subtitle">
Distinct joining methods travel between makers, then change to suit
an unfamiliar material pairing.
</p>
</div>
<aside class="disclaimer">
<strong>Imagined cultural exchange</strong>
<span>
This is a fictional teaching animation, not a documented historical event.
</span>
</aside>
</header>
<div id="labels">
<div class="station-label" id="label-0" style="--dot: var(--blue)">
<i></i>
<div>
<b>Alder Grove</b>
<span>Cross-lap joinery + wooden peg</span>
</div>
</div>
<div class="station-label" id="label-1" style="--dot: var(--sage)">
<i></i>
<div>
<b>Riverbend</b>
<span>Wrapped cord lashing</span>
</div>
</div>
<div class="station-label" id="label-2" style="--dot: var(--clay)">
<i></i>
<div>
<b>Shared Bench <em>Adapted</em></b>
<span>Lashing reworked for ceramic + wood</span>
</div>
</div>
<div id="material-tag">New pairing · clay + wood</div>
</div>
<section class="bottom">
<div class="control-panel">
<div class="phase-row">
<div>
<div class="phase-number" id="phase-number">Phase 01 / 04</div>
<div id="phase-title">Alder Grove demonstrates a cross-lap joint</div>
</div>
<div class="phase-track" aria-hidden="true">
<div id="progress"></div>
</div>
<div class="button-row">
<button class="icon-button" id="pause" aria-label="Pause animation">
❚❚
</button>
<button class="icon-button" id="reset" aria-label="Reset camera">
↺
</button>
</div>
</div>
<div class="phase-buttons">
<button class="active" data-time="0">01 · CROSS-LAP</button>
<button data-time="5">02 · WRAP & BIND</button>
<button data-time="9.5">03 · EXCHANGE</button>
<button data-time="14">04 · ADAPTATION</button>
</div>
<div class="footer-note">
<span>Drag to orbit · scroll or pinch to zoom</span>
<span>Solids, motion, and material memory</span>
</div>
</div>
</section>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Renderer, scene, camera, and direct camera controls
// -------------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeee7d8);
const renderer = new THREE.WebGLRenderer({ antialias: true });
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;
renderer.domElement.setAttribute(
"aria-label",
"Animated diorama of fictional craftspeople exchanging and adapting joining techniques."
);
document.querySelector("#scene").appendChild(renderer.domElement);
const camera = new THREE.OrthographicCamera(-8, 8, 5, -5, 0.1, 100);
const cameraTarget = new THREE.Vector3(0, 1.65, 0);
const cameraState = {
yaw: 0,
pitch: 0.24,
zoom: 1
};
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
const viewHeight = Math.max(9.6, 16.4 / aspect);
camera.left = (-viewHeight * aspect) / 2;
camera.right = (viewHeight * aspect) / 2;
camera.top = viewHeight / 2;
camera.bottom = -viewHeight / 2;
camera.zoom = cameraState.zoom;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
}
function updateCamera() {
const radius = 19;
const horizontal = Math.cos(cameraState.pitch) * radius;
camera.position.set(
Math.sin(cameraState.yaw) * horizontal,
cameraTarget.y + Math.sin(cameraState.pitch) * radius,
Math.cos(cameraState.yaw) * horizontal
);
camera.lookAt(cameraTarget);
}
let dragging = false;
let dragX = 0;
let dragY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
dragX = event.clientX;
dragY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - dragX;
const dy = event.clientY - dragY;
dragX = event.clientX;
dragY = event.clientY;
cameraState.yaw -= dx * 0.005;
cameraState.pitch = THREE.MathUtils.clamp(
cameraState.pitch + dy * 0.0035,
0.06,
0.66
);
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined) {
try {
renderer.domElement.releasePointerCapture(event.pointerId);
} catch (_) {}
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.zoom = THREE.MathUtils.clamp(
cameraState.zoom * Math.exp(-event.deltaY * 0.001),
0.72,
1.5
);
camera.zoom = cameraState.zoom;
camera.updateProjectionMatrix();
},
{ passive: false }
);
window.addEventListener("resize", resize);
resize();
updateCamera();
// -------------------------------------------------------------------------
// Lighting and reusable solid-form helpers
// -------------------------------------------------------------------------
const hemisphere = new THREE.HemisphereLight(0xfff9e8, 0x71808a, 2.05);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff3d7, 3.0);
keyLight.position.set(-7, 12, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -12;
keyLight.shadow.camera.right = 12;
keyLight.shadow.camera.top = 10;
keyLight.shadow.camera.bottom = -8;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 35;
keyLight.shadow.bias = -0.0005;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xbdd5df, 1.0);
fillLight.position.set(8, 5, -6);
scene.add(fillLight);
const material = (color, options = {}) =>
new THREE.MeshStandardMaterial({
color,
roughness: 0.82,
metalness: 0,
flatShading: true,
...options
});
const M = {
ground: material(0xe7deca),
platform: material(0xf0e8d7),
paleBlue: material(0xd6e1df),
paleGreen: material(0xd9dfd0),
paleClay: material(0xe5d1c4),
wood: material(0xa9784c),
woodLight: material(0xc49662),
woodDark: material(0x6f4e38),
cord: material(0xe3b85d),
cordLight: material(0xf0d68c),
clay: material(0xb9674b),
clayDark: material(0x8e4e3e),
ink: material(0x273b42),
skin: material(0xc98767),
skin2: material(0x9b6049),
hair: material(0x3a302b),
hair2: material(0x6a4b36),
shoe: material(0x39454a),
blue: material(0x4e7180),
sage: material(0x688574),
ochre: material(0xc28a42),
white: material(0xf8f0de),
peg: material(0xe2bd7c)
};
function addMesh(geometry, mat, parent, position = [0, 0, 0]) {
const mesh = new THREE.Mesh(geometry, mat);
mesh.position.set(...position);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function box(parent, size, mat, position) {
return addMesh(new THREE.BoxGeometry(...size), mat, parent, position);
}
function cylinder(
parent,
radiusTop,
radiusBottom,
height,
segments,
mat,
position
) {
return addMesh(
new THREE.CylinderGeometry(
radiusTop,
radiusBottom,
height,
segments
),
mat,
parent,
position
);
}
function sphere(parent, radius, mat, position, widthSegments = 12) {
return addMesh(
new THREE.SphereGeometry(radius, widthSegments, 8),
mat,
parent,
position
);
}
function makeArchPanel(x, mat, z = -1.28) {
const shape = new THREE.Shape();
shape.moveTo(-1.43, 0);
shape.lineTo(-1.43, 2.15);
shape.quadraticCurveTo(-1.43, 3.22, 0, 3.42);
shape.quadraticCurveTo(1.43, 3.22, 1.43, 2.15);
shape.lineTo(1.43, 0);
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: 0.12,
bevelEnabled: false,
curveSegments: 18
});
const panel = addMesh(geometry, mat, scene, [x, 0.03, z]);
panel.castShadow = false;
return panel;
}
function makeBench(x, width = 2.6, z = 0.25) {
const group = new THREE.Group();
group.position.set(x, 0, z);
scene.add(group);
box(group, [width, 0.16, 1.25], M.woodLight, [0, 1.04, 0]);
box(group, [0.18, 1.0, 0.18], M.woodDark, [-width * 0.39, 0.52, 0.42]);
box(group, [0.18, 1.0, 0.18], M.woodDark, [width * 0.39, 0.52, 0.42]);
box(group, [0.18, 1.0, 0.18], M.woodDark, [-width * 0.39, 0.52, -0.42]);
box(group, [0.18, 1.0, 0.18], M.woodDark, [width * 0.39, 0.52, -0.42]);
box(group, [width * 0.78, 0.10, 0.10], M.woodDark, [0, 0.48, 0]);
return group;
}
function makeFigure({
x,
z,
coat,
skin = M.skin,
hair = M.hair,
scale = 1
}) {
const root = new THREE.Group();
root.position.set(x, 0.12, z);
root.scale.setScalar(scale);
scene.add(root);
// Legs and shoes.
cylinder(root, 0.12, 0.14, 0.72, 8, M.ink, [-0.19, 0.46, 0]);
cylinder(root, 0.12, 0.14, 0.72, 8, M.ink, [0.19, 0.46, 0]);
box(root, [0.29, 0.16, 0.43], M.shoe, [-0.19, 0.10, 0.07]);
box(root, [0.29, 0.16, 0.43], M.shoe, [0.19, 0.10, 0.07]);
// Torso and apron.
cylinder(root, 0.34, 0.48, 1.02, 8, coat, [0, 1.28, 0]);
box(root, [0.61, 0.72, 0.07], M.white, [0, 1.22, 0.39]);
// Neck and head.
cylinder(root, 0.12, 0.12, 0.18, 8, skin, [0, 1.86, 0]);
const head = new THREE.Group();
head.position.set(0, 2.13, 0);
root.add(head);
sphere(head, 0.34, skin, [0, 0, 0], 12);
addMesh(
new THREE.SphereGeometry(
0.355,
12,
8,
0,
Math.PI * 2,
0,
Math.PI * 0.56
),
hair,
head,
[0, 0.035, 0]
);
sphere(head, 0.035, M.ink, [-0.115, 0.02, 0.307], 8);
sphere(head, 0.035, M.ink, [0.115, 0.02, 0.307], 8);
sphere(head, 0.055, skin, [0, -0.035, 0.335], 8);
// Articulated arms.
const arms = [];
function makeArm(side) {
const shoulder = new THREE.Group();
shoulder.position.set(0.41 * side, 1.68, 0.01);
root.add(shoulder);
cylinder(shoulder, 0.105, 0.115, 0.58, 8, coat, [0, -0.29, 0]);
sphere(shoulder, 0.115, coat, [0, -0.57, 0], 8);
const elbow = new THREE.Group();
elbow.position.set(0, -0.57, 0);
shoulder.add(elbow);
cylinder(elbow, 0.09, 0.10, 0.55, 8, skin, [0, -0.275, 0]);
sphere(elbow, 0.11, skin, [0, -0.57, 0], 8);
arms.push({ side, shoulder, elbow });
}
makeArm(-1);
makeArm(1);
root.userData = { arms, head };
return root;
}
function arm(figure, side) {
return figure.userData.arms.find((a) => a.side === side);
}
// -------------------------------------------------------------------------
// The diorama and fictional communities
// -------------------------------------------------------------------------
box(scene, [16.2, 0.32, 5.2], M.ground, [0, -0.22, 0.1]);
const stationXs = [-5, 0, 5];
const stationColors = [M.paleBlue, M.paleGreen, M.paleClay];
const ringMaterials = [];
stationXs.forEach((x, index) => {
makeArchPanel(x, stationColors[index]);
const platform = cylinder(
scene,
1.62,
1.72,
0.13,
32,
M.platform,
[x, 0.01, 0.15]
);
platform.receiveShadow = true;
const ringMaterial = material(
index === 0 ? 0x4e7180 : index === 1 ? 0x688574 : 0xbd694d,
{
transparent: true,
opacity: 0.25,
emissive: index === 0 ? 0x193039 : 0x000000,
emissiveIntensity: 0.18
}
);
const ring = addMesh(
new THREE.TorusGeometry(1.49, 0.025, 6, 64),
ringMaterial,
scene,
[x, 0.09, 0.15]
);
ring.rotation.x = Math.PI / 2;
ring.castShadow = false;
ringMaterials.push(ringMaterial);
});
// -------------------------------------------------------------------------
// Station 1: cross-lap joinery and a driven wooden peg
// -------------------------------------------------------------------------
makeBench(-5, 2.6);
const groveFigure = makeFigure({
x: -5,
z: -0.78,
coat: M.blue,
skin: M.skin2,
hair: M.hair
});
const horizontalBeam = box(
scene,
[1.85, 0.48, 0.34],
M.woodLight,
[-5, 1.63, 0.32]
);
const verticalBeam = box(
scene,
[0.57, 1.70, 0.34],
M.wood,
[-5, 2.58, 0.32]
);
const peg = cylinder(
scene,
0.105,
0.105,
0.58,
12,
M.peg,
[-5, 1.65, 1.06]
);
peg.rotation.x = Math.PI / 2;
const hammer = new THREE.Group();
hammer.position.set(-4.56, 2.55, 0.96);
scene.add(hammer);
cylinder(hammer, 0.045, 0.06, 0.68, 8, M.woodDark, [0, 0, 0]);
box(hammer, [0.40, 0.18, 0.18], M.ink, [0, 0.31, 0]);
hammer.rotation.z = -0.28;
// -------------------------------------------------------------------------
// Station 2: wrapped cord lashing around paired reeds
// -------------------------------------------------------------------------
makeBench(0, 2.5);
const riverFigure = makeFigure({
x: 0,
z: -0.78,
coat: M.sage,
skin: M.skin,
hair: M.hair2
});
cylinder(scene, 0.13, 0.15, 1.82, 10, M.woodLight, [-0.25, 1.93, 0.34]);
cylinder(scene, 0.13, 0.15, 1.82, 10, M.ochre, [0.25, 1.93, 0.34]);
function makeCordCurve(centerX, radius, yStart, yEnd, turns) {
const points = [];
const count = 150;
for (let i = 0; i < count; i++) {
const t = i / (count - 1);
const angle = t * Math.PI * 2 * turns;
points.push(
new THREE.Vector3(
centerX + Math.cos(angle) * radius,
THREE.MathUtils.lerp(yStart, yEnd, t),
0.34 + Math.sin(angle) * radius
)
);
}
return new THREE.CatmullRomCurve3(points);
}
function makeCordTube(curve) {
const geometry = new THREE.TubeGeometry(curve, 180, 0.035, 6, false);
const mesh = addMesh(geometry, M.cord, scene);
mesh.castShadow = true;
return mesh;
}
const riverCurve = makeCordCurve(0, 0.39, 1.42, 2.17, 4.5);
const riverCord = makeCordTube(riverCurve);
const riverIndexCount = riverCord.geometry.index.count;
// A loose end makes the wrapped technique legible.
const looseCord = cylinder(
scene,
0.028,
0.028,
0.75,
7,
M.cordLight,
[0.42, 2.05, 0.18]
);
looseCord.rotation.z = -0.72;
looseCord.rotation.x = 0.25;
// -------------------------------------------------------------------------
// Station 3: two makers adapt the lashing to ceramic and wood
// -------------------------------------------------------------------------
makeBench(5, 3.15);
const woodFigure = makeFigure({
x: 4.03,
z: -0.78,
coat: M.blue,
skin: M.skin2,
hair: M.hair
});
const clayFigure = makeFigure({
x: 5.88,
z: -0.78,
coat: M.ochre,
skin: M.skin,
hair: M.hair2
});
const clayRing = addMesh(
new THREE.TorusGeometry(0.43, 0.15, 8, 28),
M.clay,
scene,
[4.38, 1.86, 0.35]
);
clayRing.castShadow = true;
const woodenHandle = cylinder(
scene,
0.15,
0.18,
1.65,
10,
M.wood,
[5.52, 1.86, 0.35]
);
const adaptCurve = makeCordCurve(5.0, 0.58, 1.44, 2.17, 4.6);
const adaptCord = makeCordTube(adaptCurve);
const adaptIndexCount = adaptCord.geometry.index.count;
// A small ceramic vessel identifies the unfamiliar material clearly.
cylinder(
scene,
0.32,
0.23,
0.45,
12,
M.clayDark,
[5.78, 1.22, 0.18]
);
// -------------------------------------------------------------------------
// Curved exchange arrows
// -------------------------------------------------------------------------
function makeArrow(points, color) {
const curve = new THREE.CatmullRomCurve3(
points.map((p) => new THREE.Vector3(...p))
);
const arrowMaterial = material(color, {
transparent: true,
opacity: 0.28,
emissive: color,
emissiveIntensity: 0.12
});
const tube = addMesh(
new THREE.TubeGeometry(curve, 48, 0.032, 6, false),
arrowMaterial,
scene
);
tube.castShadow = false;
const tangent = curve.getTangent(1).normalize();
const head = addMesh(
new THREE.ConeGeometry(0.10, 0.26, 8),
arrowMaterial,
scene,
curve.getPoint(1).toArray()
);
head.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
tangent
);
head.castShadow = false;
const bead = sphere(scene, 0.095, M.cordLight, [0, 0, 0], 10);
bead.castShadow = false;
bead.visible = false;
return { curve, material: arrowMaterial, bead };
}
const arrowOne = makeArrow(
[
[-3.65, 3.03, 0.18],
[-2.82, 3.42, 0.18],
[-1.58, 3.02, 0.18]
],
0xd79b3d
);
const arrowTwo = makeArrow(
[
[1.60, 3.03, 0.18],
[2.80, 3.45, 0.18],
[3.75, 3.03, 0.18]
],
0xbd694d
);
// -------------------------------------------------------------------------
// Timeline and interface
// -------------------------------------------------------------------------
const DURATION = 23;
const phaseButtons = [...document.querySelectorAll(".phase-buttons button")];
const phaseTitle = document.querySelector("#phase-title");
const phaseNumber = document.querySelector("#phase-number");
const progress = document.querySelector("#progress");
const pauseButton = document.querySelector("#pause");
const resetCameraButton = document.querySelector("#reset");
const labels = [
document.querySelector("#label-0"),
document.querySelector("#label-1"),
document.querySelector("#label-2")
];
const materialTag = document.querySelector("#material-tag");
const phases = [
{
start: 0,
title: "Alder Grove demonstrates a cross-lap joint",
number: "Phase 01 / 04",
station: 0
},
{
start: 5,
title: "Riverbend demonstrates wrapped cord lashing",
number: "Phase 02 / 04",
station: 1
},
{
start: 9.5,
title: "Methods move between the fictional communities",
number: "Phase 03 / 04",
station: 2
},
{
start: 14,
title: "Lashing is adapted for a ceramic-and-wood joint",
number: "Phase 04 / 04",
station: 2
},
{
start: 20,
title: "A new joining practice becomes a shared technique",
number: "Closing / Shared craft",
station: 2
}
];
let elapsed = 0;
let playing = true;
let lastTime = performance.now();
let lastPhase = -1;
phaseButtons.forEach((button) => {
button.addEventListener("click", () => {
elapsed = Number(button.dataset.time);
lastTime = performance.now();
});
});
pauseButton.addEventListener("click", () => {
playing = !playing;
pauseButton.textContent = playing ? "❚❚" : "▶";
pauseButton.setAttribute(
"aria-label",
playing ? "Pause animation" : "Play animation"
);
});
resetCameraButton.addEventListener("click", () => {
cameraState.yaw = 0;
cameraState.pitch = 0.24;
cameraState.zoom = 1;
camera.zoom = 1;
camera.updateProjectionMatrix();
});
function getPhaseIndex(t) {
if (t < 5) return 0;
if (t < 9.5) return 1;
if (t < 14) return 2;
if (t < 20) return 3;
return 4;
}
function updateInterface(t, phaseIndex) {
progress.style.width = `${(t / DURATION) * 100}%`;
if (phaseIndex !== lastPhase) {
lastPhase = phaseIndex;
const phase = phases[phaseIndex];
phaseTitle.textContent = phase.title;
phaseNumber.textContent = phase.number;
labels.forEach((label, index) => {
label.classList.toggle("active", index === phase.station);
});
phaseButtons.forEach((button, index) => {
button.classList.toggle("active", index === Math.min(phaseIndex, 3));
});
}
materialTag.classList.toggle("visible", t >= 13.4);
}
// -------------------------------------------------------------------------
// Animation helpers
// -------------------------------------------------------------------------
const clamp = THREE.MathUtils.clamp;
const smooth = THREE.MathUtils.smoothstep;
const lerp = THREE.MathUtils.lerp;
function setCordProgress(mesh, indexCount, progressValue) {
const visibleIndices =
Math.floor((indexCount * clamp(progressValue, 0, 1)) / 6) * 6;
mesh.geometry.setDrawRange(0, visibleIndices);
}
function resetArm(armGroup) {
armGroup.shoulder.rotation.set(-0.34, 0, 0);
armGroup.elbow.rotation.set(-0.38, 0, 0);
}
function animateFigure(figure, amount, alternate = 0) {
figure.userData.arms.forEach((armGroup) => resetArm(armGroup));
const left = arm(figure, -1);
const right = arm(figure, 1);
left.shoulder.rotation.x = -0.45 - amount * 0.45;
left.elbow.rotation.x = -0.42 - amount * 0.34;
left.shoulder.rotation.z = -0.12 - amount * 0.12;
right.shoulder.rotation.x = -0.50 - amount * 0.48;
right.elbow.rotation.x = -0.46 - amount * 0.30;
right.shoulder.rotation.z = 0.12 + amount * 0.12;
if (alternate) {
left.shoulder.rotation.x += Math.sin(alternate) * 0.2;
right.shoulder.rotation.x -= Math.sin(alternate) * 0.2;
}
}
function animateScene(t) {
// Station 1: lower the vertical member, align, then drive the peg.
const groveProgress = clamp(t / 4.6);
const lower = smooth(groveProgress, 0, 0.36);
const pegProgress = smooth(groveProgress, 0.42, 0.72);
verticalBeam.position.y = lerp(2.58, 1.94, lower);
peg.position.z = lerp(1.06, 0.55, pegProgress);
const hammerVisible = t > 3.1 && t < 4.8;
hammer.visible = hammerVisible;
if (hammerVisible) {
const tap = Math.max(0, Math.sin((t - 3.1) * 17));
hammer.position.y = 2.55 - tap * 0.27;
hammer.rotation.z = -0.28 + tap * 0.08;
}
animateFigure(groveFigure, groveProgress);
const groveRight = arm(groveFigure, 1);
groveRight.shoulder.rotation.x = -0.95 - lower * 0.25;
groveRight.elbow.rotation.x = -0.72;
// Station 2: grow the wrapped lashing around the reed bundle.
const riverProgress = smooth(t, 5.1, 9.0);
setCordProgress(riverCord, riverIndexCount, riverProgress);
looseCord.visible = t >= 5.0;
const wrappingMotion =
t >= 5 && t < 9 ? (t - 5) * 7.5 : t >= 9 ? 18 : 0;
animateFigure(riverFigure, riverProgress * 0.92, wrappingMotion);
// Station 3: bring the ceramic and wooden members together.
const convergence = smooth(t, 9.5, 12.3);
clayRing.position.x = lerp(4.38, 4.72, convergence);
woodenHandle.position.x = lerp(5.52, 5.27, convergence);
const adaptProgress = smooth(t, 14.0, 19.4);
setCordProgress(adaptCord, adaptIndexCount, adaptProgress);
animateFigure(woodFigure, convergence * 0.72);
animateFigure(clayFigure, adaptProgress * 0.86, wrappingMotion * 0.8);
// The woodworker supports the new member from the left.
const woodRight = arm(woodFigure, 1);
woodRight.shoulder.rotation.x = -1.05;
woodRight.shoulder.rotation.z = 0.35;
woodRight.elbow.rotation.x = -0.38;
// The cord maker reaches inward to wind the adapted lashing.
const clayLeft = arm(clayFigure, -1);
clayLeft.shoulder.rotation.x = -1.02;
clayLeft.shoulder.rotation.z = -0.38;
clayLeft.elbow.rotation.x = -0.52;
// Exchange arrows brighten and carry visible tokens.
const exchangeIn = smooth(t, 9.25, 10.1);
const exchangeOut = 1 - smooth(t, 13.5, 14.15);
const exchangeGlow = Math.min(exchangeIn, exchangeOut);
arrowOne.material.opacity = 0.22 + exchangeGlow * 0.72;
arrowTwo.material.opacity = 0.22 + exchangeGlow * 0.72;
arrowOne.bead.visible = t >= 9.4 && t <= 11.4;
if (arrowOne.bead.visible) {
const p = clamp((t - 9.4) / 2.0);
arrowOne.bead.position.copy(arrowOne.curve.getPoint(p));
}
arrowTwo.bead.visible = t >= 11.2 && t <= 14.0;
if (arrowTwo.bead.visible) {
const p = clamp((t - 11.2) / 2.8);
arrowTwo.bead.position.copy(arrowTwo.curve.getPoint(p));
}
// Subtle human motion keeps the scene alive without obscuring the technique.
const breathing = Math.sin(t * 1.8) * 0.018;
groveFigure.userData.head.rotation.y = Math.sin(t * 0.55) * 0.07;
riverFigure.userData.head.rotation.y = Math.sin(t * 0.65 + 1) * 0.08;
woodFigure.userData.head.rotation.y = Math.sin(t * 0.6 + 2) * 0.06;
clayFigure.userData.head.rotation.y = Math.sin(t * 0.7 + 3) * 0.07;
groveFigure.position.y = 0.12 + breathing;
riverFigure.position.y = 0.12 - breathing;
woodFigure.position.y = 0.12 + breathing * 0.5;
clayFigure.position.y = 0.12 - breathing * 0.5;
const activeStation = t < 5 ? 0 : t < 9.5 ? 1 : 2;
ringMaterials.forEach((ringMaterial, index) => {
ringMaterial.opacity = index === activeStation ? 0.95 : 0.22;
ringMaterial.emissiveIntensity =
index === activeStation ? 0.45 : 0.08;
});
}
// -------------------------------------------------------------------------
// Project HTML labels into the Three.js scene
// -------------------------------------------------------------------------
const labelAnchors = [
new THREE.Vector3(-5, 3.92, -0.4),
new THREE.Vector3(0, 3.92, -0.4),
new THREE.Vector3(5, 3.92, -0.4)
];
const materialAnchor = new THREE.Vector3(5.0, 2.58, 0.35);
const projected = new THREE.Vector3();
function projectElement(element, anchor) {
projected.copy(anchor).project(camera);
const x = (projected.x * 0.5 + 0.5) * window.innerWidth;
const y = (-projected.y * 0.5 + 0.5) * window.innerHeight;
element.style.left = `${x}px`;
element.style.top = `${y}px`;
element.style.visibility =
projected.z > -1 && projected.z < 1 ? "visible" : "hidden";
}
// -------------------------------------------------------------------------
// Render loop
// -------------------------------------------------------------------------
function frame(now) {
const dt = Math.min((now - lastTime) / 1000, 0.05);
lastTime = now;
if (playing) {
elapsed = (elapsed + dt) % DURATION;
}
const phaseIndex = getPhaseIndex(elapsed);
updateInterface(elapsed, phaseIndex);
animateScene(elapsed);
updateCamera();
labels.forEach((label, index) => {
projectElement(label, labelAnchors[index]);
});
projectElement(materialTag, materialAnchor);
renderer.render(scene, camera);
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
requestAnimationFrame(() => {
document.querySelector("#loading").classList.add("hidden");
});
</script>
</body>
</html>
```