Prompt specification
Build or customize the Three.js 3D scene "Covered drain brick segment" 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: Covered drain brick segment
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/covered-drain-brick-segment-x2277
Scene Description Prompt:
A stylized Indus brick drain with a removable cover, exposing its channel beneath street level. Use Three.js from cdnjs in one HTML file.
Working Three.js Starter (covered-drain-brick-segment-x2277):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Indus Brick Drain</title>
<style>
:root {
--ink: #352a24;
--paper: rgba(248, 242, 229, 0.88);
--accent: #a84d32;
--line: rgba(71, 51, 39, 0.18);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e7ddcc;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
#scene {
position: fixed;
inset: 0;
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene:active {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 5;
border: 1px solid var(--line);
background: var(--paper);
box-shadow: 0 18px 50px rgba(63, 43, 30, 0.12);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
}
.title-card {
top: 24px;
left: 24px;
width: min(370px, calc(100vw - 48px));
padding: 18px 20px 17px;
border-radius: 4px 18px 18px 18px;
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 8px;
color: var(--accent);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.19em;
text-transform: uppercase;
}
.eyebrow::before {
width: 24px;
height: 2px;
content: "";
background: var(--accent);
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(25px, 3vw, 38px);
font-weight: 500;
line-height: 0.98;
letter-spacing: -0.035em;
}
.subtitle {
margin: 10px 0 0;
color: rgba(53, 42, 36, 0.68);
font-size: 12px;
line-height: 1.5;
}
.controls-card {
top: 24px;
right: 24px;
padding: 8px;
border-radius: 14px;
}
button {
min-width: 142px;
padding: 12px 16px;
border: 0;
border-radius: 9px;
background: var(--ink);
color: #fff9ef;
font: inherit;
font-size: 12px;
font-weight: 750;
letter-spacing: 0.02em;
cursor: pointer;
transition:
transform 160ms ease,
background 160ms ease,
box-shadow 160ms ease;
}
button:hover {
transform: translateY(-1px);
background: #49372e;
box-shadow: 0 7px 20px rgba(53, 42, 36, 0.2);
}
button:active {
transform: translateY(0);
}
.legend {
bottom: 24px;
left: 24px;
display: flex;
flex-wrap: wrap;
gap: 16px;
padding: 12px 15px;
border-radius: 12px;
pointer-events: none;
}
.legend-item {
display: flex;
align-items: center;
gap: 7px;
color: rgba(53, 42, 36, 0.72);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.035em;
}
.swatch {
width: 10px;
height: 10px;
border: 1px solid rgba(0, 0, 0, 0.12);
border-radius: 3px;
}
.hint {
right: 24px;
bottom: 24px;
padding: 11px 14px;
border-radius: 12px;
color: rgba(53, 42, 36, 0.67);
font-size: 10px;
font-weight: 650;
letter-spacing: 0.025em;
pointer-events: none;
}
@media (max-width: 700px) {
.title-card {
top: 14px;
left: 14px;
}
.controls-card {
top: auto;
right: 14px;
bottom: 14px;
}
.legend {
display: none;
}
.hint {
right: auto;
bottom: 18px;
left: 14px;
max-width: 52vw;
}
}
</style>
</head>
<body>
<canvas id="scene" aria-label="Interactive three-dimensional model of an Indus brick drain"></canvas>
<section class="panel title-card">
<div class="eyebrow">Archaeological Engineering</div>
<h1>Indus Brick Drain</h1>
<p class="subtitle">
A sectional street-level study of an ancient masonry drain, with its
removable stone cover shown in an exploded position.
</p>
</section>
<div class="panel controls-card">
<button id="coverButton" type="button">Seat cover</button>
</div>
<div class="panel legend">
<div class="legend-item">
<span class="swatch" style="background:#ad543a"></span>
Fired brick
</div>
<div class="legend-item">
<span class="swatch" style="background:#cdb991"></span>
Cut stone
</div>
<div class="legend-item">
<span class="swatch" style="background:#568f91"></span>
Water channel
</div>
</div>
<div class="panel hint">
Drag to orbit · Scroll to zoom · Click cover
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const canvas = document.querySelector("#scene");
const coverButton = document.querySelector("#coverButton");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe7ddcc);
scene.fog = new THREE.Fog(0xe7ddcc, 25, 48);
const camera = new THREE.PerspectiveCamera(
38,
innerWidth / innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
// Lighting
const hemi = new THREE.HemisphereLight(0xfff3d9, 0x6c716e, 2.2);
scene.add(hemi);
const sun = new THREE.DirectionalLight(0xffe4ba, 4.1);
sun.position.set(-7, 15, 9);
sun.castShadow = true;
sun.shadow.mapSize.set(2048, 2048);
sun.shadow.camera.left = -15;
sun.shadow.camera.right = 15;
sun.shadow.camera.top = 13;
sun.shadow.camera.bottom = -13;
sun.shadow.camera.near = 1;
sun.shadow.camera.far = 40;
sun.shadow.bias = -0.0004;
sun.shadow.normalBias = 0.025;
scene.add(sun);
const fill = new THREE.DirectionalLight(0xb9d7d4, 1.25);
fill.position.set(9, 6, -10);
scene.add(fill);
// Materials
const mats = {
foundation: new THREE.MeshStandardMaterial({
color: 0x897965,
roughness: 0.96
}),
support: new THREE.MeshStandardMaterial({
color: 0xa9977a,
roughness: 0.98
}),
mortar: new THREE.MeshStandardMaterial({
color: 0x6f6256,
roughness: 1
}),
brick: new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness: 0.91
}),
stone: new THREE.MeshStandardMaterial({
color: 0xcdb991,
roughness: 0.87
}),
stoneDark: new THREE.MeshStandardMaterial({
color: 0x9b8465,
roughness: 0.9
}),
iron: new THREE.MeshStandardMaterial({
color: 0x51453a,
roughness: 0.62,
metalness: 0.58
}),
brass: new THREE.MeshStandardMaterial({
color: 0xb68745,
roughness: 0.38,
metalness: 0.72
}),
water: new THREE.MeshStandardMaterial({
color: 0x4b8589,
roughness: 0.24,
metalness: 0.05,
transparent: true,
opacity: 0.66,
side: THREE.DoubleSide
}),
groove: new THREE.MeshStandardMaterial({
color: 0x735f4b,
roughness: 0.95
})
};
function addBox(w, h, d, material, x, y, z, parent = scene) {
const mesh = new THREE.Mesh(new THREE.BoxGeometry(w, h, d), material);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
// Deterministic variation
let seed = 71423;
function random() {
seed = (seed * 1664525 + 1013904223) >>> 0;
return seed / 4294967296;
}
function addInstances(items, material, castShadow = true) {
const geometry = new THREE.BoxGeometry(1, 1, 1);
const mesh = new THREE.InstancedMesh(geometry, material, items.length);
const dummy = new THREE.Object3D();
items.forEach((item, index) => {
dummy.position.set(item.x, item.y, item.z);
dummy.rotation.set(
item.rx || 0,
item.ry || 0,
item.rz || 0
);
dummy.scale.set(item.w, item.h, item.d);
dummy.updateMatrix();
mesh.setMatrixAt(index, dummy.matrix);
if (item.color !== undefined) {
mesh.setColorAt(index, new THREE.Color(item.color));
}
});
mesh.instanceMatrix.needsUpdate = true;
if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
mesh.castShadow = castShadow;
mesh.receiveShadow = true;
scene.add(mesh);
return mesh;
}
// Ground and archaeological plinth
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(120, 120),
new THREE.MeshStandardMaterial({
color: 0xd8ccb9,
roughness: 1
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -2.02;
ground.receiveShadow = true;
scene.add(ground);
addBox(22, 0.34, 11.2, mats.foundation, 0, -1.82, 0);
// Street-level support masses leave a deep central trench open.
addBox(21.6, 1.45, 4.12, mats.support, 0, -0.78, 3.18);
addBox(21.6, 1.45, 4.12, mats.support, 0, -0.78, -3.18);
// Paving stones
const pavingItems = [];
const paverColors = [
0xcbb995,
0xd2c09d,
0xc0ad89,
0xd8c7a4,
0xbfaa86
];
function paveRegion(zMin, zMax, zRows) {
const xMin = -10.6;
const xMax = 10.6;
const xCols = 13;
const dx = (xMax - xMin) / xCols;
const dz = (zMax - zMin) / zRows;
for (let ix = 0; ix < xCols; ix++) {
for (let iz = 0; iz < zRows; iz++) {
pavingItems.push({
x: xMin + dx * (ix + 0.5),
y: 0.005 + random() * 0.012,
z: zMin + dz * (iz + 0.5),
w: dx - 0.045,
h: 0.105,
d: dz - 0.045,
color: paverColors[Math.floor(random() * paverColors.length)]
});
}
}
}
paveRegion(1.19, 5.18, 3);
paveRegion(-5.18, -1.19, 3);
addInstances(pavingItems, mats.brick, false);
// Cut-stone curb blocks along the trench
const curbItems = [];
for (let i = 0; i < 14; i++) {
const x = -6.47 + i * 0.995;
curbItems.push({
x,
y: -0.02,
z: 1.105,
w: 0.955,
h: 0.17,
d: 0.24,
color: i % 3 === 0 ? 0xb89d73 : 0xc9b48b
});
curbItems.push({
x,
y: -0.02,
z: -1.105,
w: 0.955,
h: 0.17,
d: 0.24,
color: i % 3 === 0 ? 0xb89d73 : 0xc9b48b
});
}
addInstances(curbItems, mats.brick, false);
// Drain mortared backing
addBox(13.45, 1.38, 0.18, mats.mortar, 0, -0.73, -1.02);
addBox(13.45, 0.16, 2.16, mats.mortar, 0, -1.49, 0);
const brickColors = [
0xa84d34,
0xb85839,
0xc16643,
0x984632,
0xc8754c,
0xb65a3d
];
const bricks = [];
// Rear wall: staggered ancient brick courses.
for (let row = 0; row < 4; row++) {
const y = -1.25 + row * 0.34;
const offset = row % 2 ? 0.49 : 0;
for (let i = 0; i < 15; i++) {
const x = -6.68 + offset + i * 0.985;
if (x < -6.78 || x > 6.78) continue;
bricks.push({
x,
y: y + (random() - 0.5) * 0.012,
z: -1.015,
w: 0.945,
h: 0.305,
d: 0.43,
color: brickColors[Math.floor(random() * brickColors.length)]
});
}
}
// Low cutaway front wall.
for (let row = 0; row < 2; row++) {
const y = -1.25 + row * 0.34;
const offset = row % 2 ? 0.49 : 0;
for (let i = 0; i < 15; i++) {
const x = -6.68 + offset + i * 0.985;
if (x < -6.78 || x > 6.78) continue;
bricks.push({
x,
y,
z: 1.015,
w: 0.945,
h: 0.305,
d: 0.43,
color: brickColors[Math.floor(random() * brickColors.length)]
});
}
}
// End walls.
for (const x of [-6.58, 6.58]) {
for (let row = 0; row < 4; row++) {
for (const z of [-0.48, 0.48]) {
bricks.push({
x,
y: -1.25 + row * 0.34,
z,
w: 0.44,
h: 0.305,
d: 0.88,
color: brickColors[Math.floor(random() * brickColors.length)]
});
}
}
}
// Brick floor.
for (let i = 0; i < 14; i++) {
for (const z of [-0.48, 0.48]) {
bricks.push({
x: -6.39 + i * 0.985,
y: -1.435,
z,
w: 0.94,
h: 0.13,
d: 0.87,
color: brickColors[Math.floor(random() * brickColors.length)]
});
}
}
addInstances(bricks, mats.brick);
// Stone coping over the rear wall.
const copingItems = [];
for (let i = 0; i < 14; i++) {
copingItems.push({
x: -6.48 + i * 0.995,
y: 0.015,
z: -1.015,
w: 0.955,
h: 0.16,
d: 0.52,
color: i % 4 === 0 ? 0xb89c72 : 0xcdb891
});
}
addInstances(copingItems, mats.brick, false);
// Shallow water at the bottom of the channel.
const water = new THREE.Mesh(new THREE.PlaneGeometry(13.05, 1.72), mats.water);
water.rotation.x = -Math.PI / 2;
water.position.y = -1.285;
water.receiveShadow = true;
scene.add(water);
// Moving highlights suggest a slow flow through the drain.
const flowStreaks = [];
const flowMaterial = new THREE.MeshBasicMaterial({
color: 0xc0e2dc,
transparent: true,
opacity: 0.42,
depthWrite: false
});
for (let i = 0; i < 13; i++) {
const streak = new THREE.Mesh(
new THREE.PlaneGeometry(0.55 + random() * 1.05, 0.018 + random() * 0.022),
flowMaterial
);
streak.rotation.x = -Math.PI / 2;
streak.position.set(-7 + random() * 14, -1.274, -0.68 + random() * 1.36);
scene.add(streak);
flowStreaks.push({
mesh: streak,
speed: 0.65 + random() * 0.7
});
}
// Removable stone cover
const coverGroup = new THREE.Group();
coverGroup.position.set(2.85, 1.14, -0.04);
coverGroup.rotation.z = -0.075;
coverGroup.rotation.x = 0.035;
scene.add(coverGroup);
const coverBase = addBox(
4.45,
0.28,
2.08,
mats.stone,
0,
0,
0,
coverGroup
);
const coverTop = addBox(
4.18,
0.055,
1.82,
mats.stone,
0,
0.155,
0,
coverGroup
);
// Engraved linear motif.
addBox(3.55, 0.025, 0.035, mats.groove, 0, 0.193, -0.31, coverGroup);
addBox(3.55, 0.025, 0.035, mats.groove, 0, 0.193, 0.31, coverGroup);
for (const x of [-0.28, 0.28]) {
const diamond = addBox(
0.18,
0.028,
0.18,
mats.groove,
x,
0.194,
0,
coverGroup
);
diamond.rotation.y = Math.PI / 4;
}
// Brass inlay and iron lifting rings.
const brassRing = new THREE.Mesh(
new THREE.TorusGeometry(0.25, 0.025, 8, 28),
mats.brass
);
brassRing.rotation.x = Math.PI / 2;
brassRing.position.y = 0.201;
brassRing.castShadow = true;
coverGroup.add(brassRing);
for (const x of [-1.42, 1.42]) {
const ring = new THREE.Mesh(
new THREE.TorusGeometry(0.14, 0.036, 9, 24),
mats.iron
);
ring.rotation.x = Math.PI / 2;
ring.position.set(x, 0.225, 0);
ring.castShadow = true;
coverGroup.add(ring);
addBox(
0.32,
0.035,
0.08,
mats.iron,
x,
0.175,
0,
coverGroup
);
}
// Dashed lifting guides.
const guideMaterial = new THREE.LineDashedMaterial({
color: 0x80644e,
dashSize: 0.12,
gapSize: 0.09,
transparent: true,
opacity: 0.48
});
const guides = [];
for (const xOffset of [-1.42, 1.42]) {
const geometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(2.85 + xOffset, 0.08, 0),
new THREE.Vector3(2.85 + xOffset, 1.08, 0)
]);
const line = new THREE.Line(geometry, guideMaterial);
line.computeLineDistances();
scene.add(line);
guides.push({ line, xOffset });
}
// Small archaeological plaque.
const plaqueCanvas = document.createElement("canvas");
plaqueCanvas.width = 512;
plaqueCanvas.height = 128;
const plaqueContext = plaqueCanvas.getContext("2d");
plaqueContext.fillStyle = "#49382d";
plaqueContext.fillRect(0, 0, 512, 128);
plaqueContext.strokeStyle = "#b69055";
plaqueContext.lineWidth = 4;
plaqueContext.strokeRect(9, 9, 494, 110);
plaqueContext.fillStyle = "#f3dfb8";
plaqueContext.textAlign = "center";
plaqueContext.textBaseline = "middle";
plaqueContext.font = "600 35px Georgia";
plaqueContext.fillText("INDUS · 07", 256, 59);
plaqueContext.fillStyle = "#c9aa76";
plaqueContext.font = "18px sans-serif";
plaqueContext.fillText("BRICK DRAIN / STREET CHANNEL", 256, 94);
const plaqueTexture = new THREE.CanvasTexture(plaqueCanvas);
plaqueTexture.colorSpace = THREE.SRGBColorSpace;
plaqueTexture.anisotropy = renderer.capabilities.getMaxAnisotropy();
const plaque = new THREE.Mesh(
new THREE.PlaneGeometry(1.55, 0.39),
new THREE.MeshStandardMaterial({
map: plaqueTexture,
roughness: 0.58,
metalness: 0.12
})
);
plaque.position.set(-4.75, -0.38, 1.247);
plaque.castShadow = true;
scene.add(plaque);
// Street-scale bollards.
const bollardMaterial = new THREE.MeshStandardMaterial({
color: 0x50463c,
roughness: 0.66,
metalness: 0.45
});
for (const x of [-8.7, -3.9, 5.1, 8.9]) {
const bollard = new THREE.Mesh(
new THREE.CylinderGeometry(0.105, 0.145, 0.72, 12),
bollardMaterial
);
bollard.position.set(x, 0.4, 4.03);
bollard.castShadow = true;
bollard.receiveShadow = true;
scene.add(bollard);
const cap = new THREE.Mesh(
new THREE.SphereGeometry(0.115, 12, 8),
bollardMaterial
);
cap.scale.y = 0.7;
cap.position.set(x, 0.78, 4.03);
cap.castShadow = true;
scene.add(cap);
}
// Distant low architectural masses for scale and depth.
const distantMaterial = new THREE.MeshStandardMaterial({
color: 0xc6b69b,
roughness: 0.98
});
const distantBlocks = [
{ x: -9, z: -8.1, w: 5.5, h: 3.1, d: 2.4 },
{ x: -1.7, z: -8.8, w: 6.2, h: 4.3, d: 2.8 },
{ x: 7.6, z: -8.2, w: 5.8, h: 2.7, d: 2.3 }
];
for (const block of distantBlocks) {
addBox(
block.w,
block.h,
block.d,
distantMaterial,
block.x,
-2 + block.h / 2,
block.z
);
}
// Direct camera controls
const target = new THREE.Vector3(0, -0.25, 0);
let theta = 0.72;
let phi = 0.72;
let radius = 18.5;
let desiredTheta = theta;
let desiredPhi = phi;
let desiredRadius = radius;
function updateCamera() {
camera.position.set(
target.x + radius * Math.sin(phi) * Math.sin(theta),
target.y + radius * Math.cos(phi),
target.z + radius * Math.sin(phi) * Math.cos(theta)
);
camera.lookAt(target);
}
updateCamera();
let dragging = false;
let pointerMoved = false;
let lastPointerX = 0;
let lastPointerY = 0;
const raycaster = new THREE.Raycaster();
const pointer = new THREE.Vector2();
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
pointerMoved = false;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
if (Math.abs(dx) + Math.abs(dy) > 2) {
pointerMoved = true;
}
desiredTheta -= dx * 0.006;
desiredPhi = THREE.MathUtils.clamp(
desiredPhi - dy * 0.005,
0.28,
1.32
);
lastPointerX = event.clientX;
lastPointerY = event.clientY;
});
canvas.addEventListener("pointerup", (event) => {
dragging = false;
if (!pointerMoved) {
const rect = canvas.getBoundingClientRect();
pointer.x =
((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y =
-((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(pointer, camera);
const intersections = raycaster.intersectObjects(
coverGroup.children,
true
);
if (intersections.length) {
toggleCover();
}
}
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
});
canvas.addEventListener("pointercancel", () => {
dragging = false;
});
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
desiredRadius = THREE.MathUtils.clamp(
desiredRadius + event.deltaY * 0.012,
10,
29
);
},
{ passive: false }
);
canvas.addEventListener("dblclick", () => {
desiredTheta = 0.72;
desiredPhi = 0.72;
desiredRadius = 18.5;
});
// Cover animation
let coverOpen = true;
function toggleCover() {
coverOpen = !coverOpen;
coverButton.textContent = coverOpen ? "Seat cover" : "Lift cover";
coverButton.setAttribute(
"aria-label",
coverOpen ? "Seat the drain cover" : "Lift the drain cover"
);
}
coverButton.addEventListener("click", toggleCover);
window.addEventListener("keydown", (event) => {
if (event.code === "Space") {
event.preventDefault();
toggleCover();
}
});
function resize() {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
const clock = new THREE.Clock();
renderer.setAnimationLoop(() => {
const dt = Math.min(clock.getDelta(), 0.05);
const cameraEase = 1 - Math.exp(-8 * dt);
const coverEase = 1 - Math.exp(-6 * dt);
theta += (desiredTheta - theta) * cameraEase;
phi += (desiredPhi - phi) * cameraEase;
radius += (desiredRadius - radius) * cameraEase;
updateCamera();
const openPosition = new THREE.Vector3(2.85, 1.14, -0.04);
const closedPosition = new THREE.Vector3(2.85, 0.235, 0);
const desiredPosition = coverOpen ? openPosition : closedPosition;
coverGroup.position.lerp(desiredPosition, coverEase);
coverGroup.rotation.z +=
((coverOpen ? -0.075 : 0) - coverGroup.rotation.z) * coverEase;
coverGroup.rotation.x +=
((coverOpen ? 0.035 : 0) - coverGroup.rotation.x) * coverEase;
const guideOpacity = coverOpen ? 0.48 : 0.08;
guideMaterial.opacity +=
(guideOpacity - guideMaterial.opacity) * coverEase;
for (const guide of guides) {
const positions = guide.line.geometry.attributes.position;
positions.setXYZ(
0,
coverGroup.position.x + guide.xOffset,
0.08,
coverGroup.position.z
);
positions.setXYZ(
1,
coverGroup.position.x + guide.xOffset,
coverGroup.position.y - 0.04,
coverGroup.position.z
);
positions.needsUpdate = true;
guide.line.computeLineDistances();
}
for (const flow of flowStreaks) {
flow.mesh.position.x += dt * flow.speed;
if (flow.mesh.position.x > 7.2) {
flow.mesh.position.x = -7.2;
}
}
renderer.render(scene, camera);
});
</script>
</body>
</html>
```