Prompt specification
Build or customize the Three.js 3D scene "Catalyst versus temperature comparison explorer" 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: Catalyst versus temperature comparison explorer
Category: Voxel Worlds · Style: Voxel 3D
License: MIT · Reference: https://three3d.app/scene/catalyst-versus-temperature-comparison-explorer-x1928
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows activation energy and catalytic pathways. Compare a lowered-barrier toy pathway with increased temperature in a simple probabilistic model; explain that catalysts change mechanism and do not alter the equilibrium energy difference. Voxel style.
Working Three.js Starter (catalyst-versus-temperature-comparison-explorer-x1928):
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Voxel Kinetics — Activation Energy and Catalytic Pathways</title>
<style>
:root {
--bg: #071019;
--panel: #0d1a25;
--panel-2: #112330;
--line: #294454;
--text: #f4f1e8;
--muted: #9fb3bf;
--yellow: #ffd166;
--orange: #ff715b;
--cyan: #59e2d0;
--blue: #58a6ff;
--pink: #ff72b6;
--green: #a7f36b;
--shadow: #02080c;
}
* {
box-sizing: border-box;
}
html {
color-scheme: dark;
}
body {
margin: 0;
min-width: 320px;
color: var(--text);
background:
radial-gradient(circle at 15% 0%, rgba(39, 92, 110, 0.24), transparent 34rem),
linear-gradient(180deg, #09141d 0%, var(--bg) 100%);
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
body::before {
content: "";
position: fixed;
inset: 0;
z-index: -1;
pointer-events: none;
opacity: 0.22;
background-image:
linear-gradient(rgba(81, 131, 150, 0.08) 1px, transparent 1px),
linear-gradient(90deg, rgba(81, 131, 150, 0.08) 1px, transparent 1px);
background-size: 32px 32px;
}
button,
input {
font: inherit;
}
.app {
width: min(1500px, calc(100% - 32px));
margin: 0 auto;
padding: 28px 0 46px;
}
.hero {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 28px;
align-items: end;
margin-bottom: 24px;
}
.brand {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 18px;
color: var(--cyan);
font-size: 0.76rem;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.voxel-mark {
position: relative;
width: 32px;
height: 32px;
flex: 0 0 auto;
}
.voxel-mark i {
position: absolute;
display: block;
width: 10px;
height: 10px;
background: var(--cyan);
box-shadow: 3px 3px 0 var(--blue);
}
.voxel-mark i:nth-child(1) { left: 0; top: 0; }
.voxel-mark i:nth-child(2) { left: 11px; top: 0; background: var(--yellow); }
.voxel-mark i:nth-child(3) { left: 0; top: 11px; background: var(--blue); }
.voxel-mark i:nth-child(4) { left: 11px; top: 11px; }
h1 {
max-width: 920px;
margin: 0;
font-size: clamp(2.25rem, 5.5vw, 5.2rem);
line-height: 0.96;
letter-spacing: -0.065em;
}
h1 span {
color: var(--yellow);
}
.lede {
max-width: 780px;
margin: 20px 0 0;
color: var(--muted);
font-family: system-ui, sans-serif;
font-size: clamp(1rem, 1.8vw, 1.2rem);
line-height: 1.55;
}
.hero-note {
max-width: 310px;
padding: 16px;
border: 1px solid var(--line);
background: rgba(13, 26, 37, 0.86);
box-shadow: 6px 6px 0 var(--shadow);
color: var(--muted);
font-size: 0.78rem;
line-height: 1.6;
}
.hero-note strong {
display: block;
margin-bottom: 5px;
color: var(--green);
font-size: 0.76rem;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.layout {
display: grid;
grid-template-columns: minmax(0, 1fr) 390px;
gap: 22px;
align-items: start;
}
.stage-card,
.panel {
border: 1px solid var(--line);
background: var(--panel);
box-shadow: 8px 8px 0 var(--shadow);
}
.stage-card {
position: relative;
overflow: hidden;
}
.stage-head {
position: absolute;
inset: 0 0 auto 0;
z-index: 3;
display: flex;
justify-content: space-between;
gap: 12px;
padding: 15px 16px;
pointer-events: none;
background: linear-gradient(180deg, rgba(7, 16, 25, 0.95), transparent);
}
.stage-title {
font-size: 0.72rem;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.stage-subtitle {
margin-top: 6px;
color: var(--muted);
font-size: 0.68rem;
}
.stage-badge {
align-self: flex-start;
padding: 8px 10px;
border: 1px solid rgba(167, 243, 107, 0.45);
color: var(--green);
background: rgba(7, 16, 25, 0.8);
font-size: 0.66rem;
font-weight: 800;
white-space: nowrap;
}
#viewport {
position: relative;
width: 100%;
height: clamp(540px, 68vh, 720px);
min-height: 540px;
overflow: hidden;
background: #08131c;
touch-action: none;
}
#viewport canvas {
display: block;
width: 100%;
height: 100%;
cursor: grab;
}
#viewport canvas:active {
cursor: grabbing;
}
.stage-foot {
display: flex;
justify-content: space-between;
gap: 16px;
align-items: center;
padding: 13px 16px;
border-top: 1px solid var(--line);
background: #0b1822;
color: var(--muted);
font-size: 0.67rem;
line-height: 1.5;
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 13px;
}
.legend span {
display: inline-flex;
align-items: center;
gap: 6px;
}
.swatch {
width: 9px;
height: 9px;
background: currentColor;
box-shadow: 2px 2px 0 #02080c;
}
.amber { color: var(--yellow); }
.cyan { color: var(--cyan); }
.pink { color: var(--pink); }
.sidebar {
display: grid;
gap: 18px;
}
.panel {
padding: 18px;
}
.panel-kicker {
margin-bottom: 8px;
color: var(--cyan);
font-size: 0.68rem;
font-weight: 800;
letter-spacing: 0.13em;
text-transform: uppercase;
}
h2 {
margin: 0;
font-size: 1.12rem;
letter-spacing: -0.025em;
}
.panel-intro {
margin: 10px 0 17px;
color: var(--muted);
font-family: system-ui, sans-serif;
font-size: 0.85rem;
line-height: 1.55;
}
.equation {
margin: 16px 0;
padding: 12px;
border: 1px solid var(--line);
background: #09151e;
color: var(--yellow);
text-align: center;
font-size: 0.86rem;
}
.control + .control {
margin-top: 17px;
}
.control-label {
display: flex;
justify-content: space-between;
gap: 12px;
margin-bottom: 9px;
font-size: 0.73rem;
font-weight: 700;
}
.control-label output {
color: var(--yellow);
white-space: nowrap;
}
input[type="range"] {
--fill: 50%;
width: 100%;
height: 6px;
margin: 0;
border: 0;
border-radius: 0;
outline: none;
appearance: none;
background: linear-gradient(
90deg,
var(--yellow) 0%,
var(--yellow) var(--fill),
#253b49 var(--fill),
#253b49 100%
);
cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
width: 17px;
height: 17px;
border: 2px solid #071019;
border-radius: 0;
appearance: none;
background: var(--yellow);
box-shadow: 3px 3px 0 #02080c;
}
input[type="range"]::-moz-range-thumb {
width: 15px;
height: 15px;
border: 2px solid #071019;
border-radius: 0;
background: var(--yellow);
box-shadow: 3px 3px 0 #02080c;
}
.control-help {
margin-top: 7px;
color: var(--muted);
font-size: 0.64rem;
line-height: 1.5;
}
.fixed-factor {
display: flex;
justify-content: space-between;
gap: 12px;
margin-top: 17px;
padding: 11px;
border: 1px dashed #315264;
color: var(--muted);
font-size: 0.68rem;
}
.fixed-factor strong {
color: var(--cyan);
}
.compare-list {
display: grid;
gap: 10px;
margin-top: 16px;
}
.prob-card {
padding: 12px;
border: 1px solid var(--line);
background: #09151e;
}
.prob-top {
display: flex;
justify-content: space-between;
gap: 10px;
align-items: baseline;
}
.prob-name {
font-size: 0.7rem;
font-weight: 800;
}
.prob-value {
font-size: 1rem;
font-weight: 900;
}
.prob-card.original { border-left: 4px solid var(--yellow); }
.prob-card.original .prob-value { color: var(--yellow); }
.prob-card.catalyst { border-left: 4px solid var(--cyan); }
.prob-card.catalyst .prob-value { color: var(--cyan); }
.prob-card.heat { border-left: 4px solid var(--pink); }
.prob-card.heat .prob-value { color: var(--pink); }
.prob-bar {
height: 7px;
margin: 9px 0 7px;
overflow: hidden;
background: #203440;
}
.prob-fill {
width: 0;
height: 100%;
transition: width 180ms ease-out;
}
.original .prob-fill { background: var(--yellow); }
.catalyst .prob-fill { background: var(--cyan); }
.heat .prob-fill { background: var(--pink); }
.prob-meta {
display: flex;
justify-content: space-between;
gap: 8px;
color: var(--muted);
font-size: 0.61rem;
line-height: 1.4;
}
.insight {
margin-top: 14px;
padding: 12px;
border-left: 4px solid var(--green);
background: rgba(167, 243, 107, 0.07);
color: #d8e7d0;
font-family: system-ui, sans-serif;
font-size: 0.79rem;
line-height: 1.55;
}
.equilibrium {
border-color: #355d5a;
background: #0d2224;
}
.equilibrium .panel-kicker {
color: var(--green);
}
.energy-levels {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 9px;
margin: 15px 0;
}
.energy-level {
padding: 10px;
border: 1px solid #315253;
background: #091a1c;
}
.energy-level span {
display: block;
color: var(--muted);
font-size: 0.61rem;
}
.energy-level strong {
display: block;
margin-top: 5px;
color: var(--green);
font-size: 0.92rem;
}
.principle {
margin: 0;
color: #d7e4df;
font-family: system-ui, sans-serif;
font-size: 0.8rem;
line-height: 1.6;
}
.principle strong {
color: var(--green);
}
.fine-print {
margin: 13px 0 0;
color: var(--muted);
font-size: 0.65rem;
line-height: 1.55;
}
footer {
display: flex;
justify-content: space-between;
gap: 18px;
margin-top: 22px;
color: #708793;
font-size: 0.64rem;
line-height: 1.5;
}
@media (max-width: 1080px) {
.layout {
grid-template-columns: 1fr;
}
.sidebar {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sidebar .equilibrium {
grid-column: 1 / -1;
}
}
@media (max-width: 720px) {
.app {
width: min(100% - 20px, 1500px);
padding-top: 18px;
}
.hero {
grid-template-columns: 1fr;
}
.hero-note {
max-width: none;
}
#viewport {
height: 540px;
min-height: 540px;
}
.sidebar {
grid-template-columns: 1fr;
}
.sidebar .equilibrium {
grid-column: auto;
}
.stage-head,
.stage-foot {
align-items: flex-start;
flex-direction: column;
}
.stage-badge {
align-self: flex-start;
}
footer {
flex-direction: column;
}
}
@media (prefers-reduced-motion: reduce) {
.prob-fill {
transition: none;
}
}
</style>
</head>
<body>
<div class="app">
<header class="hero">
<div>
<div class="brand">
<span class="voxel-mark" aria-hidden="true"><i></i><i></i><i></i><i></i></span>
Voxel Kinetics / Interactive Notebook
</div>
<h1>Same destination.<br /><span>Different road.</span></h1>
<p class="lede">
Explore how a catalyst changes the route over an energy barrier, compare
that with adding heat, and see why the equilibrium energy difference
stays exactly the same.
</p>
</div>
<aside class="hero-note">
<strong>Model premise</strong>
A simple crossing model:
<br /><b>P(cross) = exp(−ΔE‡ / T)</b>
<br />
Energy and temperature are dimensionless toy units.
</aside>
</header>
<main class="layout">
<section class="stage-card" aria-label="Interactive voxel energy landscape">
<div class="stage-head">
<div>
<div class="stage-title">3D Energy Landscape</div>
<div class="stage-subtitle">24 thermal packets per lane · shared reaction endpoints</div>
</div>
<div class="stage-badge">ΔE = −0.65 · ALL ROUTES</div>
</div>
<div
id="viewport"
role="img"
aria-label="A three-dimensional voxel diagram showing a high uncatalyzed energy barrier, a lower two-step catalyzed route, and a heated version of the original route."
></div>
<div class="stage-foot">
<div class="legend" aria-label="Route legend">
<span class="amber"><i class="swatch"></i>Original route</span>
<span class="cyan"><i class="swatch"></i>Catalyst / two small steps</span>
<span class="pink"><i class="swatch"></i>Same route / 2× heat</span>
</div>
<div>Drag to orbit · scroll to zoom · double-click to reset</div>
</div>
</section>
<aside class="sidebar">
<section class="panel">
<div class="panel-kicker">01 / Set the toy model</div>
<h2>Barrier and temperature</h2>
<p class="panel-intro">
The original route has one tall barrier. The catalyst route replaces
it with two smaller steps. The heat test changes only the thermal
energy distribution—not the shape of the original route.
</p>
<div class="equation">
P(cross) = e<sup>−ΔE‡/T</sup>
</div>
<div class="control">
<label class="control-label" for="barrier">
<span>Original barrier ΔE‡</span>
<output id="barrierOutput" for="barrier">1.00</output>
</label>
<input id="barrier" type="range" min="0.6" max="1.6" step="0.05" value="1" />
<div class="control-help">Raises or lowers the amber energy wall.</div>
</div>
<div class="control">
<label class="control-label" for="temperature">
<span>Relative temperature T</span>
<output id="temperatureOutput" for="temperature">1.00×</output>
</label>
<input id="temperature" type="range" min="0.6" max="1.4" step="0.05" value="1" />
<div class="control-help">
Controls crossing odds. The heat comparison always uses 2T.
</div>
</div>
<div class="fixed-factor">
<span>Catalyst lowers the barrier to</span>
<strong id="catalystFactor">0.50 × original</strong>
</div>
</section>
<section class="panel">
<div class="panel-kicker">02 / Compare crossing odds</div>
<h2>Probability per toy attempt</h2>
<div class="compare-list">
<article class="prob-card original">
<div class="prob-top">
<span class="prob-name">ORIGINAL ROUTE</span>
<span class="prob-value" id="pOriginal">36.8%</span>
</div>
<div class="prob-bar"><div class="prob-fill" id="barOriginal"></div></div>
<div class="prob-meta">
<span id="formulaOriginal">e^(−1.00 / 1.00)</span>
<span>baseline</span>
</div>
</article>
<article class="prob-card catalyst">
<div class="prob-top">
<span class="prob-name">CATALYST ROUTE</span>
<span class="prob-value" id="pCatalyst">63.8%</span>
</div>
<div class="prob-bar"><div class="prob-fill" id="barCatalyst"></div></div>
<div class="prob-meta">
<span id="formulaCatalyst">e^(−0.50 / 1.00)</span>
<span id="ratioCatalyst">1.73× original</span>
</div>
</article>
<article class="prob-card heat">
<div class="prob-top">
<span class="prob-name">HEAT TEST / SAME ROUTE</span>
<span class="prob-value" id="pHeat">63.8%</span>
</div>
<div class="prob-bar"><div class="prob-fill" id="barHeat"></div></div>
<div class="prob-meta">
<span id="formulaHeat">e^(−1.00 / 2.00)</span>
<span id="ratioHeat">1.73× original</span>
</div>
</article>
</div>
<div class="insight" id="insight" aria-live="polite">
Halving the barrier and doubling the temperature produce the same
crossing probability in this toy. Equal kinetics do not mean the
mechanisms are the same.
</div>
</section>
<section class="panel equilibrium">
<div class="panel-kicker">03 / The equilibrium distinction</div>
<h2>A catalyst changes the mechanism</h2>
<div class="energy-levels">
<div class="energy-level">
<span>REACTANTS</span>
<strong>E = 0.00</strong>
</div>
<div class="energy-level">
<span>PRODUCTS</span>
<strong>E = −0.65</strong>
</div>
</div>
<p class="principle">
The endpoints do not move. A catalyst provides an
<strong>alternate mechanism</strong> with a lower activation barrier
and is regenerated. At a fixed temperature, it does not change the
equilibrium energy difference, ΔG, or the equilibrium constant.
</p>
<p class="fine-print">
The temperature control here deliberately holds endpoint energies
fixed to isolate kinetics. In a real system, temperature can shift
equilibrium because ΔG itself depends on temperature.
</p>
</section>
</aside>
</main>
<footer>
<span>Educational toy model—not a chemical kinetics simulation.</span>
<span>Three.js core / voxel geometry / no external assets</span>
</footer>
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const viewport = document.querySelector("#viewport");
const barrierInput = document.querySelector("#barrier");
const temperatureInput = document.querySelector("#temperature");
const state = {
barrier: Number(barrierInput.value),
temperature: Number(temperatureInput.value),
catalystFactor: 0.5
};
// ---------------------------------------------------------------------
// Scene
// ---------------------------------------------------------------------
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x08131c);
const camera = new THREE.OrthographicCamera(-6, 6, 4, -4, 0.1, 100);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
viewport.appendChild(renderer.domElement);
scene.add(new THREE.HemisphereLight(0xb8eaff, 0x17202b, 1.5));
const keyLight = new THREE.DirectionalLight(0xffffff, 2.2);
keyLight.position.set(-4, 8, 7);
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x59e2d0, 1.2);
rimLight.position.set(6, 2, -5);
scene.add(rimLight);
const cubeGeometry = new THREE.BoxGeometry(1, 1, 1);
const dummy = new THREE.Object3D();
const colorScratch = new THREE.Color();
const cameraState = {
yaw: 0.72,
pitch: 0.78,
radius: 13,
target: new THREE.Vector3(0, 0.55, 0)
};
function updateCamera() {
const { yaw, pitch, radius, target } = cameraState;
camera.position.set(
target.x + radius * Math.sin(pitch) * Math.sin(yaw),
target.y + radius * Math.cos(pitch),
target.z + radius * Math.sin(pitch) * Math.cos(yaw)
);
camera.lookAt(target);
}
function resizeRenderer() {
const width = Math.max(1, viewport.clientWidth);
const height = Math.max(1, viewport.clientHeight);
const aspect = width / height;
const halfHeight = aspect < 1 ? 5.6 : 4.2;
camera.left = -halfHeight * aspect;
camera.right = halfHeight * aspect;
camera.top = halfHeight;
camera.bottom = -halfHeight;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
}
new ResizeObserver(resizeRenderer).observe(viewport);
resizeRenderer();
updateCamera();
// Custom orbit controls: no addons required.
let dragging = false;
let lastPointerX = 0;
let lastPointerY = 0;
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - lastPointerX;
const dy = event.clientY - lastPointerY;
lastPointerX = event.clientX;
lastPointerY = event.clientY;
cameraState.yaw -= dx * 0.007;
cameraState.pitch = THREE.MathUtils.clamp(
cameraState.pitch + dy * 0.006,
0.35,
1.35
);
updateCamera();
});
function endDrag(event) {
dragging = false;
if (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.radius = THREE.MathUtils.clamp(
cameraState.radius + event.deltaY * 0.008,
8,
18
);
updateCamera();
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", () => {
cameraState.yaw = 0.72;
cameraState.pitch = 0.78;
cameraState.radius = 13;
updateCamera();
});
// ---------------------------------------------------------------------
// Voxel helpers
// ---------------------------------------------------------------------
function makeVoxelLine(start, end, color, size = 0.065) {
const count = 38;
const mesh = new THREE.InstancedMesh(
cubeGeometry,
new THREE.MeshBasicMaterial({ color }),
count
);
const a = new THREE.Vector3(...start);
const b = new THREE.Vector3(...end);
const point = new THREE.Vector3();
for (let i = 0; i < count; i++) {
point.lerpVectors(a, b, i / (count - 1));
dummy.position.copy(point);
dummy.scale.setScalar(size);
dummy.updateMatrix();
mesh.setMatrixAt(i, dummy.matrix);
}
mesh.instanceMatrix.needsUpdate = true;
mesh.frustumCulled = false;
scene.add(mesh);
return mesh;
}
function makeLabel(text, color = "#f4f1e8") {
const canvas = document.createElement("canvas");
canvas.width = 768;
canvas.height = 112;
const context = canvas.getContext("2d");
const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
const material = new THREE.SpriteMaterial({
map: texture,
transparent: true,
depthTest: false,
depthWrite: false
});
const sprite = new THREE.Sprite(material);
sprite.scale.set(3.8, 0.56, 1);
sprite.renderOrder = 20;
sprite.userData = { canvas, context, texture, color };
setLabel(sprite, text);
scene.add(sprite);
return sprite;
}
function setLabel(sprite, text) {
const { canvas, context, texture, color } = sprite.userData;
context.clearRect(0, 0, canvas.width, canvas.height);
context.fillStyle = "rgba(7, 16, 25, 0.91)";
context.fillRect(2, 2, canvas.width - 4, canvas.height - 4);
context.strokeStyle = color;
context.lineWidth = 5;
context.strokeRect(3, 3, canvas.width - 6, canvas.height - 6);
context.fillStyle = color;
context.font = "700 28px monospace";
context.textAlign = "center";
context.textBaseline = "middle";
context.fillText(text, canvas.width / 2, canvas.height / 2, 725);
texture.needsUpdate = true;
}
function addEndpointCluster(position, colors) {
const offsets = [
[0, 0, 0],
[0.22, 0.08, 0],
[-0.16, 0.13, 0.08],
[0.04, 0.2, -0.12],
[-0.18, 0.02, -0.15]
];
offsets.forEach((offset, index) => {
const material = new THREE.MeshStandardMaterial({
color: colors[index % colors.length],
roughness: 0.72,
metalness: 0.05
});
const cube = new THREE.Mesh(cubeGeometry, material);
cube.position.set(
position[0] + offset[0],
position[1] + offset[1],
position[2] + offset[2]
);
cube.scale.setScalar(0.22);
scene.add(cube);
});
}
// Dark voxel floor.
{
const count = 29 * 19;
const mesh = new THREE.InstancedMesh(
cubeGeometry,
new THREE.MeshBasicMaterial({ color: 0x18313d }),
count
);
let index = 0;
for (let x = -7; x <= 7; x += 0.5) {
for (let z = -4.5; z <= 4.5; z += 0.5) {
dummy.position.set(x, -1.08, z);
dummy.scale.set(0.032, 0.025, 0.032);
dummy.updateMatrix();
mesh.setMatrixAt(index, dummy.matrix);
mesh.setColorAt(
index,
colorScratch.setHex((x + z) % 1 === 0 ? 0x1b3a45 : 0x132a35)
);
index++;
}
}
mesh.instanceMatrix.needsUpdate = true;
mesh.instanceColor.needsUpdate = true;
mesh.frustumCulled = false;
scene.add(mesh);
}
// Background voxel dust.
{
const count = 90;
const mesh = new THREE.InstancedMesh(
cubeGeometry,
new THREE.MeshBasicMaterial({ color: 0x244453 }),
count
);
for (let i = 0; i < count; i++) {
dummy.position.set(
THREE.MathUtils.randFloatSpread(16),
THREE.MathUtils.randFloat(-0.6, 5.4),
THREE.MathUtils.randFloatSpread(12)
);
dummy.scale.setScalar(THREE.MathUtils.randFloat(0.025, 0.07));
dummy.updateMatrix();
mesh.setMatrixAt(i, dummy.matrix);
}
mesh.instanceMatrix.needsUpdate = true;
mesh.frustumCulled = false;
scene.add(mesh);
}
makeVoxelLine([-4.7, -0.95, 3.0], [4.7, -0.95, 3.0], 0x426879, 0.055);
makeVoxelLine([-4.7, -0.95, 3.0], [-4.7, 3.15, 3.0], 0x426879, 0.055);
const axisLabel = makeLabel("REACTION COORDINATE →", "#88a6b7");
axisLabel.position.set(0, -1.35, 3.0);
axisLabel.scale.set(3.2, 0.46, 1);
const energyLabel = makeLabel("ENERGY", "#88a6b7");
energyLabel.position.set(-5.0, 1.3, 3.0);
energyLabel.scale.set(1.8, 0.42, 1);
addEndpointCluster([-4, 0.12, 0], [0xffd166, 0xffa85c, 0xff715b]);
addEndpointCluster([4, -0.53, 0], [0x59e2d0, 0x58a6ff, 0xa7f36b]);
const reactantLabel = makeLabel("REACTANTS E = 0.00", "#ffd166");
reactantLabel.position.set(-4, 0.65, 0.2);
reactantLabel.scale.set(2.8, 0.42, 1);
const productLabel = makeLabel("PRODUCTS E = −0.65", "#a7f36b");
productLabel.position.set(4, -0.02, 0.2);
productLabel.scale.set(2.75, 0.42, 1);
const deltaLabel = makeLabel("ΔE = −0.65 • ALL ROUTES", "#a7f36b");
deltaLabel.position.set(4.3, -0.88, -0.15);
deltaLabel.scale.set(2.9, 0.42, 1);
// ---------------------------------------------------------------------
// Energy profiles
// ---------------------------------------------------------------------
const PATH_SAMPLES = 92;
function makeProfileMesh() {
const mesh = new THREE.InstancedMesh(
cubeGeometry,
new THREE.MeshStandardMaterial({
color: 0xffffff,
roughness: 0.7,
metalness: 0.04
}),
PATH_SAMPLES
);
mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
mesh.frustumCulled = false;
scene.add(mesh);
return mesh;
}
const profileMeshes = {
original: makeProfileMesh(),
catalyst: makeProfileMesh(),
heat: makeProfileMesh()
};
const curves = {
original: null,
catalyst: null,
heat: null
};
const routeLabels = {
original: makeLabel("ORIGINAL • ONE HIGH STEP", "#ffd166"),
catalyst: makeLabel("CATALYST • TWO SMALL STEPS", "#59e2d0"),
heat: makeLabel("HEAT • SAME HIGH BARRIER", "#ff72b6")
};
function makeOriginalCurve(zPosition) {
const peak = 1.0 + state.barrier * 1.2;
return new THREE.CatmullRomCurve3(
[
new THREE.Vector3(-4, 0, 0),
new THREE.Vector3(-3.3, 0.04, zPosition),
new THREE.Vector3(-2.2, peak * 0.18, zPosition),
new THREE.Vector3(-1.05, peak * 0.68, zPosition),
new THREE.Vector3(0, peak, zPosition),
new THREE.Vector3(1.05, peak * 0.72, zPosition),
new THREE.Vector3(2.2, peak * 0.25, zPosition),
new THREE.Vector3(3.3, -0.18, zPosition),
new THREE.Vector3(4, -0.65, 0)
],
false,
"catmullrom",
0.32
);
}
function makeCatalystCurve() {
const catalystBarrier = state.barrier * state.catalystFactor;
const peak = 0.42 + catalystBarrier * 1.3;
return new THREE.CatmullRomCurve3(
[
new THREE.Vector3(-4, 0, 0),
new THREE.Vector3(-3.25, 0.05, 0),
new THREE.Vector3(-2.15, peak, 0),
new THREE.Vector3(-1.15, peak, 0),
new THREE.Vector3(0, peak * 0.62, 0),
new THREE.Vector3(1.15, peak, 0),
new THREE.Vector3(2.15, peak, 0),
new THREE.Vector3(3.25, -0.15, 0),
new THREE.Vector3(4, -0.65, 0)
],
false,
"catmullrom",
0.3
);
}
function updateProfileMesh(mesh, curve, startColor, endColor) {
const start = new THREE.Color(startColor);
const end = new THREE.Color(endColor);
for (let i = 0; i < PATH_SAMPLES; i++) {
const t = i / (PATH_SAMPLES - 1);
const point = curve.getPointAt(t);
dummy.position.copy(point);
dummy.scale.setScalar(i % 8 === 0 ? 0.215 : 0.165);
dummy.updateMatrix();
mesh.setMatrixAt(i, dummy.matrix);
colorScratch.copy(start).lerp(end, t);
mesh.setColorAt(i, colorScratch);
}
mesh.instanceMatrix.needsUpdate = true;
if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;
}
function makeBarrierMesh(color) {
const mesh = new THREE.InstancedMesh(
cubeGeometry,
new THREE.MeshBasicMaterial({ color, transparent: true, opacity: 0.78 }),
18
);
mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
mesh.frustumCulled = false;
scene.add(mesh);
return mesh;
}
const barrierMeshes = {
original: makeBarrierMesh(0xffd166),
catalyst: makeBarrierMesh(0x59e2d0),
heat: makeBarrierMesh(0xff72b6)
};
function updateBarrierMesh(mesh, x, z, height) {
for (let i = 0; i < 18; i++) {
dummy.position.set(x, 0.06 + (height - 0.1) * (i / 17), z);
dummy.scale.set(0.055, 0.055, 0.055);
dummy.updateMatrix();
mesh.setMatrixAt(i, dummy.matrix);
}
mesh.instanceMatrix.needsUpdate = true;
}
function updateProfiles() {
const originalPeak = 1.0 + state.barrier * 1.2;
const catalystBarrier = state.barrier * state.catalystFactor;
const catalystPeak = 0.42 + catalystBarrier * 1.3;
curves.original = makeOriginalCurve(1.85);
curves.catalyst = makeCatalystCurve();
curves.heat = makeOriginalCurve(-1.85);
updateProfileMesh(profileMeshes.original, curves.original, 0xffd166, 0xff715b);
updateProfileMesh(profileMeshes.catalyst, curves.catalyst, 0x59e2d0, 0x58a6ff);
updateProfileMesh(profileMeshes.heat, curves.heat, 0xff72b6, 0xff5d83);
updateBarrierMesh(barrierMeshes.original, 0, 1.85, originalPeak);
updateBarrierMesh(barrierMeshes.catalyst, -1.7, 0, catalystPeak);
updateBarrierMesh(barrierMeshes.heat, 0, -1.85, originalPeak);
routeLabels.original.position.set(0, originalPeak + 0.48, 1.85);
routeLabels.catalyst.position.set(0, catalystPeak + 0.5, 0);
routeLabels.heat.position.set(0, originalPeak + 0.48, -1.85);
setLabel(
routeLabels.original,
`ORIGINAL • ΔE‡ = ${state.barrier.toFixed(2)}`
);
setLabel(
routeLabels.catalyst,
`CATALYST • ΔE‡ = ${catalystBarrier.toFixed(2)}`
);
setLabel(
routeLabels.heat,
`HEAT • SAME ΔE‡ = ${state.barrier.toFixed(2)}`
);
lanes.original.curve = curves.original;
lanes.catalyst.curve = curves.catalyst;
lanes.heat.curve = curves.heat;
}
// ---------------------------------------------------------------------
// Probabilistic thermal packets
//
// Thermal energy samples are Exp(1). A packet crosses when:
// sample * temperature >= barrier.
// Therefore P(cross) = exp(-barrier / temperature).
// All three lanes reuse the same samples for a fair comparison.
// ---------------------------------------------------------------------
const SAMPLE_COUNT = 24;
const thermalSamples = Array.from({ length: SAMPLE_COUNT }, () =>
-Math.log(1 - Math.random())
);
const lanes = {
original: {
curve: null,
z: 1.85,
bright: 0xffe27a,
dim: 0x715943,
particles: []
},
catalyst: {
curve: null,
z: 0,
bright: 0x75f4e4,
dim: 0x2d6671,
particles: []
},
heat: {
curve: null,
z: -1.85,
bright: 0xff8ac3,
dim: 0x75445f,
particles: []
}
};
Object.values(lanes).forEach((lane) => {
for (let i = 0; i < SAMPLE_COUNT; i++) {
const material = new THREE.MeshBasicMaterial({
color: lane.bright,
transparent: true,
opacity: 1
});
const cube = new THREE.Mesh(cubeGeometry, material);
cube.scale.setScalar(0.14);
scene.add(cube);
lane.particles.push({
mesh: cube,
sample: thermalSamples[i],
success: false,
progress: null,
offset: new THREE.Vector3(
THREE.MathUtils.randFloatSpread(0.18),
THREE.MathUtils.randFloat(0.02, 0.2),
THREE.MathUtils.randFloatSpread(0.14)
)
});
}
});
function laneThreshold(laneName) {
if (laneName === "catalyst") {
return state.barrier * state.catalystFactor;
}
return state.barrier;
}
function laneTemperature(laneName) {
return laneName === "heat" ? state.temperature * 2 : state.temperature;
}
function updateParticleStatuses() {
Object.entries(lanes).forEach(([laneName, lane]) => {
const threshold = laneThreshold(laneName);
const temperature = laneTemperature(laneName);
lane.particles.forEach((particle) => {
const success = particle.sample * temperature >= threshold;
if (success && !particle.success && particle.progress === null) {
particle.progress = Math.random() * 0.94;
}
particle.success = success;
particle.mesh.material.color.setHex(success ? lane.bright : lane.dim);
particle.mesh.material.opacity = success ? 0.98 : 0.26;
particle.mesh.scale.setScalar(success ? 0.145 : 0.105);
});
});
}
const startPoint = new THREE.Vector3(-4, 0.05, 0);
function updateParticles(delta, elapsed) {
Object.values(lanes).forEach((lane) => {
if (!lane.curve) return;
lane.particles.forEach((particle, index) => {
if (particle.success) {
particle.progress += delta * (0.085 + (index % 5) * 0.004);
if (particle.progress >= 1) {
particle.progress = -Math.random() * 0.45;
}
if (particle.progress >= 0) {
const point = lane.curve.getPointAt(
THREE.MathUtils.clamp(particle.progress, 0, 1)
);
particle.mesh.position.copy(point).add(particle.offset);
particle.mesh.rotation.y = elapsed * 0.8 + index;
} else {
particle.mesh.position.copy(startPoint).add(particle.offset);
}
} else {
particle.mesh.position.copy(startPoint).add(particle.offset);
particle.mesh.rotation.y = elapsed * 0.35 + index;
}
});
});
}
// ---------------------------------------------------------------------
// Model controls and readouts
// ---------------------------------------------------------------------
function paintRange(input) {
const percent =
((Number(input.value) - Number(input.min)) /
(Number(input.max) - Number(input.min))) *
100;
input.style.setProperty("--fill", `${percent}%`);
}
function updateProbabilities() {
const catalystBarrier = state.barrier * state.catalystFactor;
const pOriginal = Math.exp(-state.barrier / state.temperature);
const pCatalyst = Math.exp(-catalystBarrier / state.temperature);
const pHeat = Math.exp(
-state.barrier / (state.temperature * 2)
);
document.querySelector("#barrierOutput").textContent =
state.barrier.toFixed(2);
document.querySelector("#temperatureOutput").textContent =
`${state.temperature.toFixed(2)}×`;
document.querySelector("#catalystFactor").textContent =
`${state.catalystFactor.toFixed(2)} × original`;
document.querySelector("#pOriginal").textContent =
`${(pOriginal * 100).toFixed(1)}%`;
document.querySelector("#pCatalyst").textContent =
`${(pCatalyst * 100).toFixed(1)}%`;
document.querySelector("#pHeat").textContent =
`${(pHeat * 100).toFixed(1)}%`;
document.querySelector("#barOriginal").style.width =
`${pOriginal * 100}%`;
document.querySelector("#barCatalyst").style.width =
`${pCatalyst * 100}%`;
document.querySelector("#barHeat").style.width =
`${pHeat * 100}%`;
document.querySelector("#formulaOriginal").textContent =
`e^(−${state.barrier.toFixed(2)} / ${state.temperature.toFixed(2)})`;
document.querySelector("#formulaCatalyst").textContent =
`e^(−${catalystBarrier.toFixed(2)} / ${state.temperature.toFixed(2)})`;
document.querySelector("#formulaHeat").textContent =
`e^(−${state.barrier.toFixed(2)} / ${(state.temperature * 2).toFixed(2)})`;
const catalystRatio = pCatalyst / pOriginal;
const heatRatio = pHeat / pOriginal;
document.querySelector("#ratioCatalyst").textContent =
`${catalystRatio.toFixed(2)}× original`;
document.querySelector("#ratioHeat").textContent =
`${heatRatio.toFixed(2)}× original`;
document.querySelector("#insight").textContent =
`At T = ${state.temperature.toFixed(2)}, the original route crosses in ` +
`${(pOriginal * 100).toFixed(1)}% of toy attempts. The catalyst route ` +
`and the 2× heat test both reach ${(pCatalyst * 100).toFixed(1)}%. ` +
`Equal crossing odds do not make the mechanisms the same.`;
}
function syncModel(updateGeometry = false) {
state.barrier = Number(barrierInput.value);
state.temperature = Number(temperatureInput.value);
paintRange(barrierInput);
paintRange(temperatureInput);
if (updateGeometry) updateProfiles();
updateProbabilities();
updateParticleStatuses();
}
barrierInput.addEventListener("input", () => syncModel(true));
temperatureInput.addEventListener("input", () => syncModel(false));
// ---------------------------------------------------------------------
// Render loop
// ---------------------------------------------------------------------
updateProfiles();
syncModel(false);
const clock = new THREE.Clock();
function animate() {
const delta = Math.min(clock.getDelta(), 0.05);
const elapsed = clock.elapsedTime;
updateParticles(delta, elapsed);
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
animate();
</script>
</body>
</html>
```