Prompt specification
Build or customize the Three.js 3D scene "Heated and unheated soup model" 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: Heated and unheated soup model
Category: Everyday & Industrial · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/heated-and-unheated-soup-model-x0154
Scene Description Prompt:
I'd like to see this as a low-poly Three.js scene: heated and unheated soup model. Compare two identical pots with visible tracer particles; activating a bottom heater starts prescribed circulation in one pot while the control pot remains comparatively still. Use cdnjs and return one self-contained HTML file.
Working Three.js Starter (heated-and-unheated-soup-model-x0154):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Low-Poly Soup Circulation Comparison</title>
<style>
:root {
color-scheme: dark;
--panel: rgba(12, 18, 25, 0.86);
--border: rgba(255, 255, 255, 0.13);
--text: #eef4f8;
--muted: #9eacb7;
--orange: #ff8a45;
--cyan: #70ddff;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
color: var(--text);
background:
radial-gradient(circle at 50% 38%, #1a2933 0%, #0d151c 45%, #080d12 100%);
}
#scene {
position: fixed;
inset: 0;
}
#scene canvas {
display: block;
width: 100%;
height: 100%;
cursor: grab;
touch-action: none;
outline: none;
}
#scene canvas.dragging {
cursor: grabbing;
}
.panel {
position: fixed;
z-index: 10;
top: 22px;
left: 22px;
width: min(340px, calc(100vw - 44px));
padding: 19px;
border: 1px solid var(--border);
border-radius: 16px;
background: var(--panel);
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
}
h1 {
margin: 0 0 5px;
font-size: 20px;
line-height: 1.2;
letter-spacing: -0.02em;
}
.subtitle {
margin: 0 0 17px;
color: var(--muted);
font-size: 13px;
line-height: 1.45;
}
#heater-toggle {
width: 100%;
min-height: 45px;
border: 1px solid rgba(255, 138, 69, 0.45);
border-radius: 10px;
padding: 11px 14px;
color: #fff7ef;
background: linear-gradient(135deg, #9b3820, #d35a28);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
font: inherit;
font-size: 14px;
font-weight: 700;
cursor: pointer;
transition: filter 160ms ease, transform 160ms ease, background 160ms ease;
}
#heater-toggle:hover {
filter: brightness(1.12);
}
#heater-toggle:active {
transform: translateY(1px);
}
#heater-toggle.active {
border-color: rgba(255, 205, 121, 0.75);
background: linear-gradient(135deg, #d45a25, #f3943e);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.18),
0 0 24px rgba(255, 111, 42, 0.3);
}
.status-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 14px;
color: var(--muted);
font-size: 12px;
}
.status-dot {
display: inline-block;
width: 7px;
height: 7px;
margin-right: 7px;
border-radius: 50%;
background: #66727c;
box-shadow: 0 0 0 rgba(255, 138, 69, 0);
transition: background 200ms ease, box-shadow 200ms ease;
}
.status-dot.active {
background: #ff8a45;
box-shadow: 0 0 12px rgba(255, 138, 69, 0.9);
}
.meter {
height: 4px;
margin-top: 9px;
overflow: hidden;
border-radius: 999px;
background: rgba(255, 255, 255, 0.08);
}
.meter > span {
display: block;
width: 0;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, #a7371e, #ff9a48, #ffe0a3);
transition: width 100ms linear;
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 9px 16px;
margin-top: 16px;
padding-top: 14px;
border-top: 1px solid rgba(255, 255, 255, 0.08);
color: #c7d1d8;
font-size: 12px;
}
.legend-item {
display: flex;
align-items: center;
gap: 7px;
}
.swatch {
width: 9px;
height: 9px;
border-radius: 50%;
box-shadow: 0 0 8px currentColor;
}
.swatch.heated {
color: var(--orange);
background: var(--orange);
}
.swatch.control {
color: var(--cyan);
background: var(--cyan);
}
.hint {
position: fixed;
z-index: 10;
right: 20px;
bottom: 18px;
padding: 8px 11px;
border: 1px solid rgba(255, 255, 255, 0.09);
border-radius: 9px;
color: rgba(224, 235, 242, 0.68);
background: rgba(8, 13, 18, 0.55);
font-size: 11px;
pointer-events: none;
backdrop-filter: blur(8px);
}
.reset {
position: fixed;
z-index: 10;
top: 22px;
right: 22px;
border: 1px solid var(--border);
border-radius: 10px;
padding: 9px 12px;
color: #d7e0e6;
background: rgba(12, 18, 25, 0.72);
font: inherit;
font-size: 12px;
cursor: pointer;
backdrop-filter: blur(10px);
}
.reset:hover {
background: rgba(28, 39, 48, 0.88);
}
@media (max-width: 650px) {
.panel {
top: 12px;
left: 12px;
width: min(310px, calc(100vw - 24px));
padding: 15px;
}
h1 {
font-size: 17px;
}
.subtitle {
margin-bottom: 12px;
}
.reset {
top: auto;
right: 12px;
bottom: 12px;
}
.hint {
display: none;
}
}
</style>
</head>
<body>
<main id="scene"></main>
<section class="panel" aria-label="Scene controls">
<h1>Soup circulation lab</h1>
<p class="subtitle">
Two identical low-poly pots with tracer particles. Activate the bottom heater
to drive prescribed toroidal circulation in the left pot.
</p>
<button id="heater-toggle" type="button" aria-pressed="false">
Activate bottom heater
</button>
<div class="status-row">
<span><i id="status-dot" class="status-dot"></i><span id="status-text">Heater off</span></span>
<span id="heat-value">0% heat</span>
</div>
<div class="meter" aria-hidden="true"><span id="heat-fill"></span></div>
<div class="legend" aria-label="Tracer legend">
<span class="legend-item">
<i class="swatch heated"></i> Heated-pot tracers
</span>
<span class="legend-item">
<i class="swatch control"></i> Control-pot tracers
</span>
</div>
</section>
<button id="reset-view" class="reset" type="button">Reset view</button>
<div class="hint">Drag to orbit · Scroll to zoom · Double-click to reset</div>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const TAU = Math.PI * 2;
const sceneHost = document.querySelector("#scene");
const heaterButton = document.querySelector("#heater-toggle");
const statusDot = document.querySelector("#status-dot");
const statusText = document.querySelector("#status-text");
const heatFill = document.querySelector("#heat-fill");
const heatValue = document.querySelector("#heat-value");
const resetButton = document.querySelector("#reset-view");
const scene = new THREE.Scene();
scene.fog = new THREE.Fog(0x0b1218, 9, 18);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0x0b1218, 0);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.domElement.tabIndex = 0;
renderer.domElement.setAttribute(
"aria-label",
"Interactive three-dimensional comparison of heated and unheated soup circulation"
);
sceneHost.appendChild(renderer.domElement);
const camera = new THREE.PerspectiveCamera(
42,
window.innerWidth / window.innerHeight,
0.1,
100
);
const cameraState = {
radius: 7.2,
theta: 0,
phi: 0.9,
target: new THREE.Vector3(0, 0.68, 0)
};
function updateCamera() {
const sinPhi = Math.sin(cameraState.phi);
camera.position.set(
cameraState.target.x + cameraState.radius * sinPhi * Math.sin(cameraState.theta),
cameraState.target.y + cameraState.radius * Math.cos(cameraState.phi),
cameraState.target.z + cameraState.radius * sinPhi * Math.cos(cameraState.theta)
);
camera.lookAt(cameraState.target);
}
function resetCamera() {
cameraState.radius = 7.2;
cameraState.theta = 0;
cameraState.phi = 0.9;
cameraState.target.set(0, 0.68, 0);
updateCamera();
}
updateCamera();
// Lighting.
scene.add(new THREE.HemisphereLight(0xbfd8e8, 0x30251f, 2.15));
const keyLight = new THREE.DirectionalLight(0xfff0db, 3.1);
keyLight.position.set(3.5, 7.5, 5.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.camera.near = 0.5;
keyLight.shadow.camera.far = 18;
keyLight.shadow.bias = -0.0007;
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x79bfff, 1.4);
rimLight.position.set(-5, 3, -4);
scene.add(rimLight);
// Ground.
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(30, 30),
new THREE.MeshStandardMaterial({
color: 0x111b22,
roughness: 0.96,
metalness: 0.02
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.035;
ground.receiveShadow = true;
scene.add(ground);
const floorRing = new THREE.Mesh(
new THREE.RingGeometry(3.8, 3.83, 64),
new THREE.MeshBasicMaterial({
color: 0x30414c,
transparent: true,
opacity: 0.32,
side: THREE.DoubleSide,
depthWrite: false
})
);
floorRing.rotation.x = -Math.PI / 2;
floorRing.position.y = -0.025;
scene.add(floorRing);
const potX = [-1.65, 1.65];
const soupY = 0.965;
const coldSoupColor = new THREE.Color(0x397a72);
const hotSoupColor = new THREE.Color(0xe18437);
const potMaterial = new THREE.MeshStandardMaterial({
color: 0x34444e,
metalness: 0.62,
roughness: 0.48,
flatShading: true,
side: THREE.DoubleSide
});
const potDarkMaterial = new THREE.MeshStandardMaterial({
color: 0x202b32,
metalness: 0.72,
roughness: 0.42,
flatShading: true
});
const rimMaterial = new THREE.MeshStandardMaterial({
color: 0x71838d,
metalness: 0.78,
roughness: 0.3,
flatShading: true
});
const handleMaterial = new THREE.MeshStandardMaterial({
color: 0x283740,
metalness: 0.68,
roughness: 0.45,
flatShading: true
});
const standMaterial = new THREE.MeshStandardMaterial({
color: 0x151e24,
metalness: 0.55,
roughness: 0.6,
flatShading: true
});
const particleGeometry = new THREE.SphereGeometry(0.046, 7, 5);
const trailHeatedColors = [0xffd166, 0xff704d, 0xfff0b3];
const trailControlColors = [0x70ddff, 0xb6f4ff, 0x5fa9ff];
function seededRandom(seed) {
let value = seed >>> 0;
return () => {
value += 0x6d2b79f5;
let t = value;
t = Math.imul(t ^ (t >>> 15), t | 1);
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
function createTextSprite(text, accent) {
const canvas = document.createElement("canvas");
canvas.width = 512;
canvas.height = 128;
const context = canvas.getContext("2d");
context.clearRect(0, 0, canvas.width, canvas.height);
context.fillStyle = "rgba(8, 14, 19, 0.88)";
context.strokeStyle = "rgba(255,255,255,0.18)";
context.lineWidth = 3;
const x = 12;
const y = 18;
const width = 488;
const height = 92;
const radius = 20;
context.beginPath();
context.moveTo(x + radius, y);
context.lineTo(x + width - radius, y);
context.quadraticCurveTo(x + width, y, x + width, y + radius);
context.lineTo(x + width, y + height - radius);
context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
context.lineTo(x + radius, y + height);
context.quadraticCurveTo(x, y + height, x, y + height - radius);
context.lineTo(x, y + radius);
context.quadraticCurveTo(x, y, x + radius, y);
context.closePath();
context.fill();
context.stroke();
context.fillStyle = accent;
context.fillRect(28, 47, 10, 34);
context.font = "700 34px system-ui, sans-serif";
context.textAlign = "center";
context.textBaseline = "middle";
context.fillStyle = "#edf5f8";
context.fillText(text, 270, 65);
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const sprite = new THREE.Sprite(
new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
})
);
sprite.scale.set(1.5, 0.375, 1);
sprite.renderOrder = 10;
return sprite;
}
function createTracerSet(parent, heated) {
const random = seededRandom(heated ? 12345 : 67890);
const colors = heated ? trailHeatedColors : trailControlColors;
const trailLength = heated ? 18 : 6;
const tracers = [];
for (let i = 0; i < 24; i += 1) {
const color = colors[i % colors.length];
const particleMaterial = new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity: heated ? 0.88 : 0.78,
depthWrite: false
});
const particle = new THREE.Mesh(particleGeometry, particleMaterial);
particle.renderOrder = 5;
parent.add(particle);
const trailPositions = new Float32Array(trailLength * 3);
const trailGeometry = new THREE.BufferGeometry();
trailGeometry.setAttribute(
"position",
new THREE.BufferAttribute(trailPositions, 3).setUsage(THREE.DynamicDrawUsage)
);
const trailMaterial = new THREE.LineBasicMaterial({
color,
transparent: true,
opacity: heated ? 0.1 : 0.08,
depthWrite: false
});
const trail = new THREE.Line(trailGeometry, trailMaterial);
trail.renderOrder = 4;
parent.add(trail);
const tracer = {
particle,
trail,
trailPositions,
trailLength,
theta: random() * TAU,
phi: random() * TAU,
majorRadius: 0.35 + random() * 0.25,
minorRadius: 0.1 + random() * 0.095,
rate: 0.76 + random() * 0.45,
seed: random() * TAU
};
const initial = computeTracerPosition(tracer, 0, heated, 0);
particle.position.copy(initial);
for (let k = 0; k < trailLength; k += 1) {
trailPositions[k * 3] = initial.x;
trailPositions[k * 3 + 1] = initial.y;
trailPositions[k * 3 + 2] = initial.z;
}
tracers.push(tracer);
}
return tracers;
}
function computeTracerPosition(tracer, phase, heated, elapsed) {
const theta = tracer.theta + phase * tracer.rate;
const phi = tracer.phi + phase * tracer.rate * 1.3;
const radius =
tracer.majorRadius + tracer.minorRadius * Math.cos(phi);
const verticalScale = heated ? 0.58 : 0.14;
const x = radius * Math.cos(theta);
const z = radius * Math.sin(theta);
const y =
soupY +
0.017 +
tracer.minorRadius * verticalScale * Math.sin(phi);
if (!heated) {
const jitter = 0.006;
return new THREE.Vector3(
x + Math.sin(elapsed * 0.65 + tracer.seed) * jitter,
y + Math.cos(elapsed * 0.55 + tracer.seed) * jitter,
z + Math.cos(elapsed * 0.6 + tracer.seed) * jitter
);
}
return new THREE.Vector3(x, y, z);
}
function createPot(x, isHeated) {
const group = new THREE.Group();
group.position.x = x;
scene.add(group);
// Shared-looking support platform.
const stand = new THREE.Mesh(
new THREE.CylinderGeometry(0.96, 1.0, 0.1, 12),
standMaterial
);
stand.position.y = 0.055;
stand.castShadow = true;
stand.receiveShadow = true;
group.add(stand);
const body = new THREE.Mesh(
new THREE.CylinderGeometry(1.02, 0.84, 0.82, 12, 1, true),
potMaterial
);
body.position.y = 0.66;
body.castShadow = true;
body.receiveShadow = true;
group.add(body);
const potBase = new THREE.Mesh(
new THREE.CylinderGeometry(0.855, 0.84, 0.13, 12),
potDarkMaterial
);
potBase.position.y = 0.205;
potBase.castShadow = true;
potBase.receiveShadow = true;
group.add(potBase);
const rim = new THREE.Mesh(
new THREE.TorusGeometry(1.02, 0.055, 4, 24),
rimMaterial
);
rim.rotation.x = Math.PI / 2;
rim.position.y = 1.075;
rim.castShadow = true;
group.add(rim);
// Blocky side handles.
for (const side of [-1, 1]) {
const handle = new THREE.Mesh(
new THREE.BoxGeometry(0.3, 0.12, 0.2),
handleMaterial
);
handle.position.set(side * 1.075, 0.72, 0);
handle.rotation.z = side * -0.12;
handle.castShadow = true;
group.add(handle);
}
const soupMaterial = new THREE.MeshStandardMaterial({
color: coldSoupColor.clone(),
emissive: 0x000000,
emissiveIntensity: 0,
metalness: 0.03,
roughness: 0.43,
transparent: true,
opacity: 0.79,
depthWrite: false,
flatShading: true,
side: THREE.DoubleSide
});
const soup = new THREE.Mesh(
new THREE.CylinderGeometry(0.925, 0.925, 0.035, 12),
soupMaterial
);
soup.position.y = soupY;
soup.renderOrder = 1;
group.add(soup);
const label = createTextSprite(
isHeated ? "HEATED POT" : "CONTROL POT",
isHeated ? "#ff8a45" : "#70ddff"
);
label.position.set(0, 1.5, 0);
group.add(label);
const tracers = createTracerSet(group, isHeated);
let heaterMaterial = null;
let heaterGlow = null;
let heatLight = null;
if (isHeated) {
heaterMaterial = new THREE.MeshStandardMaterial({
color: 0x4a2118,
emissive: 0xff3b12,
emissiveIntensity: 0.05,
metalness: 0.35,
roughness: 0.58,
flatShading: true
});
const segmentCount = 10;
for (let i = 0; i < segmentCount; i += 1) {
const angle = (i / segmentCount) * TAU;
const segment = new THREE.Mesh(
new THREE.BoxGeometry(0.27, 0.065, 0.105),
heaterMaterial
);
segment.position.set(
Math.cos(angle) * 0.86,
0.135,
Math.sin(angle) * 0.86
);
segment.rotation.y = -angle;
segment.castShadow = true;
group.add(segment);
}
heaterGlow = new THREE.Mesh(
new THREE.CircleGeometry(1.11, 24),
new THREE.MeshBasicMaterial({
color: 0xff4b18,
transparent: true,
opacity: 0,
side: THREE.DoubleSide,
depthWrite: false,
blending: THREE.AdditiveBlending
})
);
heaterGlow.rotation.x = -Math.PI / 2;
heaterGlow.position.y = 0.015;
heaterGlow.renderOrder = 2;
group.add(heaterGlow);
heatLight = new THREE.PointLight(0xff4b1d, 0, 2.4, 2);
heatLight.position.set(0, 0.24, 0);
group.add(heatLight);
}
return {
group,
soup,
soupMaterial,
tracers,
heaterMaterial,
heaterGlow,
heatLight
};
}
const heatedPot = createPot(potX[0], true);
const controlPot = createPot(potX[1], false);
let heaterOn = false;
let heat = 0;
let heatedFlowPhase = 0;
let controlFlowPhase = 0;
function setHeater(on) {
heaterOn = on;
heaterButton.classList.toggle("active", on);
heaterButton.setAttribute("aria-pressed", String(on));
heaterButton.textContent = on ? "Switch bottom heater off" : "Activate bottom heater";
statusDot.classList.toggle("active", on);
statusText.textContent = on
? "Heater active — circulation rising"
: "Heater off — fields nearly still";
}
heaterButton.addEventListener("click", () => {
setHeater(!heaterOn);
});
resetButton.addEventListener("click", resetCamera);
// Camera controls are implemented directly, without Three.js addons.
let dragging = false;
let pointerX = 0;
let pointerY = 0;
let dragDistance = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
dragDistance = 0;
pointerX = event.clientX;
pointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
renderer.domElement.classList.add("dragging");
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - pointerX;
const dy = event.clientY - pointerY;
pointerX = event.clientX;
pointerY = event.clientY;
dragDistance += Math.abs(dx) + Math.abs(dy);
cameraState.theta -= dx * 0.006;
cameraState.phi = THREE.MathUtils.clamp(
cameraState.phi - dy * 0.005,
0.34,
1.38
);
updateCamera();
});
function stopDragging(event) {
if (!dragging) return;
dragging = false;
renderer.domElement.classList.remove("dragging");
if (event.pointerId !== undefined && renderer.domElement.hasPointerCapture(event.pointerId)) {
renderer.domElement.releasePointerCapture(event.pointerId);
}
}
renderer.domElement.addEventListener("pointerup", stopDragging);
renderer.domElement.addEventListener("pointercancel", stopDragging);
renderer.domElement.addEventListener("dblclick", resetCamera);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
cameraState.radius = THREE.MathUtils.clamp(
cameraState.radius * Math.exp(event.deltaY * 0.001),
4.2,
12.5
);
updateCamera();
},
{ passive: false }
);
function updateTrail(tracer, position) {
const positions = tracer.trailPositions;
for (let i = tracer.trailLength - 1; i > 0; i -= 1) {
positions[i * 3] = positions[(i - 1) * 3];
positions[i * 3 + 1] = positions[(i - 1) * 3 + 1];
positions[i * 3 + 2] = positions[(i - 1) * 3 + 2];
}
positions[0] = position.x;
positions[1] = position.y;
positions[2] = position.z;
tracer.trail.geometry.attributes.position.needsUpdate = true;
}
function updatePot(pot, phase, heated, elapsed) {
for (const tracer of pot.tracers) {
const position = computeTracerPosition(
tracer,
phase,
heated,
elapsed
);
tracer.particle.position.copy(position);
updateTrail(tracer, position);
}
}
const clock = new THREE.Clock();
function animate() {
const delta = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
const response = 1 - Math.exp(-delta * 2.6);
heat += ((heaterOn ? 1 : 0) - heat) * response;
heatedFlowPhase += delta * heat * 1.32;
controlFlowPhase += delta * 0.022;
heatedPot.soupMaterial.color.copy(coldSoupColor).lerp(hotSoupColor, heat);
heatedPot.soupMaterial.emissive.copy(hotSoupColor);
heatedPot.soupMaterial.emissiveIntensity = heat * 0.12;
if (heatedPot.heaterMaterial) {
heatedPot.heaterMaterial.emissiveIntensity = 0.04 + heat * 3.4;
heatedPot.heaterMaterial.color.setRGB(
0.29 + heat * 0.42,
0.13 + heat * 0.12,
0.09 + heat * 0.02
);
heatedPot.heaterGlow.material.opacity = heat * 0.22;
heatedPot.heatLight.intensity = heat * 2.5;
}
for (const tracer of heatedPot.tracers) {
tracer.particle.material.opacity = 0.82 + heat * 0.18;
tracer.trail.material.opacity = 0.07 + heat * 0.31;
}
updatePot(heatedPot, heatedFlowPhase, true, elapsed);
updatePot(controlPot, controlFlowPhase, false, elapsed);
heatFill.style.width = `${Math.round(heat * 100)}%`;
heatValue.textContent = `${Math.round(heat * 100)}% heat`;
renderer.render(scene, camera);
}
renderer.setAnimationLoop(animate);
function onResize() {
const width = window.innerWidth;
const height = window.innerHeight;
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(width, height, false);
camera.aspect = width / height;
camera.fov = camera.aspect < 0.85 ? 65 : 42;
camera.updateProjectionMatrix();
}
window.addEventListener("resize", onResize);
onResize();
</script>
</body>
</html>
```