Back to the app
The code
Build a Cell, Part by Part by GPT-6.1 Terra
Exactly as the AI wrote it. Shown as text, so nothing runs on this page.
index.html
broken · auto-checked (Checked by an automated pass. Not hand-played yet.)<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,viewport-fit=cover">
<meta name="theme-color" content="#091b29">
<title>The living cell · An interactive animal cell</title>
<style>
@import url('data:text/css,');
:root{color-scheme:dark;--ink:#e9f8f5;--muted:#9ab9b9;--line:rgba(171,226,218,.16);--mint:#a6f4d1;--yellow:#f9d995;--panel:rgba(9,29,40,.82)}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#071722;color:var(--ink);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,input{font:inherit}button{cursor:pointer}button:focus-visible,input:focus-visible{outline:3px solid #f8dd98;outline-offset:3px}
#app{height:100%;height:100dvh;position:relative;overflow:hidden;background:radial-gradient(ellipse at 52% 47%,#1b5360 0%,#102f3d 40%,#071722 76%)}
#app:before{content:"";position:absolute;inset:0;pointer-events:none;opacity:.28;background-image:radial-gradient(#b9f8e8 0.7px,transparent 1px);background-size:47px 47px;mask-image:linear-gradient(120deg,transparent,#000,transparent)}
#scene{position:absolute;inset:0;touch-action:none}canvas{display:block;width:100%;height:100%;touch-action:none}
.header{position:absolute;top:0;left:0;right:0;padding:27px 34px;display:flex;align-items:flex-start;justify-content:space-between;gap:20px;pointer-events:none;z-index:3}.brand{display:flex;align-items:center;gap:11px}.brand-icon{width:36px;height:36px;border:1px solid #81d6c2;border-radius:50%;display:grid;place-items:center;color:#a6f4d1;font-size:20px;box-shadow:inset 0 0 15px #5de2bd33}.eyebrow{text-transform:uppercase;letter-spacing:.19em;color:#a7d0c8;font-size:10px;font-weight:750}.brand strong{display:block;font-size:14px;letter-spacing:.02em;margin-top:3px}.header-right{display:flex;align-items:center;gap:9px;color:#bdd7d1;font-size:11px;letter-spacing:.12em;text-transform:uppercase}.live-dot{width:7px;height:7px;background:#a0f1ce;border-radius:50%;box-shadow:0 0 12px #a0f1ce}
.intro{position:absolute;z-index:2;left:35px;top:112px;max-width:300px;pointer-events:none}.intro .eyebrow{color:#b7e1d5}.intro h1{font-family:Georgia,serif;font-weight:400;line-height:1.02;letter-spacing:-.04em;font-size:clamp(38px,4vw,61px);margin:15px 0}.intro h1 em{color:#b4eccc;font-weight:400}.intro p{font-size:13px;line-height:1.7;color:#a5c5c2;max-width:250px;margin:0}
.legend{position:absolute;left:35px;bottom:178px;display:flex;gap:10px;align-items:center;z-index:2;color:#a2c6c1;font-size:11px;letter-spacing:.06em;pointer-events:none}.legend svg{width:23px;height:23px;stroke:#a8e4d2;fill:none;stroke-width:1.4}
.card{position:absolute;z-index:4;right:34px;top:50%;transform:translateY(-48%);width:270px;padding:22px;background:linear-gradient(150deg,rgba(24,59,67,.9),rgba(8,29,40,.9));border:1px solid rgba(174,228,213,.23);border-radius:18px;box-shadow:0 20px 50px #00121c55;backdrop-filter:blur(15px)}.card-top{display:flex;justify-content:space-between;align-items:center;gap:10px}.card-tag{font-size:9px;letter-spacing:.18em;text-transform:uppercase;font-weight:800;color:#b9e7d9}.card-index{color:#95b9b4;font-size:11px}.color-dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--accent,#f5ca8a);box-shadow:0 0 12px var(--accent,#f5ca8a);margin-right:7px}.card h2{font-family:Georgia,serif;font-size:27px;font-weight:400;line-height:1.1;margin:21px 0 10px}.card p{color:#b6cfca;font-size:13px;line-height:1.65;margin:0;min-height:42px}.card-foot{margin-top:21px;padding-top:15px;border-top:1px solid var(--line);font-size:10px;color:#89aea9;letter-spacing:.04em;line-height:1.4}
.controls{position:absolute;z-index:5;left:24px;right:24px;bottom:22px;background:rgba(7,26,36,.86);border:1px solid rgba(165,222,209,.2);border-radius:17px;backdrop-filter:blur(18px);box-shadow:0 12px 40px #00121a55;padding:15px 17px;display:flex;align-items:center;gap:22px}.timeline{flex:1;min-width:100px}.timeline-head{display:flex;justify-content:space-between;gap:10px;font-size:10px;text-transform:uppercase;letter-spacing:.14em;font-weight:750;color:#abcac4;margin-bottom:9px}.timeline-head span:last-child{color:#e6f3e9;letter-spacing:.04em;text-transform:none}.slider-row{display:flex;align-items:center;gap:10px}.slider-row input{width:100%;height:20px;margin:0;accent-color:#b4f1d4;cursor:pointer}.slider-row small{font-size:10px;color:#92b5ae;white-space:nowrap}.actions{display:flex;align-items:center;gap:8px}.action{min-height:44px;border:1px solid rgba(183,231,218,.24);border-radius:10px;background:#143642;color:#e8f7ef;padding:0 15px;white-space:nowrap;font-size:12px;font-weight:700}.action:hover{background:#1c4d57}.action.primary{background:#bbefd5;color:#10382f;border-color:#bbefd5}.action.primary:hover{background:#d5ffe7}.switch{display:flex;align-items:center;gap:9px}.switch-visual{width:30px;height:17px;border-radius:20px;background:#45615e;position:relative;transition:.2s}.switch-visual:after{content:"";position:absolute;left:3px;top:3px;width:11px;height:11px;background:#e9f8ed;border-radius:50%;transition:.2s}.switch[aria-pressed=true] .switch-visual{background:#83dcb5}.switch[aria-pressed=true] .switch-visual:after{transform:translateX(13px);background:#123e32}
.stage-badge{position:absolute;z-index:2;left:50%;top:99px;transform:translateX(-50%);border:1px solid #afe9d535;background:#0a293599;border-radius:50px;padding:9px 14px;color:#c8e9dd;font-size:10px;letter-spacing:.12em;text-transform:uppercase;white-space:nowrap;pointer-events:none}.stage-badge b{color:#adf2d0;margin-right:6px}.loading{position:absolute;inset:0;display:grid;place-items:center;text-align:center;background:#081c28;z-index:10;color:#c7eade;font-size:14px;letter-spacing:.05em}.loading.hide{display:none}.error{max-width:310px;line-height:1.6;padding:20px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
@media(max-width:800px){.header{padding:18px 18px}.header-right{font-size:9px}.intro{left:20px;top:83px;max-width:220px}.intro h1{font-size:39px;margin:10px 0}.intro p{font-size:11px;line-height:1.5;max-width:180px}.stage-badge{top:90px;left:auto;right:18px;transform:none;font-size:9px;padding:8px 10px}.card{top:auto;bottom:167px;right:16px;transform:none;width:205px;padding:15px;border-radius:14px}.card h2{font-size:21px;margin:13px 0 6px}.card p{font-size:11px;line-height:1.45;min-height:0}.card-foot{margin-top:11px;padding-top:9px;font-size:9px}.legend{left:19px;bottom:185px;font-size:10px;max-width:125px}.controls{left:10px;right:10px;bottom:max(10px,env(safe-area-inset-bottom));padding:12px;gap:10px;flex-direction:column;align-items:stretch}.timeline-head{margin-bottom:3px}.actions{justify-content:space-between}.action{flex:1;padding:0 8px;font-size:11px}.switch{justify-content:center}.slider-row input{height:18px}}
@media(max-width:390px){.intro h1{font-size:33px}.intro p{max-width:150px}.card{width:185px}.header-right{display:none}.stage-badge{top:82px}.legend{max-width:105px}.card h2{font-size:19px}}
@media(max-height:600px) and (min-width:801px){.intro{top:83px}.intro h1{font-size:38px}.card{top:45%}.legend{bottom:130px}.controls{bottom:10px}}
</style>
</head>
<body>
<div id="app">
<div id="scene" aria-label="Interactive three-dimensional animal cell"></div>
<header class="header"><div class="brand"><div class="brand-icon">✳</div><div><div class="eyebrow">A tiny world, up close</div><strong>THE CELL ATLAS</strong></div></div><div class="header-right"><span class="live-dot"></span> An interactive exploration</div></header>
<section class="intro"><div class="eyebrow">Biology · No. 01</div><h1>Meet the<br><em>animal cell.</em></h1><p>A whole world of tiny parts, working together to keep life moving.</p></section>
<div class="stage-badge" id="badge"><b>●</b> Building a cell</div>
<div class="legend"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 13a8 8 0 0 1 13-6m3 4a8 8 0 0 1-13 6M16 3l1 4-4 1M8 21l-1-4 4-1"/></svg><span id="hint">Drag to orbit · pinch to zoom</span></div>
<aside class="card" aria-live="polite"><div class="card-top"><span class="card-tag"><i class="color-dot" id="dot"></i><span id="tag">The beginning</span></span><span class="card-index" id="index">00 / 11</span></div><h2 id="part-title">Cell membrane</h2><p id="part-description">This flexible outer skin holds the cell together and controls what goes in and out.</p><div class="card-foot" id="card-foot">Watch the cell come to life, one part at a time.</div></aside>
<div class="controls"><div class="timeline"><div class="timeline-head"><span>Build your cell</span><span id="progress-text">0 of 11 parts</span></div><div class="slider-row"><small>EMPTY</small><input type="range" min="0" max="11" step="1" value="0" id="slider" aria-label="Scrub through cell construction"><small>COMPLETE</small></div></div><div class="actions"><button class="action switch" id="cut" aria-pressed="false"><span class="switch-visual" aria-hidden="true"></span> Cut open</button><button class="action primary" id="rebuild">↻ Rebuild</button></div></div>
<div class="loading" id="loading"><div>Preparing your tiny world…</div></div>
</div>
<script type="module">
import * as THREE from 'https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js';
import { OrbitControls } from 'https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/controls/OrbitControls.js';
const $=id=>document.getElementById(id);
const data=[
{name:'Nucleus',desc:'The nucleus holds DNA, the instructions that help run the cell.',color:'#caa1f3'},
{name:'Nucleolus',desc:'The nucleolus makes the building blocks for ribosomes.',color:'#f7b0d5'},
{name:'Rough endoplasmic reticulum',desc:'This folded network helps make and move proteins, with ribosomes attached to its surface.',color:'#8bcce3'},
{name:'Smooth endoplasmic reticulum',desc:'This smooth network makes fats and helps break down harmful substances.',color:'#7edecb'},
{name:'Ribosomes',desc:'Ribosomes are tiny builders that put proteins together.',color:'#fae0a1'},
{name:'Golgi apparatus',desc:'The Golgi apparatus sorts, packs, and sends materials around the cell.',color:'#f2b5a0'},
{name:'Mitochondria',desc:'Mitochondria release energy from food for the cell to use.',color:'#ffbc86'},
{name:'Lysosomes',desc:'Lysosomes break down worn-out parts and other waste.',color:'#f3aabc'},
{name:'Vesicles',desc:'Vesicles are little bubbles that carry and store materials.',color:'#b2e8a2'},
{name:'Centrioles',desc:'Centrioles help organize the structures needed when a cell divides.',color:'#f4d88a'},
{name:'Cytoskeleton',desc:'The cytoskeleton is a network of fibers that supports the cell and helps things move.',color:'#a9e5dd'}
];
const host=$('scene'), loading=$('loading');
let renderer;
try{renderer=new THREE.WebGLRenderer({antialias:true,alpha:true});}catch(e){loading.innerHTML='<div class="error">Your browser could not start the 3D view. Try opening this page in a browser with WebGL enabled.</div>';throw e;}
renderer.setPixelRatio(Math.min(window.devicePixelRatio||1,2));renderer.setSize(innerWidth,innerHeight);renderer.setClearColor(0x000000,0);renderer.localClippingEnabled=true;renderer.outputColorSpace=THREE.SRGBColorSpace;host.appendChild(renderer.domElement);
const scene=new THREE.Scene();const camera=new THREE.PerspectiveCamera(38,innerWidth/innerHeight,.1,100);const controls=new OrbitControls(camera,renderer.domElement);controls.enableDamping=true;controls.dampingFactor=.07;controls.enablePan=false;controls.minDistance=4;controls.maxDistance=13;controls.rotateSpeed=.55;controls.zoomSpeed=.8;
function startCamera(){camera.position.set(0,2.1,9.8);controls.target.set(0,0,0);controls.update();}startCamera();
scene.add(new THREE.HemisphereLight(0xd0fff4,0x28465a,2.2));const key=new THREE.DirectionalLight(0xfff3db,2.6);key.position.set(4,7,7);scene.add(key);const rim=new THREE.DirectionalLight(0x72d7df,2);rim.position.set(-5,-1,-4);scene.add(rim);
const root=new THREE.Group();scene.add(root);const cutPlane=new THREE.Plane(new THREE.Vector3(0,0,-1),0);let cutting=false;
const materials=[];function mat(color,opt={}){const m=new THREE.MeshStandardMaterial({color,roughness:.43,metalness:.05,...opt});materials.push(m);return m;}
function sphere(color,r,x,y,z,scale=[1,1,1],opt={}){const m=new THREE.Mesh(new THREE.SphereGeometry(r,24,16),mat(color,opt));m.position.set(x,y,z);m.scale.set(...scale);return m;}
const membrane= sphere(0x83dfd5,2.65,0,0,0,[1.03,.91,1],{transparent:true,opacity:.12,roughness:.22,depthWrite:false,side:THREE.DoubleSide});root.add(membrane);
const shellWire=new THREE.Mesh(new THREE.SphereGeometry(2.65,32,20),new THREE.MeshBasicMaterial({color:0x84e5d4,wireframe:true,transparent:true,opacity:.045,depthWrite:false}));shellWire.scale.copy(membrane.scale);materials.push(shellWire.material);root.add(shellWire);
const glow=new THREE.Mesh(new THREE.SphereGeometry(2.67,48,32),new THREE.MeshBasicMaterial({color:0x78e4d0,transparent:true,opacity:.06,side:THREE.BackSide,depthWrite:false}));glow.scale.copy(membrane.scale);materials.push(glow.material);root.add(glow);
const groups=data.map((d,i)=>{let g=new THREE.Group();g.userData.index=i;root.add(g);return g;});const hit=[];
function add(group,obj,index){group.add(obj);obj.traverse(o=>{if(o.isMesh){o.userData.index=index;hit.push(o)}});return obj;}
function tube(points,r,color,group,index,closed=false){let curve=new THREE.CatmullRomCurve3(points.map(p=>new THREE.Vector3(...p)),closed);return add(group,new THREE.Mesh(new THREE.TubeGeometry(curve,Math.max(32,points.length*5),r,8,closed),mat(color)),index);}
function torus(color,r,tubeR){return new THREE.Mesh(new THREE.TorusGeometry(r,tubeR,10,52),mat(color));}
// Nucleus and its bright nucleolus.
add(groups[0],sphere(0x9a79cf,.89,-.48,.16,-.15,[1,1,.92],{transparent:true,opacity:.85}),0);
const nucRim=torus(0xd0b5ed,.83,.024);nucRim.position.set(-.48,.16,.47);nucRim.rotation.x=.14;add(groups[0],nucRim,0);
add(groups[1],sphere(0xf5a7cc,.27,-.7,.32,.58,[1,.94,.86]),1);
// Curved folded membranes, built as wavy ribbons and tubes.
function ribbonLayer(group,index,color,y,rad,phase,rough){const pts=[];for(let j=0;j<=32;j++){let a=Math.PI*.12+j/32*Math.PI*1.70;pts.push([-.48+Math.cos(a)*rad, y+Math.sin(a*3+phase)*.07, -.15+Math.sin(a)*rad*.66]);}tube(pts,.055,color,group,index);if(rough){for(let j=2;j<pts.length-1;j+=3){let p=pts[j];add(groups[4],sphere(0xffe8ad,.046,p[0],p[1]+.08,p[2]),4);}}}
for(let i=0;i<5;i++)ribbonLayer(groups[2],2,0x7bbfd8,-.75+i*.13,1.16+i*.055,i,true);
for(let i=0;i<4;i++)ribbonLayer(groups[3],3,0x70d2c0,.73+i*.12,1.12+i*.08,i,false);
for(let i=0;i<16;i++){let a=i*2.4;let r=1.5+(i%3)*.16;add(groups[4],sphere(0xffe5a4,.047,Math.cos(a)*r,Math.sin(a)*1.05,(i%4-1.5)*.58),4);}
// Golgi: a stack of flattened curved sacs.
for(let i=0;i<5;i++){let points=[];for(let j=0;j<=14;j++){let x=(j/14-.5)*1.12;points.push([1.33+x,-.28+i*.14+Math.cos(x*3)*.13,.24+Math.sin(x*3)*.13]);}tube(points,.071,0xf0a995,groups[5],5);}
function mitochondrion(x,y,z,rot){let group=new THREE.Group();group.position.set(x,y,z);group.rotation.z=rot;add(group,sphere(0xee9f68,.42,0,0,0,[1.65,.72,.8]),6);let points=[];for(let i=0;i<=16;i++){let x=-.48+i*.06;points.push([x,Math.sin(i*Math.PI/2)*.16,.27]);}tube(points,.025,0xffe1a3,group,6);groups[6].add(group);}
mitochondrion(-1.55,-.95,.58,-.48);mitochondrion(1.13,1.24,-.3,.45);mitochondrion(1.68,-1.03,-.43,-.7);
[[1.75,.65,.7],[-1.65,.7,-.15],[.15,-1.58,-.65]].forEach((p,i)=>{add(groups[7],sphere(0xe893ad,.22,...p,[1,1,1]),7);add(groups[7],sphere(0xffd1d7,.055,p[0]-.06,p[1]+.06,p[2]+.18),7)});
[[-1.95,-.05,.55],[.75,1.72,.28],[1.78,.13,-.55],[-.9,-1.55,.3],[.72,-1.22,.78]].forEach((p,i)=>add(groups[8],sphere(0xb9e7a2,.11+(i%2)*.035,...p,[1,1,1],{transparent:true,opacity:.85}),8));
// Centrioles are two bundles of short parallel rods.
function centriole(x,y,z,rz){const g=new THREE.Group();g.position.set(x,y,z);g.rotation.z=rz;for(let j=0;j<9;j++){let a=j*Math.PI*2/9;let rod=new THREE.Mesh(new THREE.CylinderGeometry(.033,.033,.46,8),mat(0xf1ce84));rod.position.set(Math.cos(a)*.13,0,Math.sin(a)*.13);add(g,rod,9)}groups[9].add(g)}centriole(.56,-.68,1.18,.75);centriole(.83,-.76,1.13,-.65);
// A few curved fibers suggest the cell's internal scaffolding.
for(let i=0;i<7;i++){let a=i*Math.PI*2/7;let points=[];for(let j=0;j<=8;j++){let t=j/8;points.push([Math.cos(a)*(.5+t*1.78),Math.sin(a)*(.5+t*1.45),-.5+Math.sin(t*3+i)*.35]);}tube(points,.012,0x9cded3,groups[10],10);}
let current=0,selected=-1,auto=true,autoStart=performance.now(),lastStageTime=0,fly=null,demo=location.hash==='#demo',demoStart=performance.now(),demoAction=-1;
const slider=$('slider');
function setCard(i){selected=i;let item=data[i];$('dot').style.setProperty('--accent',item?item.color:'#9ce8d2');$('tag').textContent=item?'Meet the organelle':'The beginning';$('index').textContent=item?String(i+1).padStart(2,'0')+' / 11':'00 / 11';$('part-title').textContent=item?item.name:'Cell membrane';$('part-description').textContent=item?item.desc:'This flexible outer skin holds the cell together and controls what goes in and out.';$('card-foot').textContent=current===11?'Tap a part to take a closer look.':'Watch the cell come to life, one part at a time.';}
function setStage(n,show=true){current=Math.max(0,Math.min(11,Math.round(n)));groups.forEach((g,i)=>g.visible=i<current);slider.value=current;$('progress-text').textContent=current+' of 11 parts';$('badge').innerHTML=current===11?'<b>●</b> Cell complete':'<b>●</b> Building a cell';if(show)setCard(current-1);else if(selected>=current)setCard(current-1);}
function setCut(on){cutting=on;$('cut').setAttribute('aria-pressed',String(on));materials.forEach(m=>{m.clippingPlanes=on?[cutPlane]:[];m.needsUpdate=true;});}
function restart(){fly=null;setCut(false);setStage(0);startCamera();auto=true;autoStart=performance.now();lastStageTime=0;}
function stopDemo(){if(demo){demo=false;auto=false;$('hint').textContent='Drag to orbit · pinch to zoom';}}
slider.addEventListener('input',()=>{stopDemo();auto=false;fly=null;setStage(+slider.value)});
$('cut').addEventListener('click',()=>{stopDemo();setCut(!cutting)});
$('rebuild').addEventListener('click',()=>{stopDemo();restart()});
function focusPart(i){if(i<0||i>=current)return;setCard(i);let box=new THREE.Box3().setFromObject(groups[i]);let center=new THREE.Vector3();box.getCenter(center);if(!Number.isFinite(center.x))center.set(0,0,0);let direction=camera.position.clone().sub(controls.target).normalize();let dest=center.clone().add(direction.multiplyScalar(5.1));fly={start:performance.now(),fromPos:camera.position.clone(),fromTarget:controls.target.clone(),toPos:dest,toTarget:center};}
const ray=new THREE.Raycaster(),mouse=new THREE.Vector2();let down=null;
renderer.domElement.addEventListener('pointerdown',e=>{stopDemo();fly=null;down={x:e.clientX,y:e.clientY,time:performance.now()};},{passive:true});
renderer.domElement.addEventListener('pointerup',e=>{if(!down)return;let dist=Math.hypot(e.clientX-down.x,e.clientY-down.y);if(dist<8&&performance.now()-down.time<650){const rect=renderer.domElement.getBoundingClientRect();mouse.set((e.clientX-rect.left)/rect.width*2-1,-(e.clientY-rect.top)/rect.height*2+1);ray.setFromCamera(mouse,camera);const intersections=ray.intersectObjects(hit,false);for(const obj of intersections){let i=obj.object.userData.index;if(i<current&&(!cutting||obj.point.z<=.02)){focusPart(i);break;}}}down=null;},{passive:true});
function resize(){let w=innerWidth,h=innerHeight;renderer.setSize(w,h);camera.aspect=w/h;camera.updateProjectionMatrix();let mobile=w<800;camera.fov=mobile?48:38;camera.updateProjectionMatrix();root.position.set(mobile?-.2:0,mobile?.1:0,0)}window.addEventListener('resize',resize);resize();
function animate(now){requestAnimationFrame(animate);let t=now*.001;
if(demo){let elapsed=(now-demoStart)%21000;let cycle=Math.floor((now-demoStart)/21000);if(cycle!==demoAction){demoAction=cycle;restart();auto=false;setStage(0)}if(elapsed<11000){let s=Math.min(11,Math.floor(elapsed/1000));if(s!==current)setStage(s)}else if(elapsed<14000){if(!cutting)setCut(true);camera.position.applyAxisAngle(new THREE.Vector3(0,1,0),.0035)}else if(elapsed<17000){if(cutting)setCut(false);if(selected!==6)focusPart(6)}else if(elapsed<20000){if(selected!==5)focusPart(5)}else if(current!==0){setStage(0);startCamera();}}
else if(auto){let s=Math.min(11,Math.floor((now-autoStart)/1450));if(s!==current)setStage(s);if(s===11)auto=false;}
if(fly){let p=Math.min(1,(now-fly.start)/850);let ease=p*p*(3-2*p);camera.position.lerpVectors(fly.fromPos,fly.toPos,ease);controls.target.lerpVectors(fly.fromTarget,fly.toTarget,ease);if(p===1)fly=null;}
groups.forEach((g,i)=>{g.position.y=Math.sin(t*.65+i*1.1)*.025;let pulse=1+Math.sin(t*1.2+i)*.012;g.scale.setScalar(pulse)});membrane.scale.set(1.03*(1+Math.sin(t*.8)*.008),.91*(1+Math.sin(t*.8)*.008),1+Math.sin(t*.8)*.008);shellWire.scale.copy(membrane.scale);glow.scale.copy(membrane.scale);controls.update();renderer.render(scene,camera);}
setStage(0);loading.classList.add('hide');requestAnimationFrame(animate);
</script>
<script>setTimeout(function(){var e=document.getElementById('loading');if(e&&!e.classList.contains('hide'))e.innerHTML='<div class="error">The 3D library could not load. Check your connection and reload this page.</div>';},12000);</script>
</body>
</html>
