Prompt specification
Build or customize the Three.js 3D scene "Siphon start and broken-column comparison" 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: Siphon start and broken-column comparison
Category: Science & Physics · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/siphon-start-and-broken-column-comparison-x1498
Scene Description Prompt:
Please use Three.js from cdnjs for a stylized scene based on this idea: siphon start and broken-column comparison. Compare a continuous liquid-filled tube with one containing an air break; illustrate why the modeled continuous flow stops when the column is interrupted. Return one self-contained HTML file.
Working Three.js Starter (siphon-start-and-broken-column-comparison-x1498):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Broken Column — Siphon Comparison</title>
<style>
:root {
--bg: #07111f;
--panel: rgba(11, 25, 43, 0.82);
--panel-border: rgba(164, 211, 235, 0.18);
--text: #eef8ff;
--muted: #99afc1;
--cyan: #55ead8;
--cyan-soft: rgba(85, 234, 216, 0.14);
--amber: #ffc76a;
--orange: #ff8b5e;
--orange-soft: rgba(255, 139, 94, 0.15);
--shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background:
radial-gradient(circle at 18% 12%, rgba(34, 104, 126, 0.2), transparent 34%),
radial-gradient(circle at 85% 30%, rgba(79, 58, 91, 0.18), transparent 30%),
linear-gradient(145deg, #07111f 0%, #081727 55%, #050d18 100%);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button { font: inherit; }
#app, #scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
cursor: grab;
}
#scene canvas:active { cursor: grabbing; }
.vignette {
position: fixed;
inset: 0;
pointer-events: none;
background:
linear-gradient(to bottom, rgba(3, 9, 17, 0.24), transparent 30%, transparent 72%, rgba(3, 9, 17, 0.5)),
radial-gradient(circle at center, transparent 50%, rgba(2, 7, 13, 0.38) 100%);
}
.header {
position: fixed;
z-index: 5;
top: 28px;
left: 30px;
width: min(470px, calc(100vw - 60px));
pointer-events: none;
}
.eyebrow {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
color: var(--cyan);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
content: "";
width: 28px;
height: 2px;
border-radius: 99px;
background: var(--cyan);
box-shadow: 0 0 14px rgba(85, 234, 216, 0.65);
}
h1 {
margin: 0;
max-width: 440px;
font-size: clamp(30px, 4.2vw, 58px);
line-height: 0.98;
letter-spacing: -0.055em;
font-weight: 760;
text-wrap: balance;
}
.header p {
max-width: 410px;
margin: 17px 0 0;
color: var(--muted);
font-size: 14px;
line-height: 1.6;
}
.story {
position: fixed;
z-index: 5;
top: 28px;
right: 28px;
width: min(355px, calc(100vw - 56px));
padding: 19px;
border: 1px solid var(--panel-border);
border-radius: 20px;
background: var(--panel);
box-shadow: var(--shadow);
backdrop-filter: blur(18px) saturate(120%);
}
.story-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
margin-bottom: 13px;
}
.live-status {
display: inline-flex;
align-items: center;
gap: 8px;
color: #c9dce9;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.live-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--amber);
box-shadow: 0 0 12px rgba(255, 199, 106, 0.65);
}
.live-dot.flowing {
background: var(--cyan);
box-shadow: 0 0 12px rgba(85, 234, 216, 0.75);
}
.phase-badge {
padding: 5px 8px;
border: 1px solid rgba(255, 199, 106, 0.22);
border-radius: 999px;
color: var(--amber);
background: rgba(255, 199, 106, 0.08);
font-size: 9px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.story h2 {
margin: 0 0 8px;
font-size: 19px;
line-height: 1.18;
letter-spacing: -0.025em;
}
.story-copy {
min-height: 72px;
margin: 0;
color: #a9bdcc;
font-size: 12.5px;
line-height: 1.55;
}
.state-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 9px;
margin-top: 15px;
}
.state {
padding: 10px 11px;
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 12px;
background: rgba(255, 255, 255, 0.035);
}
.state span {
display: block;
margin-bottom: 6px;
color: #72899b;
font-size: 9px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.state strong {
font-size: 11px;
letter-spacing: 0.08em;
}
.state strong.flowing { color: var(--cyan); }
.state strong.blocked { color: var(--orange); }
.state strong.ready { color: #c7d6e1; }
.equation {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
gap: 4px 12px;
margin-top: 12px;
padding: 12px 13px;
border: 1px solid rgba(255, 199, 106, 0.15);
border-radius: 12px;
background: rgba(255, 199, 106, 0.055);
}
.equation span {
color: #b5c4ce;
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.equation strong {
grid-row: span 2;
color: var(--amber);
font-family: Georgia, serif;
font-size: 22px;
font-style: italic;
font-weight: 500;
}
.equation small {
color: #7f93a2;
font-size: 10px;
line-height: 1.35;
}
.controls {
position: fixed;
z-index: 7;
left: 50%;
bottom: 27px;
display: flex;
align-items: center;
gap: 9px;
transform: translateX(-50%);
padding: 8px;
border: 1px solid var(--panel-border);
border-radius: 16px;
background: rgba(8, 20, 35, 0.86);
box-shadow: var(--shadow);
backdrop-filter: blur(18px);
}
.controls button {
min-height: 42px;
padding: 0 16px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 10px;
color: #c8d7e2;
background: rgba(255, 255, 255, 0.045);
cursor: pointer;
font-size: 12px;
font-weight: 750;
white-space: nowrap;
transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.controls button:hover {
transform: translateY(-1px);
border-color: rgba(85, 234, 216, 0.4);
color: #fff;
background: rgba(85, 234, 216, 0.08);
}
.controls button:focus-visible {
outline: 2px solid var(--cyan);
outline-offset: 2px;
}
.controls .primary {
min-width: 146px;
border-color: rgba(85, 234, 216, 0.35);
color: #041816;
background: var(--cyan);
box-shadow: 0 7px 24px rgba(41, 212, 194, 0.2);
}
.controls .primary:hover {
color: #041816;
background: #79f4e5;
}
.controls .interrupt {
color: #ffc0a6;
}
.hint {
position: fixed;
z-index: 4;
right: 30px;
bottom: 30px;
display: flex;
align-items: center;
gap: 8px;
color: rgba(188, 207, 220, 0.62);
font-size: 10px;
letter-spacing: 0.07em;
pointer-events: none;
}
.hint svg { opacity: 0.65; }
#labels {
position: fixed;
z-index: 3;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.scene-label {
position: absolute;
min-width: 118px;
padding: 8px 11px;
transform: translate(-50%, -100%);
border: 1px solid rgba(85, 234, 216, 0.24);
border-radius: 10px;
color: #eafffc;
background: rgba(7, 24, 38, 0.78);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
backdrop-filter: blur(8px);
opacity: 0;
transition: opacity 180ms ease;
white-space: nowrap;
}
.scene-label::after {
content: "";
position: absolute;
left: 50%;
bottom: -13px;
width: 1px;
height: 13px;
background: rgba(85, 234, 216, 0.55);
}
.scene-label strong {
display: block;
font-size: 9px;
font-weight: 850;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.scene-label small {
display: block;
margin-top: 3px;
color: #8ca5b5;
font-size: 9px;
}
.scene-label.orange {
border-color: rgba(255, 139, 94, 0.34);
color: #fff0e9;
}
.scene-label.orange::after { background: rgba(255, 139, 94, 0.65); }
.scene-label.amber { border-color: rgba(255, 199, 106, 0.3); }
.scene-label.amber::after { background: rgba(255, 199, 106, 0.55); }
.scene-label.mini {
min-width: 0;
padding: 5px 8px;
border-radius: 8px;
}
.scene-label.mini strong { font-size: 8px; }
.scene-label.is-visible { opacity: 1; }
.model-note {
position: fixed;
z-index: 4;
left: 30px;
bottom: 31px;
width: 300px;
color: rgba(159, 180, 196, 0.62);
font-size: 9.5px;
line-height: 1.45;
pointer-events: none;
}
#loader {
position: fixed;
z-index: 20;
inset: 0;
display: grid;
place-items: center;
color: #b6cad8;
background: #07111f;
transition: opacity 500ms ease, visibility 500ms ease;
}
#loader.hide {
opacity: 0;
visibility: hidden;
}
.loader-ring {
width: 42px;
height: 42px;
margin: 0 auto 14px;
border: 2px solid rgba(85, 234, 216, 0.16);
border-top-color: var(--cyan);
border-radius: 50%;
animation: spin 900ms linear infinite;
}
#loader p {
margin: 0;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
.header {
top: 20px;
left: 20px;
width: min(410px, calc(100vw - 40px));
}
.header p { display: none; }
.story {
top: auto;
right: 16px;
bottom: 92px;
width: 315px;
padding: 15px;
}
.story-copy { min-height: 0; }
.state-grid, .equation { display: none; }
.model-note, .hint { display: none; }
.controls { bottom: 15px; }
}
@media (max-width: 620px) {
.header {
top: 15px;
left: 16px;
width: calc(100vw - 32px);
}
h1 {
max-width: 310px;
font-size: 33px;
}
.eyebrow { margin-bottom: 8px; font-size: 9px; }
.story {
right: 12px;
bottom: 88px;
width: calc(100vw - 24px);
padding: 12px 14px;
border-radius: 15px;
}
.story h2 { font-size: 15px; }
.story-copy { font-size: 11px; line-height: 1.45; }
.story-top { margin-bottom: 8px; }
.phase-badge { display: none; }
.controls {
width: calc(100vw - 20px);
bottom: 10px;
gap: 6px;
padding: 6px;
}
.controls button {
min-height: 38px;
padding: 0 10px;
font-size: 10px;
}
.controls .primary { min-width: 112px; }
.scene-label.mini { display: none !important; }
.scene-label { min-width: 104px; padding: 6px 8px; }
.scene-label small { display: none; }
}
</style>
</head>
<body>
<main id="app">
<div id="scene" aria-label="Interactive 3D comparison of a continuous siphon and an interrupted liquid column"></div>
<div class="vignette"></div>
<div id="labels"></div>
<header class="header">
<div class="eyebrow">Hydraulic study / 01</div>
<h1>One column.<br>Two outcomes.</h1>
<p>
A side-by-side, idealized siphon experiment: continuity carries pressure
around the bend, while an air gap stops the modeled flow.
</p>
</header>
<aside class="story" aria-live="polite">
<div class="story-top">
<div class="live-status">
<span id="liveDot" class="live-dot"></span>
<span id="liveText">Experiment ready</span>
</div>
<span id="phaseBadge" class="phase-badge">Ready</span>
</div>
<h2 id="storyTitle">Ready to establish flow</h2>
<p id="storyCopy" class="story-copy">
Both tubes begin liquid-filled. The right-hand tube contains an air gap.
Start the experiment to compare the two columns.
</p>
<div class="state-grid">
<div class="state">
<span>Continuous rig</span>
<strong id="leftState" class="ready">READY</strong>
</div>
<div class="state">
<span>Interrupted rig</span>
<strong id="rightState" class="blocked">BLOCKED</strong>
</div>
</div>
<div class="equation">
<span>Available pressure head</span>
<strong>Δp = ρgΔh</strong>
<small id="equationNote">Head exists, but only a connected liquid column can transmit it.</small>
</div>
</aside>
<div class="controls">
<button id="primaryButton" class="primary" type="button">▶ Start siphon</button>
<button id="interruptButton" class="interrupt" type="button">Interrupt left</button>
<button id="resetButton" type="button">Reset</button>
</div>
<div class="model-note">
Idealized incompressible model. Air entrainment, capillary effects, transient
draining and vapor-pressure limits are intentionally omitted.
</div>
<div class="hint">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M8 10V7a2 2 0 0 1 4 0v3m0 0V5a2 2 0 0 1 4 0v5m0 0v-2a2 2 0 0 1 4 0v5c0 4-3 7-7 7h-1c-2.5 0-4.5-1-6-3l-3-4a2 2 0 0 1 3-2l2 2V8a2 2 0 0 1 4 0" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Drag to orbit · Scroll to zoom
</div>
<div id="loader">
<div>
<div class="loader-ring"></div>
<p>Preparing the experiment</p>
</div>
</div>
</main>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const sceneHost = document.getElementById("scene");
const labelsHost = document.getElementById("labels");
const ui = {
primary: document.getElementById("primaryButton"),
interrupt: document.getElementById("interruptButton"),
reset: document.getElementById("resetButton"),
title: document.getElementById("storyTitle"),
copy: document.getElementById("storyCopy"),
leftState: document.getElementById("leftState"),
rightState: document.getElementById("rightState"),
phase: document.getElementById("phaseBadge"),
liveText: document.getElementById("liveText"),
liveDot: document.getElementById("liveDot"),
equationNote: document.getElementById("equationNote"),
loader: document.getElementById("loader")
};
const scene = new THREE.Scene();
scene.fog = new THREE.Fog(0x07111f, 25, 48);
const camera = new THREE.PerspectiveCamera(38, 1, 0.1, 100);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.15;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.setAttribute("aria-label", "Two laboratory siphon rigs");
sceneHost.appendChild(renderer.domElement);
const cameraState = {
target: new THREE.Vector3(0, 2.45, 0),
yaw: 0.035,
pitch: 0.285,
distance: 19,
dragging: false,
pointerX: 0,
pointerY: 0
};
const clock = new THREE.Clock();
const Y_AXIS = new THREE.Vector3(0, 1, 0);
const Z_AXIS = new THREE.Vector3(0, 0, 1);
const palette = {
cyan: 0x55ead8,
cyanLight: 0xc9fff7,
cyanDark: 0x0c8079,
orange: 0xff8b5e,
amber: 0xffc76a,
blue: 0x8bd9f6,
metal: 0x7890a4,
dark: 0x101d2c
};
const floor = new THREE.Mesh(
new THREE.PlaneGeometry(44, 30),
new THREE.MeshStandardMaterial({
color: 0x071321,
roughness: 0.9,
metalness: 0.05
})
);
floor.rotation.x = -Math.PI / 2;
floor.position.y = -0.2;
floor.receiveShadow = true;
scene.add(floor);
const grid = new THREE.GridHelper(32, 32, 0x224052, 0x122737);
grid.position.y = -0.185;
grid.material.transparent = true;
grid.material.opacity = 0.28;
scene.add(grid);
scene.add(new THREE.HemisphereLight(0xc9efff, 0x111827, 1.65));
const keyLight = new THREE.DirectionalLight(0xffffff, 3.1);
keyLight.position.set(-4, 13, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -13;
keyLight.shadow.camera.right = 13;
keyLight.shadow.camera.top = 11;
keyLight.shadow.camera.bottom = -7;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 35;
keyLight.shadow.normalBias = 0.025;
scene.add(keyLight);
const cyanLight = new THREE.PointLight(0x45e5d1, 25, 13, 2);
cyanLight.position.set(-7, 5, 5);
scene.add(cyanLight);
const orangeLight = new THREE.PointLight(0xff8558, 20, 12, 2);
orangeLight.position.set(7, 4.5, 4);
scene.add(orangeLight);
const rimLight = new THREE.PointLight(0x73a9ff, 18, 15, 2);
rimLight.position.set(0, 7, -6);
scene.add(rimLight);
const pathPoints = [
new THREE.Vector3(-2.55, 0.78, 0),
new THREE.Vector3(-2.55, 1.80, 0),
new THREE.Vector3(-2.50, 3.15, 0),
new THREE.Vector3(-2.18, 4.05, 0),
new THREE.Vector3(-1.55, 4.68, 0),
new THREE.Vector3(-0.72, 5.02, 0),
new THREE.Vector3(0.18, 4.98, 0),
new THREE.Vector3(1.02, 4.48, 0),
new THREE.Vector3(1.52, 3.55, 0),
new THREE.Vector3(1.88, 2.45, 0),
new THREE.Vector3(2.55, 1.52, 0)
];
function curveFrom(points) {
return new THREE.CatmullRomCurve3(points, false, "centripetal", 0.5);
}
const fullCurve = curveFrom(pathPoints);
const brokenLeftCurve = curveFrom(pathPoints.slice(0, 6));
const brokenRightCurve = curveFrom(pathPoints.slice(5));
function makeTube(curve, parent, options = {}) {
const shellMaterial = new THREE.MeshPhysicalMaterial({
color: options.shellColor ?? 0x9be8f5,
transparent: true,
opacity: 0.22,
roughness: 0.12,
metalness: 0.02,
side: THREE.DoubleSide,
depthWrite: false
});
const coreMaterial = new THREE.MeshStandardMaterial({
color: options.coreColor ?? 0x28d5c4,
emissive: 0x075d58,
emissiveIntensity: 0.48,
roughness: 0.25,
metalness: 0.03,
transparent: true,
opacity: 0.78,
depthWrite: false
});
const shell = new THREE.Mesh(
new THREE.TubeGeometry(curve, 150, 0.19, 16, false),
shellMaterial
);
shell.renderOrder = 5;
const core = new THREE.Mesh(
new THREE.TubeGeometry(curve, 150, 0.105, 12, false),
coreMaterial
);
core.renderOrder = 4;
parent.add(shell, core);
return { shell, core };
}
function makeTank(parent, x, height, radius, level, bottom = 0.08) {
const group = new THREE.Group();
group.position.x = x;
parent.add(group);
const glassMaterial = new THREE.MeshPhysicalMaterial({
color: 0xa7e6f5,
transparent: true,
opacity: 0.16,
roughness: 0.08,
metalness: 0,
side: THREE.DoubleSide,
depthWrite: false
});
const shell = new THREE.Mesh(
new THREE.CylinderGeometry(radius, radius, height, 48, 1, true),
glassMaterial
);
shell.position.y = bottom + height / 2;
shell.renderOrder = 3;
group.add(shell);
const base = new THREE.Mesh(
new THREE.CylinderGeometry(radius * 0.99, radius * 0.99, 0.07, 48),
new THREE.MeshStandardMaterial({
color: 0x26394a,
roughness: 0.42,
metalness: 0.48
})
);
base.position.y = bottom;
base.castShadow = true;
base.receiveShadow = true;
group.add(base);
const ringMaterial = new THREE.MeshStandardMaterial({
color: 0x7e9cad,
roughness: 0.3,
metalness: 0.65
});
const topRing = new THREE.Mesh(
new THREE.TorusGeometry(radius, 0.028, 8, 64),
ringMaterial
);
topRing.rotation.x = Math.PI / 2;
topRing.position.y = bottom + height;
group.add(topRing);
const bottomRing = new THREE.Mesh(
new THREE.TorusGeometry(radius, 0.025, 8, 64),
ringMaterial
);
bottomRing.rotation.x = Math.PI / 2;
bottomRing.position.y = bottom + 0.025;
group.add(bottomRing);
const waterMaterial = new THREE.MeshPhysicalMaterial({
color: 0x1fc8c0,
emissive: 0x073c43,
emissiveIntensity: 0.35,
roughness: 0.2,
metalness: 0,
transparent: true,
opacity: 0.72,
depthWrite: true
});
const water = new THREE.Mesh(
new THREE.CylinderGeometry(radius * 0.91, radius * 0.91, 1, 48),
waterMaterial
);
water.castShadow = true;
group.add(water);
const top = new THREE.Mesh(
new THREE.CircleGeometry(radius * 0.91, 48),
new THREE.MeshBasicMaterial({
color: 0x75f4e7,
transparent: true,
opacity: 0.35,
side: THREE.DoubleSide,
depthWrite: false
})
);
top.rotation.x = -Math.PI / 2;
top.renderOrder = 6;
group.add(top);
const tank = {
group,
water,
top,
level,
initialLevel: level,
bottom,
height,
radius
};
updateTank(tank, level);
return tank;
}
function updateTank(tank, level) {
tank.level = level;
const fluidHeight = Math.max(0.02, level - tank.bottom);
tank.water.scale.y = fluidHeight;
tank.water.position.y = tank.bottom + fluidHeight / 2;
tank.top.position.y = level;
}
function makeFlowParticles(parent, curve, count = 22) {
const group = new THREE.Group();
parent.add(group);
const geometry = new THREE.SphereGeometry(0.072, 10, 8);
const material = new THREE.MeshBasicMaterial({
color: palette.cyanLight,
transparent: true,
opacity: 0.95
});
const items = [];
for (let i = 0; i < count; i++) {
const mesh = new THREE.Mesh(geometry, material);
mesh.renderOrder = 8;
group.add(mesh);
items.push(mesh);
}
return { group, items, curve };
}
function makeGapMarker(parent, start, end) {
const group = new THREE.Group();
parent.add(group);
const direction = end.clone().sub(start);
const length = direction.length();
direction.normalize();
const hazeMaterial = new THREE.MeshBasicMaterial({
color: palette.orange,
transparent: true,
opacity: 0.14,
depthWrite: false
});
const haze = new THREE.Mesh(
new THREE.CylinderGeometry(0.13, 0.13, length, 24),
hazeMaterial
);
haze.position.copy(start).add(end).multiplyScalar(0.5);
haze.quaternion.setFromUnitVectors(Y_AXIS, direction);
haze.renderOrder = 7;
group.add(haze);
const ringGeometry = new THREE.TorusGeometry(0.205, 0.025, 8, 32);
const ringMaterial = new THREE.MeshStandardMaterial({
color: palette.orange,
emissive: 0x7a260d,
emissiveIntensity: 0.55,
roughness: 0.35,
metalness: 0.25
});
for (const point of [start, end]) {
const ring = new THREE.Mesh(ringGeometry, ringMaterial);
ring.position.copy(point);
ring.quaternion.setFromUnitVectors(Z_AXIS, direction);
group.add(ring);
}
const lineGeometry = new THREE.BufferGeometry().setFromPoints([
start.clone().add(new THREE.Vector3(0, 0, 0.2)),
end.clone().add(new THREE.Vector3(0, 0, 0.2))
]);
const line = new THREE.Line(
lineGeometry,
new THREE.LineDashedMaterial({
color: palette.orange,
dashSize: 0.12,
gapSize: 0.08,
transparent: true,
opacity: 0.75
})
);
line.computeLineDistances();
group.add(line);
const bubbleGeometry = new THREE.SphereGeometry(0.026, 8, 6);
const bubbleMaterial = new THREE.MeshBasicMaterial({
color: 0xffc0a4,
transparent: true,
opacity: 0.58
});
for (let i = 0; i < 7; i++) {
const bubble = new THREE.Mesh(bubbleGeometry, bubbleMaterial);
const t = (i + 0.5) / 7;
bubble.position.copy(start).lerp(end, t);
bubble.position.y += 0.06 + 0.03 * Math.sin(i * 2.4);
bubble.position.z = Math.sin(i * 1.7) * 0.055;
group.add(bubble);
}
return group;
}
function makeDimension(parent, broken = false) {
const group = new THREE.Group();
parent.add(group);
const x = 2.98;
const z = 0.26;
const top = 2.32;
const bottom = 1.52;
const color = broken ? palette.orange : palette.amber;
const points = [
new THREE.Vector3(x, top, z),
new THREE.Vector3(x, bottom, z)
];
const line = new THREE.Line(
new THREE.BufferGeometry().setFromPoints(points),
new THREE.LineDashedMaterial({
color,
dashSize: 0.12,
gapSize: 0.08,
transparent: true,
opacity: broken ? 0.42 : 0.72
})
);
line.computeLineDistances();
group.add(line);
const tickGeometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(x - 0.11, top, z),
new THREE.Vector3(x + 0.11, top, z),
new THREE.Vector3(x - 0.11, bottom, z),
new THREE.Vector3(x + 0.11, bottom, z)
]);
group.add(new THREE.Line(
tickGeometry,
new THREE.LineBasicMaterial({ color, transparent: true, opacity: 0.72 })
));
return group;
}
function makeStand(parent) {
const stand = new THREE.Group();
parent.add(stand);
const material = new THREE.MeshStandardMaterial({
color: 0x536b7f,
roughness: 0.38,
metalness: 0.68
});
const pole = new THREE.Mesh(
new THREE.CylinderGeometry(0.032, 0.042, 4.35, 12),
material
);
pole.position.set(0.16, 2.16, -0.42);
pole.castShadow = true;
stand.add(pole);
const foot = new THREE.Mesh(
new THREE.CylinderGeometry(0.28, 0.32, 0.065, 32),
material
);
foot.position.set(0.16, 0.02, -0.42);
foot.castShadow = true;
stand.add(foot);
const arm = new THREE.Mesh(
new THREE.CylinderGeometry(0.028, 0.028, 0.55, 10),
material
);
arm.rotation.x = Math.PI / 2;
arm.position.set(0.16, 4.77, -0.23);
stand.add(arm);
const clamp = new THREE.Mesh(
new THREE.TorusGeometry(0.205, 0.018, 8, 24),
new THREE.MeshStandardMaterial({
color: palette.amber,
emissive: 0x49300a,
emissiveIntensity: 0.35,
roughness: 0.35,
metalness: 0.45
})
);
clamp.rotation.y = Math.PI / 2;
clamp.position.set(0.16, 4.77, 0);
stand.add(clamp);
}
function makeRig(x, id, brokenInitially) {
const group = new THREE.Group();
group.position.x = x;
scene.add(group);
const platform = new THREE.Mesh(
new THREE.CylinderGeometry(3.35, 3.5, 0.14, 64),
new THREE.MeshStandardMaterial({
color: 0x0e1c2a,
roughness: 0.58,
metalness: 0.32
})
);
platform.scale.z = 0.49;
platform.position.y = -0.07;
platform.receiveShadow = true;
group.add(platform);
const platformRing = new THREE.Mesh(
new THREE.TorusGeometry(3.34, 0.018, 6, 96),
new THREE.MeshBasicMaterial({
color: brokenInitially ? palette.orange : palette.cyan,
transparent: true,
opacity: 0.2
})
);
platformRing.rotation.x = Math.PI / 2;
platformRing.scale.y = 0.49;
platformRing.position.y = 0.005;
group.add(platformRing);
makeStand(group);
const continuousGroup = new THREE.Group();
const brokenGroup = new THREE.Group();
group.add(continuousGroup, brokenGroup);
makeTube(fullCurve, continuousGroup);
makeTube(brokenLeftCurve, brokenGroup);
makeTube(brokenRightCurve, brokenGroup);
const gap = makeGapMarker(
brokenGroup,
pathPoints[5].clone(),
pathPoints[6].clone()
);
const particles = makeFlowParticles(continuousGroup, fullCurve, 24);
const source = makeTank(group, -2.55, 2.4, 0.78, 2.32);
const destination = makeTank(group, 2.55, 1.18, 0.72, 0.78);
const stream = new THREE.Mesh(
new THREE.CylinderGeometry(0.075, 0.095, 1, 16),
new THREE.MeshPhysicalMaterial({
color: 0x63eee0,
emissive: 0x0d7770,
emissiveIntensity: 0.35,
transparent: true,
opacity: 0.64,
roughness: 0.18,
depthWrite: false
})
);
stream.renderOrder = 7;
group.add(stream);
const splash = new THREE.Group();
group.add(splash);
const splashGeometry = new THREE.SphereGeometry(0.035, 8, 6);
const splashMaterial = new THREE.MeshBasicMaterial({
color: 0xc7fff6,
transparent: true,
opacity: 0.8
});
const splashItems = [];
for (let i = 0; i < 10; i++) {
const item = new THREE.Mesh(splashGeometry, splashMaterial);
splash.add(item);
splashItems.push(item);
}
const primeMaterial = new THREE.MeshBasicMaterial({
color: palette.amber,
transparent: true,
opacity: 0.95
});
const primePulse = new THREE.Mesh(
new THREE.SphereGeometry(0.12, 14, 10),
primeMaterial
);
primePulse.renderOrder = 10;
group.add(primePulse);
const blockedMaterial = new THREE.MeshBasicMaterial({
color: palette.orange,
transparent: true,
opacity: 0.9
});
const blockedPulse = new THREE.Mesh(
new THREE.SphereGeometry(0.095, 12, 8),
blockedMaterial
);
blockedPulse.renderOrder = 10;
group.add(blockedPulse);
const collarMaterial = new THREE.MeshStandardMaterial({
color: 0xb0c5d2,
roughness: 0.28,
metalness: 0.68
});
const inletCollar = new THREE.Mesh(
new THREE.TorusGeometry(0.205, 0.028, 8, 28),
collarMaterial
);
inletCollar.rotation.x = Math.PI / 2;
inletCollar.position.set(-2.55, 0.78, 0);
group.add(inletCollar);
const outletCollar = new THREE.Mesh(
new THREE.TorusGeometry(0.205, 0.028, 8, 28),
collarMaterial
);
outletCollar.rotation.x = Math.PI / 2;
outletCollar.position.set(2.55, 1.52, 0);
group.add(outletCollar);
makeDimension(group, brokenInitially);
continuousGroup.visible = !brokenInitially;
brokenGroup.visible = brokenInitially;
return {
id,
group,
continuousGroup,
brokenGroup,
gap,
particles,
source,
destination,
stream,
splash,
splashItems,
primePulse,
blockedPulse,
brokenInitially
};
}
const leftRig = makeRig(-4.35, "left", false);
const rightRig = makeRig(4.35, "right", true);
function makeLabel(title, subtitle, tone = "cyan", mini = false) {
const element = document.createElement("div");
element.className = `scene-label ${tone}${mini ? " mini" : ""}`;
const strong = document.createElement("strong");
strong.textContent = title;
element.appendChild(strong);
if (subtitle) {
const small = document.createElement("small");
small.textContent = subtitle;
element.appendChild(small);
}
labelsHost.appendChild(element);
return {
element,
anchor: new THREE.Vector3(),
visible: true
};
}
const labels = {
continuous: makeLabel("Continuous column", "one connected liquid path"),
broken: makeLabel("Air break", "hydraulic path interrupted", "orange"),
leftGap: makeLabel("Air inserted", "pressure signal ends here", "orange"),
rightGap: makeLabel("Air gap", "no continuous liquid column", "orange"),
source: makeLabel("Source surface", "higher free surface", "cyan", true),
outlet: makeLabel("Outlet", "lower discharge point", "amber", true),
head: makeLabel("Δh", "available pressure head", "amber", true),
flow: makeLabel("Flowing", "continuous liquid column", "cyan", true)
};
function worldPoint(rig, x, y, z = 0) {
return new THREE.Vector3(rig.group.position.x + x, y, z);
}
function updateLabel(label, anchor, visible = true) {
const projected = anchor.clone().project(camera);
const onScreen = projected.z > -1 && projected.z < 1 &&
projected.x > -1.25 && projected.x < 1.25 &&
projected.y > -1.25 && projected.y < 1.25;
label.element.classList.toggle("is-visible", visible && onScreen);
if (!visible) return;
label.element.style.left = `${(projected.x * 0.5 + 0.5) * window.innerWidth}px`;
label.element.style.top = `${(-projected.y * 0.5 + 0.5) * window.innerHeight}px`;
}
let phase = "ready";
let phaseTime = 0;
let flowClock = 0;
let leftInterrupted = false;
function effectiveLeftFlow() {
return phase === "flowing" && !leftInterrupted;
}
function refreshUI() {
const flowing = effectiveLeftFlow();
ui.primary.textContent =
phase === "ready" ? "▶ Start siphon" :
phase === "priming" ? "■ Cancel start" :
phase === "flowing" ? "Ⅱ Pause flow" :
"▶ Resume flow";
ui.interrupt.textContent = leftInterrupted ? "Restore left" : "Interrupt left";
if (phase === "ready") {
ui.phase.textContent = "Ready";
ui.liveText.textContent = "Experiment ready";
ui.liveDot.classList.remove("flowing");
ui.title.textContent = "Ready to establish flow";
ui.copy.textContent =
"Both tubes begin liquid-filled. The right-hand tube contains an air gap. Start the experiment to compare the two columns.";
} else if (phase === "priming") {
ui.phase.textContent = "Priming";
ui.liveText.textContent = "Pressure pulse advancing";
ui.liveDot.classList.remove("flowing");
ui.title.textContent = "Establishing a continuous column";
ui.copy.textContent =
"A pressure pulse travels through the unbroken liquid on the left. On the interrupted rig, it reaches the air gap and dissipates.";
} else if (phase === "flowing" && leftInterrupted) {
ui.phase.textContent = "Interrupted";
ui.liveText.textContent = "Flow interrupted";
ui.liveDot.classList.remove("flowing");
ui.title.textContent = "The interruption stops the modeled flow";
ui.copy.textContent =
"The inserted air separates the liquid column. Pressure can no longer be transmitted to the descending leg, so the siphon stalls even though a height difference still exists.";
} else if (phase === "flowing") {
ui.phase.textContent = "Flowing";
ui.liveText.textContent = "Continuous siphon active";
ui.liveDot.classList.add("flowing");
ui.title.textContent = "Continuous flow transmits pressure";
ui.copy.textContent =
"The source-to-outlet height difference supplies pressure head. Because the liquid column remains connected, that pressure travels around the crest and keeps the outlet flowing.";
} else {
ui.phase.textContent = "Paused";
ui.liveText.textContent = "Flow paused";
ui.liveDot.classList.remove("flowing");
ui.title.textContent = "The comparison is paused";
ui.copy.textContent =
"The continuous column still links the source and outlet. Restore the interrupted left tube or resume the animation to compare the response again.";
}
ui.leftState.className = flowing ? "flowing" :
leftInterrupted ? "blocked" :
phase === "priming" ? "ready" : "ready";
ui.leftState.textContent = flowing ? "FLOWING" :
leftInterrupted ? "STOPPED" :
phase === "priming" ? "PRIMING" : "READY";
ui.rightState.className = "blocked";
ui.rightState.textContent = "BLOCKED";
ui.equationNote.textContent = leftInterrupted
? "Δh is still present, but the air gap prevents pressure transmission."
: "Head exists, but only a connected liquid column can transmit it.";
}
ui.primary.addEventListener("click", () => {
if (phase === "ready") {
phase = "priming";
phaseTime = 0;
} else if (phase === "priming") {
phase = "ready";
phaseTime = 0;
} else if (phase === "flowing") {
phase = "paused";
} else {
phase = "flowing";
}
refreshUI();
});
ui.interrupt.addEventListener("click", () => {
leftInterrupted = !leftInterrupted;
leftRig.continuousGroup.visible = !leftInterrupted;
leftRig.brokenGroup.visible = leftInterrupted;
refreshUI();
});
ui.reset.addEventListener("click", () => {
phase = "ready";
phaseTime = 0;
flowClock = 0;
leftInterrupted = false;
leftRig.continuousGroup.visible = true;
leftRig.brokenGroup.visible = false;
updateTank(leftRig.source, leftRig.source.initialLevel);
updateTank(leftRig.destination, leftRig.destination.initialLevel);
refreshUI();
});
refreshUI();
function updateStreamAndSplash(rig, active, clockValue) {
rig.stream.visible = active;
rig.splash.visible = active;
const level = rig.destination.level;
const length = Math.max(0.08, 1.52 - level);
rig.stream.scale.y = length;
rig.stream.position.set(2.55, level + length / 2, 0);
rig.splashItems.forEach((item, i) => {
const phaseOffset = (i / rig.splashItems.length + clockValue * 0.63) % 1;
const angle = i * 2.399;
const radius = 0.05 + phaseOffset * 0.20;
item.position.set(
2.55 + Math.cos(angle) * radius,
level + 0.02 + Math.sin(phaseOffset * Math.PI) * 0.22,
Math.sin(angle) * radius
);
item.scale.setScalar(1 - phaseOffset * 0.45);
});
}
function animate() {
requestAnimationFrame(animate);
const dt = Math.min(clock.getDelta(), 0.05);
if (phase === "priming") {
phaseTime += dt;
if (phaseTime >= 2.15) {
phase = "flowing";
phaseTime = 0;
refreshUI();
}
}
if (phase === "flowing") flowClock += dt;
// Left pressure/priming pulse.
leftRig.primePulse.visible = phase === "priming" || phase === "flowing";
if (phase === "priming") {
const t = Math.min(0.999, phaseTime / 2.15);
leftRig.primePulse.position.copy(fullCurve.getPointAt(t));
leftRig.primePulse.scale.setScalar(0.8 + Math.sin(t * Math.PI) * 0.55);
leftRig.primePulse.material.opacity = 0.95;
} else if (phase === "flowing" && !leftInterrupted) {
const t = (flowClock * 0.32) % 1;
leftRig.primePulse.position.copy(fullCurve.getPointAt(t));
leftRig.primePulse.scale.setScalar(0.78);
leftRig.primePulse.material.opacity = 0.72;
} else {
leftRig.primePulse.visible = false;
}
// Right pressure pulse travels only as far as the air gap.
rightRig.blockedPulse.visible = phase === "priming" || phase === "flowing";
if (rightRig.blockedPulse.visible) {
const t = phase === "priming"
? Math.min(0.999, phaseTime / 2.15)
: (flowClock * 0.3) % 1;
rightRig.blockedPulse.position.copy(brokenLeftCurve.getPointAt(t));
rightRig.blockedPulse.material.opacity = t > 0.72
? Math.max(0, 1 - (t - 0.72) / 0.28)
: 0.9;
rightRig.blockedPulse.scale.setScalar(t > 0.72 ? 0.65 : 1);
}
// The interrupted left tube shows a pulse dying at the inserted gap.
leftRig.blockedPulse.visible = leftInterrupted && phase === "flowing";
if (leftRig.blockedPulse.visible) {
const t = (flowClock * 0.3) % 1;
leftRig.blockedPulse.position.copy(brokenLeftCurve.getPointAt(t));
leftRig.blockedPulse.material.opacity = t > 0.72
? Math.max(0, 1 - (t - 0.72) / 0.28)
: 0.9;
}
const particlesVisible = phase === "flowing" || phase === "paused";
leftRig.particles.group.visible = particlesVisible && !leftInterrupted;
if (leftRig.particles.group.visible) {
leftRig.particles.items.forEach((particle, i) => {
const t = (flowClock * 0.115 + i / leftRig.particles.items.length) % 1;
particle.position.copy(fullCurve.getPointAt(t));
const pulse = 0.82 + 0.28 * Math.sin(flowClock * 5 + i);
particle.scale.setScalar(pulse);
});
}
const flowing = effectiveLeftFlow();
if (flowing) {
updateTank(
leftRig.source,
Math.max(2.13, leftRig.source.level - dt * 0.005)
);
updateTank(
leftRig.destination,
Math.min(1.12, leftRig.destination.level + dt * 0.007)
);
}
updateStreamAndSplash(leftRig, flowing, flowClock);
updateStreamAndSplash(rightRig, false, flowClock);
// Scene labels.
updateLabel(
labels.continuous,
worldPoint(leftRig, -1.25, 5.62),
phase !== "ready" || true
);
updateLabel(
labels.broken,
worldPoint(rightRig, -0.30, 5.62),
true
);
updateLabel(
labels.leftGap,
worldPoint(leftRig, -0.27, 5.43),
leftInterrupted
);
updateLabel(
labels.rightGap,
worldPoint(rightRig, -0.27, 5.43),
true
);
updateLabel(
labels.source,
worldPoint(leftRig, -2.55, 2.67),
true
);
updateLabel(
labels.outlet,
worldPoint(leftRig, 2.55, 1.83),
true
);
updateLabel(
labels.head,
worldPoint(leftRig, 3.04, 1.93),
true
);
updateLabel(
labels.flow,
worldPoint(leftRig, 2.80, 1.43),
flowing
);
// Custom camera controls: pointer orbit and wheel zoom.
camera.position.x =
cameraState.target.x +
cameraState.distance * Math.sin(cameraState.yaw) * Math.cos(cameraState.pitch);
camera.position.y =
cameraState.target.y +
cameraState.distance * Math.sin(cameraState.pitch);
camera.position.z =
cameraState.target.z +
cameraState.distance * Math.cos(cameraState.yaw) * Math.cos(cameraState.pitch);
camera.lookAt(cameraState.target);
renderer.render(scene, camera);
}
function resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const aspect = width / height;
renderer.setSize(width, height);
camera.aspect = aspect;
if (aspect < 0.85) {
camera.fov = 44;
cameraState.distance = 36;
} else if (aspect < 1.35) {
camera.fov = 41;
cameraState.distance = 23;
} else {
camera.fov = 38;
cameraState.distance = 19;
}
camera.updateProjectionMatrix();
}
renderer.domElement.addEventListener("pointerdown", (event) => {
cameraState.dragging = true;
cameraState.pointerX = event.clientX;
cameraState.pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!cameraState.dragging) return;
const dx = event.clientX - cameraState.pointerX;
const dy = event.clientY - cameraState.pointerY;
cameraState.pointerX = event.clientX;
cameraState.pointerY = event.clientY;
cameraState.yaw -= dx * 0.005;
cameraState.pitch = THREE.MathUtils.clamp(
cameraState.pitch + dy * 0.004,
0.08,
0.82
);
});
function endDrag(event) {
cameraState.dragging = false;
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("wheel", (event) => {
event.preventDefault();
cameraState.distance = THREE.MathUtils.clamp(
cameraState.distance + event.deltaY * 0.012,
13,
42
);
}, { passive: false });
renderer.domElement.addEventListener("dblclick", () => {
cameraState.yaw = 0.035;
cameraState.pitch = 0.285;
resize();
});
window.addEventListener("resize", resize);
resize();
requestAnimationFrame(() => {
ui.loader.classList.add("hide");
animate();
});
</script>
</body>
</html>
```