by adom
The Adom logomark is a hydrogen 2p orbital: psi = (2p_x + 2p_y)/sqrt(2). A live Babylon.js lab that proves it (all 16 real spherical harmonics, the alignment cheat, and the directed loop), plus loader.html: the same animation as one dependency-free WebGL file for webview load screens.
← Commit history
speed (percent playback), negative margin (full bleed, -70 clamp), orbit (auto yaw with whole-turn epoch latch) + live postMessage + rig buttons
6 files changed
+184−38
SKILL.md+10@@ -145,6 +145,16 @@ readbacks for the fit measurement); the loader is that lab distilled. - Inert by default: a load screen never eats input. `?interact=1` arms click-to-capture (teal ring + glow); click-away or blur releases.+- `?speed=N` runs the ANIMATION clocks at N percent (10 = a tenth speed).+ Camera springs and interaction stay real time. Live: postMessage+ `{adomLoader:{speed:N}}`.+- `?margin=-N` bleeds: the camera moves N percent closer, so -50 doubles the+ mark and it runs off every edge (clamp -70, near-plane safety). Same+ postMessage margin channel as positive values.+- `?orbit=D` auto-rotates the camera D degrees per second during play (try+ 12). The yaw glides to the nearest whole turn as sculpting starts, so the+ epoch always lands square-on and play resumes with no unwind. Live:+ postMessage `{adomLoader:{orbit:D}}`. - `?emerge=1` replaces the logo intro entirely: the equation runs from t=0 and the surface condenses out of nothing (2.6 s scale and fade) straight into play, then the normal pt/dt/ct/st timeline. Off by default; it is a
loader.html+41−11@@ -27,12 +27,25 @@ var PT=P('pt',4.5), DT=P('dt',3), CT=P('ct',0.3), ST=P('st',0); var LOGO_PK=Math.max(0,Math.min(1,P('logo',100)/100)); var LLEAD=Math.abs(P('llead',1)), TLEAD=Math.abs(P('tlead',1.5)); var EMERGE=String(P('emerge',0))==='1';+/* speed: percent playback rate for the ANIMATION clocks (timeline, evolution,+ birth). 100 is real time; 10 is a tenth speed. Camera springs and user+ interaction stay real-time so the feel never goes gluey. */+var SPEED=Math.max(0.05,Math.min(3,Math.abs(P('speed',100))/100));+/* orbit: automatic camera yaw during PLAY, in degrees per second (0 = off,+ try 12). The angle glides to the nearest whole turn as sculpting begins,+ so every epoch still lands square-on for the logo overlay, and play+ resumes from the equivalent orientation with no unwinding sweep. */+var ORBIT=(P('orbit',0)||0)*Math.PI/180; var OV=Q.get('ov')!=='0', DO_INTRO=Q.get('intro')!=='0'&&!EMERGE; /* margin: percent of the container left EMPTY around the mark. 0 is the classic framing; 80 sits the anim small in the middle of a big window. Implemented as camera distance, so perspective, the overlay match and the epoch glide all stay exact at any margin. */-var MARGIN=Math.max(0,Math.min(90,P('margin',0)));+/* margin accepts NEGATIVE values for full bleed: -N moves the camera N%+ closer, so -50 doubles the mark and it runs off every edge. Clamped at+ -70 so the surface never crosses the near plane. */+var MARGIN=Math.max(-70,Math.min(90,P('margin',0)));+function homeFor(m){ return m<0 ? R*(1+m/100) : R/(1-m/100); } /* MODES bundle the quality knobs so nobody has to reason about them: mode=lightweight fps 30, dpr 1, seg 48, no antialias: spinner fleets, dialogs, battery. Looks fine at small sizes.@@ -261,7 +274,7 @@ gl.uniform3fv(U.cPos,C_POS); /* Babylon LEFT-HANDED camera, reproduced exactly: eye (0,0,-4.4) looking +Z, fov 0.8 fixed on the LIMITING axis so the mark keeps its fraction of any canvas shape (the lab's fitFraming rule). */-var R=4.4, HOME=R/(1-MARGIN/100), CAMR=HOME, PANX=0, PANY=0, FOV=0.8, ZN=0.1, ZF=Math.max(100,HOME*3);+var R=4.4, HOME=homeFor(MARGIN), CAMR=HOME, PANX=0, PANY=0, FOV=0.8, ZN=0.1, ZF=Math.max(100,HOME*3); /* Babylon's ACTUAL zoom model, tuned against the lab's measured curve: each notch deposits a decaying velocity integral (inertia 0.9) that is consumed frame by frame straight into the radius, while the lab's springs pull@@ -277,11 +290,13 @@ function setMVP2(w,h,r,px,py,s){ r=(r===undefined)?CAMR:r; px=px||0; py=py||0; s=(s===undefined)?1:s; var m=proj(w,h); var A=ZF/(ZF-ZN), B=-ZN*ZF/(ZF-ZN);- // view: model scale s (emerge birth), pan, then z' = z + r (eye at -r on z, LH)+ // view: yaw orbA about Y, model scale s (emerge birth), pan, then+ // z' = z + r (eye at -r on z, LH). c=1,sn=0 reduces to the plain matrix.+ var c=Math.cos(orbA), sn=Math.sin(orbA); gl.uniformMatrix4fv(U.uMVP,false,new Float32Array([- m.m0*s,0,0,0,+ m.m0*s*c,0,-A*s*sn,-s*sn, 0,m.m5*s,0,0,- 0,0,A*s,s,+ m.m0*s*sn,0,A*s*c,s*c, -m.m0*px,-m.m5*py,A*r+B,r ])); }@@ -329,6 +344,7 @@ var inIntro=DO_INTRO, introT=0, t=(DO_INTRO||EMERGE)?0:eE, tEvo=0, rolled=false, plain play, then the normal pt/dt/ct/st timeline takes over. Keep pt comfortably above BIRTH_S so the first epoch never lands mid-birth. */ var BIRTH_S=2.6, birth=EMERGE?0:1, birthT=0;+var orbA=0; // auto-orbit yaw, radians function frame(now){ if(FPSCAP>0){@@ -336,18 +352,19 @@ function frame(now){ lastDraw=now; } applySize();- var dt=Math.min(0.05,(now-last)/1000); last=now; tEvo+=dt;- if(birth<1){birthT+=dt;birth=smooth(Math.min(1,birthT/BIRTH_S));+ var dt=Math.min(0.05,(now-last)/1000); last=now;+ var adt=dt*SPEED; tEvo+=adt;+ if(birth<1){birthT+=adt;birth=smooth(Math.min(1,birthT/BIRTH_S)); glc.style.opacity=birth>=1?'':String(0.04+0.96*birth);} var k,cheat,fill,teal,pinned=false,drawMesh=true; if(inIntro){- introT+=dt;+ introT+=adt; var e1=INTRO.dark,e2=e1+INTRO.logoIn,e3=e2+INTRO.hold,e4=e3+INTRO.reveal,x=introT; k=1;cheat=1;teal=1;pinned=true;drawMesh=x>=e2; fill = x<e1?0 : x<e2?smooth((x-e1)/(e2-e1)) : x<e3?1 : 1-smooth((x-e3)/(e4-e3)); if(x>=e4){inIntro=false;t=eE;roll();} }else{- t=(t+dt)%CYC;+ t=(t+adt)%CYC; var ctw=OV?Math.min(CT,DT):CT; if(t<PT){k=0;} else if(t<PT+DT){k=smooth((t-PT)/DT);}@@ -364,6 +381,17 @@ function frame(now){ teal = t<eS ? (TLEAD<=0.01?0:(t<=eS-TLEAD?0:smooth(1-(eS-t)/TLEAD))) : t<=eE ? 1 : (TLEAD<=0.01?0:(t>=eE+TLEAD?0:smooth(1-(t-eE)/TLEAD))); }+ /* Auto-orbit: yaw advances only in pure play; the moment sculpting starts+ the angle is pulled to the nearest whole turn, so the epoch pose is the+ calibrated square-on view and nothing ever has to spin backwards. */+ if(ORBIT!==0){+ var kk=inIntro?1:k;+ if(kk<=0){ orbA+=ORBIT*adt; }+ else{+ var whole=Math.round(orbA/(2*Math.PI))*(2*Math.PI);+ orbA=orbA+(whole-orbA)*smooth(Math.min(1,kk));+ }+ } /* The camera comes HOME for the logo. Whatever the user zoomed or panned, the framing glides back to the exact calibrated pose before epoch-start, holds through the epoch (the overlay match depends on it), and hands the@@ -476,10 +504,12 @@ if (Q.get('interact')==='1' || window.__ADOM_LOADER_INTERACT){ if(typeof d.bg==='string'){ applyBg(d.bg); } if(typeof d.fps==='number'){ FPSCAP=Math.max(0,d.fps); if(FPSCAP>0&&FPSCAP<20)FPSCAP=20; } if(typeof d.margin==='number'){- MARGIN=Math.max(0,Math.min(90,d.margin));- HOME=R/(1-MARGIN/100);+ MARGIN=Math.max(-70,Math.min(90,d.margin));+ HOME=homeFor(MARGIN); ZF=Math.max(100,HOME*3); }+ if(typeof d.speed==='number'){ SPEED=Math.max(0.05,Math.min(3,Math.abs(d.speed)/100)); }+ if(typeof d.orbit==='number'){ ORBIT=d.orbit*Math.PI/180; } }); window.addEventListener('blur',function(){ live=false; edge.style.opacity='0'; document.body.style.cursor='pointer'; hint.textContent='click to zoom'; hint.style.color='#8b949e'; });
package.json+1−1@@ -2,7 +2,7 @@ "slug": "orbital-lab", "title": "Orbital Lab", "type": "app",- "version": "1.0.21",+ "version": "1.0.22", "description": "The Adom logomark is a hydrogen 2p orbital: psi = (2p_x + 2p_y)/sqrt(2). A live Babylon.js lab that proves it (all 16 real spherical harmonics, the alignment cheat, and the directed loop), plus loader.html: the same animation as one dependency-free WebGL file for webview load screens.", "tags": [ "brand",
readme.html+66−13@@ -2634,9 +2634,20 @@ window.__lab = { push, zeros, HARMONICS, setAnim:v=>{animate=v;} }; <button data-s="180,140">Tiny</button> <button data-s="760,475">Reset</button> <span style="margin-left:10px">margin</span>+ <button data-m="-50">-50% bleed</button>+ <button data-m="-30">-30%</button> <button data-m="0">0%</button> <button data-m="40">40%</button> <button data-m="80">80%</button>+ <span style="margin-left:10px">speed</span>+ <button data-sp="10">10%</button>+ <button data-sp="25">25%</button>+ <button data-sp="50">50%</button>+ <button data-sp="100">100%</button>+ <span style="margin-left:10px">orbit</span>+ <button data-o="0">off</button>+ <button data-o="12">12°/s</button>+ <button data-o="45">45°/s</button> <span style="margin-left:10px">hint</span> <button data-h="1">on</button> <button data-h="0">off</button>@@ -2678,12 +2689,25 @@ var PT=P('pt',4.5), DT=P('dt',3), CT=P('ct',0.3), var LOGO_PK=Math.max(0,Math.min(1,P('logo',100)/100)); var LLEAD=Math.abs(P('llead',1)), TLEAD=Math.abs(P('tlead',1.5)); var EMERGE=String(P('emerge',0))==='1';+/* speed: percent playback rate for the ANIMATION clocks (timeline, evolution,+ birth). 100 is real time; 10 is a tenth speed. Camera springs and user+ interaction stay real-time so the feel never goes gluey. */+var SPEED=Math.max(0.05,Math.min(3,Math.abs(P('speed',100))/100));+/* orbit: automatic camera yaw during PLAY, in degrees per second (0 = off,+ try 12). The angle glides to the nearest whole turn as sculpting begins,+ so every epoch still lands square-on for the logo overlay, and play+ resumes from the equivalent orientation with no unwinding sweep. */+var ORBIT=(P('orbit',0)||0)*Math.PI/180; var OV=Q.get('ov')!=='0', DO_INTRO=Q.get('intro')!=='0'&&!EMERGE; /* margin: percent of the container left EMPTY around the mark. 0 is the classic framing; 80 sits the anim small in the middle of a big window. Implemented as camera distance, so perspective, the overlay match and the epoch glide all stay exact at any margin. */-var MARGIN=Math.max(0,Math.min(90,P('margin',0)));+/* margin accepts NEGATIVE values for full bleed: -N moves the camera N%+ closer, so -50 doubles the mark and it runs off every edge. Clamped at+ -70 so the surface never crosses the near plane. */+var MARGIN=Math.max(-70,Math.min(90,P('margin',0)));+function homeFor(m){ return m<0 ? R*(1+m/100) : R/(1-m/100); } /* MODES bundle the quality knobs so nobody has to reason about them: mode=lightweight fps 30, dpr 1, seg 48, no antialias: spinner fleets, dialogs, battery. Looks fine at small sizes.@@ -2912,7 +2936,7 @@ gl.uniform3fv(U.cPos,C_POS); /* Babylon LEFT-HANDED camera, reproduced exactly: eye (0,0,-4.4) looking +Z, fov 0.8 fixed on the LIMITING axis so the mark keeps its fraction of any canvas shape (the lab's fitFraming rule). */-var R=4.4, HOME=R/(1-MARGIN/100), CAMR=HOME, PANX=0, PANY=0, FOV=0.8, ZN=0.1, ZF=Math.max(100,HOME*3);+var R=4.4, HOME=homeFor(MARGIN), CAMR=HOME, PANX=0, PANY=0, FOV=0.8, ZN=0.1, ZF=Math.max(100,HOME*3); /* Babylon's ACTUAL zoom model, tuned against the lab's measured curve: each notch deposits a decaying velocity integral (inertia 0.9) that is consumed frame by frame straight into the radius, while the lab's springs pull@@ -2928,11 +2952,13 @@ function setMVP2(w,h,r,px,py,s){ r=(r===undefined)?CAMR:r; px=px||0; py=py||0; s=(s===undefined)?1:s; var m=proj(w,h); var A=ZF/(ZF-ZN), B=-ZN*ZF/(ZF-ZN);- // view: model scale s (emerge birth), pan, then z' = z + r (eye at -r on z, LH)+ // view: yaw orbA about Y, model scale s (emerge birth), pan, then+ // z' = z + r (eye at -r on z, LH). c=1,sn=0 reduces to the plain matrix.+ var c=Math.cos(orbA), sn=Math.sin(orbA); gl.uniformMatrix4fv(U.uMVP,false,new Float32Array([- m.m0*s,0,0,0,+ m.m0*s*c,0,-A*s*sn,-s*sn, 0,m.m5*s,0,0,- 0,0,A*s,s,+ m.m0*s*sn,0,A*s*c,s*c, -m.m0*px,-m.m5*py,A*r+B,r ])); }@@ -2980,6 +3006,7 @@ var inIntro=DO_INTRO, introT=0, t=(DO_INTRO||EMERGE)?0:eE, tEvo=0, rolled=false, plain play, then the normal pt/dt/ct/st timeline takes over. Keep pt comfortably above BIRTH_S so the first epoch never lands mid-birth. */ var BIRTH_S=2.6, birth=EMERGE?0:1, birthT=0;+var orbA=0; // auto-orbit yaw, radians function frame(now){ if(FPSCAP>0){@@ -2987,18 +3014,19 @@ function frame(now){ lastDraw=now; } applySize();- var dt=Math.min(0.05,(now-last)/1000); last=now; tEvo+=dt;- if(birth<1){birthT+=dt;birth=smooth(Math.min(1,birthT/BIRTH_S));+ var dt=Math.min(0.05,(now-last)/1000); last=now;+ var adt=dt*SPEED; tEvo+=adt;+ if(birth<1){birthT+=adt;birth=smooth(Math.min(1,birthT/BIRTH_S)); glc.style.opacity=birth>=1?'':String(0.04+0.96*birth);} var k,cheat,fill,teal,pinned=false,drawMesh=true; if(inIntro){- introT+=dt;+ introT+=adt; var e1=INTRO.dark,e2=e1+INTRO.logoIn,e3=e2+INTRO.hold,e4=e3+INTRO.reveal,x=introT; k=1;cheat=1;teal=1;pinned=true;drawMesh=x>=e2; fill = x<e1?0 : x<e2?smooth((x-e1)/(e2-e1)) : x<e3?1 : 1-smooth((x-e3)/(e4-e3)); if(x>=e4){inIntro=false;t=eE;roll();} }else{- t=(t+dt)%CYC;+ t=(t+adt)%CYC; var ctw=OV?Math.min(CT,DT):CT; if(t<PT){k=0;} else if(t<PT+DT){k=smooth((t-PT)/DT);}@@ -3015,6 +3043,17 @@ function frame(now){ teal = t<eS ? (TLEAD<=0.01?0:(t<=eS-TLEAD?0:smooth(1-(eS-t)/TLEAD))) : t<=eE ? 1 : (TLEAD<=0.01?0:(t>=eE+TLEAD?0:smooth(1-(t-eE)/TLEAD))); }+ /* Auto-orbit: yaw advances only in pure play; the moment sculpting starts+ the angle is pulled to the nearest whole turn, so the epoch pose is the+ calibrated square-on view and nothing ever has to spin backwards. */+ if(ORBIT!==0){+ var kk=inIntro?1:k;+ if(kk<=0){ orbA+=ORBIT*adt; }+ else{+ var whole=Math.round(orbA/(2*Math.PI))*(2*Math.PI);+ orbA=orbA+(whole-orbA)*smooth(Math.min(1,kk));+ }+ } /* The camera comes HOME for the logo. Whatever the user zoomed or panned, the framing glides back to the exact calibrated pose before epoch-start, holds through the epoch (the overlay match depends on it), and hands the@@ -3127,10 +3166,12 @@ if (Q.get('interact')==='1' || window.__ADOM_LOADER_INTERACT if(typeof d.bg==='string'){ applyBg(d.bg); } if(typeof d.fps==='number'){ FPSCAP=Math.max(0,d.fps); if(FPSCAP>0&&FPSCAP<20)FPSCAP=20; } if(typeof d.margin==='number'){- MARGIN=Math.max(0,Math.min(90,d.margin));- HOME=R/(1-MARGIN/100);+ MARGIN=Math.max(-70,Math.min(90,d.margin));+ HOME=homeFor(MARGIN); ZF=Math.max(100,HOME*3); }+ if(typeof d.speed==='number'){ SPEED=Math.max(0.05,Math.min(3,Math.abs(d.speed)/100)); }+ if(typeof d.orbit==='number'){ ORBIT=d.orbit*Math.PI/180; } }); window.addEventListener('blur',function(){ live=false; edge.style.opacity='0'; document.body.style.cursor='pointer'; hint.textContent='click to zoom'; hint.style.color='#8b949e'; });@@ -3172,6 +3213,16 @@ if (Q.get('interact')==='1' || window.__ADOM_LOADER_INTERACT ifr.contentWindow.postMessage({adomLoader:{margin:parseFloat(b.getAttribute('data-m'))}},'*'); }); });+ document.querySelectorAll('.rig-acts button[data-sp]').forEach(function(b){+ b.addEventListener('click',function(){+ ifr.contentWindow.postMessage({adomLoader:{speed:parseFloat(b.getAttribute('data-sp'))}},'*');+ });+ });+ document.querySelectorAll('.rig-acts button[data-o]').forEach(function(b){+ b.addEventListener('click',function(){+ ifr.contentWindow.postMessage({adomLoader:{orbit:parseFloat(b.getAttribute('data-o'))}},'*');+ });+ }); document.querySelectorAll('.rig-acts button[data-h]').forEach(function(b){ b.addEventListener('click',function(){ ifr.contentWindow.postMessage({adomLoader:{hint:b.getAttribute('data-h')==='1'}},'*');@@ -3210,7 +3261,7 @@ if (Q.get('interact')==='1' || window.__ADOM_LOADER_INTERACT </script> <h2 style="margin-top:30px">Ship it as a webview loader</h2> <p><b>loader.html</b> on this page is the animation above distilled to ONE dependency-free file:- raw WebGL, no Babylon, no CDN, no fonts, no fetch, about 29 KB. It boots instantly, which+ raw WebGL, no Babylon, no CDN, no fonts, no fetch, about 30 KB. It boots instantly, which is the point: it plays while your webview's real content is still loading. Under 10 KB gzipped, zero requests, one draw call over 12,800 vertex-shader-displaced triangles, and about 0.06 ms of JS per frame, so the CPU stays asleep. The wheel is tuned against the@@ -3326,7 +3377,9 @@ if (Q.get('interact')==='1' || window.__ADOM_LOADER_INTERACT <tr><td>bg</td><td>0d1117</td><td>hex background, or <b>transparent</b> to composite over the container's own background (GL context runs with alpha). Also settable live by postMessage</td></tr> <tr><td>hint</td><td>0</td><td>1 shows the small "click to zoom" pill in armed contexts. Off by default: production stays pure. Armed contexts can also flip it live by postMessage</td></tr> <tr><td>emerge</td><td>0</td><td>1 replaces the logo intro: the equation runs from t=0 and the surface condenses out of nothing (2.6 s scale and fade) straight into play, then the normal timeline. Keep pt above ~3 s so the first epoch never lands mid-birth. A taste toggle: try the start buttons in the rig above</td></tr>- <tr><td>margin</td><td>0</td><td>percent of the container left empty around the mark: 80 sits it small in the middle of a big window, 20 nearly fills. Zoom-in still brings it to the screen; zoom-out caps at 40% past the margined framing</td></tr>+ <tr><td>margin</td><td>0</td><td>percent of the container left empty around the mark: 80 sits it small in the middle of a big window, 20 nearly fills. NEGATIVE margins bleed: -50 moves the camera 50% closer so the animation runs off every edge (clamped at -70 to protect the near plane). Zoom-in still brings it to the screen; zoom-out caps at 40% past the margined framing. Live-settable by postMessage</td></tr>+ <tr><td>speed</td><td>100</td><td>percent playback rate for the animation clocks (timeline, evolution, birth): 10 runs it at a tenth speed. Camera springs and user interaction stay real time so the feel never goes gluey. Live-settable by postMessage</td></tr>+ <tr><td>orbit</td><td>0</td><td>automatic camera yaw during PLAY in degrees per second (try 12). As sculpting starts the angle glides to the nearest whole turn, so every epoch still lands square-on for the logo and play resumes with no unwinding sweep. Live-settable by postMessage</td></tr> </table> <h3>The three tuned cuts</h3> <p>These are the settings the loop was actually tuned to, saved live while dialing it in.
tools/build-loader.py+42−12@@ -12,7 +12,7 @@ Constraints that shape it, in order: LEFT-HANDED view/projection exactly: this codebase already burned seven attempts on a mirrored mark, so chirality is not left to chance. 3. John's tuned numbers as defaults (the "john 1" snapshot), overridable by- URL params: ?pt=4.5&dt=3&ct=0.3&st=0&logo=100&llead=1&tlead=1.5&ov=1&intro=1&interact=0&emerge=0+ URL params: ?pt=4.5&dt=3&ct=0.3&st=0&logo=100&llead=1&tlead=1.5&ov=1&intro=1&interact=0&emerge=0&speed=100&orbit=0&margin=0..-80 for bleed Run: python3 tools/build-loader.py """@@ -77,12 +77,25 @@ var PT=P('pt',4.5), DT=P('dt',3), CT=P('ct',0.3), ST=P('st',0); var LOGO_PK=Math.max(0,Math.min(1,P('logo',100)/100)); var LLEAD=Math.abs(P('llead',1)), TLEAD=Math.abs(P('tlead',1.5)); var EMERGE=String(P('emerge',0))==='1';+/* speed: percent playback rate for the ANIMATION clocks (timeline, evolution,+ birth). 100 is real time; 10 is a tenth speed. Camera springs and user+ interaction stay real-time so the feel never goes gluey. */+var SPEED=Math.max(0.05,Math.min(3,Math.abs(P('speed',100))/100));+/* orbit: automatic camera yaw during PLAY, in degrees per second (0 = off,+ try 12). The angle glides to the nearest whole turn as sculpting begins,+ so every epoch still lands square-on for the logo overlay, and play+ resumes from the equivalent orientation with no unwinding sweep. */+var ORBIT=(P('orbit',0)||0)*Math.PI/180; var OV=Q.get('ov')!=='0', DO_INTRO=Q.get('intro')!=='0'&&!EMERGE; /* margin: percent of the container left EMPTY around the mark. 0 is the classic framing; 80 sits the anim small in the middle of a big window. Implemented as camera distance, so perspective, the overlay match and the epoch glide all stay exact at any margin. */-var MARGIN=Math.max(0,Math.min(90,P('margin',0)));+/* margin accepts NEGATIVE values for full bleed: -N moves the camera N%+ closer, so -50 doubles the mark and it runs off every edge. Clamped at+ -70 so the surface never crosses the near plane. */+var MARGIN=Math.max(-70,Math.min(90,P('margin',0)));+function homeFor(m){ return m<0 ? R*(1+m/100) : R/(1-m/100); } /* MODES bundle the quality knobs so nobody has to reason about them: mode=lightweight fps 30, dpr 1, seg 48, no antialias: spinner fleets, dialogs, battery. Looks fine at small sizes.@@ -161,7 +174,7 @@ gl.uniform3fv(U.cPos,C_POS); /* Babylon LEFT-HANDED camera, reproduced exactly: eye (0,0,-4.4) looking +Z, fov 0.8 fixed on the LIMITING axis so the mark keeps its fraction of any canvas shape (the lab's fitFraming rule). */-var R=4.4, HOME=R/(1-MARGIN/100), CAMR=HOME, PANX=0, PANY=0, FOV=0.8, ZN=0.1, ZF=Math.max(100,HOME*3);+var R=4.4, HOME=homeFor(MARGIN), CAMR=HOME, PANX=0, PANY=0, FOV=0.8, ZN=0.1, ZF=Math.max(100,HOME*3); /* Babylon's ACTUAL zoom model, tuned against the lab's measured curve: each notch deposits a decaying velocity integral (inertia 0.9) that is consumed frame by frame straight into the radius, while the lab's springs pull@@ -185,11 +198,13 @@ function setMVP2(w,h,r,px,py,s){ r=(r===undefined)?CAMR:r; px=px||0; py=py||0; s=(s===undefined)?1:s; var m=proj(w,h); var A=ZF/(ZF-ZN), B=-ZN*ZF/(ZF-ZN);- // view: model scale s (emerge birth), pan, then z' = z + r (eye at -r on z, LH)+ // view: yaw orbA about Y, model scale s (emerge birth), pan, then+ // z' = z + r (eye at -r on z, LH). c=1,sn=0 reduces to the plain matrix.+ var c=Math.cos(orbA), sn=Math.sin(orbA); gl.uniformMatrix4fv(U.uMVP,false,new Float32Array([- m.m0*s,0,0,0,+ m.m0*s*c,0,-A*s*sn,-s*sn, 0,m.m5*s,0,0,- 0,0,A*s,s,+ m.m0*s*sn,0,A*s*c,s*c, -m.m0*px,-m.m5*py,A*r+B,r ])); }@@ -237,6 +252,7 @@ var inIntro=DO_INTRO, introT=0, t=(DO_INTRO||EMERGE)?0:eE, tEvo=0, rolled=false, plain play, then the normal pt/dt/ct/st timeline takes over. Keep pt comfortably above BIRTH_S so the first epoch never lands mid-birth. */ var BIRTH_S=2.6, birth=EMERGE?0:1, birthT=0;+var orbA=0; // auto-orbit yaw, radians function frame(now){ if(FPSCAP>0){@@ -244,18 +260,19 @@ function frame(now){ lastDraw=now; } applySize();- var dt=Math.min(0.05,(now-last)/1000); last=now; tEvo+=dt;- if(birth<1){birthT+=dt;birth=smooth(Math.min(1,birthT/BIRTH_S));+ var dt=Math.min(0.05,(now-last)/1000); last=now;+ var adt=dt*SPEED; tEvo+=adt;+ if(birth<1){birthT+=adt;birth=smooth(Math.min(1,birthT/BIRTH_S)); glc.style.opacity=birth>=1?'':String(0.04+0.96*birth);} var k,cheat,fill,teal,pinned=false,drawMesh=true; if(inIntro){- introT+=dt;+ introT+=adt; var e1=INTRO.dark,e2=e1+INTRO.logoIn,e3=e2+INTRO.hold,e4=e3+INTRO.reveal,x=introT; k=1;cheat=1;teal=1;pinned=true;drawMesh=x>=e2; fill = x<e1?0 : x<e2?smooth((x-e1)/(e2-e1)) : x<e3?1 : 1-smooth((x-e3)/(e4-e3)); if(x>=e4){inIntro=false;t=eE;roll();} }else{- t=(t+dt)%CYC;+ t=(t+adt)%CYC; var ctw=OV?Math.min(CT,DT):CT; if(t<PT){k=0;} else if(t<PT+DT){k=smooth((t-PT)/DT);}@@ -272,6 +289,17 @@ function frame(now){ teal = t<eS ? (TLEAD<=0.01?0:(t<=eS-TLEAD?0:smooth(1-(eS-t)/TLEAD))) : t<=eE ? 1 : (TLEAD<=0.01?0:(t>=eE+TLEAD?0:smooth(1-(t-eE)/TLEAD))); }+ /* Auto-orbit: yaw advances only in pure play; the moment sculpting starts+ the angle is pulled to the nearest whole turn, so the epoch pose is the+ calibrated square-on view and nothing ever has to spin backwards. */+ if(ORBIT!==0){+ var kk=inIntro?1:k;+ if(kk<=0){ orbA+=ORBIT*adt; }+ else{+ var whole=Math.round(orbA/(2*Math.PI))*(2*Math.PI);+ orbA=orbA+(whole-orbA)*smooth(Math.min(1,kk));+ }+ } /* The camera comes HOME for the logo. Whatever the user zoomed or panned, the framing glides back to the exact calibrated pose before epoch-start, holds through the epoch (the overlay match depends on it), and hands the@@ -384,10 +412,12 @@ if (Q.get('interact')==='1' || window.__ADOM_LOADER_INTERACT){ if(typeof d.bg==='string'){ applyBg(d.bg); } if(typeof d.fps==='number'){ FPSCAP=Math.max(0,d.fps); if(FPSCAP>0&&FPSCAP<20)FPSCAP=20; } if(typeof d.margin==='number'){- MARGIN=Math.max(0,Math.min(90,d.margin));- HOME=R/(1-MARGIN/100);+ MARGIN=Math.max(-70,Math.min(90,d.margin));+ HOME=homeFor(MARGIN); ZF=Math.max(100,HOME*3); }+ if(typeof d.speed==='number'){ SPEED=Math.max(0.05,Math.min(3,Math.abs(d.speed)/100)); }+ if(typeof d.orbit==='number'){ ORBIT=d.orbit*Math.PI/180; } }); window.addEventListener('blur',function(){ live=false; edge.style.opacity='0'; document.body.style.cursor='pointer'; hint.textContent='click to zoom'; hint.style.color='#8b949e'; });
tools/build-readme.py+24−1@@ -131,9 +131,20 @@ edocs = """ <button data-s="180,140">Tiny</button> <button data-s="760,475">Reset</button> <span style="margin-left:10px">margin</span>+ <button data-m="-50">-50% bleed</button>+ <button data-m="-30">-30%</button> <button data-m="0">0%</button> <button data-m="40">40%</button> <button data-m="80">80%</button>+ <span style="margin-left:10px">speed</span>+ <button data-sp="10">10%</button>+ <button data-sp="25">25%</button>+ <button data-sp="50">50%</button>+ <button data-sp="100">100%</button>+ <span style="margin-left:10px">orbit</span>+ <button data-o="0">off</button>+ <button data-o="12">12°/s</button>+ <button data-o="45">45°/s</button> <span style="margin-left:10px">hint</span> <button data-h="1">on</button> <button data-h="0">off</button>@@ -172,6 +183,16 @@ edocs = """ ifr.contentWindow.postMessage({adomLoader:{margin:parseFloat(b.getAttribute('data-m'))}},'*'); }); });+ document.querySelectorAll('.rig-acts button[data-sp]').forEach(function(b){+ b.addEventListener('click',function(){+ ifr.contentWindow.postMessage({adomLoader:{speed:parseFloat(b.getAttribute('data-sp'))}},'*');+ });+ });+ document.querySelectorAll('.rig-acts button[data-o]').forEach(function(b){+ b.addEventListener('click',function(){+ ifr.contentWindow.postMessage({adomLoader:{orbit:parseFloat(b.getAttribute('data-o'))}},'*');+ });+ }); document.querySelectorAll('.rig-acts button[data-h]').forEach(function(b){ b.addEventListener('click',function(){ ifr.contentWindow.postMessage({adomLoader:{hint:b.getAttribute('data-h')==='1'}},'*');@@ -326,7 +347,9 @@ edocs = """ <tr><td>bg</td><td>0d1117</td><td>hex background, or <b>transparent</b> to composite over the container's own background (GL context runs with alpha). Also settable live by postMessage</td></tr> <tr><td>hint</td><td>0</td><td>1 shows the small "click to zoom" pill in armed contexts. Off by default: production stays pure. Armed contexts can also flip it live by postMessage</td></tr> <tr><td>emerge</td><td>0</td><td>1 replaces the logo intro: the equation runs from t=0 and the surface condenses out of nothing (2.6 s scale and fade) straight into play, then the normal timeline. Keep pt above ~3 s so the first epoch never lands mid-birth. A taste toggle: try the start buttons in the rig above</td></tr>- <tr><td>margin</td><td>0</td><td>percent of the container left empty around the mark: 80 sits it small in the middle of a big window, 20 nearly fills. Zoom-in still brings it to the screen; zoom-out caps at 40% past the margined framing</td></tr>+ <tr><td>margin</td><td>0</td><td>percent of the container left empty around the mark: 80 sits it small in the middle of a big window, 20 nearly fills. NEGATIVE margins bleed: -50 moves the camera 50% closer so the animation runs off every edge (clamped at -70 to protect the near plane). Zoom-in still brings it to the screen; zoom-out caps at 40% past the margined framing. Live-settable by postMessage</td></tr>+ <tr><td>speed</td><td>100</td><td>percent playback rate for the animation clocks (timeline, evolution, birth): 10 runs it at a tenth speed. Camera springs and user interaction stay real time so the feel never goes gluey. Live-settable by postMessage</td></tr>+ <tr><td>orbit</td><td>0</td><td>automatic camera yaw during PLAY in degrees per second (try 12). As sculpting starts the angle glides to the nearest whole turn, so every epoch still lands square-on for the logo and play resumes with no unwinding sweep. Live-settable by postMessage</td></tr> </table> <h3>The three tuned cuts</h3> <p>These are the settings the loop was actually tuned to, saved live while dialing it in.