Prompt specification
Build or customize the Three.js 3D scene "Bouquet stem bundle structure" 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: Bouquet stem bundle structure
Category: Architecture & Cities · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/bouquet-stem-bundle-structure-x0497
Scene Description Prompt:
Five stylized flower stems pass through one binding point and spread into a bouquet. Build this in HTML using Three.js from cdnjs.
Working Three.js Starter (bouquet-stem-bundle-structure-x0497):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Five Stems — One Binding Point</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
}
body {
color: #27352d;
background:
radial-gradient(circle at 52% 45%, #fffdf8 0%, #fff8ed 42%, #f4e9dc 100%);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
body::before {
content: "";
position: fixed;
width: min(78vw, 900px);
aspect-ratio: 1;
left: 50%;
top: 48%;
transform: translate(-50%, -50%);
border-radius: 50%;
background: radial-gradient(
circle,
rgba(255, 255, 255, 0.86) 0%,
rgba(255, 255, 255, 0.25) 58%,
transparent 72%
);
pointer-events: none;
}
canvas {
position: fixed;
inset: 0;
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.caption {
position: fixed;
top: clamp(24px, 5vw, 64px);
left: clamp(24px, 5vw, 70px);
z-index: 2;
max-width: 320px;
pointer-events: none;
}
.eyebrow {
margin-bottom: 12px;
color: #9b7662;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.22em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: clamp(32px, 4.2vw, 62px);
font-weight: 400;
line-height: 0.98;
letter-spacing: -0.035em;
}
.caption p {
margin: 18px 0 0;
color: #79847b;
font-size: 12px;
line-height: 1.6;
}
.count {
position: fixed;
right: clamp(24px, 5vw, 70px);
bottom: clamp(24px, 5vw, 56px);
z-index: 2;
display: flex;
align-items: center;
gap: 12px;
color: #8d7767;
font-size: 10px;
font-weight: 750;
letter-spacing: 0.15em;
text-transform: uppercase;
pointer-events: none;
}
.count strong {
color: #39493e;
font-size: 18px;
font-weight: 500;
letter-spacing: 0;
}
.divider {
width: 46px;
height: 1px;
background: #cbb8a8;
}
@media (max-width: 700px) {
.caption p {
display: none;
}
.count {
gap: 8px;
}
.divider {
width: 24px;
}
}
</style>
</head>
<body>
<div class="caption">
<div class="eyebrow">Floral study · No. 05</div>
<h1>One knot,<br />five ways to bloom.</h1>
<p>Drag to orbit the bouquet.<br />Scroll or pinch to zoom.</p>
</div>
<div class="count">
<strong>05</strong>
<span>stems</span>
<span class="divider"></span>
<strong>01</strong>
<span>binding point</span>
</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();
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: true
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0x000000, 0);
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 three-dimensional bouquet with five flower stems"
);
document.body.prepend(renderer.domElement);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
100
);
const target = new THREE.Vector3(0, 0.68, 0);
// Custom camera controls implemented without Three.js addons.
let theta = 0;
let phi = 1.48;
let radius = 8.7;
let desiredTheta = theta;
let desiredPhi = phi;
let desiredRadius = radius;
const pointers = new Map();
let previousPinchDistance = 0;
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", (event) => {
pointers.set(event.pointerId, {
x: event.clientX,
y: event.clientY
});
canvas.setPointerCapture(event.pointerId);
if (pointers.size === 2) {
previousPinchDistance = getPinchDistance();
}
});
canvas.addEventListener("pointermove", (event) => {
const previous = pointers.get(event.pointerId);
if (!previous) return;
const current = {
x: event.clientX,
y: event.clientY
};
pointers.set(event.pointerId, current);
if (pointers.size === 1) {
const dx = current.x - previous.x;
const dy = current.y - previous.y;
desiredTheta -= dx * 0.006;
desiredPhi = THREE.MathUtils.clamp(
desiredPhi - dy * 0.005,
0.72,
1.78
);
} else if (pointers.size === 2) {
const pinchDistance = getPinchDistance();
if (previousPinchDistance > 0 && pinchDistance > 0) {
desiredRadius = THREE.MathUtils.clamp(
desiredRadius *
(previousPinchDistance / pinchDistance),
5.5,
12
);
}
previousPinchDistance = pinchDistance;
}
});
function endPointer(event) {
pointers.delete(event.pointerId);
previousPinchDistance = pointers.size === 2
? getPinchDistance()
: 0;
}
canvas.addEventListener("pointerup", endPointer);
canvas.addEventListener("pointercancel", endPointer);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
desiredRadius = THREE.MathUtils.clamp(
desiredRadius + event.deltaY * 0.006,
5.5,
12
);
},
{ passive: false }
);
canvas.addEventListener("dblclick", () => {
desiredTheta = 0;
desiredPhi = 1.48;
desiredRadius = 8.7;
});
function getPinchDistance() {
const values = [...pointers.values()];
if (values.length < 2) return 0;
return Math.hypot(
values[0].x - values[1].x,
values[0].y - values[1].y
);
}
// Lighting.
scene.add(new THREE.HemisphereLight(0xfff7e9, 0x8ca493, 2.1));
const keyLight = new THREE.DirectionalLight(0xfff2dd, 3.3);
keyLight.position.set(4.5, 7, 6);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.left = -6;
keyLight.shadow.camera.right = 6;
keyLight.shadow.camera.top = 7;
keyLight.shadow.camera.bottom = -5;
keyLight.shadow.bias = -0.0004;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xcce8ff, 1.55);
fillLight.position.set(-5, 2.5, 4);
scene.add(fillLight);
const rimLight = new THREE.DirectionalLight(0xffb7aa, 1.4);
rimLight.position.set(1, 4, -5);
scene.add(rimLight);
// Soft receiving shadow.
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(24, 24),
new THREE.ShadowMaterial({
color: 0x604a38,
opacity: 0.16
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -2.08;
ground.receiveShadow = true;
scene.add(ground);
const bouquet = new THREE.Group();
scene.add(bouquet);
const bindingPoint = new THREE.Vector3(0, -1.03, 0);
const stemMaterial = new THREE.MeshStandardMaterial({
color: 0x416d4c,
roughness: 0.78,
metalness: 0
});
const stemHighlightMaterial = new THREE.MeshStandardMaterial({
color: 0x6d9366,
roughness: 0.82
});
const leafMaterials = [
new THREE.MeshStandardMaterial({
color: 0x4f8058,
roughness: 0.85,
side: THREE.DoubleSide
}),
new THREE.MeshStandardMaterial({
color: 0x739565,
roughness: 0.86,
side: THREE.DoubleSide
})
];
const veinMaterial = new THREE.MeshStandardMaterial({
color: 0xa5ba7d,
roughness: 0.9
});
const flowerDefinitions = [
{
head: new THREE.Vector3(-2.08, 1.28, 0.18),
tail: new THREE.Vector3(-0.27, -1.96, 0.06),
petal: 0xff8c95,
petalAlt: 0xf97887,
center: 0x713d4b,
pollen: 0xf6c568,
scale: 0.92,
petals: 11
},
{
head: new THREE.Vector3(-1.24, 2.30, -0.18),
tail: new THREE.Vector3(0.15, -2.02, -0.06),
petal: 0xf3b657,
petalAlt: 0xeaa047,
center: 0x76502d,
pollen: 0xffdf83,
scale: 0.98,
petals: 12
},
{
head: new THREE.Vector3(0.03, 2.88, 0.08),
tail: new THREE.Vector3(0.25, -1.94, 0.03),
petal: 0xb59ce7,
petalAlt: 0xa488dc,
center: 0x5c4778,
pollen: 0xf2cc68,
scale: 1.04,
petals: 12
},
{
head: new THREE.Vector3(1.30, 2.23, -0.22),
tail: new THREE.Vector3(-0.11, -2.00, -0.1),
petal: 0xfff0bf,
petalAlt: 0xf4dfa9,
center: 0x87683d,
pollen: 0xd59b3e,
scale: 0.97,
petals: 11
},
{
head: new THREE.Vector3(2.08, 1.22, 0.16),
tail: new THREE.Vector3(0.02, -1.97, 0.12),
petal: 0xed72a5,
petalAlt: 0xdf5d96,
center: 0x71374f,
pollen: 0xf6bf62,
scale: 0.91,
petals: 11
}
];
const petalGeometry = new THREE.SphereGeometry(1, 16, 10);
const centerGeometry = new THREE.SphereGeometry(1, 18, 12);
const pollenGeometry = new THREE.SphereGeometry(1, 8, 6);
const leafGeometry = new THREE.SphereGeometry(1, 12, 7);
function createLeaf(curve, t, sideSign, materialIndex) {
const point = curve.getPointAt(t);
const tangent = curve.getTangentAt(t).normalize();
const side = new THREE.Vector3(
-tangent.y,
tangent.x,
0
).normalize();
const direction = side
.clone()
.multiplyScalar(sideSign)
.addScaledVector(tangent, 0.28)
.normalize();
const leafGroup = new THREE.Group();
leafGroup.position.copy(point).addScaledVector(side, sideSign * 0.07);
leafGroup.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction
);
const leaf = new THREE.Mesh(
leafGeometry,
leafMaterials[materialIndex]
);
leaf.scale.set(0.15, 0.46, 0.055);
leaf.castShadow = true;
leafGroup.add(leaf);
const veinCurve = new THREE.CatmullRomCurve3([
new THREE.Vector3(0, -0.38, 0.052),
new THREE.Vector3(0, 0, 0.067),
new THREE.Vector3(0, 0.38, 0.052)
]);
const vein = new THREE.Mesh(
new THREE.TubeGeometry(veinCurve, 12, 0.011, 5, false),
veinMaterial
);
veinGroupSafeAdd(leafGroup, vein);
return leafGroup;
}
function veinGroupSafeAdd(parent, child) {
parent.add(child);
}
function createFlower(definition, index) {
const flower = new THREE.Group();
flower.position.copy(definition.head);
flower.scale.setScalar(definition.scale);
flower.rotation.x = (1.4 - definition.head.y) * 0.085;
flower.rotation.y = -definition.head.x * 0.025;
flower.rotation.z = (index - 2) * 0.035;
const petalMaterial = new THREE.MeshStandardMaterial({
color: definition.petal,
roughness: 0.64,
metalness: 0
});
const alternatePetalMaterial = new THREE.MeshStandardMaterial({
color: definition.petalAlt,
roughness: 0.67,
metalness: 0
});
const centerMaterial = new THREE.MeshStandardMaterial({
color: definition.center,
roughness: 0.9
});
const pollenMaterial = new THREE.MeshStandardMaterial({
color: definition.pollen,
roughness: 0.86
});
for (let i = 0; i < definition.petals; i++) {
const angle = (i / definition.petals) * Math.PI * 2;
const petal = new THREE.Mesh(
petalGeometry,
i % 3 === 0 ? alternatePetalMaterial : petalMaterial
);
const radius = 0.39 + (i % 2) * 0.025;
petal.position.set(
Math.sin(angle) * radius,
Math.cos(angle) * radius,
(i % 2) * 0.018
);
petal.rotation.z = -angle;
petal.rotation.x = (i % 2 ? 1 : -1) * 0.055;
petal.scale.set(0.205, 0.47, 0.105);
petal.castShadow = true;
petal.receiveShadow = true;
flower.add(petal);
}
const center = new THREE.Mesh(centerGeometry, centerMaterial);
center.position.z = 0.085;
center.scale.set(0.285, 0.285, 0.13);
center.castShadow = true;
flower.add(center);
for (let i = 0; i < 9; i++) {
const angle = (i / 9) * Math.PI * 2;
const pollen = new THREE.Mesh(pollenGeometry, pollenMaterial);
pollen.position.set(
Math.cos(angle) * 0.115,
Math.sin(angle) * 0.115,
0.195
);
pollen.scale.setScalar(0.028 + (i % 2) * 0.006);
flower.add(pollen);
}
bouquet.add(flower);
}
flowerDefinitions.forEach((definition, index) => {
const { head, tail } = definition;
const curve = new THREE.CatmullRomCurve3([
tail.clone(),
bindingPoint.clone(),
new THREE.Vector3(head.x * 0.10, -0.42, head.z * 0.18),
new THREE.Vector3(head.x * 0.43, 0.30, head.z * 0.42),
new THREE.Vector3(head.x * 0.77, head.y - 0.74, head.z * 0.80),
head.clone()
]);
const stem = new THREE.Mesh(
new THREE.TubeGeometry(curve, 64, 0.052, 8, false),
stemMaterial
);
stem.castShadow = true;
stem.receiveShadow = true;
bouquet.add(stem);
// A fine highlight following the upper portion of each stem.
const highlightPoints = [];
for (let i = 0; i <= 24; i++) {
const t = 0.32 + (i / 24) * 0.64;
const point = curve.getPointAt(t);
point.z += 0.041;
point.x -= 0.013;
highlightPoints.push(point);
}
const highlight = new THREE.Mesh(
new THREE.TubeGeometry(
new THREE.CatmullRomCurve3(highlightPoints),
40,
0.009,
5,
false
),
stemHighlightMaterial
);
bouquet.add(highlight);
bouquet.add(createLeaf(curve, 0.43, index % 2 ? 1 : -1, 0));
bouquet.add(createLeaf(curve, 0.64, index % 2 ? -1 : 1, 1));
createFlower(definition, index);
});
// Binding wrap, bow loops, central knot, and ribbon tails.
const ribbonMaterial = new THREE.MeshStandardMaterial({
color: 0xe85f55,
roughness: 0.72,
metalness: 0
});
const ribbonDarkMaterial = new THREE.MeshStandardMaterial({
color: 0xc94b48,
roughness: 0.76
});
const wrap = new THREE.Mesh(
new THREE.TorusGeometry(0.235, 0.055, 10, 36),
ribbonDarkMaterial
);
wrap.rotation.x = Math.PI / 2;
wrap.position.copy(bindingPoint);
wrap.castShadow = true;
bouquet.add(wrap);
const bow = new THREE.Group();
bow.position.set(0, bindingPoint.y + 0.015, 0.08);
bouquet.add(bow);
[-1, 1].forEach((side) => {
const loop = new THREE.Mesh(
new THREE.TorusGeometry(0.27, 0.064, 10, 36),
ribbonMaterial
);
loop.position.x = side * 0.225;
loop.rotation.z = side * 0.18;
loop.scale.set(1.28, 0.72, 1);
loop.castShadow = true;
bow.add(loop);
});
const knot = new THREE.Mesh(
new THREE.SphereGeometry(0.16, 14, 10),
ribbonMaterial
);
knot.position.z = 0.15;
knot.scale.set(1.05, 0.86, 0.9);
knot.castShadow = true;
bow.add(knot);
const leftTailCurve = new THREE.CatmullRomCurve3([
new THREE.Vector3(-0.08, -0.02, 0.12),
new THREE.Vector3(-0.25, -0.28, 0.18),
new THREE.Vector3(-0.35, -0.62, 0.12),
new THREE.Vector3(-0.29, -0.83, 0.16)
]);
const rightTailCurve = new THREE.CatmullRomCurve3([
new THREE.Vector3(0.08, -0.02, 0.12),
new THREE.Vector3(0.26, -0.30, 0.18),
new THREE.Vector3(0.39, -0.60, 0.13),
new THREE.Vector3(0.33, -0.79, 0.17)
]);
[
leftTailCurve,
rightTailCurve
].forEach((curve) => {
const tail = new THREE.Mesh(
new THREE.TubeGeometry(curve, 24, 0.055, 7, false),
ribbonMaterial
);
tail.castShadow = true;
bow.add(tail);
});
const reduceMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
const clock = new THREE.Clock();
function updateCamera() {
theta += (desiredTheta - theta) * 0.075;
phi += (desiredPhi - phi) * 0.075;
radius += (desiredRadius - radius) * 0.075;
const offset = new THREE.Vector3().setFromSphericalCoords(
radius,
phi,
theta
);
camera.position.copy(target).add(offset);
camera.lookAt(target);
}
function animate() {
const elapsed = clock.getElapsedTime();
updateCamera();
if (!reduceMotion) {
bouquet.rotation.z = Math.sin(elapsed * 0.62) * 0.009;
bouquet.rotation.x = Math.sin(elapsed * 0.43) * 0.004;
}
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
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>
```