Prompt specification
Build or customize the Three.js 3D scene "Pulse Beads With Accent Rings" 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: Pulse Beads With Accent Rings
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/pulse-beads-with-accent-rings-x3341
Scene Description Prompt:
Twelve stylized beads form an evenly spaced pulse loop; movable accent rings change grouping without changing spacing. Three.js from cdnjs, one HTML file.
Working Three.js Starter (pulse-beads-with-accent-rings-x3341):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pulse Loop — Twelve Beads</title>
<style>
:root {
color-scheme: dark;
--bg: #070912;
--panel: rgba(15, 19, 34, 0.76);
--line: rgba(255, 255, 255, 0.12);
--text: #f5f4ef;
--muted: #9da5ba;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
color: var(--text);
}
canvas {
position: fixed;
inset: 0;
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
.vignette {
position: fixed;
inset: 0;
pointer-events: none;
background:
radial-gradient(circle at 50% 45%, transparent 35%, rgba(0, 0, 0, 0.46) 100%);
z-index: 1;
}
header {
position: fixed;
top: 28px;
left: 32px;
z-index: 2;
pointer-events: none;
max-width: 390px;
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 11px;
color: #aab2c8;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.22em;
text-transform: uppercase;
}
.eyebrow::before {
width: 25px;
height: 1px;
content: "";
background: #75e6ec;
box-shadow: 0 0 10px #75e6ec;
}
h1 {
margin: 0;
font-size: clamp(30px, 4.6vw, 64px);
font-weight: 620;
line-height: 0.95;
letter-spacing: -0.055em;
}
header p {
max-width: 330px;
margin: 16px 0 0;
color: var(--muted);
font-size: 13px;
line-height: 1.55;
}
.stats {
display: flex;
gap: 18px;
margin-top: 22px;
color: #d8dbe5;
font-size: 10px;
font-weight: 650;
letter-spacing: 0.14em;
text-transform: uppercase;
}
.stats span {
display: flex;
align-items: center;
gap: 7px;
}
.stats i {
width: 5px;
height: 5px;
border-radius: 50%;
background: #75e6ec;
box-shadow: 0 0 9px #75e6ec;
}
.panel {
position: fixed;
top: 28px;
right: 28px;
z-index: 3;
width: min(330px, calc(100vw - 40px));
padding: 19px;
border: 1px solid var(--line);
border-radius: 18px;
background: var(--panel);
box-shadow:
0 24px 70px rgba(0, 0, 0, 0.35),
inset 0 1px rgba(255, 255, 255, 0.04);
backdrop-filter: blur(18px);
-webkit-backdrop-filter: blur(18px);
}
.panel-title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 17px;
}
.panel-title strong {
font-size: 11px;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.reset {
border: 1px solid var(--line);
border-radius: 8px;
padding: 6px 9px;
background: rgba(255, 255, 255, 0.04);
color: #cbd0dd;
font: inherit;
font-size: 10px;
cursor: pointer;
transition: background 150ms, border-color 150ms;
}
.reset:hover {
border-color: rgba(255, 255, 255, 0.28);
background: rgba(255, 255, 255, 0.09);
}
.control {
--c: #75e6ec;
padding: 13px 0 11px;
border-top: 1px solid rgba(255, 255, 255, 0.075);
}
.control:first-of-type {
border-top: 0;
}
.control-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.ring-name {
display: flex;
align-items: center;
gap: 9px;
font-size: 12px;
font-weight: 600;
}
.ring-name::before {
width: 8px;
height: 8px;
border-radius: 50%;
content: "";
background: var(--c);
box-shadow: 0 0 12px var(--c);
}
.ring-value {
color: #aeb6ca;
font-size: 10px;
font-variant-numeric: tabular-nums;
letter-spacing: 0.08em;
}
input[type="range"] {
width: 100%;
height: 3px;
margin: 0;
border-radius: 99px;
outline: none;
appearance: none;
-webkit-appearance: none;
background: rgba(255, 255, 255, 0.14);
accent-color: var(--c);
cursor: ew-resize;
}
input[type="range"]::-webkit-slider-thumb {
width: 14px;
height: 14px;
border: 3px solid #101524;
border-radius: 50%;
appearance: none;
-webkit-appearance: none;
background: var(--c);
box-shadow: 0 0 11px var(--c);
}
input[type="range"]::-moz-range-thumb {
width: 10px;
height: 10px;
border: 3px solid #101524;
border-radius: 50%;
background: var(--c);
box-shadow: 0 0 11px var(--c);
}
.hint {
position: fixed;
left: 50%;
bottom: 24px;
z-index: 2;
width: max-content;
max-width: calc(100vw - 30px);
transform: translateX(-50%);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 99px;
padding: 9px 15px;
background: rgba(10, 13, 24, 0.68);
color: #9da5ba;
font-size: 10px;
letter-spacing: 0.07em;
text-align: center;
pointer-events: none;
backdrop-filter: blur(12px);
}
.hint b {
color: #e9ebf2;
font-weight: 650;
}
@media (max-width: 720px) {
header {
top: 20px;
left: 20px;
max-width: calc(100vw - 40px);
}
header p {
display: none;
}
.stats {
margin-top: 14px;
}
.panel {
top: auto;
right: 15px;
bottom: 62px;
width: min(315px, calc(100vw - 30px));
padding: 14px 16px;
}
.panel-title {
margin-bottom: 8px;
}
.control {
padding: 9px 0 7px;
}
.hint {
bottom: 17px;
font-size: 9px;
}
}
</style>
</head>
<body>
<div class="vignette"></div>
<header>
<div class="eyebrow">Kinetic study / 012</div>
<h1>Pulse<br />Loop</h1>
<p>
Twelve fixed beads. Three movable boundaries. Shift an accent ring to
regroup the sequence without disturbing its spacing.
</p>
<div class="stats">
<span><i></i>12 beads</span>
<span><i></i>3 groups</span>
<span><i></i>30° intervals</span>
</div>
</header>
<aside class="panel" aria-label="Accent ring controls">
<div class="panel-title">
<strong>Accent boundaries</strong>
<button class="reset" id="reset" type="button">Reset</button>
</div>
<div class="control" style="--c:#ff776d">
<div class="control-head">
<label class="ring-name" for="ring0">Ring A</label>
<span class="ring-value" id="value0">000° · 4 beads</span>
</div>
<input id="ring0" type="range" min="0" max="359" value="12" />
</div>
<div class="control" style="--c:#66e3ec">
<div class="control-head">
<label class="ring-name" for="ring1">Ring B</label>
<span class="ring-value" id="value1">130° · 4 beads</span>
</div>
<input id="ring1" type="range" min="0" max="359" value="130" />
</div>
<div class="control" style="--c:#ffd166">
<div class="control-head">
<label class="ring-name" for="ring2">Ring C</label>
<span class="ring-value" id="value2">248° · 4 beads</span>
</div>
<input id="ring2" type="range" min="0" max="359" value="248" />
</div>
</aside>
<div class="hint">
<b>Drag a ring</b> to regroup · <b>Drag background</b> to orbit ·
<b>Scroll</b> 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";
const LOOP_RADIUS = 3.05;
const LOOP_Y = 0.55;
const TAU = Math.PI * 2;
const palette = [
new THREE.Color("#ff776d"),
new THREE.Color("#66e3ec"),
new THREE.Color("#ffd166")
];
const initialRingAngles = [12 / 360, 130 / 360, 248 / 360];
const ringAngles = [...initialRingAngles];
const scene = new THREE.Scene();
scene.background = new THREE.Color("#070912");
scene.fog = new THREE.FogExp2("#070912", 0.035);
const camera = new THREE.PerspectiveCamera(
42,
innerWidth / innerHeight,
0.1,
60
);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
renderer.setSize(innerWidth, innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.15;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
document.body.prepend(renderer.domElement);
const hemisphere = new THREE.HemisphereLight(0xa8c8ff, 0x16101d, 1.45);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xffffff, 3.5);
keyLight.position.set(4, 8, 5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(1024, 1024);
keyLight.shadow.camera.left = -6;
keyLight.shadow.camera.right = 6;
keyLight.shadow.camera.top = 6;
keyLight.shadow.camera.bottom = -6;
keyLight.shadow.bias = -0.0003;
scene.add(keyLight);
const cyanLight = new THREE.PointLight(0x4de8f1, 14, 12, 2);
cyanLight.position.set(-4, 2.2, 2.5);
scene.add(cyanLight);
const warmLight = new THREE.PointLight(0xff735e, 12, 12, 2);
warmLight.position.set(4, 1.2, -3);
scene.add(warmLight);
const ground = new THREE.Mesh(
new THREE.CircleGeometry(11, 96),
new THREE.MeshStandardMaterial({
color: 0x080b14,
roughness: 0.92,
metalness: 0.05
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.43;
ground.receiveShadow = true;
scene.add(ground);
const grid = new THREE.GridHelper(20, 40, 0x26314b, 0x111827);
grid.position.y = -0.415;
grid.material.transparent = true;
grid.material.opacity = 0.22;
scene.add(grid);
const starPositions = [];
for (let i = 0; i < 420; i++) {
const radius = 7 + Math.random() * 12;
const angle = Math.random() * TAU;
const height = -1 + Math.random() * 9;
starPositions.push(
Math.cos(angle) * radius,
height,
Math.sin(angle) * radius
);
}
const starGeometry = new THREE.BufferGeometry();
starGeometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(starPositions, 3)
);
const stars = new THREE.Points(
starGeometry,
new THREE.PointsMaterial({
color: 0xb8c8ee,
size: 0.025,
transparent: true,
opacity: 0.45,
depthWrite: false
})
);
scene.add(stars);
class LoopCurve extends THREE.Curve {
getPoint(t, target = new THREE.Vector3()) {
const angle = t * TAU;
return target.set(
Math.cos(angle) * LOOP_RADIUS,
LOOP_Y,
Math.sin(angle) * LOOP_RADIUS
);
}
}
const loopCurve = new LoopCurve();
loopCurve.arcLengthDivisions = 600;
const loopWire = new THREE.Mesh(
new THREE.TubeGeometry(loopCurve, 240, 0.035, 10, true),
new THREE.MeshStandardMaterial({
color: 0x9aa6bb,
metalness: 0.9,
roughness: 0.24
})
);
loopWire.castShadow = true;
scene.add(loopWire);
const beads = [];
for (let i = 0; i < 12; i++) {
const root = new THREE.Group();
root.position.copy(loopCurve.getPoint(i / 12));
const shellMaterial = new THREE.MeshPhysicalMaterial({
color: 0xffffff,
emissive: 0x000000,
emissiveIntensity: 0.2,
metalness: 0.22,
roughness: 0.24,
clearcoat: 0.8,
clearcoatRoughness: 0.18,
flatShading: true
});
const shell = new THREE.Mesh(
new THREE.DodecahedronGeometry(0.285, 0),
shellMaterial
);
shell.rotation.set(i * 0.31, i * 0.57, i * 0.19);
shell.castShadow = true;
shell.receiveShadow = true;
root.add(shell);
const bandMaterial = new THREE.MeshStandardMaterial({
color: 0xffffff,
emissive: 0x000000,
emissiveIntensity: 0.4,
metalness: 0.75,
roughness: 0.2
});
const band = new THREE.Mesh(
new THREE.TorusGeometry(0.268, 0.012, 8, 40),
bandMaterial
);
band.rotation.x = Math.PI / 2;
band.position.y = -0.015;
root.add(band);
const sparkMaterial = new THREE.MeshBasicMaterial({
color: 0xffffff,
transparent: true,
opacity: 0.95
});
const spark = new THREE.Mesh(
new THREE.SphereGeometry(0.043, 12, 8),
sparkMaterial
);
spark.position.y = 0.24;
root.add(spark);
scene.add(root);
beads.push({
root,
shell,
shellMaterial,
band,
bandMaterial,
spark,
sparkMaterial,
groupIndex: 0,
seed: i * 0.73
});
}
const rings = [];
const ringHitMeshes = [];
for (let i = 0; i < 3; i++) {
const group = new THREE.Group();
const material = new THREE.MeshStandardMaterial({
color: palette[i],
emissive: palette[i],
emissiveIntensity: 1.25,
metalness: 0.55,
roughness: 0.18
});
const torus = new THREE.Mesh(
new THREE.TorusGeometry(0.365, 0.035, 14, 72),
material
);
torus.castShadow = true;
group.add(torus);
const halo = new THREE.Mesh(
new THREE.TorusGeometry(0.435, 0.008, 8, 72),
new THREE.MeshBasicMaterial({
color: palette[i],
transparent: true,
opacity: 0.42,
depthWrite: false
})
);
group.add(halo);
const hitMesh = new THREE.Mesh(
new THREE.TorusGeometry(0.37, 0.12, 10, 40),
new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0,
depthWrite: false
})
);
hitMesh.userData.ringIndex = i;
group.add(hitMesh);
ringHitMeshes.push(hitMesh);
scene.add(group);
rings.push({ group, torus, halo, material, index: i });
}
const segmentMeshes = palette.map((color) => {
const mesh = new THREE.Mesh(
new THREE.BufferGeometry(),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: 0.72
})
);
scene.add(mesh);
return mesh;
});
const pulseMarker = new THREE.Mesh(
new THREE.SphereGeometry(0.075, 16, 12),
new THREE.MeshBasicMaterial({ color: 0xffffff })
);
scene.add(pulseMarker);
const cameraState = {
theta: 0.72,
phi: 0.88,
radius: 10.4,
target: new THREE.Vector3(0, 0.25, 0)
};
function updateCamera() {
const { theta, phi, radius, target } = cameraState;
const sinPhi = Math.sin(phi);
camera.position.set(
target.x + radius * sinPhi * Math.cos(theta),
target.y + radius * Math.cos(phi),
target.z + radius * sinPhi * Math.sin(theta)
);
camera.lookAt(target);
}
updateCamera();
const controls = {
draggingRing: false,
orbiting: false,
ringIndex: -1,
dragOffset: 0,
lastX: 0,
lastY: 0
};
const pointer = new THREE.Vector2();
const raycaster = new THREE.Raycaster();
const dragPlane = new THREE.Plane(
new THREE.Vector3(0, 1, 0),
-LOOP_Y
);
const planeHit = new THREE.Vector3();
function setPointer(event) {
const rect = renderer.domElement.getBoundingClientRect();
pointer.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
pointer.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
}
function normalizeAngle(angle) {
return ((angle % 1) + 1) % 1;
}
function shortestDifference(a, b) {
return ((b - a + 1.5) % 1) - 0.5;
}
function pointerAngle() {
raycaster.setFromCamera(pointer, camera);
const hit = raycaster.ray.intersectPlane(dragPlane, planeHit);
if (!hit) return null;
return normalizeAngle(Math.atan2(planeHit.z, planeHit.x) / TAU);
}
function setRingAngle(index, angle) {
ringAngles[index] = normalizeAngle(angle);
const slider = document.getElementById(`ring${index}`);
slider.value = Math.round(ringAngles[index] * 360) % 360;
regroup();
}
renderer.domElement.addEventListener("pointerdown", (event) => {
setPointer(event);
raycaster.setFromCamera(pointer, camera);
const hits = raycaster.intersectObjects(ringHitMeshes, false);
if (hits.length) {
controls.draggingRing = true;
controls.ringIndex = hits[0].object.userData.ringIndex;
const angle = pointerAngle();
if (angle !== null) {
controls.dragOffset = shortestDifference(
ringAngles[controls.ringIndex],
angle
);
}
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.style.cursor = "grabbing";
} else {
controls.orbiting = true;
controls.lastX = event.clientX;
controls.lastY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.style.cursor = "grabbing";
}
});
renderer.domElement.addEventListener("pointermove", (event) => {
setPointer(event);
if (controls.draggingRing) {
const angle = pointerAngle();
if (angle !== null) {
const targetAngle =
angle + shortestDifference(angle, ringAngles[controls.ringIndex]) +
controls.dragOffset;
setRingAngle(controls.ringIndex, targetAngle);
}
return;
}
if (controls.orbiting) {
const dx = event.clientX - controls.lastX;
const dy = event.clientY - controls.lastY;
cameraState.theta -= dx * 0.006;
cameraState.phi = THREE.MathUtils.clamp(
cameraState.phi + dy * 0.005,
0.28,
1.43
);
controls.lastX = event.clientX;
controls.lastY = event.clientY;
updateCamera();
return;
}
raycaster.setFromCamera(pointer, camera);
const hoveringRing =
raycaster.intersectObjects(ringHitMeshes, false).length > 0;
renderer.domElement.style.cursor = hoveringRing ? "pointer" : "grab";
});
function endPointer(event) {
controls.draggingRing = false;
controls.orbiting = false;
controls.ringIndex = -1;
if (renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
renderer.domElement.style.cursor = "grab";
}
renderer.domElement.addEventListener("pointerup", endPointer);
renderer.domElement.addEventListener("pointercancel", endPointer);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius * Math.exp(event.deltaY * 0.001),
7,
16
);
updateCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", () => {
cameraState.theta = 0.72;
cameraState.phi = 0.88;
cameraState.radius = 10.4;
updateCamera();
});
for (let i = 0; i < 3; i++) {
const slider = document.getElementById(`ring${i}`);
slider.addEventListener("input", () => {
setRingAngle(i, Number(slider.value) / 360);
});
}
document.getElementById("reset").addEventListener("click", () => {
for (let i = 0; i < 3; i++) {
setRingAngle(i, initialRingAngles[i]);
}
cameraState.theta = 0.72;
cameraState.phi = 0.88;
cameraState.radius = 10.4;
updateCamera();
});
function containsAngle(angle, start, end) {
if (start <= end) {
return angle >= start && angle < end;
}
return angle >= start || angle < end;
}
function rebuildSegments(sortedBoundaries) {
for (let i = 0; i < sortedBoundaries.length; i++) {
const current = sortedBoundaries[i];
const next = sortedBoundaries[(i + 1) % sortedBoundaries.length];
let span = next.angle - current.angle;
if (i === sortedBoundaries.length - 1) span += 1;
const mesh = segmentMeshes[current.index];
if (span < 0.001) {
mesh.visible = false;
continue;
}
const steps = Math.max(8, Math.ceil(span * 100));
const points = [];
for (let step = 0; step <= steps; step++) {
const angle = (current.angle + (span * step) / steps) * TAU;
points.push(
new THREE.Vector3(
Math.cos(angle) * LOOP_RADIUS,
LOOP_Y + 0.004,
Math.sin(angle) * LOOP_RADIUS
)
);
}
const curve = new THREE.CatmullRomCurve3(
points,
false,
"centripetal"
);
mesh.geometry.dispose();
mesh.geometry = new THREE.TubeGeometry(
curve,
steps,
0.046,
8,
false
);
mesh.visible = true;
}
}
function regroup() {
const sorted = ringAngles
.map((angle, index) => ({ angle, index }))
.sort((a, b) => a.angle - b.angle);
const counts = [0, 0, 0];
const pearl = new THREE.Color("#f2efe7");
beads.forEach((bead, beadIndex) => {
const angle = beadIndex / 12;
let assigned = sorted[0].index;
for (let i = 0; i < sorted.length; i++) {
const current = sorted[i];
const next =
sorted[(i + 1) % sorted.length].angle +
(i === sorted.length - 1 ? 1 : 0);
if (containsAngle(angle, current.angle, next)) {
assigned = current.index;
break;
}
}
const color = palette[assigned];
bead.groupIndex = assigned;
counts[assigned]++;
bead.shellMaterial.color.copy(color).lerp(pearl, 0.16);
bead.shellMaterial.emissive.copy(color);
bead.bandMaterial.color.copy(color);
bead.bandMaterial.emissive.copy(color);
bead.sparkMaterial.color.copy(color).lerp(pearl, 0.5);
});
for (let i = 0; i < 3; i++) {
const degrees = Math.round(ringAngles[i] * 360) % 360;
const value = document.getElementById(`value${i}`);
value.textContent =
`${String(degrees).padStart(3, "0")}° · ${counts[i]} beads`;
}
rebuildSegments(sorted);
}
regroup();
const clock = new THREE.Clock();
const tangent = new THREE.Vector3();
const zAxis = new THREE.Vector3(0, 0, 1);
function animate() {
const elapsed = clock.getElapsedTime();
const pulsePosition = (elapsed * 0.115) % 1;
pulseMarker.position.copy(loopCurve.getPoint(pulsePosition));
rings.forEach((ring) => {
const t = ringAngles[ring.index];
ring.group.position.copy(loopCurve.getPoint(t));
tangent.copy(loopCurve.getTangent(t)).normalize();
ring.group.quaternion.setFromUnitVectors(zAxis, tangent);
const shimmer = 1 + Math.sin(elapsed * 2.3 + ring.index) * 0.018;
ring.torus.scale.setScalar(shimmer);
ring.halo.rotation.z = elapsed * 0.18 * (ring.index % 2 ? 1 : -1);
});
beads.forEach((bead) => {
const t = Number(bead.root.userData.angle ?? 0);
const distance = Math.abs(t - pulsePosition);
const circularDistance = Math.min(distance, 1 - distance);
const pulse = Math.exp(-circularDistance * circularDistance * 210);
const ripple = Math.sin(t * TAU * 3 - elapsed * 2.1) * 0.018;
const scale = 1 + pulse * 0.15 + ripple;
bead.root.scale.setScalar(scale);
bead.shellMaterial.emissiveIntensity = 0.16 + pulse * 0.95;
bead.bandMaterial.emissiveIntensity = 0.28 + pulse * 1.2;
bead.sparkMaterial.opacity = 0.58 + pulse * 0.42;
});
// Store each bead's fixed angular position for the pulse calculation.
beads.forEach((bead, index) => {
bead.root.userData.angle = index / 12;
});
cyanLight.position.x = Math.cos(elapsed * 0.32) * 4.2;
cyanLight.position.z = Math.sin(elapsed * 0.32) * 4.2;
warmLight.position.x = Math.cos(elapsed * 0.24 + 2.4) * 4;
warmLight.position.z = Math.sin(elapsed * 0.24 + 2.4) * 4;
stars.rotation.y = elapsed * 0.004;
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
addEventListener("resize", () => {
camera.aspect = innerWidth / innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(innerWidth, innerHeight);
renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
});
</script>
</body>
</html>
```