Prompt specification
Build or customize the Three.js 3D scene "Shelf bracket load path" 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: Shelf bracket load path
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/shelf-bracket-load-path-x0229
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing shelf supports and brackets. Model a shelf resting on two triangular brackets fixed to a wall panel; colored arrows trace the schematic load path from book stack to mounting points. Voxel style.
Working Three.js Starter (shelf-bracket-load-path-x0229):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Voxel Shelf Load Path</title>
<style>
:root {
--ink: #24313b;
--paper: rgba(248, 246, 237, 0.93);
--load: #ff625f;
--spread: #ffbd35;
--transfer: #28c7b2;
--anchor: #548cff;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #e8e5da;
color: var(--ink);
font-family: "Courier New", Courier, monospace;
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
cursor: grab;
touch-action: none;
}
#scene canvas:active {
cursor: grabbing;
}
.info-panel {
position: fixed;
top: 22px;
left: 22px;
z-index: 10;
width: min(350px, calc(100vw - 44px));
padding: 18px 18px 16px;
background: var(--paper);
border: 2px solid var(--ink);
box-shadow: 7px 7px 0 rgba(36, 49, 59, 0.14);
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 9px;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 9px;
height: 9px;
background: var(--load);
border: 2px solid var(--ink);
box-shadow: 4px 4px 0 var(--transfer);
}
h1 {
margin: 0 0 8px;
font-size: clamp(21px, 3vw, 29px);
line-height: 1.04;
letter-spacing: -0.05em;
text-transform: uppercase;
}
.description {
margin: 0 0 16px;
font-size: 11px;
line-height: 1.55;
color: #52616b;
}
.legend {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px 12px;
padding-top: 13px;
border-top: 2px solid rgba(36, 49, 59, 0.15);
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.legend-swatch {
flex: 0 0 auto;
width: 16px;
height: 10px;
border: 2px solid var(--ink);
}
.legend-swatch.load {
background: var(--load);
}
.legend-swatch.spread {
background: var(--spread);
}
.legend-swatch.transfer {
background: var(--transfer);
}
.legend-swatch.anchor {
background: var(--anchor);
}
.control-hint {
position: fixed;
right: 22px;
bottom: 20px;
z-index: 10;
padding: 10px 12px;
background: rgba(248, 246, 237, 0.86);
border: 2px solid var(--ink);
font-size: 10px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
pointer-events: none;
}
#reset-view {
position: fixed;
right: 22px;
top: 22px;
z-index: 11;
padding: 11px 13px;
border: 2px solid var(--ink);
border-radius: 0;
background: var(--ink);
color: #fffef7;
font: 700 10px "Courier New", Courier, monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
cursor: pointer;
box-shadow: 4px 4px 0 rgba(36, 49, 59, 0.18);
}
#reset-view:hover {
background: #344754;
}
#reset-view:active {
transform: translate(2px, 2px);
box-shadow: 2px 2px 0 rgba(36, 49, 59, 0.18);
}
@media (max-width: 620px) {
.info-panel {
top: 14px;
left: 14px;
width: min(320px, calc(100vw - 28px));
padding: 14px;
}
.description {
display: none;
}
.legend {
margin-top: 12px;
}
#reset-view {
top: auto;
right: 14px;
bottom: 14px;
}
.control-hint {
display: none;
}
}
</style>
</head>
<body>
<div
id="scene"
role="img"
aria-label="Voxel-style shelf supported by two triangular wall brackets, with colored arrows showing the load path from books to wall anchors."
></div>
<section class="info-panel">
<div class="eyebrow">Structural study / 01</div>
<h1>Voxel Shelf Load Path</h1>
<p class="description">
A book load spreads through the shelf, enters two triangular brackets,
and resolves into wall-mounting forces.
</p>
<div class="legend" aria-label="Load path legend">
<div class="legend-item">
<span class="legend-swatch load"></span>
Applied load
</div>
<div class="legend-item">
<span class="legend-swatch spread"></span>
Shelf spread
</div>
<div class="legend-item">
<span class="legend-swatch transfer"></span>
Bracket transfer
</div>
<div class="legend-item">
<span class="legend-swatch anchor"></span>
Wall anchors
</div>
</div>
</section>
<button id="reset-view" type="button">Reset view</button>
<div class="control-hint">Drag to orbit · Scroll to zoom</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// ------------------------------------------------------------
// Renderer and scene
// ------------------------------------------------------------
const sceneHost = document.getElementById("scene");
const reducedMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xe8e5da);
scene.fog = new THREE.Fog(0xe8e5da, 24, 44);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
100
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
sceneHost.appendChild(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xfff6df, 0x71818d, 2.25);
scene.add(hemisphere);
const sunlight = new THREE.DirectionalLight(0xfff1d2, 3.6);
sunlight.position.set(-6, 11, 9);
sunlight.castShadow = true;
sunlight.shadow.mapSize.set(2048, 2048);
sunlight.shadow.camera.left = -12;
sunlight.shadow.camera.right = 12;
sunlight.shadow.camera.top = 12;
sunlight.shadow.camera.bottom = -8;
sunlight.shadow.camera.near = 1;
sunlight.shadow.camera.far = 35;
sunlight.shadow.bias = -0.0005;
sunlight.shadow.normalBias = 0.025;
scene.add(sunlight);
const fill = new THREE.DirectionalLight(0xc8dcff, 1.15);
fill.position.set(8, 5, -3);
scene.add(fill);
// ------------------------------------------------------------
// Voxel construction helpers
// ------------------------------------------------------------
function makeBox({
w,
h,
d,
x = 0,
y = 0,
z = 0,
color,
roughness = 0.8,
metalness = 0,
edge = true,
edgeColor = 0x24313b,
edgeOpacity = 0.22,
parent = scene
}) {
const geometry = new THREE.BoxGeometry(w, h, d);
const material = new THREE.MeshStandardMaterial({
color,
roughness,
metalness,
flatShading: true
});
const mesh = new THREE.Mesh(geometry, material);
mesh.position.set(x, y, z);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
if (edge) {
const edges = new THREE.EdgesGeometry(geometry);
const lineMaterial = new THREE.LineBasicMaterial({
color: edgeColor,
transparent: true,
opacity: edgeOpacity
});
mesh.add(new THREE.LineSegments(edges, lineMaterial));
}
return mesh;
}
function addShadowPlane() {
makeBox({
w: 34,
h: 0.2,
d: 34,
x: 0,
y: -0.77,
z: 0,
color: 0xd9d5c9,
roughness: 1,
edge: false
});
// Sparse floor grid, also built from thin cuboids.
for (let x = -12; x <= 12; x += 2) {
makeBox({
w: 0.018,
h: 0.012,
d: 25,
x,
y: -0.658,
z: 1,
color: 0xbcb8ae,
edge: false
});
}
for (let z = -10; z <= 12; z += 2) {
makeBox({
w: 25,
h: 0.012,
d: 0.018,
x: 0,
y: -0.657,
z,
color: 0xbcb8ae,
edge: false
});
}
}
function buildWallPanel() {
makeBox({
w: 11.25,
h: 6.0,
d: 0.36,
x: 0,
y: 2.15,
z: -1.18,
color: 0x899a96,
roughness: 0.96,
edgeOpacity: 0.12
});
const columns = 11;
const rows = 6;
const tileSize = 0.94;
const gap = 0.04;
const palette = [
0xaebdb6,
0xb8c5bd,
0xa5b6b0,
0xc2cbc2,
0x9eb0aa
];
for (let row = 0; row < rows; row++) {
for (let column = 0; column < columns; column++) {
const x =
(column - (columns - 1) / 2) * (tileSize + gap);
const y =
2.15 +
(row - (rows - 1) / 2) * (tileSize + gap);
const paletteIndex =
(column * 3 + row * 5 + column * row) % palette.length;
makeBox({
w: tileSize,
h: tileSize,
d: 0.12,
x,
y,
z: -0.965,
color: palette[paletteIndex],
roughness: 0.95,
edgeColor: 0x536862,
edgeOpacity: 0.1
});
}
}
}
function buildShelf() {
const boardDepth = 0.54;
const boardGap = 0.025;
const shelfDepth = 5 * boardDepth + 4 * boardGap;
const backEdge = -0.78;
const woodColors = [
0xb87845,
0xc6874d,
0xae6d3e,
0xc78a51,
0xb47442
];
for (let i = 0; i < 5; i++) {
const z =
backEdge +
boardDepth / 2 +
i * (boardDepth + boardGap);
makeBox({
w: 8.8,
h: 0.26,
d: boardDepth,
x: 0,
y: 1.72,
z,
color: woodColors[i],
roughness: 0.82,
edgeColor: 0x553a2a,
edgeOpacity: 0.32
});
}
// Darker front fascia and small underside blocks.
makeBox({
w: 8.86,
h: 0.23,
d: 0.16,
x: 0,
y: 1.70,
z: 2.01,
color: 0x87502f,
roughness: 0.85,
edgeColor: 0x4e3022
});
for (const x of [-4.05, -2.1, 0, 2.1, 4.05]) {
makeBox({
w: 0.42,
h: 0.14,
d: 2.55,
x,
y: 1.54,
z: 0.46,
color: 0x8a5634,
edgeOpacity: 0.18
});
}
}
const mountHalos = [];
function buildBracket(bracketX) {
const steel = 0x2d414f;
const steelLight = 0x3b5361;
const steelDark = 0x22333f;
// Wall plate.
makeBox({
w: 0.44,
h: 1.42,
d: 0.18,
x: bracketX,
y: 0.91,
z: -0.81,
color: steel,
roughness: 0.58,
metalness: 0.38,
edgeOpacity: 0.4
});
// Horizontal support arm.
makeBox({
w: 0.32,
h: 0.24,
d: 2.5,
x: bracketX,
y: 1.47,
z: 0.47,
color: steelLight,
roughness: 0.56,
metalness: 0.4,
edgeOpacity: 0.4
});
// Front joint block.
makeBox({
w: 0.42,
h: 0.38,
d: 0.28,
x: bracketX,
y: 1.35,
z: 1.68,
color: steelDark,
roughness: 0.55,
metalness: 0.42,
edgeOpacity: 0.42
});
// Stepped voxel diagonal creates the triangular brace.
const start = new THREE.Vector3(bracketX, 0.36, -0.68);
const end = new THREE.Vector3(bracketX, 1.46, 1.65);
const count = 12;
for (let i = 0; i < count; i++) {
const t = i / (count - 1);
const point = start.clone().lerp(end, t);
makeBox({
w: 0.28,
h: 0.23,
d: 0.27,
x: point.x,
y: point.y,
z: point.z,
color: i % 2 === 0 ? steelLight : steel,
roughness: 0.58,
metalness: 0.38,
edgeOpacity: 0.34
});
}
// Corner fasteners.
for (const y of [0.34, 1.47]) {
for (const dx of [-0.13, 0.13]) {
makeBox({
w: 0.075,
h: 0.075,
d: 0.05,
x: bracketX + dx,
y,
z: -0.697,
color: 0xd5d9d5,
roughness: 0.35,
metalness: 0.72,
edge: false
});
}
}
// Two highlighted load-bearing wall mounting points.
for (const y of [1.28, 0.50]) {
const halo = new THREE.Mesh(
new THREE.BoxGeometry(0.30, 0.30, 0.07),
new THREE.MeshBasicMaterial({
color: 0x548cff,
transparent: true,
opacity: 0.13,
depthTest: false,
depthWrite: false
})
);
halo.position.set(bracketX, y, -0.655);
halo.renderOrder = 25;
scene.add(halo);
mountHalos.push(halo);
makeBox({
w: 0.16,
h: 0.16,
d: 0.06,
x: bracketX,
y,
z: -0.685,
color: 0x17232c,
roughness: 0.42,
metalness: 0.55,
edgeOpacity: 0.5
});
makeBox({
w: 0.075,
h: 0.075,
d: 0.035,
x: bracketX,
y,
z: -0.642,
color: 0x93a5ad,
roughness: 0.3,
metalness: 0.8,
edge: false
});
}
}
function buildBook({
bottom,
x,
z,
height,
width = 1.85,
depth = 1.35,
color,
labelColor = 0xf4e8c9
}) {
const group = new THREE.Group();
group.position.set(x, bottom, z);
scene.add(group);
const coverThickness = 0.055;
const pageHeight = height - coverThickness * 2;
makeBox({
w: width,
h: coverThickness,
d: depth,
x: 0,
y: coverThickness / 2,
z: 0,
color,
roughness: 0.88,
parent: group
});
makeBox({
w: width,
h: coverThickness,
d: depth,
x: 0,
y: height - coverThickness / 2,
z: 0,
color,
roughness: 0.88,
parent: group
});
makeBox({
w: width - 0.13,
h: pageHeight,
d: depth - 0.12,
x: 0,
y: height / 2,
z: -0.025,
color: 0xe9dfc5,
roughness: 1,
edgeColor: 0x8d826c,
edgeOpacity: 0.2,
parent: group
});
// Colored spine on the front-facing side.
makeBox({
w: width + 0.03,
h: height,
d: 0.10,
x: 0,
y: height / 2,
z: depth / 2 - 0.025,
color,
roughness: 0.86,
parent: group
});
makeBox({
w: 0.34,
h: 0.095,
d: 0.025,
x: -width * 0.23,
y: 0,
z: depth / 2 + 0.038,
color: labelColor,
roughness: 0.95,
edge: false,
parent: group
});
// Tiny page divisions.
for (const xOffset of [-0.43, 0.43]) {
makeBox({
w: 0.018,
h: Math.max(0.08, height - 0.12),
d: 0.018,
x: xOffset,
y: height / 2,
z: depth / 2 + 0.04,
color: 0xb4aa94,
edge: false,
parent: group
});
}
}
function buildBooks() {
let bottom = 1.855;
const books = [
{
height: 0.30,
x: -0.13,
z: 0.01,
color: 0xe75f59,
labelColor: 0xffe5b4
},
{
height: 0.27,
x: 0.01,
z: -0.03,
color: 0xe4b348,
labelColor: 0x24313b
},
{
height: 0.24,
x: -0.06,
z: 0.00,
color: 0x269e94,
labelColor: 0xf7efcf
},
{
height: 0.22,
x: 0.02,
z: -0.02,
color: 0x765aa5,
labelColor: 0xffdda0
}
];
for (const book of books) {
buildBook({ ...book, bottom });
bottom += book.height + 0.012;
}
}
// ------------------------------------------------------------
// Voxel arrows
// ------------------------------------------------------------
const COLORS = {
load: 0xff625f,
spread: 0xffbd35,
transfer: 0x28c7b2,
anchor: 0x548cff
};
const arrows = [];
const localUp = new THREE.Vector3(0, 1, 0);
function addVoxelArrow(
fromValues,
toValues,
color,
phase = 0,
thickness = 0.095,
pulseSpeed = 0.18
) {
const from = new THREE.Vector3(...fromValues);
const to = new THREE.Vector3(...toValues);
const direction = to.clone().sub(from);
const length = direction.length();
if (length < 0.001) return;
const group = new THREE.Group();
group.position.copy(from);
group.quaternion.setFromUnitVectors(
localUp,
direction.clone().normalize()
);
const material = new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.95,
depthTest: false,
depthWrite: false
});
const headLength = Math.min(0.42, length * 0.38);
const shaftLength = length - headLength;
const shaft = new THREE.Mesh(
new THREE.BoxGeometry(
thickness,
shaftLength,
thickness
),
material
);
shaft.position.y = shaftLength / 2;
group.add(shaft);
// Three stepped blocks form a pixel-style arrowhead.
const widths = [
thickness * 3.4,
thickness * 2.45,
thickness * 1.45
];
for (let i = 0; i < widths.length; i++) {
const tierHeight = headLength / widths.length;
const tier = new THREE.Mesh(
new THREE.BoxGeometry(
widths[i],
tierHeight,
widths[i]
),
material
);
tier.position.y =
shaftLength + tierHeight * (i + 0.5);
group.add(tier);
}
const pulseMaterial = new THREE.MeshBasicMaterial({
color: 0xffffff,
transparent: true,
opacity: 0.85,
depthTest: false,
depthWrite: false
});
const pulse = new THREE.Mesh(
new THREE.BoxGeometry(
thickness * 1.45,
thickness * 1.45,
thickness * 1.45
),
pulseMaterial
);
group.add(pulse);
group.traverse((object) => {
if (object.isMesh) object.renderOrder = 30;
});
scene.add(group);
arrows.push({
group,
material,
pulse,
pulseMaterial,
length,
phase,
pulseSpeed
});
}
function buildLoadPath() {
// Applied load entering the book stack.
addVoxelArrow(
[0.65, 3.50, 0.05],
[0.65, 2.95, 0.05],
COLORS.load,
0.0,
0.115,
0.22
);
// The shelf spreads the load toward both brackets.
addVoxelArrow(
[0.90, 1.94, 1.33],
[-2.85, 1.94, 1.33],
COLORS.spread,
0.35,
0.095,
0.17
);
addVoxelArrow(
[0.90, 1.94, 1.33],
[2.85, 1.94, 1.33],
COLORS.spread,
0.55,
0.095,
0.17
);
for (const bracketX of [-3, 3]) {
// Load drops from the shelf into each bracket arm.
addVoxelArrow(
[bracketX, 1.94, 1.33],
[bracketX, 1.60, 1.33],
COLORS.transfer,
0.9,
0.095,
0.20
);
// Force travels backward along the horizontal arm.
addVoxelArrow(
[bracketX, 1.67, 1.54],
[bracketX, 1.67, -0.63],
COLORS.transfer,
1.15,
0.085,
0.19
);
// Upper wall anchor receives the horizontal component.
addVoxelArrow(
[bracketX, 1.67, -0.63],
[bracketX, 1.29, -0.63],
COLORS.anchor,
1.45,
0.085,
0.23
);
// Diagonal component travels to the lower wall anchor.
addVoxelArrow(
[bracketX, 1.43, 1.64],
[bracketX, 0.51, -0.64],
COLORS.anchor,
1.7,
0.09,
0.18
);
}
}
// ------------------------------------------------------------
// Assemble scene
// ------------------------------------------------------------
addShadowPlane();
buildWallPanel();
buildShelf();
buildBracket(-3);
buildBracket(3);
buildBooks();
buildLoadPath();
// ------------------------------------------------------------
// Custom orbit controls — no external control modules
// ------------------------------------------------------------
const target = new THREE.Vector3(0, 1.65, 0.25);
const controls = {
theta: 0.54,
phi: 1.17,
radius: 15.7,
dragging: false,
lastX: 0,
lastY: 0
};
function updateCamera() {
const sinPhi = Math.sin(controls.phi);
const cosPhi = Math.cos(controls.phi);
camera.position.set(
target.x +
controls.radius * sinPhi * Math.sin(controls.theta),
target.y + controls.radius * cosPhi,
target.z +
controls.radius * sinPhi * Math.cos(controls.theta)
);
camera.lookAt(target);
}
function resetCamera() {
controls.theta = 0.54;
controls.phi = 1.17;
controls.radius = 15.7;
updateCamera();
}
renderer.domElement.addEventListener("pointerdown", (event) => {
controls.dragging = true;
controls.lastX = event.clientX;
controls.lastY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!controls.dragging) return;
const dx = event.clientX - controls.lastX;
const dy = event.clientY - controls.lastY;
controls.lastX = event.clientX;
controls.lastY = event.clientY;
controls.theta -= dx * 0.006;
controls.phi = THREE.MathUtils.clamp(
controls.phi + dy * 0.005,
0.64,
1.46
);
updateCamera();
});
function endDrag(event) {
controls.dragging = false;
if (
event.pointerId !== undefined &&
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();
controls.radius = THREE.MathUtils.clamp(
controls.radius * Math.exp(event.deltaY * 0.001),
10,
23
);
updateCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetCamera);
document
.getElementById("reset-view")
.addEventListener("click", resetCamera);
window.addEventListener("keydown", (event) => {
const step = 0.08;
if (event.key === "ArrowLeft") {
controls.theta += step;
} else if (event.key === "ArrowRight") {
controls.theta -= step;
} else if (event.key === "ArrowUp") {
controls.phi = THREE.MathUtils.clamp(
controls.phi - step,
0.64,
1.46
);
} else if (event.key === "ArrowDown") {
controls.phi = THREE.MathUtils.clamp(
controls.phi + step,
0.64,
1.46
);
} else {
return;
}
updateCamera();
});
updateCamera();
// ------------------------------------------------------------
// Animation
// ------------------------------------------------------------
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const time = clock.getElapsedTime();
for (const arrow of arrows) {
const wave =
(Math.sin(time * 3.1 - arrow.phase * 2.4) + 1) * 0.5;
arrow.material.opacity = 0.68 + wave * 0.30;
if (!reducedMotion) {
const progress =
(time * arrow.pulseSpeed + arrow.phase * 0.17) % 1;
arrow.pulse.position.y = progress * arrow.length;
arrow.pulseMaterial.opacity =
Math.sin(progress * Math.PI) * 0.9;
const pulseScale =
0.72 + Math.sin(progress * Math.PI) * 0.5;
arrow.pulse.scale.setScalar(pulseScale);
}
}
for (let i = 0; i < mountHalos.length; i++) {
const pulse =
reducedMotion
? 0.18
: 0.11 +
((Math.sin(time * 3.4 - i * 0.8) + 1) * 0.5) * 0.13;
mountHalos[i].material.opacity = pulse;
if (!reducedMotion) {
const scale = 0.94 + pulse * 0.85;
mountHalos[i].scale.set(scale, scale, 1);
}
}
renderer.render(scene, camera);
}
animate();
// ------------------------------------------------------------
// Resize
// ------------------------------------------------------------
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setPixelRatio(
Math.min(window.devicePixelRatio, 2)
);
renderer.setSize(
window.innerWidth,
window.innerHeight
);
});
</script>
</body>
</html>
```