Deck.transition('portal-in',{dur:1.1,frag:`void main(){ vec2 q=(vUv-.5)*vec2(uRes.x/uRes.y,1.); float r=smoothstep(0.,1.,p)*2.2; float m=smoothstep(r-.25,r,length(q)); vec3 c=mix(texture(tB,vUv).rgb,texture(tA,vUv).rgb,m); c+=vec3(.5,.75,1.)*m*(1.-m)*2.2; o=vec4(c,1.); }`}); Deck.scene({ id:'pile', title:'You are here', enterWith:'portal-in', post:{tone:'none',vignette:.10,grain:.02}, beats:[{dur:12.6,hold:3},{dur:4.4,hold:5}], notes:['That was the whole talk, on one curve. Now we go back down it. (Wait for the ride to stop.) This is today.', 'Look up. Everything in this talk is in that wall, and the wall starts a few steps in front of us. From down here it still looks flat. That is what the bottom of an exponential looks like.'], setup(d){ const N=17,L=34,H=62,PW=6,M=240; const PX=[],PY=[],CU=[0]; for(let i=0;i<=M;i++){const u=i/M;PX.push(L*u);PY.push(H*Math.pow(u,PW));} for(let i=1;i<=M;i++)CU.push(CU[i-1]+Math.hypot(PX[i]-PX[i-1],PY[i]-PY[i-1])); const S=CU[M]; const pt=s=>{s=Math.max(0,Math.min(S,s));let lo=0,hi=M; while(hi-lo>1){const m=(lo+hi)>>1;if(CU[m]<=s)lo=m;else hi=m;} const g=(s-CU[lo])/Math.max(1e-9,CU[hi]-CU[lo]); return [PX[lo]+(PX[hi]-PX[lo])*g,PY[lo]+(PY[hi]-PY[lo])*g];}; const tan=s=>{const a=pt(s-.5),b=pt(s+.5),dx=b[0]-a[0],dy=b[1]-a[1],l=Math.hypot(dx,dy)||1;return [dx/l,dy/l];}; const cols=[[255,255,255,51,71,92],[239,228,205,138,106,63],[16,52,74,206,228,239],[14,72,71,120,220,203], [44,30,18,240,168,60],[26,32,48,221,229,242],[255,255,255,194,60,43],[20,16,12,255,177,74], [58,110,168,223,234,247],[232,116,58,58,26,10],[46,107,74,207,230,214],[191,224,245,42,74,106],[255,255,255,26,26,26]]; let sd=7;const rnd=()=>{sd=(sd*1103515245+12345)&0x7fffffff;return sd/0x7fffffff;}; const sh=[];for(let i=0;i<8;i++)sh.push({s:rnd()*S*.92,h:2+rnd()*14,z:2.5+rnd()*6,ph:rnd()*6.283,sz:.28+rnd()*.22}); const now=new Date(); const date=now.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'}); const cam={ro:[0,0,0],u:[1,0,0],v:[0,1,0],w:[0,0,1],F:1.35}; const sub=(a,b)=>[a[0]-b[0],a[1]-b[1],a[2]-b[2]]; const cr=(a,b)=>[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]; const dt=(a,b)=>a[0]*b[0]+a[1]*b[1]+a[2]*b[2]; const nz=a=>{const l=Math.hypot(a[0],a[1],a[2])||1;return [a[0]/l,a[1]/l,a[2]/l];}; const setCam=(ro,ta)=>{cam.ro=ro;const w=nz(sub(ta,ro));const u=nz(cr(w,[0,1,0]));cam.w=w;cam.u=u;cam.v=cr(u,w);}; const pr=p=>{const dd=sub(p,cam.ro),z=dt(dd,cam.w),x=dt(dd,cam.u),y=dt(dd,cam.v); return {z,x:960+1080*cam.F*x/z,y:540-1080*cam.F*y/z};}; return {S,N,pt,tan,cols,sh,cam,setCam,pr,date, sky:d.pass(`uniform float uHor,uDim; void main(){ vec2 q=design(vUv); float hy=q.y-uHor; vec3 c; if(hy>0.){ c=mix(vec3(.62,.78,.94),vec3(.12,.33,.70),pow(sat(hy/900.),.75)); vec2 cp=q/1350.+vec2(uTime*.006,0.); c=mix(c,vec3(1.),smoothstep(.52,.85,fbm(cp*vec2(2.,4.)))*sat(hy/130.)*.8); c=mix(c,vec3(1.),smoothstep(.60,.90,fbm(cp*vec2(4.,9.)+7.))*sat(hy/220.)*.45); } else { float dd=-hy/620.; c=mix(vec3(.91,.95,.99),vec3(.70,.80,.94),sat(dd)); c*=.95+.10*fbm(q*vec2(.01,.05)); c=mix(c,vec3(.62,.78,.94),exp(hy*.004)*.55); } c*=1.-uDim*.6*(1.-smoothstep(0.,680.,q.x))*(.45+.55*(1.-smoothstep(0.,720.,q.y))); o=vec4(c,1.); }`,'pile sky')}; }, draw(s,d,r){ const E=d.E,L=E.lin; const ride=s.k(0,.5,10.2,E.io3); const tilt=s.k(1,.2,3.8,E.io3); const step=r.S/r.N; const csA=14.5*step,csB=1.5*step; const cs=csA+(csB-csA)*ride; const c0=r.pt(cs),t0=r.tan(cs); const ro=[c0[0]-t0[1]*1.5,c0[1]+t0[0]*1.5,9.2-1.4*ride]; const up=r.pt(Math.min(r.S-1,cs+34*tilt)); const ta=[up[0]+t0[0]*2*tilt,up[1]+18*tilt+1.0,0]; r.setCam(ro,ta); const w=r.cam.w,hx=w[0],hz=w[2],hl=Math.hypot(hx,hz); let hor=1500; if(hl>1e-4){const q=r.pr([ro[0]+hx/hl*900,ro[1],ro[2]+hz/hl*900]);if(q.z>.2)hor=q.y;} r.sky.draw({uHor:hor,uDim:.2+.5*s.p[1]}); const c=d.ctx2d; const list=[]; for(let i=0;ib.z-a.z); let sel=null; for(const f of list){ const q=f.q,si=f.i-2; c.beginPath();c.moveTo(q[0].x,q[0].y);c.lineTo(q[1].x,q[1].y);c.lineTo(q[2].x,q[2].y);c.lineTo(q[3].x,q[3].y);c.closePath(); if(si>=0&&sip.x),ys=sel.map(p=>p.y); const x0=Math.min(...xs),y0=Math.min(...ys),x1=Math.max(...xs),y1=Math.max(...ys); d.select(x0,y0,Math.max(80,x1-x0),Math.max(56,y1-y0),{a:s.k(0,10.3,11.3,L)}); } const h=d.text('You are here.',{x:150,y:700,size:96,font:'display',color:'#12233a', show:s.k(0,10.4,11.6,L),hide:s.k(1,0,.6,L)}); d.text(r.date,{x:150,y:h.y+h.h+26,size:34,font:'mono',color:'#2b4664', show:s.k(0,10.9,12.1,L),hide:s.k(1,0,.6,L)}); d.text('This is\nthe flat part.',{x:150,y:120,size:100,font:'display',color:'#ffffff', show:s.k(1,.9,2.3,L)}); } });