Prompt specification
Build or customize the Three.js 3D scene "Curb transition wheel section" 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: Curb transition wheel section
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/curb-transition-wheel-section-x0469
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows a stroller wheel beside two stylized curb profiles. Put a vertical curb and a sloped transition on matching bases with equal top heights. Give the wheel a visible axle, tire, and fork. Thin side-profile guides trace its center path over each obstacle, exposing the abrupt change at the step. Align both profiles to one baseline so the geometric contact difference is clear; the example does not specify an accessibility standard.
Working Three.js Starter (curb-transition-wheel-section-x0469):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Wheel Center Paths Across Curb Profiles</title>
<style>
:root {
color-scheme: light;
--ink: #172630;
--muted: #60727d;
--coral: #c95743;
--teal: #177c80;
--panel: rgba(248, 251, 252, 0.88);
--border: rgba(23, 38, 48, 0.12);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #eaf0f3;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
color: var(--ink);
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
.intro {
position: fixed;
z-index: 10;
top: 24px;
left: 26px;
width: min(380px, calc(100vw - 52px));
padding: 17px 19px 16px;
border: 1px solid var(--border);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 12px 35px rgba(30, 48, 58, 0.09);
backdrop-filter: blur(12px);
pointer-events: none;
}
.eyebrow {
margin: 0 0 6px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: clamp(21px, 2.2vw, 29px);
line-height: 1.12;
letter-spacing: -0.035em;
}
.intro p {
margin: 9px 0 0;
color: var(--muted);
font-size: 12.5px;
line-height: 1.5;
}
.hud {
position: fixed;
z-index: 10;
right: 20px;
bottom: 18px;
left: 20px;
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 14px;
pointer-events: none;
}
.legend {
max-width: 680px;
padding: 13px 15px;
border: 1px solid var(--border);
border-radius: 14px;
background: var(--panel);
box-shadow: 0 10px 30px rgba(30, 48, 58, 0.08);
backdrop-filter: blur(12px);
color: var(--muted);
font-size: 11.5px;
line-height: 1.55;
pointer-events: none;
}
.legend-row {
display: flex;
flex-wrap: wrap;
gap: 8px 17px;
margin-bottom: 4px;
}
.legend-item {
display: inline-flex;
align-items: center;
gap: 7px;
white-space: nowrap;
}
.swatch {
width: 20px;
height: 4px;
border-radius: 99px;
background: var(--coral);
}
.swatch.teal {
background: var(--teal);
}
.swatch.dashed {
height: 0;
border-top: 3px dashed var(--coral);
border-radius: 0;
background: none;
}
.disclaimer {
color: #536671;
}
.controls {
display: flex;
gap: 6px;
padding: 6px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--panel);
box-shadow: 0 8px 24px rgba(30, 48, 58, 0.08);
backdrop-filter: blur(12px);
pointer-events: auto;
}
button {
min-width: 38px;
height: 34px;
padding: 0 10px;
border: 0;
border-radius: 8px;
background: #e3eaed;
color: var(--ink);
font: inherit;
font-size: 12px;
font-weight: 750;
cursor: pointer;
}
button:hover {
background: #d5e0e5;
}
button:focus-visible {
outline: 3px solid rgba(23, 124, 128, 0.28);
outline-offset: 2px;
}
.hint {
position: fixed;
z-index: 9;
top: 26px;
right: 24px;
padding: 8px 11px;
border: 1px solid var(--border);
border-radius: 10px;
background: rgba(248, 251, 252, 0.76);
color: var(--muted);
font-size: 10.5px;
pointer-events: none;
}
@media (max-width: 760px) {
.intro {
top: 14px;
left: 14px;
width: calc(100vw - 28px);
padding: 13px 15px;
}
.intro p {
font-size: 11.5px;
}
.hint {
display: none;
}
.hud {
right: 12px;
bottom: 12px;
left: 12px;
align-items: stretch;
flex-direction: column;
}
.legend {
font-size: 10.5px;
}
.controls {
align-self: flex-end;
}
}
</style>
</head>
<body>
<section class="intro">
<p class="eyebrow">Geometric comparison</p>
<h1>Wheel center paths across curb profiles</h1>
<p>
One stroller wheel is shown beside matched vertical and sloped transitions.
Both profiles share the same baseline and top elevation.
</p>
</section>
<div class="hint">Drag to orbit · Scroll to zoom</div>
<div class="hud">
<div class="legend">
<div class="legend-row">
<span class="legend-item"><i class="swatch"></i>Vertical profile</span>
<span class="legend-item"><i class="swatch dashed"></i>Abrupt center-path change</span>
<span class="legend-item"><i class="swatch teal"></i>Continuous offset center path</span>
</div>
<div class="disclaimer">
Geometric illustration only. The dashed jump is not a traversable motion;
no accessibility standard or compliance claim is specified.
</div>
</div>
<div class="controls" aria-label="Camera controls">
<button id="zoomOut" title="Zoom out" aria-label="Zoom out">−</button>
<button id="reset" title="Reset view">Reset</button>
<button id="zoomIn" title="Zoom in" aria-label="Zoom in">+</button>
</div>
</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeaf0f3);
scene.fog = new THREE.Fog(0xeaf0f3, 15, 28);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.04;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute("aria-label", "Interactive three-dimensional curb and stroller wheel comparison");
document.body.prepend(renderer.domElement);
const camera = new THREE.OrthographicCamera(-5, 5, 3, -3, 0.1, 100);
const cameraTarget = new THREE.Vector3(0, 0.62, 0);
const view = {
theta: 0.72,
phi: 1.04,
zoom: 1
};
function updateCamera() {
const radius = 14;
camera.position.set(
cameraTarget.x + radius * Math.sin(view.phi) * Math.sin(view.theta),
cameraTarget.y + radius * Math.cos(view.phi),
cameraTarget.z + radius * Math.sin(view.phi) * Math.cos(view.theta)
);
camera.lookAt(cameraTarget);
camera.zoom = view.zoom;
camera.updateProjectionMatrix();
}
function resize() {
const aspect = window.innerWidth / window.innerHeight;
const halfHeight = Math.max(2.72, 3.85 / aspect);
camera.left = -halfHeight * aspect;
camera.right = halfHeight * aspect;
camera.top = halfHeight;
camera.bottom = -halfHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
updateCamera();
}
window.addEventListener("resize", resize);
resize();
// Lighting.
scene.add(new THREE.HemisphereLight(0xffffff, 0x788993, 2.1));
const keyLight = new THREE.DirectionalLight(0xffffff, 3.2);
keyLight.position.set(5, 9, 7);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -8;
keyLight.shadow.camera.right = 8;
keyLight.shadow.camera.top = 8;
keyLight.shadow.camera.bottom = -8;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 25;
keyLight.shadow.normalBias = 0.025;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0xc8e8ef, 1.25);
rimLight.position.set(-6, 4, -5);
scene.add(rimLight);
// Shared dimensions.
const LANE_A = -1.70;
const LANE_B = 1.70;
const PROFILE_WIDTH = 1.72;
const BASE_WIDTH = 2.66;
const BASE_LENGTH = 5.0;
const CURB_HEIGHT = 0.72;
const SLOPE_START = -0.50;
const SLOPE_END = 0.75;
const WHEEL_RADIUS = 0.435;
const coral = new THREE.Color(0xc95743);
const teal = new THREE.Color(0x177c80);
const groundMaterial = new THREE.MeshStandardMaterial({
color: 0xe7edef,
roughness: 0.95,
metalness: 0
});
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(18, 14),
groundMaterial
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.215;
ground.receiveShadow = true;
scene.add(ground);
const grid = new THREE.GridHelper(18, 36, 0xbdc9cf, 0xd2dce1);
grid.position.y = -0.207;
grid.material.transparent = true;
grid.material.opacity = 0.28;
scene.add(grid);
const baseMaterial = new THREE.MeshStandardMaterial({
color: 0xd2dce0,
roughness: 0.78,
metalness: 0.02
});
const baseEdgeMaterial = new THREE.LineBasicMaterial({
color: 0x758893,
transparent: true,
opacity: 0.34
});
function makeBase(laneX) {
const geometry = new THREE.BoxGeometry(BASE_WIDTH, 0.20, BASE_LENGTH);
const base = new THREE.Mesh(geometry, baseMaterial);
base.position.set(laneX, -0.10, 0);
base.castShadow = true;
base.receiveShadow = true;
scene.add(base);
const edgeGeometry = new THREE.EdgesGeometry(geometry, 20);
const edges = new THREE.LineSegments(edgeGeometry, baseEdgeMaterial);
edges.position.copy(base.position);
scene.add(edges);
}
makeBase(LANE_A);
makeBase(LANE_B);
function makeProfile(laneX, points, color) {
const shape = new THREE.Shape();
shape.moveTo(points[0][0], points[0][1]);
for (let i = 1; i < points.length; i++) {
shape.lineTo(points[i][0], points[i][1]);
}
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth: PROFILE_WIDTH,
bevelEnabled: false,
steps: 1
});
// The shape's local X becomes world Z, so both panels travel in the
// same direction while remaining side-by-side on matching bases.
geometry.rotateY(-Math.PI / 2);
geometry.translate(laneX + PROFILE_WIDTH / 2, 0, 0);
const material = new THREE.MeshStandardMaterial({
color,
roughness: 0.64,
metalness: 0.02
});
const profile = new THREE.Mesh(geometry, material);
profile.castShadow = true;
profile.receiveShadow = true;
scene.add(profile);
const edgeGeometry = new THREE.EdgesGeometry(geometry, 22);
const edgeMaterial = new THREE.LineBasicMaterial({
color: 0x30434d,
transparent: true,
opacity: 0.30
});
const edges = new THREE.LineSegments(edgeGeometry, edgeMaterial);
scene.add(edges);
}
makeProfile(
LANE_A,
[
[-2.2, 0],
[0, 0],
[0, CURB_HEIGHT],
[2.2, CURB_HEIGHT],
[2.2, 0]
],
0xe47c68
);
makeProfile(
LANE_B,
[
[-2.2, 0],
[SLOPE_START, 0],
[SLOPE_END, CURB_HEIGHT],
[2.2, CURB_HEIGHT],
[2.2, 0]
],
0x68aaa7
);
function cylinderBetween(a, b, radius, material, radialSegments = 12) {
const direction = new THREE.Vector3().subVectors(b, a);
const length = direction.length();
const geometry = new THREE.CylinderGeometry(
radius,
radius,
length,
radialSegments
);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.copy(a).add(b).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
mesh.castShadow = true;
scene.add(mesh);
return mesh;
}
function makeTube(points, color, radius = 0.014, segments = 160) {
const curve = new THREE.CatmullRomCurve3(
points,
false,
"centripetal"
);
const geometry = new THREE.TubeGeometry(
curve,
segments,
radius,
7,
false
);
const material = new THREE.MeshBasicMaterial({ color });
const mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
return mesh;
}
// Thin top-edge highlights.
const highlightMaterial = new THREE.MeshBasicMaterial({
color: 0xffffff,
transparent: true,
opacity: 0.62
});
cylinderBetween(
new THREE.Vector3(LANE_A, CURB_HEIGHT + 0.008, 0),
new THREE.Vector3(LANE_A, CURB_HEIGHT + 0.008, 2.2),
0.012,
highlightMaterial
);
cylinderBetween(
new THREE.Vector3(LANE_A, 0.02, 0),
new THREE.Vector3(LANE_A, CURB_HEIGHT + 0.01, 0),
0.011,
highlightMaterial
);
cylinderBetween(
new THREE.Vector3(LANE_B, CURB_HEIGHT + 0.008, SLOPE_END),
new THREE.Vector3(LANE_B, CURB_HEIGHT + 0.008, 2.2),
0.012,
highlightMaterial
);
cylinderBetween(
new THREE.Vector3(LANE_B, 0.02, SLOPE_START),
new THREE.Vector3(LANE_B, CURB_HEIGHT + 0.01, SLOPE_END),
0.012,
highlightMaterial
);
// Vertical-profile guide: the lower and upper sections are solid, while
// the step itself is dashed to expose the discontinuous center change.
const guideVerticalMaterial = new THREE.MeshBasicMaterial({ color: coral });
cylinderBetween(
new THREE.Vector3(LANE_A, WHEEL_RADIUS, -2.2),
new THREE.Vector3(LANE_A, WHEEL_RADIUS, 0),
0.016,
guideVerticalMaterial
);
cylinderBetween(
new THREE.Vector3(LANE_A, CURB_HEIGHT + WHEEL_RADIUS, 0),
new THREE.Vector3(LANE_A, CURB_HEIGHT + WHEEL_RADIUS, 2.2),
0.016,
guideVerticalMaterial
);
const dashBottom = WHEEL_RADIUS;
const dashTop = CURB_HEIGHT + WHEEL_RADIUS;
const dashCount = 9;
for (let i = 0; i < dashCount; i++) {
const t0 = i / dashCount;
const t1 = (i + 0.56) / dashCount;
cylinderBetween(
new THREE.Vector3(
LANE_A,
THREE.MathUtils.lerp(dashBottom, dashTop, t0),
0
),
new THREE.Vector3(
LANE_A,
THREE.MathUtils.lerp(dashBottom, dashTop, t1),
0
),
0.018,
guideVerticalMaterial
);
}
const markerMaterial = new THREE.MeshBasicMaterial({ color: coral });
for (const y of [dashBottom, dashTop]) {
const marker = new THREE.Mesh(
new THREE.SphereGeometry(0.043, 16, 12),
markerMaterial
);
marker.position.set(LANE_A, y, 0);
scene.add(marker);
}
// Sloped-profile guide: a continuous offset of the wheel center around
// the two profile corners and along the inclined and horizontal surfaces.
const slopeAngle = Math.atan2(
CURB_HEIGHT,
SLOPE_END - SLOPE_START
);
const slopeGuide = [];
slopeGuide.push(
new THREE.Vector3(LANE_B, WHEEL_RADIUS, -2.2),
new THREE.Vector3(LANE_B, WHEEL_RADIUS, SLOPE_START)
);
for (let i = 1; i <= 14; i++) {
const alpha =
Math.PI / 2 + (i / 14) * slopeAngle;
slopeGuide.push(
new THREE.Vector3(
LANE_B,
SLOPE_START * 0 + WHEEL_RADIUS * Math.sin(alpha),
SLOPE_START + WHEEL_RADIUS * Math.cos(alpha)
)
);
}
const slopeNormalX = -Math.sin(slopeAngle);
const slopeNormalY = Math.cos(slopeAngle);
for (let i = 1; i <= 24; i++) {
const t = i / 24;
const surfaceZ = THREE.MathUtils.lerp(
SLOPE_START,
SLOPE_END,
t
);
const surfaceY = THREE.MathUtils.lerp(0, CURB_HEIGHT, t);
slopeGuide.push(
new THREE.Vector3(
LANE_B,
surfaceY + WHEEL_RADIUS * slopeNormalY,
surfaceZ + WHEEL_RADIUS * slopeNormalX
)
);
}
for (let i = 1; i <= 14; i++) {
const alpha =
Math.PI / 2 + slopeAngle - (i / 14) * slopeAngle;
slopeGuide.push(
new THREE.Vector3(
LANE_B,
CURB_HEIGHT + WHEEL_RADIUS * Math.sin(alpha),
SLOPE_END + WHEEL_RADIUS * Math.cos(alpha)
)
);
}
slopeGuide.push(
new THREE.Vector3(
LANE_B,
CURB_HEIGHT + WHEEL_RADIUS,
2.2
)
);
makeTube(slopeGuide, teal, 0.016, 260);
// Common baseline and equal-height reference.
function makeDashedLine(points, color, dashSize = 0.12, gapSize = 0.08) {
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineDashedMaterial({
color,
dashSize,
gapSize,
transparent: true,
opacity: 0.72
});
const line = new THREE.Line(geometry, material);
line.computeLineDistances();
scene.add(line);
return line;
}
makeDashedLine(
[
new THREE.Vector3(-2.95, 0.012, -2.44),
new THREE.Vector3(2.95, 0.012, -2.44)
],
0x627985,
0.13,
0.085
);
makeDashedLine(
[
new THREE.Vector3(-2.80, CURB_HEIGHT + 0.012, 2.34),
new THREE.Vector3(2.80, CURB_HEIGHT + 0.012, 2.34)
],
0x627985,
0.11,
0.075
);
const referenceMaterial = new THREE.LineBasicMaterial({
color: 0x718691,
transparent: true,
opacity: 0.48
});
for (const x of [-2.80, 2.80]) {
const points = [
new THREE.Vector3(x, 0.04, 2.34),
new THREE.Vector3(x, CURB_HEIGHT - 0.04, 2.34)
];
const geometry = new THREE.BufferGeometry().setFromPoints(points);
scene.add(new THREE.Line(geometry, referenceMaterial));
}
// Stroller wheel: tire, rim, spokes, axle, hub and fork.
const wheelX = LANE_A;
const wheelZ = -0.59;
const wheelCenter = new THREE.Vector3(
wheelX,
WHEEL_RADIUS,
wheelZ
);
const tireMaterial = new THREE.MeshStandardMaterial({
color: 0x17242c,
roughness: 0.72,
metalness: 0.03
});
const rubberMaterial = new THREE.MeshStandardMaterial({
color: 0x25343c,
roughness: 0.86,
metalness: 0
});
const rimMaterial = new THREE.MeshStandardMaterial({
color: 0xd9e2e5,
roughness: 0.28,
metalness: 0.78
});
const forkMaterial = new THREE.MeshStandardMaterial({
color: 0x71848e,
roughness: 0.3,
metalness: 0.72
});
const tire = new THREE.Mesh(
new THREE.TorusGeometry(0.335, 0.10, 20, 56),
tireMaterial
);
tire.rotation.y = Math.PI / 2;
tire.position.copy(wheelCenter);
tire.castShadow = true;
tire.receiveShadow = true;
scene.add(tire);
const sidewall = new THREE.Mesh(
new THREE.TorusGeometry(0.286, 0.023, 12, 48),
rubberMaterial
);
sidewall.rotation.y = Math.PI / 2;
sidewall.position.set(wheelX + 0.085, wheelCenter.y, wheelZ);
sidewall.castShadow = true;
scene.add(sidewall);
const rim = new THREE.Mesh(
new THREE.TorusGeometry(0.257, 0.019, 12, 48),
rimMaterial
);
rim.rotation.y = Math.PI / 2;
rim.position.copy(wheelCenter);
rim.castShadow = true;
scene.add(rim);
const hub = new THREE.Mesh(
new THREE.CylinderGeometry(0.070, 0.070, 0.26, 24),
rimMaterial
);
hub.rotation.z = Math.PI / 2;
hub.position.copy(wheelCenter);
hub.castShadow = true;
scene.add(hub);
// A deliberately long axle makes its presence visible beyond the hubs.
cylinderBetween(
new THREE.Vector3(wheelX - 0.34, wheelCenter.y, wheelZ),
new THREE.Vector3(wheelX + 0.34, wheelCenter.y, wheelZ),
0.032,
rimMaterial,
20
);
for (const side of [-1, 1]) {
const cap = new THREE.Mesh(
new THREE.CylinderGeometry(0.052, 0.052, 0.028, 20),
forkMaterial
);
cap.rotation.z = Math.PI / 2;
cap.position.set(
wheelX + side * 0.35,
wheelCenter.y,
wheelZ
);
cap.castShadow = true;
scene.add(cap);
}
for (let i = 0; i < 8; i++) {
const angle = (i / 8) * Math.PI * 2;
const inner = new THREE.Vector3(
wheelX + 0.072,
wheelCenter.y + Math.cos(angle) * 0.075,
wheelZ + Math.sin(angle) * 0.075
);
const outer = new THREE.Vector3(
wheelX + 0.072,
wheelCenter.y + Math.cos(angle) * 0.255,
wheelZ + Math.sin(angle) * 0.255
);
cylinderBetween(inner, outer, 0.011, rimMaterial, 8);
}
for (const side of [-1, 1]) {
const x = wheelX + side * 0.215;
const forkCurve = new THREE.CatmullRomCurve3([
new THREE.Vector3(x, wheelCenter.y, wheelZ),
new THREE.Vector3(x + side * 0.025, 0.72, wheelZ - 0.015),
new THREE.Vector3(x, 1.00, wheelZ - 0.15),
new THREE.Vector3(x, 1.15, wheelZ - 0.23)
]);
const fork = new THREE.Mesh(
new THREE.TubeGeometry(forkCurve, 28, 0.036, 10, false),
forkMaterial
);
fork.castShadow = true;
scene.add(fork);
}
cylinderBetween(
new THREE.Vector3(wheelX - 0.22, 1.15, wheelZ - 0.23),
new THREE.Vector3(wheelX + 0.22, 1.15, wheelZ - 0.23),
0.041,
forkMaterial,
16
);
cylinderBetween(
new THREE.Vector3(wheelX, 1.15, wheelZ - 0.23),
new THREE.Vector3(wheelX, 1.42, wheelZ - 0.28),
0.045,
forkMaterial,
16
);
// Canvas-backed labels keep the diagram self-contained.
function roundedRect(ctx, x, y, w, h, r) {
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.arcTo(x + w, y, x + w, y + h, r);
ctx.arcTo(x + w, y + h, x, y + h, r);
ctx.arcTo(x, y + h, x, y, r);
ctx.arcTo(x, y, x + w, y, r);
ctx.closePath();
}
function makeBadge(lines, accent, scale = [2.1, 0.5]) {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 190;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
roundedRect(ctx, 6, 6, 756, 178, 24);
ctx.fillStyle = "rgba(20, 34, 43, 0.91)";
ctx.fill();
ctx.strokeStyle = accent;
ctx.lineWidth = 5;
ctx.stroke();
ctx.textAlign = "center";
ctx.textBaseline = "middle";
if (lines.length === 1) {
ctx.fillStyle = "#f8fbfc";
ctx.font = "700 45px system-ui, sans-serif";
ctx.fillText(lines[0], 384, 95);
} else {
ctx.fillStyle = "#f8fbfc";
ctx.font = "700 43px system-ui, sans-serif";
ctx.fillText(lines[0], 384, 70);
ctx.fillStyle = accent;
ctx.font = "650 29px system-ui, sans-serif";
ctx.fillText(lines[1], 384, 126);
}
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
texture.minFilter = THREE.LinearFilter;
texture.magFilter = THREE.LinearFilter;
const material = new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(scale[0], scale[1], 1);
sprite.renderOrder = 20;
scene.add(sprite);
return sprite;
}
const verticalBadge = makeBadge(
["VERTICAL CURB", "abrupt center change"],
"#ed806d",
[2.22, 0.51]
);
verticalBadge.position.set(LANE_A, 1.83, 1.56);
const slopeBadge = makeBadge(
["SLOPED TRANSITION", "continuous center change"],
"#4bc0bc",
[2.42, 0.51]
);
slopeBadge.position.set(LANE_B, 1.83, 1.56);
const baselineBadge = makeBadge(
["ONE COMMON BASELINE"],
"#9ab0bb",
[1.82, 0.39]
);
baselineBadge.position.set(0, 0.16, -2.45);
const topBadge = makeBadge(
["MATCHING TOP ELEVATIONS"],
"#9ab0bb",
[2.02, 0.39]
);
topBadge.position.set(0, 0.82, 2.39);
// Direct, dependency-free camera controls.
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.style.cursor = "grabbing";
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
view.theta -= dx * 0.006;
view.phi = THREE.MathUtils.clamp(view.phi + dy * 0.005, 0.42, 1.43);
updateCamera();
});
function endDrag(event) {
dragging = false;
renderer.domElement.style.cursor = "grab";
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("contextmenu", (event) => event.preventDefault());
renderer.domElement.addEventListener("wheel", (event) => {
event.preventDefault();
view.zoom = THREE.MathUtils.clamp(
view.zoom * Math.exp(-event.deltaY * 0.001),
0.68,
1.65
);
updateCamera();
}, { passive: false });
renderer.domElement.style.cursor = "grab";
document.getElementById("zoomIn").addEventListener("click", () => {
view.zoom = THREE.MathUtils.clamp(view.zoom * 1.12, 0.68, 1.65);
updateCamera();
});
document.getElementById("zoomOut").addEventListener("click", () => {
view.zoom = THREE.MathUtils.clamp(view.zoom / 1.12, 0.68, 1.65);
updateCamera();
});
document.getElementById("reset").addEventListener("click", () => {
view.theta = 0.72;
view.phi = 1.04;
view.zoom = 1;
updateCamera();
});
renderer.setAnimationLoop(() => {
renderer.render(scene, camera);
});
</script>
</body>
</html>
```