Prompt specification
Build or customize the Three.js 3D scene "Scribe preparing a ruled page" 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: Scribe preparing a ruled page
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/scribe-preparing-a-ruled-page-x2370
Scene Description Prompt:
Make a standalone HTML scene with Three.js from cdnjs that depicts medieval manuscript copying and binding. Create a referenced medieval writing desk with ruled page, pen, ink vessel, and exemplar stand. Animate line placement and mark decorative writing as nonspecific illustration. Low-poly.
Working Three.js Starter (scribe-preparing-a-ruled-page-x2370):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Medieval Scriptorium — Copying Desk</title>
<style>
:root {
color-scheme: dark;
--ink: #241811;
--parchment: #ead29a;
--gold: #c99b52;
--glass: rgba(25, 17, 12, 0.76);
--line: rgba(224, 195, 137, 0.25);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #19130f;
font-family: Georgia, "Times New Roman", serif;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
#vignette {
position: fixed;
inset: 0;
pointer-events: none;
background:
radial-gradient(circle at 50% 45%, transparent 38%, rgba(8, 5, 3, 0.48) 100%),
linear-gradient(180deg, rgba(8, 5, 3, 0.12), transparent 30%, rgba(8, 5, 3, 0.25));
z-index: 2;
}
#hud {
position: fixed;
inset: 0;
z-index: 3;
pointer-events: none;
color: var(--parchment);
}
#title {
position: absolute;
top: 24px;
left: 28px;
max-width: min(490px, calc(100vw - 56px));
padding: 16px 18px 14px;
border: 1px solid var(--line);
border-left: 3px solid var(--gold);
background: var(--glass);
backdrop-filter: blur(8px);
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}
#title h1 {
margin: 0 0 5px;
color: #f2dfb5;
font-size: clamp(21px, 3vw, 31px);
font-weight: 500;
letter-spacing: 0.04em;
}
#title p {
margin: 0;
color: #c8b489;
font: 12px/1.45 system-ui, sans-serif;
}
#legend {
position: absolute;
left: 28px;
bottom: 27px;
display: grid;
gap: 7px;
padding: 12px 15px;
border: 1px solid var(--line);
background: var(--glass);
color: #d9c59a;
font: 11px/1.2 system-ui, sans-serif;
backdrop-filter: blur(8px);
}
#legend span {
display: flex;
align-items: center;
gap: 8px;
}
#legend i {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
box-shadow: 0 0 0 2px rgba(255,255,255,0.08);
}
#legend .copy { background: #6f321d; }
#legend .source { background: #55758c; }
#legend .tools { background: #b6904e; }
#controls {
position: absolute;
right: 28px;
bottom: 27px;
width: min(330px, calc(100vw - 56px));
padding: 13px 14px;
border: 1px solid var(--line);
background: var(--glass);
backdrop-filter: blur(8px);
pointer-events: auto;
}
#status {
min-height: 16px;
margin-bottom: 9px;
color: #ead9ae;
font: 11px/1.35 system-ui, sans-serif;
}
#progressTrack {
height: 3px;
overflow: hidden;
background: rgba(235, 213, 164, 0.14);
}
#progress {
width: 0;
height: 100%;
background: linear-gradient(90deg, #80512c, #d8ad63);
transition: width 100ms linear;
}
.buttonRow {
display: flex;
gap: 8px;
margin-top: 11px;
}
button {
appearance: none;
border: 1px solid rgba(220, 185, 116, 0.32);
background: rgba(104, 71, 36, 0.66);
color: #f0dfb8;
padding: 7px 10px;
font: 11px system-ui, sans-serif;
cursor: pointer;
transition: background 140ms, border-color 140ms;
}
button:hover {
background: rgba(139, 91, 42, 0.82);
border-color: rgba(230, 196, 124, 0.62);
}
#hint {
margin-left: auto;
align-self: center;
color: #998b70;
font: 10px system-ui, sans-serif;
}
@media (max-width: 680px) {
#title { top: 14px; left: 14px; }
#legend { display: none; }
#controls { right: 14px; bottom: 14px; width: calc(100vw - 28px); }
#hint { display: none; }
}
</style>
</head>
<body>
<div id="vignette"></div>
<div id="hud">
<section id="title">
<h1>Medieval Scriptorium</h1>
<p>
Reference-informed generic late-medieval copying desk.
The animated marks are decorative, non-linguistic strokes.
</p>
</section>
<section id="legend" aria-label="Scene legend">
<span><i class="copy"></i> ruled copy sheet</span>
<span><i class="source"></i> exemplar on stand</span>
<span><i class="tools"></i> quill and ink vessel</span>
</section>
<section id="controls">
<div id="status" aria-live="polite">Preparing the copy sheet…</div>
<div id="progressTrack"><div id="progress"></div></div>
<div class="buttonRow">
<button id="replay" type="button">Replay copying</button>
<button id="pause" type="button">Pause</button>
<span id="hint">Drag to orbit · wheel to zoom · double-click resets</span>
</div>
</section>
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ---------------------------------------------------------------------
// Renderer, camera and lighting
// ---------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x19130f);
scene.fog = new THREE.Fog(0x19130f, 8.5, 15.5);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
50
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 1.8));
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",
"Interactive low-poly medieval manuscript copying scene"
);
document.body.prepend(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xdde8f0, 0x3b2517, 1.65);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffd59a, 3.15);
keyLight.position.set(-3.5, 7, 4.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -5;
keyLight.shadow.camera.right = 5;
keyLight.shadow.camera.top = 5;
keyLight.shadow.camera.bottom = -5;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 16;
keyLight.shadow.bias = -0.00035;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0x9bbbd3, 0.85);
fillLight.position.set(5, 3.5, -4);
scene.add(fillLight);
// ---------------------------------------------------------------------
// Materials and low-poly construction helpers
// ---------------------------------------------------------------------
function standard(color, roughness = 0.85, metalness = 0) {
return new THREE.MeshStandardMaterial({
color,
roughness,
metalness,
flatShading: true
});
}
const materials = {
wood: standard(0x6f3c20, 0.88),
woodLight: standard(0x8b5429, 0.84),
woodDark: standard(0x422414, 0.92),
parchment: standard(0xe5ca91, 0.96),
parchmentEdge: standard(0xc7a86e, 0.98),
ink: standard(0x321d15, 0.68),
ruling: standard(0x9b4c3e, 0.95),
blue: standard(0x365d7c, 0.74),
red: standard(0x8b3025, 0.78),
gold: standard(0xc99a4b, 0.4, 0.5),
ceramic: standard(0x294c67, 0.62),
ceramicDark: standard(0x173348, 0.67),
stone: standard(0x51483e, 0.98),
stoneDark: standard(0x3e3832, 0.98),
floor: standard(0x39281d, 0.96),
rug: standard(0x642b27, 0.95),
ivory: standard(0xe2d5b7, 0.82),
feather: new THREE.MeshStandardMaterial({
color: 0xe8dfc6,
roughness: 0.92,
side: THREE.DoubleSide,
flatShading: true
}),
wax: standard(0x8a3328, 0.88),
flame: new THREE.MeshStandardMaterial({
color: 0xffb23e,
emissive: 0xff681a,
emissiveIntensity: 2.4,
roughness: 0.6,
flatShading: true
})
};
function addMesh(geometry, material, parent = scene) {
const mesh = new THREE.Mesh(geometry, material);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function box(w, h, d, material, x = 0, y = 0, z = 0, parent = scene) {
const mesh = addMesh(new THREE.BoxGeometry(w, h, d), material, parent);
mesh.position.set(x, y, z);
return mesh;
}
function cylinderBetween(a, b, radius, material, parent = scene, sides = 6) {
const direction = b.clone().sub(a);
const length = direction.length();
const mesh = addMesh(
new THREE.CylinderGeometry(radius, radius, length, sides),
material,
parent
);
mesh.position.copy(a).add(b).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return mesh;
}
function seededRandom(seed) {
return function () {
seed |= 0;
seed = seed + 0x6D2B79F5 | 0;
let t = Math.imul(seed ^ seed >>> 15, 1 | seed);
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
return ((t ^ t >>> 14) >>> 0) / 4294967296;
};
}
// ---------------------------------------------------------------------
// Room, floor and rug
// ---------------------------------------------------------------------
const floor = addMesh(
new THREE.PlaneGeometry(18, 18),
materials.floor
);
floor.rotation.x = -Math.PI / 2;
floor.castShadow = false;
box(13, 6.3, 0.24, materials.stoneDark, 0, 3.15, -4.65);
const blockRandom = seededRandom(91);
const blockMaterials = [
materials.stone,
materials.stoneDark,
standard(0x5b5146, 0.98),
standard(0x494139, 0.98)
];
for (let row = 0; row < 6; row++) {
for (let col = 0; col < 8; col++) {
const block = box(
1.58,
1.00,
0.08,
blockMaterials[Math.floor(blockRandom() * blockMaterials.length)],
-5.63 + col * 1.61,
0.51 + row * 1.02,
-4.49
);
block.castShadow = false;
}
}
box(6.6, 0.035, 4.15, materials.rug, 0, 0.025, 0.1);
box(6.25, 0.012, 3.8, materials.woodDark, 0, 0.047, 0.1);
const rugBorder = standard(0x9a5a36, 0.95);
box(6.32, 0.012, 0.065, rugBorder, 0, 0.057, -1.76);
box(6.32, 0.012, 0.065, rugBorder, 0, 0.057, 1.96);
box(0.065, 0.012, 3.73, rugBorder, -3.13, 0.057, 0.1);
box(0.065, 0.012, 3.73, rugBorder, 3.13, 0.057, 0.1);
// A stylized cold window in the rear wall.
const windowGroup = new THREE.Group();
windowGroup.position.set(-3.15, 3.35, -4.27);
scene.add(windowGroup);
const paneMaterial = new THREE.MeshStandardMaterial({
color: 0x6c9eaa,
emissive: 0x315a68,
emissiveIntensity: 0.7,
roughness: 0.85,
flatShading: true
});
box(1.85, 2.25, 0.08, paneMaterial, 0, 0, 0, windowGroup);
box(2.08, 0.16, 0.18, materials.woodDark, 0, 1.18, 0.04, windowGroup);
box(2.08, 0.16, 0.18, materials.woodDark, 0, -1.18, 0.04, windowGroup);
box(0.16, 2.48, 0.18, materials.woodDark, -1.00, 0, 0.04, windowGroup);
box(0.16, 2.48, 0.18, materials.woodDark, 1.00, 0, 0.04, windowGroup);
box(0.10, 2.30, 0.18, materials.woodDark, 0, 0, 0.07, windowGroup);
box(1.90, 0.10, 0.18, materials.woodDark, 0, 0, 0.07, windowGroup);
const windowLight = new THREE.PointLight(0x9cc9dc, 7, 7, 2);
windowLight.position.set(-3.1, 3.6, -3.6);
scene.add(windowLight);
// ---------------------------------------------------------------------
// Medieval trestle writing table
// ---------------------------------------------------------------------
const desk = new THREE.Group();
scene.add(desk);
box(5.35, 0.20, 2.48, materials.wood, 0, 1.45, 0, desk);
box(5.40, 0.075, 2.52, materials.woodLight, 0, 1.535, 0, desk);
box(5.08, 0.12, 0.12, materials.woodDark, 0, 1.31, 1.23, desk);
for (const x of [-2.05, 2.05]) {
for (const z of [-0.82, 0.82]) {
const leg = box(0.19, 1.32, 0.19, materials.woodDark, x, 0.71, z, desk);
leg.rotation.z = x < 0 ? -0.035 : 0.035;
}
box(0.22, 0.19, 1.88, materials.wood, x, 0.36, 0, desk);
box(0.48, 0.12, 2.05, materials.woodDark, x, 0.12, 0, desk);
}
box(4.08, 0.16, 0.18, materials.woodDark, 0, 0.52, 0, desk);
box(0.20, 0.20, 1.86, materials.wood, 0, 0.52, 0, desk);
// Small carved-looking front bosses.
for (const x of [-1.1, 0, 1.1]) {
const boss = addMesh(
new THREE.OctahedronGeometry(0.11, 0),
materials.woodLight,
desk
);
boss.position.set(x, 1.31, 1.27);
boss.scale.set(1.15, 1.15, 0.42);
}
// ---------------------------------------------------------------------
// Sloped writing board and ruled parchment
// ---------------------------------------------------------------------
const copyBoard = new THREE.Group();
copyBoard.position.set(-0.73, 1.69, 0.08);
copyBoard.rotation.x = 0.10;
scene.add(copyBoard);
box(2.43, 0.08, 2.39, materials.woodDark, 0, 0, 0, copyBoard);
box(2.49, 0.055, 0.075, materials.woodLight, 0, 0.025, 1.15, copyBoard);
box(2.49, 0.055, 0.075, materials.woodLight, 0, 0.025, -1.15, copyBoard);
box(0.075, 0.055, 2.30, materials.woodLight, -1.18, 0.025, 0, copyBoard);
box(0.075, 0.055, 2.30, materials.woodLight, 1.18, 0.025, 0, copyBoard);
// Two slightly offset lower sheets make the stack visible.
box(2.10, 0.014, 2.17, materials.parchmentEdge, 0.015, 0.049, 0.012, copyBoard);
box(2.07, 0.014, 2.15, materials.parchment, -0.010, 0.061, 0, copyBoard);
box(2.04, 0.022, 2.12, materials.parchment, 0, 0.077, 0, copyBoard);
const PAGE_TOP = 0.088;
const TEXT_Y = 0.099;
const RULE_Y = 0.091;
// Ruling is deliberately visible between and beside the decorative marks.
for (let i = 0; i < 7; i++) {
const z = -0.76 + i * 0.255;
const rule = box(1.83, 0.004, 0.009, materials.ruling, 0, RULE_Y, z, copyBoard);
rule.castShadow = false;
}
for (const x of [-0.91, 0.91]) {
const rule = box(0.009, 0.004, 1.83, materials.ruling, x, RULE_Y, 0, copyBoard);
rule.castShadow = false;
}
const blueMargin = box(
0.009, 0.004, 1.78, materials.blue, -0.86, RULE_Y + 0.001, 0, copyBoard
);
blueMargin.castShadow = false;
// Brass corner pins.
for (const x of [-0.97, 0.97]) {
for (const z of [-0.98, 0.98]) {
const pin = addMesh(
new THREE.CylinderGeometry(0.025, 0.025, 0.012, 8),
materials.gold,
copyBoard
);
pin.position.set(x, 0.096, z);
}
}
// A non-letter-like illuminated initial: a geometric rosette.
const initial = new THREE.Group();
initial.position.set(-0.86, 0.099, -0.80);
initial.scale.setScalar(0.001);
copyBoard.add(initial);
box(0.25, 0.010, 0.25, materials.gold, 0, 0, 0, initial);
const blueRing = addMesh(
new THREE.TorusGeometry(0.085, 0.018, 4, 12),
materials.blue,
initial
);
blueRing.rotation.x = Math.PI / 2;
blueRing.position.y = 0.010;
const redRing = addMesh(
new THREE.TorusGeometry(0.050, 0.011, 4, 10),
materials.red,
initial
);
redRing.rotation.x = Math.PI / 2;
redRing.position.y = 0.015;
for (let i = 0; i < 6; i++) {
const spoke = box(0.012, 0.008, 0.15, materials.red, 0, 0.013, 0, initial);
spoke.rotation.y = i * Math.PI / 3;
}
const initialCenter = addMesh(
new THREE.OctahedronGeometry(0.035, 0),
materials.blue,
initial
);
initialCenter.position.y = 0.024;
// ---------------------------------------------------------------------
// Exemplar stand and source sheet
// ---------------------------------------------------------------------
const standBase = box(0.78, 0.09, 0.62, materials.woodDark, 1.65, 1.59, -0.35);
standBase.rotation.y = -0.03;
cylinderBetween(
new THREE.Vector3(1.65, 1.63, -0.39),
new THREE.Vector3(1.65, 2.53, -0.48),
0.065,
materials.wood,
scene,
7
);
cylinderBetween(
new THREE.Vector3(1.65, 1.63, -0.12),
new THREE.Vector3(1.65, 2.18, -0.39),
0.035,
materials.woodDark,
scene,
6
);
const exemplar = new THREE.Group();
exemplar.position.set(1.65, 2.46, -0.40);
exemplar.rotation.x = -0.12;
scene.add(exemplar);
box(1.10, 1.30, 0.11, materials.wood, 0, 0, 0, exemplar);
box(0.91, 1.10, 0.025, materials.parchment, 0, 0, 0.071, exemplar);
box(1.02, 0.045, 0.15, materials.woodLight, 0, 0.63, 0.02, exemplar);
box(1.02, 0.045, 0.15, materials.woodLight, 0, -0.63, 0.02, exemplar);
for (let i = 0; i < 7; i++) {
const rule = box(
0.75, 0.007, 0.004, materials.ruling,
0, 0.40 - i * 0.13, 0.087, exemplar
);
rule.castShadow = false;
}
const sourceRed = box(
0.008, 0.96, 0.004, materials.red, -0.38, 0, 0.088, exemplar
);
sourceRed.castShadow = false;
const sourceBlue = box(
0.008, 0.96, 0.004, materials.blue, 0.38, 0, 0.088, exemplar
);
sourceBlue.castShadow = false;
function makeExemplarMarks() {
const positions = [];
const colors = [];
const random = seededRandom(417);
const sepia = new THREE.Color(0x61301d);
const red = new THREE.Color(0x8f3325);
const blue = new THREE.Color(0x3d5f79);
for (let line = 0; line < 6; line++) {
const y = 0.38 - line * 0.13;
let x = -0.33;
while (x < 0.31) {
const width = 0.035 + random() * 0.055;
const steps = 2 + Math.floor(random() * 2);
const color = line === 0 && x < -0.18
? blue
: (line === 2 && x > 0.13 ? red : sepia);
for (let j = 0; j < steps; j++) {
const x0 = x + j * width / steps;
const x1 = x + (j + 1) * width / steps;
const y0 = y + (random() - 0.5) * 0.012;
const y1 = y + (random() - 0.5) * 0.012;
positions.push(x0, y0, 0.092, x1, y1, 0.092);
colors.push(color.r, color.g, color.b, color.r, color.g, color.b);
}
x += width + 0.018 + random() * 0.018;
}
}
const geometry = new THREE.BufferGeometry();
geometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(positions, 3)
);
geometry.setAttribute(
"color",
new THREE.Float32BufferAttribute(colors, 3)
);
const marks = new THREE.LineSegments(
geometry,
new THREE.LineBasicMaterial({
vertexColors: true,
transparent: true,
opacity: 0.94
})
);
exemplar.add(marks);
}
makeExemplarMarks();
// A small geometric decoration at the source page's head.
const sourceInitial = addMesh(
new THREE.TorusGeometry(0.075, 0.012, 4, 10),
materials.blue,
exemplar
);
sourceInitial.rotation.x = Math.PI / 2;
sourceInitial.position.set(-0.28, 0.49, 0.094);
// ---------------------------------------------------------------------
// Faceted ink vessel
// ---------------------------------------------------------------------
const inkPot = new THREE.Group();
inkPot.position.set(0.76, 1.56, 0.72);
scene.add(inkPot);
const potProfile = [
new THREE.Vector2(0.12, 0.00),
new THREE.Vector2(0.20, 0.07),
new THREE.Vector2(0.23, 0.24),
new THREE.Vector2(0.19, 0.37),
new THREE.Vector2(0.105, 0.45),
new THREE.Vector2(0.105, 0.52)
];
const pot = addMesh(
new THREE.LatheGeometry(potProfile, 10),
materials.ceramic,
inkPot
);
const potRim = addMesh(
new THREE.TorusGeometry(0.11, 0.019, 5, 12),
materials.gold,
inkPot
);
potRim.rotation.x = Math.PI / 2;
potRim.position.y = 0.52;
for (const y of [0.16, 0.35]) {
const band = addMesh(
new THREE.TorusGeometry(0.205, 0.012, 4, 12),
materials.gold,
inkPot
);
band.rotation.x = Math.PI / 2;
band.position.y = y;
band.scale.setScalar(0.94);
}
const inkSurface = addMesh(
new THREE.CircleGeometry(0.091, 12),
materials.ink,
inkPot
);
inkSurface.rotation.x = -Math.PI / 2;
inkSurface.position.y = 0.515;
// ---------------------------------------------------------------------
// Candle for additional medieval desk atmosphere
// ---------------------------------------------------------------------
const candle = new THREE.Group();
candle.position.set(2.17, 1.56, 0.72);
scene.add(candle);
const candleBody = addMesh(
new THREE.CylinderGeometry(0.075, 0.09, 0.34, 8),
materials.ivory,
candle
);
candleBody.position.y = 0.17;
const waxDrip = addMesh(
new THREE.CylinderGeometry(0.025, 0.035, 0.11, 6),
materials.ivory,
candle
);
waxDrip.position.set(0.075, 0.27, 0.02);
const flame = addMesh(
new THREE.ConeGeometry(0.065, 0.17, 6),
materials.flame,
candle
);
flame.position.y = 0.43;
const candleLight = new THREE.PointLight(0xffa23c, 5.5, 3.3, 2);
candleLight.position.set(2.17, 2.03, 0.72);
scene.add(candleLight);
// ---------------------------------------------------------------------
// Quill
// ---------------------------------------------------------------------
const quill = new THREE.Group();
scene.add(quill);
const shaft = addMesh(
new THREE.CylinderGeometry(0.017, 0.030, 1.08, 6),
materials.ivory,
quill
);
shaft.position.y = 0.67;
const nib = addMesh(
new THREE.ConeGeometry(0.034, 0.16, 5),
materials.ink,
quill
);
nib.position.y = 0.08;
nib.rotation.z = Math.PI;
const featherShape = new THREE.Shape();
featherShape.moveTo(0.00, 0.53);
featherShape.lineTo(0.13, 0.75);
featherShape.lineTo(0.21, 1.12);
featherShape.lineTo(0.13, 1.43);
featherShape.lineTo(0.035, 1.66);
featherShape.lineTo(-0.07, 1.49);
featherShape.lineTo(-0.18, 1.18);
featherShape.lineTo(-0.16, 0.84);
featherShape.lineTo(-0.09, 0.62);
featherShape.closePath();
const feather = addMesh(
new THREE.ShapeGeometry(featherShape),
materials.feather,
quill
);
feather.position.z = -0.012;
const veinPositions = [
0.00, 0.57, 0.006,
0.025, 1.12, 0.006,
0.035, 1.61, 0.006
];
const veinGeometry = new THREE.BufferGeometry();
veinGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(veinPositions, 3)
);
const vein = new THREE.Line(
veinGeometry,
new THREE.LineBasicMaterial({ color: 0x7d684d })
);
quill.add(vein);
const barbPositions = [];
for (let i = 0; i < 8; i++) {
const y = 0.67 + i * 0.115;
const halfWidth = 0.15 * Math.sin((i + 1) / 9 * Math.PI);
barbPositions.push(
0.005, y, 0.010,
halfWidth, y + 0.105, 0.010,
0.005, y, 0.010,
-halfWidth * 0.86, y + 0.10, 0.010
);
}
const barbGeometry = new THREE.BufferGeometry();
barbGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(barbPositions, 3)
);
const barbs = new THREE.LineSegments(
barbGeometry,
new THREE.LineBasicMaterial({
color: 0x9b8462,
transparent: true,
opacity: 0.72
})
);
quill.add(barbs);
// ---------------------------------------------------------------------
// Animated decorative writing
// ---------------------------------------------------------------------
function createDecorativeLine(z, index) {
const random = seededRandom(1200 + index * 97);
const positions = [];
const colors = [];
const sepia = new THREE.Color(0x63301e);
const fadedRed = new THREE.Color(0x8e3b2c);
const fadedBlue = new THREE.Color(0x3e5f73);
let x = -0.88;
let word = 0;
while (x < 0.88) {
const wordWidth = 0.070 + random() * 0.125;
const steps = 3 + Math.floor(random() * 2);
const step = wordWidth / steps;
let color = sepia;
if (word % 9 === 7) color = fadedRed;
if (index === 1 && word % 13 === 10) color = fadedBlue;
for (let j = 0; j < steps; j++) {
const x0 = x + j * step;
const x1 = x + (j + 1) * step;
const y0 = z + (random() - 0.5) * 0.019;
const y1 = z + (random() - 0.5) * 0.019;
positions.push(
x0, TEXT_Y, y0,
x1, TEXT_Y, y1
);
colors.push(
color.r, color.g, color.b,
color.r, color.g, color.b
);
}
x += wordWidth + 0.028 + random() * 0.025;
word++;
}
const geometry = new THREE.BufferGeometry();
geometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(positions, 3)
);
geometry.setAttribute(
"color",
new THREE.Float32BufferAttribute(colors, 3)
);
geometry.setDrawRange(0, 0);
const mesh = new THREE.LineSegments(
geometry,
new THREE.LineBasicMaterial({
vertexColors: true,
transparent: true,
opacity: 0.96
})
);
copyBoard.add(mesh);
return {
mesh,
positions: new Float32Array(positions),
segmentCount: positions.length / 6,
start: new THREE.Vector3(-0.88, TEXT_Y, z)
};
}
const lineZ = [-0.51, -0.28, -0.05, 0.18, 0.41, 0.64];
const copyLines = lineZ.map((z, i) => createDecorativeLine(z, i));
const state = {
lineIndex: 0,
lineTime: 0,
elapsed: 0,
paused: false,
complete: false
};
const LINE_DURATION = 2.45;
const statusElement = document.getElementById("status");
const progressElement = document.getElementById("progress");
const pauseButton = document.getElementById("pause");
const replayButton = document.getElementById("replay");
function setStatus(text) {
if (statusElement.textContent !== text) statusElement.textContent = text;
}
function resetCopy() {
state.lineIndex = 0;
state.lineTime = 0;
state.elapsed = 0;
state.paused = false;
state.complete = false;
for (const line of copyLines) {
line.mesh.geometry.setDrawRange(0, 0);
}
initial.scale.setScalar(0.001);
pauseButton.textContent = "Pause";
setStatus("Copying line 1 of 6 — decorative marks, not text");
progressElement.style.width = "0%";
}
replayButton.addEventListener("click", resetCopy);
pauseButton.addEventListener("click", () => {
state.paused = !state.paused;
pauseButton.textContent = state.paused ? "Resume" : "Pause";
setStatus(
state.paused
? "Copying paused"
: state.complete
? "Copy complete — abstract decorative marks"
: `Copying line ${state.lineIndex + 1} of 6 — decorative marks, not text`
);
});
scene.updateMatrixWorld(true);
quill.position.copy(
copyBoard.localToWorld(new THREE.Vector3(-0.88, TEXT_Y + 0.014, -0.51))
);
// ---------------------------------------------------------------------
// Camera controls implemented directly, without addons
// ---------------------------------------------------------------------
const orbit = {
theta: 0.72,
phi: 1.08,
radius: 8.15
};
const cameraTarget = new THREE.Vector3(0, 1.68, 0.05);
const spherical = new THREE.Spherical();
function updateCamera() {
spherical.set(orbit.radius, orbit.phi, orbit.theta);
camera.position.setFromSpherical(spherical).add(cameraTarget);
camera.lookAt(cameraTarget);
}
function resetCamera() {
orbit.theta = 0.72;
orbit.phi = 1.08;
orbit.radius = 8.15;
updateCamera();
}
let dragging = false;
let previousX = 0;
let previousY = 0;
renderer.domElement.addEventListener("pointerdown", event => {
dragging = true;
previousX = event.clientX;
previousY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", event => {
if (!dragging) return;
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
orbit.theta -= dx * 0.006;
orbit.phi = THREE.MathUtils.clamp(
orbit.phi - dy * 0.005,
0.40,
1.38
);
updateCamera();
});
function endDrag(event) {
dragging = false;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener("wheel", event => {
event.preventDefault();
orbit.radius = THREE.MathUtils.clamp(
orbit.radius + event.deltaY * 0.005,
4.7,
11.0
);
updateCamera();
}, { passive: false });
renderer.domElement.addEventListener("dblclick", resetCamera);
addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 1.8));
});
updateCamera();
resetCopy();
// ---------------------------------------------------------------------
// Animation loop
// ---------------------------------------------------------------------
const clock = new THREE.Clock();
const nibTarget = new THREE.Vector3();
const localNib = new THREE.Vector3();
function animate() {
requestAnimationFrame(animate);
const delta = Math.min(clock.getDelta(), 0.05);
const time = clock.elapsedTime;
if (!state.paused && !state.complete) {
state.elapsed += delta;
state.lineTime += delta;
const line = copyLines[state.lineIndex];
const lineProgress = Math.min(state.lineTime / LINE_DURATION, 1);
const visibleSegments = Math.min(
line.segmentCount,
Math.floor(lineProgress * line.segmentCount)
);
line.mesh.geometry.setDrawRange(0, visibleSegments);
if (lineProgress >= 1) {
if (state.lineIndex === copyLines.length - 1) {
state.complete = true;
setStatus("Copy complete — abstract decorative marks");
} else {
state.lineIndex++;
state.lineTime = 0;
setStatus(
`Copying line ${state.lineIndex + 1} of 6 — decorative marks, not text`
);
}
}
}
const initialReveal = THREE.MathUtils.clamp(state.elapsed / 0.85, 0, 1);
const easedReveal = 1 - Math.pow(1 - initialReveal, 3);
initial.scale.setScalar(0.001 + easedReveal * 0.999);
if (!state.complete) {
const activeLine = copyLines[state.lineIndex];
const count = activeLine.mesh.geometry.drawRange.count;
if (count > 0) {
const endpointIndex = (count * 2 - 1) * 3;
localNib.set(
activeLine.positions[endpointIndex],
activeLine.positions[endpointIndex + 1] + 0.014,
activeLine.positions[endpointIndex + 2]
);
} else {
localNib.copy(activeLine.start);
localNib.y += 0.014;
}
copyBoard.updateWorldMatrix(true, false);
nibTarget.copy(copyBoard.localToWorld(localNib));
} else {
const finalLine = copyLines[copyLines.length - 1];
const endpointIndex = (finalLine.segmentCount * 2 - 1) * 3;
localNib.set(
finalLine.positions[endpointIndex],
finalLine.positions[endpointIndex + 1] + 0.014,
finalLine.positions[endpointIndex + 2]
);
copyBoard.updateWorldMatrix(true, false);
nibTarget.copy(copyBoard.localToWorld(localNib));
}
const follow = state.paused ? 0.035 : 0.24;
quill.position.lerp(nibTarget, follow);
if (!state.paused) {
quill.rotation.z = -0.22 + Math.sin(time * 2.1) * 0.012;
quill.rotation.x = -0.12 + Math.sin(time * 1.6) * 0.015;
quill.rotation.y = 0.10 + Math.sin(time * 1.2) * 0.018;
}
const totalProgress = state.complete
? 1
: (state.lineIndex + Math.min(state.lineTime / LINE_DURATION, 1)) /
copyLines.length;
progressElement.style.width = `${totalProgress * 100}%`;
const flicker = 0.82 + Math.sin(time * 11.3) * 0.09
+ Math.sin(time * 19.7) * 0.06;
candleLight.intensity = 5.2 * flicker;
flame.scale.y = 0.94 + flicker * 0.09;
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```