Prompt specification
Build or customize the Three.js 3D scene "Basket Rim Weaving Sequence" 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: Basket Rim Weaving Sequence
Category: Art & Culture · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/basket-rim-weaving-sequence-x3358
Scene Description Prompt:
Create a standalone low-poly scene in one HTML file using Three.js from cdnjs. Animate a few strips threaded around a simple basket frame. Advance one crossing at a time and preserve the already woven section's over-under pattern.
Working Three.js Starter (basket-rim-weaving-sequence-x3358):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Low-Poly Woven Basket</title>
<style>
:root {
color-scheme: light;
--ink: #352b24;
--muted: #74675b;
--paper: rgba(255, 251, 244, 0.88);
--line: rgba(74, 57, 43, 0.16);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #eee7da;
color: var(--ink);
font-family: Inter, ui-sans-serif, system-ui, -apple-system,
BlinkMacSystemFont, "Segoe UI", sans-serif;
}
canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
canvas:active {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 2;
border: 1px solid var(--line);
background: var(--paper);
box-shadow: 0 14px 40px rgba(60, 42, 27, 0.10);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
#intro {
top: 22px;
left: 22px;
width: min(330px, calc(100vw - 44px));
padding: 18px 20px 16px;
border-radius: 18px;
}
h1 {
margin: 0 0 7px;
font-size: 22px;
line-height: 1.1;
letter-spacing: -0.035em;
}
#intro p {
margin: 0;
color: var(--muted);
font-size: 13px;
line-height: 1.5;
}
#status {
top: 22px;
right: 22px;
width: min(270px, calc(100vw - 44px));
padding: 16px 18px;
border-radius: 18px;
}
.eyebrow {
margin-bottom: 8px;
color: var(--muted);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
}
#status-text {
min-height: 42px;
font-size: 14px;
font-weight: 700;
line-height: 1.4;
}
#total-progress {
height: 5px;
margin: 10px 0 15px;
overflow: hidden;
border-radius: 999px;
background: rgba(80, 59, 42, 0.10);
}
#total-fill {
width: 0%;
height: 100%;
border-radius: inherit;
background: #49392d;
transition: width 120ms linear;
}
.strip-row {
display: grid;
grid-template-columns: 10px 1fr 42px;
gap: 9px;
align-items: center;
margin-top: 8px;
font-size: 11px;
color: var(--muted);
}
.swatch {
width: 9px;
height: 9px;
border-radius: 50%;
}
.strip-track {
height: 4px;
overflow: hidden;
border-radius: 999px;
background: rgba(80, 59, 42, 0.10);
}
.strip-fill {
width: 0%;
height: 100%;
border-radius: inherit;
transition: width 100ms linear;
}
.strip-count {
text-align: right;
font-variant-numeric: tabular-nums;
}
#controls {
left: 50%;
bottom: 22px;
display: flex;
gap: 8px;
padding: 8px;
border-radius: 16px;
transform: translateX(-50%);
}
button {
appearance: none;
border: 0;
border-radius: 10px;
padding: 9px 14px;
background: #49392d;
color: #fffaf1;
font: inherit;
font-size: 12px;
font-weight: 750;
cursor: pointer;
transition: transform 120ms ease, background 120ms ease;
}
button:hover {
background: #5b4738;
transform: translateY(-1px);
}
button.secondary {
background: rgba(73, 57, 45, 0.09);
color: var(--ink);
}
button.secondary:hover {
background: rgba(73, 57, 45, 0.15);
}
#hint {
position: fixed;
z-index: 2;
right: 24px;
bottom: 24px;
color: rgba(53, 43, 36, 0.62);
font-size: 11px;
pointer-events: none;
}
@media (max-width: 700px) {
#intro {
top: 12px;
left: 12px;
width: calc(100vw - 24px);
padding: 14px 16px;
}
#intro p {
font-size: 12px;
}
#status {
top: auto;
right: 12px;
bottom: 76px;
width: 210px;
padding: 12px 14px;
}
#hint {
display: none;
}
#controls {
bottom: 12px;
}
}
</style>
</head>
<body>
<section id="intro" class="panel">
<h1>Plain Weave</h1>
<p>
Three flat reeds are threaded through a low-poly basket frame.
Each crossing is placed individually, and completed over-under
states remain locked.
</p>
</section>
<section id="status" class="panel">
<div class="eyebrow">Weaving status</div>
<div id="status-text">Preparing the first crossing…</div>
<div id="total-progress">
<div id="total-fill"></div>
</div>
<div id="strip-list"></div>
</section>
<div id="controls" class="panel">
<button id="pause" type="button">Pause</button>
<button id="replay" class="secondary" type="button">Replay</button>
</div>
<div id="hint">Drag to orbit · Scroll to zoom · Double-click to reset view</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Scene setup
// -------------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xeee7da);
scene.fog = new THREE.Fog(0xeee7da, 13, 24);
const renderer = new THREE.WebGLRenderer({
antialias: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
document.body.prepend(renderer.domElement);
const camera = new THREE.PerspectiveCamera(
38,
window.innerWidth / window.innerHeight,
0.1,
100
);
const cameraTarget = new THREE.Vector3(0, 1.25, 0);
const cameraState = {
yaw: 0.62,
pitch: 0.64,
radius: 8.8
};
function updateCamera() {
const { yaw, pitch, radius } = cameraState;
const horizontal = radius * Math.sin(pitch);
camera.position.set(
cameraTarget.x + horizontal * Math.sin(yaw),
cameraTarget.y + radius * Math.cos(pitch),
cameraTarget.z + horizontal * Math.cos(yaw)
);
camera.lookAt(cameraTarget);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(0xfff7e9, 0x88715e, 2.0);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff1d7, 3.1);
keyLight.position.set(5.5, 9, 5.5);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -6;
keyLight.shadow.camera.right = 6;
keyLight.shadow.camera.top = 7;
keyLight.shadow.camera.bottom = -5;
keyLight.shadow.camera.near = 0.5;
keyLight.shadow.camera.far = 25;
keyLight.shadow.normalBias = 0.025;
scene.add(keyLight);
const fillLight = new THREE.DirectionalLight(0xb8d8d2, 1.0);
fillLight.position.set(-5, 4, -4);
scene.add(fillLight);
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(40, 40),
new THREE.MeshStandardMaterial({
color: 0xe9e0d1,
roughness: 1,
metalness: 0
})
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.035;
floor.receiveShadow = true;
scene.add(floor);
// -------------------------------------------------------------------------
// Basket frame
// -------------------------------------------------------------------------
const STAKE_COUNT = 12;
const BOTTOM_Y = 0.16;
const TOP_Y = 3.12;
const BOTTOM_RADIUS = 2.15;
const TOP_RADIUS = 1.76;
const ANGLE_STEP = (Math.PI * 2) / STAKE_COUNT;
const frameMaterial = new THREE.MeshStandardMaterial({
color: 0x9b6841,
roughness: 0.83,
metalness: 0,
flatShading: true
});
const rimMaterial = new THREE.MeshStandardMaterial({
color: 0xb27b4e,
roughness: 0.76,
metalness: 0,
flatShading: true
});
function radiusAt(y) {
const t = THREE.MathUtils.clamp(
(y - BOTTOM_Y) / (TOP_Y - BOTTOM_Y),
0,
1
);
return THREE.MathUtils.lerp(BOTTOM_RADIUS, TOP_RADIUS, t);
}
function stakePosition(index, y) {
const angle = index * ANGLE_STEP;
const radius = radiusAt(y);
return new THREE.Vector3(
Math.cos(angle) * radius,
y,
Math.sin(angle) * radius
);
}
const unitCylinder = new THREE.CylinderGeometry(1, 1, 1, 6, 1, false);
function addCylinderBetween(a, b, radius, material) {
const direction = new THREE.Vector3().subVectors(b, a);
const length = direction.length();
const mesh = new THREE.Mesh(unitCylinder, material);
mesh.position.copy(a).add(b).multiplyScalar(0.5);
mesh.scale.set(radius, length, radius);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add(mesh);
return mesh;
}
for (let i = 0; i < STAKE_COUNT; i++) {
addCylinderBetween(
stakePosition(i, BOTTOM_Y),
stakePosition(i, TOP_Y),
0.105,
frameMaterial
);
}
// Top and bottom polygon hoops.
for (let i = 0; i < STAKE_COUNT; i++) {
const next = (i + 1) % STAKE_COUNT;
addCylinderBetween(
stakePosition(i, TOP_Y),
stakePosition(next, TOP_Y),
0.085,
rimMaterial
);
const lowerY = 0.34;
addCylinderBetween(
stakePosition(i, lowerY),
stakePosition(next, lowerY),
0.070,
rimMaterial
);
}
const base = new THREE.Mesh(
new THREE.CylinderGeometry(
BOTTOM_RADIUS * 0.98,
BOTTOM_RADIUS * 0.93,
0.17,
STAKE_COUNT
),
new THREE.MeshStandardMaterial({
color: 0x855a39,
roughness: 0.9,
flatShading: true
})
);
base.position.y = 0.06;
base.castShadow = true;
base.receiveShadow = true;
scene.add(base);
// -------------------------------------------------------------------------
// Ribbon geometry
//
// Each reed is a rectangular strip following a circular path. At a stake,
// "over" moves the strip radially outward and "under" moves it inward.
// -------------------------------------------------------------------------
const SAMPLE_COUNT = 10;
const STRIP_WIDTH = 0.235;
const STRIP_THICKNESS = 0.052;
const OVER_OFFSET = 0.17;
const UNDER_OFFSET = -0.16;
const MAX_POINTS = STAKE_COUNT * SAMPLE_COUNT + 16;
function smoothstep(edge0, edge1, value) {
const x = THREE.MathUtils.clamp(
(value - edge0) / (edge1 - edge0),
0,
1
);
return x * x * (3 - 2 * x);
}
function crossingOffset(state) {
return state === "over" ? OVER_OFFSET : UNDER_OFFSET;
}
function createRibbonGeometry() {
const geometry = new THREE.BufferGeometry();
const positions = new Float32Array(MAX_POINTS * 4 * 3);
const normals = new Float32Array(MAX_POINTS * 4 * 3);
const indices = [];
for (let point = 0; point < MAX_POINTS - 1; point++) {
const a = point * 4;
const b = (point + 1) * 4;
for (let face = 0; face < 4; face++) {
const c1 = face;
const c2 = (face + 1) % 4;
indices.push(
a + c1, b + c1, b + c2,
a + c1, b + c2, a + c2
);
}
}
geometry.setAttribute(
"position",
new THREE.BufferAttribute(positions, 3).setUsage(THREE.DynamicDrawUsage)
);
geometry.setAttribute(
"normal",
new THREE.BufferAttribute(normals, 3).setUsage(THREE.DynamicDrawUsage)
);
geometry.setIndex(indices);
geometry.setDrawRange(0, 0);
return geometry;
}
const stripDefinitions = [
{
name: "Terracotta",
color: 0xc96345,
y: 0.86,
start: 0
},
{
name: "Marigold",
color: 0xe0a33b,
y: 1.51,
start: 4
},
{
name: "Verdigris",
color: 0x4f9184,
y: 2.16,
start: 8
}
];
const strips = stripDefinitions.map((definition) => {
const material = new THREE.MeshStandardMaterial({
color: definition.color,
roughness: 0.72,
metalness: 0,
flatShading: true,
side: THREE.DoubleSide
});
const mesh = new THREE.Mesh(createRibbonGeometry(), material);
mesh.castShadow = true;
mesh.receiveShadow = true;
mesh.frustumCulled = false;
scene.add(mesh);
return {
...definition,
mesh,
cursor: definition.start,
crossings: Array(STAKE_COUNT).fill(null),
completedSegments: [],
current: null,
done: false
};
});
const tipMarker = new THREE.Mesh(
new THREE.IcosahedronGeometry(0.095, 0),
new THREE.MeshStandardMaterial({
color: 0xfff4d6,
emissive: 0x7f5930,
emissiveIntensity: 0.16,
roughness: 0.55,
flatShading: true
})
);
tipMarker.castShadow = true;
scene.add(tipMarker);
// -------------------------------------------------------------------------
// Weaving state machine
//
// Completed segments are never recomputed from a changing global pattern.
// Their two crossing states are stored permanently. The active segment is
// the only part allowed to change while it is moving.
// -------------------------------------------------------------------------
let activeStripIndex = 0;
let running = true;
let totalCompleted = 0;
function beginCrossing(strip) {
const from = strip.cursor;
const to = (from + 1) % STAKE_COUNT;
const fromState = strip.crossings[from];
const toState = fromState === "over" ? "under" : "over";
strip.current = {
from,
to,
fromState,
toState,
progress: 0
};
}
function chooseNextStrip() {
for (let offset = 1; offset <= strips.length; offset++) {
const index = (activeStripIndex + offset) % strips.length;
if (!strips[index].done) {
activeStripIndex = index;
beginCrossing(strips[index]);
return;
}
}
activeStripIndex = -1;
}
function completeCrossing(strip) {
const segment = strip.current;
// Lock this crossing into the strip's permanent pattern.
strip.crossings[segment.to] = segment.toState;
strip.completedSegments.push({
from: segment.from,
to: segment.to,
fromState: segment.fromState,
toState: segment.toState
});
strip.cursor = segment.to;
strip.current = null;
totalCompleted++;
if (strip.completedSegments.length === STAKE_COUNT) {
strip.done = true;
}
}
function resetWeave() {
totalCompleted = 0;
for (const strip of strips) {
strip.cursor = strip.start;
strip.crossings.fill(null);
strip.crossings[strip.start] = "over";
strip.completedSegments.length = 0;
strip.current = null;
strip.done = false;
}
activeStripIndex = 0;
beginCrossing(strips[0]);
updateInterface();
}
// -------------------------------------------------------------------------
// Path construction
// -------------------------------------------------------------------------
function segmentAngleDelta(segment) {
return (
((segment.to - segment.from + STAKE_COUNT) % STAKE_COUNT) *
ANGLE_STEP
);
}
function makePathPoint(angle, radius, y) {
return new THREE.Vector3(
Math.cos(angle) * radius,
y,
Math.sin(angle) * radius
);
}
function completedSegmentPoint(segment, t) {
const angle =
segment.from * ANGLE_STEP + segmentAngleDelta(segment) * t;
// The strip returns to the neutral radius between stakes, then moves
// inward or outward around each stake.
const fromInfluence = 1 - smoothstep(0, 0.22, t);
const toInfluence = smoothstep(0.78, 1, t);
const offset =
crossingOffset(segment.fromState) * fromInfluence +
crossingOffset(segment.toState) * toInfluence;
return makePathPoint(
angle,
radiusAt(0) * 0 + radiusForStrip(segment.stripY) + offset,
segment.stripY
);
}
function activeSegmentPoint(segment, t, progress) {
const growth = smoothstep(0, 1, Math.min(progress / 0.78, 1));
const reveal = smoothstep(0.32, 0.92, progress);
const actualT = t * growth;
const angle =
segment.from * ANGLE_STEP + segmentAngleDelta(segment) * actualT;
const fromInfluence = 1 - smoothstep(0, 0.22, actualT);
const toInfluence = smoothstep(0.78, 1, actualT);
const offset =
crossingOffset(segment.fromState) * fromInfluence +
crossingOffset(segment.toState) * toInfluence * reveal;
return makePathPoint(
angle,
radiusForStrip(segment.stripY) + offset,
segment.stripY
);
}
function radiusForStrip(y) {
return radiusAt(y);
}
function buildStripPoints(strip) {
const points = [];
// These segments use immutable stored crossing states.
for (const segment of strip.completedSegments) {
segment.stripY = strip.y;
for (let sample = 0; sample < SAMPLE_COUNT; sample++) {
points.push(
completedSegmentPoint(segment, sample / SAMPLE_COUNT)
);
}
}
if (strip.current) {
const segment = { ...strip.current, stripY: strip.y };
// Include the exact stake point, followed by the growing tip.
points.push(activeSegmentPoint(segment, 0, segment.progress));
for (let sample = 1; sample <= SAMPLE_COUNT; sample++) {
points.push(
activeSegmentPoint(
segment,
sample / SAMPLE_COUNT,
segment.progress
)
);
}
} else if (strip.completedSegments.length) {
// Close the final point when the strip has completed its full loop.
const segment = {
...strip.completedSegments[strip.completedSegments.length - 1],
stripY: strip.y
};
points.push(completedSegmentPoint(segment, 1));
}
return points;
}
function updateRibbonGeometry(strip, points) {
const geometry = strip.mesh.geometry;
const position = geometry.getAttribute("position");
const normal = geometry.getAttribute("normal");
const halfWidth = STRIP_WIDTH * 0.5;
const halfThickness = STRIP_THICKNESS * 0.5;
for (let i = 0; i < points.length; i++) {
const point = points[i];
const radius = Math.hypot(point.x, point.z);
const angle = Math.atan2(point.z, point.x);
const outward = new THREE.Vector3(
Math.cos(angle),
0,
Math.sin(angle)
);
const up = new THREE.Vector3(0, 1, 0);
const corners = [
point.clone()
.addScaledVector(outward, halfThickness)
.addScaledVector(up, halfWidth),
point.clone()
.addScaledVector(outward, halfThickness)
.addScaledVector(up, -halfWidth),
point.clone()
.addScaledVector(outward, -halfThickness)
.addScaledVector(up, -halfWidth),
point.clone()
.addScaledVector(outward, -halfThickness)
.addScaledVector(up, halfWidth)
];
for (let corner = 0; corner < 4; corner++) {
const index = i * 4 + corner;
const vector = corners[corner];
position.setXYZ(index, vector.x, vector.y, vector.z);
// FlatShading derives the final face normals in the shader.
normal.setXYZ(index, outward.x, 0, outward.z);
}
}
position.needsUpdate = true;
normal.needsUpdate = true;
geometry.setDrawRange(0, Math.max(0, (points.length - 1) * 4 * 6));
}
// -------------------------------------------------------------------------
// Interface
// -------------------------------------------------------------------------
const statusText = document.querySelector("#status-text");
const totalFill = document.querySelector("#total-fill");
const stripList = document.querySelector("#strip-list");
const pauseButton = document.querySelector("#pause");
const replayButton = document.querySelector("#replay");
const stripUI = strips.map((strip) => {
const row = document.createElement("div");
row.className = "strip-row";
const swatch = document.createElement("div");
swatch.className = "swatch";
swatch.style.background = `#${strip.color.toString(16).padStart(6, "0")}`;
const track = document.createElement("div");
track.className = "strip-track";
const fill = document.createElement("div");
fill.className = "strip-fill";
fill.style.background = swatch.style.background;
track.appendChild(fill);
const count = document.createElement("div");
count.className = "strip-count";
row.append(swatch, track, count);
stripList.appendChild(row);
return { fill, count };
});
function updateInterface() {
const active =
activeStripIndex >= 0 ? strips[activeStripIndex] : null;
if (active?.current) {
const segment = active.current;
const direction =
segment.toState === "over" ? "OVER" : "UNDER";
statusText.textContent =
`${active.name} reed is threading ${direction} stake ` +
`${segment.to + 1}.`;
} else if (totalCompleted === strips.length * STAKE_COUNT) {
statusText.textContent = "The three reeds are fully woven.";
} else {
statusText.textContent = "Preparing the next crossing…";
}
const total = strips.length * STAKE_COUNT;
totalFill.style.width = `${(totalCompleted / total) * 100}%`;
strips.forEach((strip, index) => {
const partial = strip.current
? strip.current.progress / STAKE_COUNT
: 0;
const fraction =
(strip.completedSegments.length + partial) / STAKE_COUNT;
stripUI[index].fill.style.width = `${fraction * 100}%`;
stripUI[index].count.textContent =
`${strip.completedSegments.length}/${STAKE_COUNT}`;
});
}
pauseButton.addEventListener("click", () => {
running = !running;
pauseButton.textContent = running ? "Pause" : "Resume";
});
replayButton.addEventListener("click", () => {
running = true;
pauseButton.textContent = "Pause";
resetWeave();
});
// -------------------------------------------------------------------------
// Custom camera controls — no addons required
// -------------------------------------------------------------------------
let dragging = false;
let pointerX = 0;
let pointerY = 0;
const canvas = renderer.domElement;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
pointerX = event.clientX;
pointerY = event.clientY;
canvas.setPointerCapture(event.pointerId);
});
canvas.addEventListener("pointermove", (event) => {
if (!dragging) return;
const deltaX = event.clientX - pointerX;
const deltaY = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
cameraState.yaw -= deltaX * 0.006;
cameraState.pitch = THREE.MathUtils.clamp(
cameraState.pitch + deltaY * 0.005,
0.25,
1.18
);
});
function endDrag(event) {
dragging = false;
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", endDrag);
canvas.addEventListener("pointercancel", endDrag);
canvas.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius + event.deltaY * 0.006,
5.8,
14
);
},
{ passive: false }
);
canvas.addEventListener("dblclick", () => {
cameraState.yaw = 0.62;
cameraState.pitch = 0.64;
cameraState.radius = 8.8;
});
canvas.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
// -------------------------------------------------------------------------
// Animation loop
// -------------------------------------------------------------------------
const CROSSING_DURATION = 0.62;
let previousTime = performance.now();
function animate(time) {
const delta = Math.min((time - previousTime) / 1000, 0.05);
previousTime = time;
if (running && activeStripIndex >= 0) {
const strip = strips[activeStripIndex];
if (strip.current) {
strip.current.progress += delta / CROSSING_DURATION;
if (strip.current.progress >= 1) {
strip.current.progress = 1;
completeCrossing(strip);
if (!strip.done) {
chooseNextStrip();
} else {
activeStripIndex = -1;
const next = strips.find((candidate) => !candidate.done);
if (next) {
activeStripIndex = strips.indexOf(next);
beginCrossing(next);
}
}
}
}
}
let activeTip = null;
for (const strip of strips) {
const points = buildStripPoints(strip);
updateRibbonGeometry(strip, points);
if (strip.current && points.length) {
activeTip = points[points.length - 1];
}
}
if (activeTip) {
const pulse = 1 + Math.sin(time * 0.008) * 0.08;
tipMarker.visible = true;
tipMarker.position.copy(activeTip);
tipMarker.scale.setScalar(pulse);
} else {
tipMarker.visible = false;
}
updateCamera();
updateInterface();
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
resetWeave();
requestAnimationFrame(animate);
</script>
</body>
</html>
```