Prompt specification
Build or customize the Three.js 3D scene "Idea Blocks on a Support Scaffold" 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: Idea Blocks on a Support Scaffold
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/idea-blocks-on-a-support-scaffold-x3389
Scene Description Prompt:
Please use Three.js from cdnjs for a low-poly scene based on this idea: idea blocks on a support scaffold. Build an abstract stack labeled as a metaphor for supporting ideas. Make the scaffold visible and state that physical support illustrates only one selected relationship. Return one self-contained HTML file.
Working Three.js Starter (idea-blocks-on-a-support-scaffold-x3389):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#eee8dc" />
<title>Supporting Ideas — A Low-Poly Metaphor</title>
<style>
:root {
--ink: #18333b;
--muted: #627177;
--paper: #eee8dc;
--accent: #e7a62c;
--panel: rgba(250, 247, 239, 0.88);
--line: rgba(24, 51, 59, 0.18);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--paper);
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;
outline: none;
}
#scene:active {
cursor: grabbing;
}
.header {
position: fixed;
z-index: 5;
top: clamp(20px, 4vw, 48px);
left: clamp(20px, 5vw, 72px);
width: min(470px, calc(100vw - 40px));
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
color: var(--muted);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 28px;
height: 3px;
background: var(--accent);
border-radius: 99px;
}
h1 {
margin: 0;
max-width: 440px;
font-size: clamp(38px, 6.5vw, 78px);
font-weight: 850;
line-height: 0.9;
letter-spacing: -0.065em;
text-transform: uppercase;
}
.subtitle {
max-width: 390px;
margin: 20px 0 0;
color: #50646a;
font-size: clamp(14px, 1.6vw, 18px);
line-height: 1.55;
}
.selection-pill {
position: fixed;
z-index: 5;
top: clamp(20px, 4vw, 48px);
right: clamp(20px, 5vw, 72px);
display: flex;
align-items: center;
gap: 9px;
padding: 10px 13px;
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(250, 247, 239, 0.72);
backdrop-filter: blur(12px);
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
pointer-events: none;
}
.selection-pill span {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 0 4px rgba(231, 166, 44, 0.16);
}
.note {
position: fixed;
z-index: 5;
left: clamp(20px, 5vw, 72px);
bottom: clamp(20px, 4vw, 48px);
width: min(430px, calc(100vw - 40px));
padding: 17px 19px;
border: 1px solid var(--line);
border-left: 4px solid var(--accent);
border-radius: 4px 15px 15px 4px;
background: var(--panel);
backdrop-filter: blur(15px);
box-shadow: 0 14px 40px rgba(40, 53, 55, 0.08);
pointer-events: none;
}
.note strong {
display: block;
margin-bottom: 6px;
color: var(--ink);
font-size: 10px;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.note p {
margin: 0;
color: #52666c;
font-size: 13px;
line-height: 1.55;
}
.controls {
position: fixed;
z-index: 6;
right: clamp(20px, 5vw, 72px);
bottom: clamp(20px, 4vw, 48px);
display: flex;
align-items: center;
gap: 12px;
}
.hint {
color: var(--muted);
font-size: 11px;
font-weight: 650;
letter-spacing: 0.03em;
pointer-events: none;
}
button {
appearance: none;
padding: 10px 13px;
border: 1px solid var(--line);
border-radius: 999px;
background: rgba(250, 247, 239, 0.82);
color: var(--ink);
font: inherit;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.06em;
text-transform: uppercase;
cursor: pointer;
backdrop-filter: blur(12px);
transition: transform 150ms ease, background 150ms ease;
}
button:hover {
transform: translateY(-2px);
background: #fffaf0;
}
button:focus-visible {
outline: 3px solid rgba(231, 166, 44, 0.45);
outline-offset: 3px;
}
.callout {
position: fixed;
z-index: 4;
min-width: 174px;
padding: 10px 12px;
border: 1px solid rgba(231, 166, 44, 0.62);
border-radius: 12px;
background: rgba(255, 249, 233, 0.92);
box-shadow: 0 10px 30px rgba(74, 55, 22, 0.12);
backdrop-filter: blur(10px);
transform: translate(-50%, -50%);
pointer-events: none;
}
.callout::after {
content: "";
position: absolute;
left: 50%;
bottom: -8px;
width: 14px;
height: 14px;
border-right: 1px solid rgba(231, 166, 44, 0.62);
border-bottom: 1px solid rgba(231, 166, 44, 0.62);
background: rgba(255, 249, 233, 0.92);
transform: translateX(-50%) rotate(45deg);
}
.callout small {
display: block;
margin-bottom: 3px;
color: #9a6c13;
font-size: 8px;
font-weight: 850;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.callout b {
color: #574112;
font-size: 13px;
letter-spacing: 0.03em;
}
.loading {
position: fixed;
inset: 0;
z-index: 20;
display: grid;
place-items: center;
background: var(--paper);
color: var(--muted);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
transition: opacity 400ms ease;
}
.loading.hidden {
opacity: 0;
pointer-events: none;
}
@media (max-width: 760px) {
.header {
top: 20px;
}
h1 {
font-size: clamp(34px, 12vw, 56px);
}
.subtitle {
max-width: 290px;
margin-top: 13px;
font-size: 13px;
}
.selection-pill {
top: auto;
right: 18px;
bottom: 104px;
}
.note {
bottom: 20px;
padding: 13px 15px;
}
.note p {
font-size: 11px;
}
.hint {
display: none;
}
.controls {
right: 18px;
bottom: 24px;
}
.callout {
min-width: 145px;
padding: 8px 10px;
}
.callout b {
font-size: 11px;
}
}
</style>
</head>
<body>
<canvas
id="scene"
aria-label="Interactive low-poly scene showing labeled idea blocks supported by a visible scaffold."
tabindex="0"
></canvas>
<header class="header">
<div class="eyebrow">Abstract study / Idea blocks</div>
<h1>Supporting<br />Ideas</h1>
<p class="subtitle">
A low-poly metaphor: labeled ideas form a stack while a visible scaffold
makes one chosen relationship tangible.
</p>
</header>
<div class="selection-pill"><span></span>One relation selected</div>
<div class="callout" id="relationCallout" aria-hidden="true">
<small>Selected relationship</small>
<b>SUPPORTED BY</b>
</div>
<aside class="note">
<strong>Physical support, narrowly read</strong>
<p>
Physical support illustrates only one selected relationship: an idea can be
supported by conditions, people, or resources. It does not represent every
relationship among ideas.
</p>
</aside>
<div class="controls">
<span class="hint">Drag to orbit · Scroll to zoom</span>
<button id="resetView" type="button">Reset view</button>
</div>
<div class="loading" id="loading">Building the metaphor</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 loading = document.querySelector("#loading");
const callout = document.querySelector("#relationCallout");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeee8dc);
scene.fog = new THREE.Fog(0xeee8dc, 12, 25);
const renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: false,
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;
const camera = new THREE.PerspectiveCamera(
34,
window.innerWidth / window.innerHeight,
0.1,
60
);
const target = new THREE.Vector3(0, 2.25, 0);
const spherical = new THREE.Spherical(11.2, 1.03, 0.54);
function updateCamera() {
camera.position.setFromSpherical(spherical).add(target);
camera.lookAt(target);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(0xfff8e9, 0x789097, 2.15);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff1d2, 3.2);
keyLight.position.set(6, 10, 7);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -8;
keyLight.shadow.camera.right = 8;
keyLight.shadow.camera.top = 9;
keyLight.shadow.camera.bottom = -4;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 25;
keyLight.shadow.bias = -0.0008;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0xb9dfe4, 1.35);
rimLight.position.set(-7, 5, -6);
scene.add(rimLight);
const world = new THREE.Group();
scene.add(world);
const frameMaterial = new THREE.MeshStandardMaterial({
color: 0x35535d,
roughness: 0.72,
metalness: 0.12,
flatShading: true
});
const braceMaterial = new THREE.MeshStandardMaterial({
color: 0xb27a35,
roughness: 0.76,
metalness: 0.08,
flatShading: true
});
const jointMaterial = new THREE.MeshStandardMaterial({
color: 0xe0a84b,
roughness: 0.65,
flatShading: true
});
const up = new THREE.Vector3(0, 1, 0);
function beam(a, b, radius, material, radialSegments = 6) {
const start = new THREE.Vector3(...a);
const end = new THREE.Vector3(...b);
const direction = end.clone().sub(start);
const length = direction.length();
const geometry = new THREE.CylinderGeometry(
radius,
radius,
length,
radialSegments,
1,
false
);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.copy(start).add(end).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(up, direction.normalize());
mesh.castShadow = true;
mesh.receiveShadow = true;
return mesh;
}
function joint(position, radius = 0.09) {
const mesh = new THREE.Mesh(
new THREE.DodecahedronGeometry(radius, 0),
jointMaterial
);
mesh.position.set(...position);
mesh.castShadow = true;
return mesh;
}
// Faceted ground platform.
const ground = new THREE.Mesh(
new THREE.CylinderGeometry(5.25, 5.45, 0.22, 14),
new THREE.MeshStandardMaterial({
color: 0xe5dfd1,
roughness: 0.95,
flatShading: true
})
);
ground.position.y = -0.16;
ground.receiveShadow = true;
world.add(ground);
const groundInset = new THREE.Mesh(
new THREE.CylinderGeometry(4.72, 4.82, 0.035, 14),
new THREE.MeshStandardMaterial({
color: 0xd9d3c5,
roughness: 1,
flatShading: true
})
);
groundInset.position.y = -0.035;
groundInset.receiveShadow = true;
world.add(groundInset);
// Visible support scaffold.
const scaffold = new THREE.Group();
world.add(scaffold);
const postX = 2.55;
const postZ = 1.72;
const postBottom = 0.08;
const postTop = 4.92;
const levels = [0.3, 2.5, 4.72];
for (const x of [-postX, postX]) {
for (const z of [-postZ, postZ]) {
scaffold.add(
beam([x, postBottom, z], [x, postTop, z], 0.075, frameMaterial)
);
scaffold.add(joint([x, 0.3, z], 0.105));
scaffold.add(joint([x, 2.5, z], 0.09));
scaffold.add(joint([x, 4.72, z], 0.105));
const foot = new THREE.Mesh(
new THREE.CylinderGeometry(0.19, 0.22, 0.14, 8),
jointMaterial
);
foot.position.set(x, 0.03, z);
foot.castShadow = true;
foot.receiveShadow = true;
scaffold.add(foot);
}
}
for (const y of levels) {
scaffold.add(beam([-postX, y, -postZ], [postX, y, -postZ], 0.065, frameMaterial));
scaffold.add(beam([-postX, y, postZ], [postX, y, postZ], 0.065, frameMaterial));
scaffold.add(beam([-postX, y, -postZ], [-postX, y, postZ], 0.065, frameMaterial));
scaffold.add(beam([postX, y, -postZ], [postX, y, postZ], 0.065, frameMaterial));
}
// Diagonal braces remain visible around rather than in front of the ideas.
scaffold.add(
beam([-postX, 0.38, -postZ], [postX, 4.62, -postZ], 0.045, braceMaterial)
);
scaffold.add(
beam([postX, 0.38, -postZ], [-postX, 4.62, -postZ], 0.045, braceMaterial)
);
scaffold.add(
beam([-postX, 0.38, -postZ], [-postX, 4.62, postZ], 0.045, braceMaterial)
);
scaffold.add(
beam([-postX, 4.62, -postZ], [-postX, 0.38, postZ], 0.045, braceMaterial)
);
scaffold.add(
beam([postX, 0.38, -postZ], [postX, 4.62, postZ], 0.045, braceMaterial)
);
// Narrow platform slats directly support the idea stack.
for (let i = 0; i < 5; i++) {
const z = -1.28 + i * 0.64;
const slat = new THREE.Mesh(
new THREE.BoxGeometry(4.15, 0.13, 0.42),
braceMaterial
);
slat.position.set(0, 0.275, z);
slat.castShadow = true;
slat.receiveShadow = true;
scaffold.add(slat);
}
function roundedRect(ctx, x, y, width, height, radius) {
const r = Math.min(radius, width / 2, height / 2);
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.arcTo(x + width, y, x + width, y + height, r);
ctx.arcTo(x + width, y + height, x, y + height, r);
ctx.arcTo(x, y + height, x, y, r);
ctx.arcTo(x, y, x + width, y, r);
ctx.closePath();
}
function makeLabelTexture(text, number, accent) {
const labelCanvas = document.createElement("canvas");
labelCanvas.width = 1024;
labelCanvas.height = 256;
const ctx = labelCanvas.getContext("2d");
ctx.clearRect(0, 0, 1024, 256);
roundedRect(ctx, 8, 8, 1008, 240, 38);
ctx.fillStyle = "rgba(255, 252, 244, 0.96)";
ctx.fill();
ctx.strokeStyle = "rgba(24, 51, 59, 0.18)";
ctx.lineWidth = 4;
ctx.stroke();
ctx.fillStyle = accent;
roundedRect(ctx, 42, 57, 132, 142, 20);
ctx.fill();
ctx.fillStyle = "#ffffff";
ctx.font = "800 61px Inter, Arial, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(number, 108, 130);
let fontSize = 66;
ctx.font = `800 ${fontSize}px Inter, Arial, sans-serif`;
const measured = ctx.measureText(text).width;
if (measured > 740) {
fontSize = Math.floor(fontSize * (740 / measured));
ctx.font = `800 ${fontSize}px Inter, Arial, sans-serif`;
}
ctx.fillStyle = "#18333b";
ctx.textAlign = "left";
ctx.fillText(text, 210, 130);
const texture = new THREE.CanvasTexture(labelCanvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.anisotropy = Math.min(renderer.capabilities.getMaxAnisotropy(), 8);
texture.needsUpdate = true;
return texture;
}
function chamferedBlockGeometry(width, height, depth) {
const cut = Math.min(0.13, width * 0.08, depth * 0.08);
const shape = new THREE.Shape();
const x = width / 2;
const y = depth / 2;
shape.moveTo(-x + cut, -y);
shape.lineTo(x - cut, -y);
shape.lineTo(x, -y + cut);
shape.lineTo(x, y - cut);
shape.lineTo(x - cut, y);
shape.lineTo(-x + cut, y);
shape.lineTo(-x, y - cut);
shape.lineTo(-x, -y + cut);
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: height,
bevelEnabled: true,
bevelSegments: 1,
steps: 1,
bevelSize: 0.045,
bevelThickness: 0.045,
curveSegments: 1
});
geometry.translate(0, 0, -height / 2);
geometry.rotateX(-Math.PI / 2);
geometry.computeVertexNormals();
return geometry;
}
const ideaBlocks = [
{
text: "QUESTION",
number: "01",
color: 0xe66f55,
labelAccent: "#c84f37",
width: 3.05,
height: 0.8,
depth: 1.82,
x: -0.16,
y: 0.76,
z: 0.02,
rotation: -0.055
},
{
text: "SIGNAL",
number: "02",
color: 0x319b8b,
labelAccent: "#19786b",
width: 2.55,
height: 0.72,
depth: 1.55,
x: 0.18,
y: 1.52,
z: -0.04,
rotation: 0.075
},
{
text: "CONTEXT",
number: "03",
color: 0xe5bd57,
labelAccent: "#ad8422",
width: 2.22,
height: 0.68,
depth: 1.34,
x: -0.14,
y: 2.22,
z: 0.04,
rotation: -0.08
},
{
text: "INSIGHT",
number: "04",
color: 0x897bb6,
labelAccent: "#675a95",
width: 1.92,
height: 0.62,
depth: 1.17,
x: 0.17,
y: 2.87,
z: -0.02,
rotation: 0.095
},
{
text: "POSSIBILITY",
number: "05",
color: 0x6ebdad,
labelAccent: "#438f80",
width: 1.63,
height: 0.58,
depth: 1.02,
x: -0.04,
y: 3.47,
z: 0.03,
rotation: -0.11
}
];
ideaBlocks.forEach((data) => {
const group = new THREE.Group();
group.position.set(data.x, data.y, data.z);
group.rotation.y = data.rotation;
const material = new THREE.MeshStandardMaterial({
color: data.color,
roughness: 0.68,
metalness: 0.03,
flatShading: true
});
const geometry = chamferedBlockGeometry(
data.width,
data.height,
data.depth
);
const mesh = new THREE.Mesh(geometry, material);
mesh.castShadow = true;
mesh.receiveShadow = true;
group.add(mesh);
const edges = new THREE.LineSegments(
new THREE.EdgesGeometry(geometry, 22),
new THREE.LineBasicMaterial({
color: 0x17343b,
transparent: true,
opacity: 0.42
})
);
group.add(edges);
const labelTexture = makeLabelTexture(
data.text,
data.number,
data.labelAccent
);
const labelMaterial = new THREE.MeshBasicMaterial({
map: labelTexture,
transparent: true,
depthWrite: false,
polygonOffset: true,
polygonOffsetFactor: -2
});
const label = new THREE.Mesh(
new THREE.PlaneGeometry(Math.min(data.width * 0.78, 1.92), 0.43),
labelMaterial
);
label.position.set(
0,
0,
data.depth / 2 + 0.075
);
group.add(label);
world.add(group);
});
// Highlight the one selected relationship: the base idea is supported.
const relationMaterial = new THREE.MeshStandardMaterial({
color: 0xf0aa28,
emissive: 0x9c5a00,
emissiveIntensity: 0.24,
roughness: 0.48,
flatShading: true
});
const relationLine = beam(
[-2.34, 0.78, 0.72],
[-1.56, 0.78, 0.72],
0.027,
relationMaterial,
8
);
world.add(relationLine);
const arrow = new THREE.Mesh(
new THREE.ConeGeometry(0.085, 0.2, 6),
relationMaterial
);
arrow.position.set(-1.57, 0.78, 0.72);
arrow.quaternion.setFromUnitVectors(
up,
new THREE.Vector3(1, 0, 0)
);
arrow.castShadow = true;
world.add(arrow);
for (const x of [-2.34, -1.85]) {
const dot = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.055, 0),
relationMaterial
);
dot.position.set(x, 0.78, 0.72);
world.add(dot);
}
// Low-poly fragments around the stage suggest an idea-rich environment.
const fragmentColors = [
0xd69b62,
0x7ca6a7,
0xc77862,
0x8d83ae,
0xd5b45d
];
for (let i = 0; i < 13; i++) {
const angle = (i / 13) * Math.PI * 2 + 0.25;
const radius = 3.75 + (i % 3) * 0.25;
const fragment = new THREE.Mesh(
new THREE.DodecahedronGeometry(0.1 + (i % 4) * 0.035, 0),
new THREE.MeshStandardMaterial({
color: fragmentColors[i % fragmentColors.length],
roughness: 0.84,
flatShading: true
})
);
fragment.position.set(
Math.cos(angle) * radius,
0.07 + (i % 2) * 0.025,
Math.sin(angle) * radius
);
fragment.scale.set(
1 + (i % 2) * 0.35,
0.65 + (i % 3) * 0.18,
0.8 + (i % 2) * 0.2
);
fragment.rotation.set(i * 0.4, i * 0.7, i * 0.2);
fragment.castShadow = true;
fragment.receiveShadow = true;
world.add(fragment);
}
// Direct camera controls implemented here; no addons are used.
let dragging = false;
let previousX = 0;
let previousY = 0;
let pointerId = null;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
pointerId = event.pointerId;
previousX = event.clientX;
previousY = event.clientY;
canvas.setPointerCapture(event.pointerId);
canvas.focus({ preventScroll: true });
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging || event.pointerId !== pointerId) return;
const deltaX = event.clientX - previousX;
const deltaY = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
spherical.theta -= deltaX * 0.006;
spherical.phi -= deltaY * 0.005;
spherical.phi = THREE.MathUtils.clamp(spherical.phi, 0.38, 1.43);
updateCamera();
});
function stopDragging(event) {
if (event && pointerId !== null && canvas.hasPointerCapture(pointerId)) {
canvas.releasePointerCapture(pointerId);
}
dragging = false;
pointerId = null;
}
canvas.addEventListener("pointerup", stopDragging);
canvas.addEventListener("pointercancel", stopDragging);
canvas.addEventListener("lostpointercapture", () => {
dragging = false;
pointerId = null;
});
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
spherical.radius = THREE.MathUtils.clamp(
spherical.radius * Math.exp(event.deltaY * 0.001),
7.2,
15.5
);
updateCamera();
},
{ passive: false }
);
document.querySelector("#resetView").addEventListener("click", () => {
spherical.set(11.2, 1.03, 0.54);
updateCamera();
});
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height);
}
window.addEventListener("resize", resize);
const calloutAnchor = new THREE.Vector3(-2.0, 1.05, 0.72);
const projected = new THREE.Vector3();
function positionCallout() {
projected.copy(calloutAnchor).project(camera);
const x = (projected.x * 0.5 + 0.5) * window.innerWidth;
const y = (-projected.y * 0.5 + 0.5) * window.innerHeight;
const visible = projected.z > -1 && projected.z < 1;
callout.style.opacity = visible ? "1" : "0";
callout.style.left = `${x}px`;
callout.style.top = `${y}px`;
}
function animate() {
renderer.render(scene, camera);
positionCallout();
requestAnimationFrame(animate);
}
renderer.render(scene, camera);
positionCallout();
requestAnimationFrame(() => {
loading.classList.add("hidden");
setTimeout(() => loading.remove(), 450);
});
animate();
</script>
</body>
</html>
```