Deck.scene({ id:'lamp', title:'How far you can see', enterWith:'fade', post:{bloom:1.2,threshold:.8,vignette:.3,grain:.04}, beats:[{dur:2,hold:4},{dur:6,hold:5},{dur:5,hold:6}], notes:[ 'Forget test scores. Intelligence is how far you can see. This is one person, with one lantern, in the dark. Everything inside the pool you can think about. Everything outside it is not there.', 'Now light the brightest lantern anyone ever carried. Einstein. Look at how much more of the field he lights. Almost nothing. Now everyone alive, all eight billion of us, together. It is beautiful. It is also still night.', 'So what does it look like when the sun comes up? All of this was always here. What we called the world was one small fold in it.' ], setup(d){ return { bg:d.pass(`uniform float uBack,uEin,uAll,uSun; uniform vec2 uM; vec3 grass(vec3 c, vec2 q, float fL, float li, vec3 warm){ float w=8.+fL*5.; float x=q.x+sin(uTime*.7+fL*2.+q.x*.002)*8.*sat((960.-q.y)/300.); float id=floor(x/w); float rnd=hash12(vec2(id,fL+1.)); float base=790.+fL*75.+rnd*40.; float top=base-(110.+(260.-fL*60.)*hash12(vec2(id,fL+9.))); float lean=(hash12(vec2(id,fL+3.))-.5)*.08; float fx=x-(id+.5)*w-lean*(base-q.y); float tp=sat((q.y-top)/(base-top)); float m=smoothstep(.6+1.6*tp,.1+1.*tp,abs(fx))*step(top,q.y)*step(q.y,base)*step(.2,rnd); vec3 straw=vec3(.6,.45,.24)*(.45+.6*rnd)*(.25+.75*tp)*li*warm*1.3+vec3(.004,.005,.008); return mix(c,straw,m); } vec3 closeup(vec2 q){ vec2 F=vec2(1350.,470.); float fl=.9+.1*sin(uTime*13.)*sin(uTime*7.3+1.); vec3 warm=vec3(1.,.55,.22)*fl; float r=length(q-F); float li=1.6/(1.+r*r/60000.)*exp(-r/700.); vec2 B=vec2(1350.,900.); float gp=exp(-length((q-B)*vec2(1.,2.6))/320.); vec3 c=vec3(.002,.002,.004); float gr=smoothstep(690.,760.,q.y); c+=vec3(.3,.2,.1)*(.5+.6*fbm(q*vec2(.02,.06)))*gp*warm*gr; vec2 v=rot2(.3)*vec2(q.x-1110.,(q.y-950.)*3.); float pm=smoothstep(2.,-2.,sdBox(v,vec2(85.,105.))); float ln=1.-.25*step(.6,fract(v.y/22.))*step(abs(v.x),60.)*step(abs(v.y),80.); c=mix(c,vec3(.8,.75,.62)*ln*li*warm*1.3,pm); for(int i=0;i<3;i++){ float fi=float(i); vec2 rc=vec2(1190.+fi*250.,905.+fi*25.); vec2 rr=vec2(75.-fi*15.,45.-fi*8.); vec2 dq=(q-rc)/rr; float e=length(dq)+.12*fbm(q*.03); float m=smoothstep(1.03,.97,e)*step(dq.y,.35); vec3 rk=vec3(.3,.26,.22)*(.35+.65*sat(-dq.y+.3))*(.6+.6*fbm(q*.05))*li*warm*1.3; c=mix(c,rk,m); } c=grass(c,q,0.,li,warm); c=grass(c,q,1.,li,warm); vec3 metal=vec3(.06,.045,.035)+vec3(.5,.3,.12)*li*.5; float pole=step(abs(q.x-1462.),5.)*step(330.,q.y)*step(q.y,905.); float hk=step(abs(length(q-vec2(1406.,330.))-56.),3.5)*step(q.y,330.); float ch=step(abs(q.x-1350.),1.5)*step(330.,q.y)*step(q.y,388.); float cap=step(sdBox(q-vec2(1350.,396.),vec2(30.,9.)),0.); float bas=step(sdBox(q-vec2(1350.,540.),vec2(36.,9.)),0.); float wire=step(abs(abs(q.x-1350.)-36.),2.)*step(400.,q.y)*step(q.y,535.); float gl=length((q-F)/vec2(40.,64.)); c=mix(c,warm*(.5+.6*(1.-gl))*1.2,smoothstep(1.02,.98,gl)); c=mix(c,metal,sat(pole+hk+ch+cap+bas+wire)); float fd=length((q-F-vec2(0.,6.))/vec2(10.,24.)); c+=vec3(1.,.7,.35)*6.*smoothstep(1.,.2,fd); c+=warm*(.6*exp(-r/45.)+.15*exp(-r/160.)); c=grass(c,q,2.,li,warm); for(int i=0;i<5;i++){ float fi=float(i); float an=uTime*(1.3+fi*.37)+fi*1.7; vec2 mp=F+vec2(cos(an)*(70.+fi*22.),sin(an*1.4)*(45.+fi*15.)); c+=vec3(1.,.85,.6)*1.2*smoothstep(4.5,1.5,length(q-mp)); } return c; } vec3 plain(vec2 p){ float hz=.3; float below=step(p.y,hz-.002); float ry=max(hz-p.y,.004); float t=2./ry; vec2 g=vec2(p.x*t,t); vec2 cg=g*6.; float aa=max(fwidth(cg.x),fwidth(cg.y)); vec2 id=floor(cg), f=fract(cg)-.5; float rnd=hash12(id); vec2 jo=vec2(hash12(id+3.1),hash12(id+5.7))-.5; float dd=length(f-jo*.6); float riv=max(exp(-abs(g.x-2.*sin(g.y*.21)-1.)*2.5),exp(-abs(g.x+3.-1.5*sin(g.y*.3+2.))*2.5)); float dens=sat(smoothstep(.5,.72,fbm(g*.3+3.))+.8*riv*(.5+.5*fbm(g*.8))); vec2 Y=vec2(1.67,4.76), Ei=vec2(2.3,5.6); float rv=sat((uAll*1.3-length(g-Y)/30.-rnd*.2)*8.); float on=step(rnd,dens*.8)*rv; float fli=.75+.25*sin(uTime*3.+rnd*40.); float I=2.5*(.5+rnd); float pt=on*smoothstep(.16,.0,dd)*I*fli; float avg=dens*.8*rv*.045*2.5; vec3 AMB=vec3(1.,.42,.12); vec3 c=AMB*mix(pt,avg,sat(aa*1.5-.5)); c+=AMB*.06*dens*rv; c+=AMB*(.5*exp(-length(g-Y)*7.)+uEin*.7*exp(-length(g-Ei)*4.5)); c*=exp(-t*.03)*below; c+=AMB*.04*uAll*exp(-abs(p.y-hz)*12.)*(1.-below); vec2 ys=vec2(Y.x/Y.y,hz-2./Y.y), es=vec2(Ei.x/Ei.y,hz-2./Ei.y); vec2 a=p-ys, b=p-es; c+=vec3(1.,.6,.3)*(.00003/(dot(a,a)+.00001)+uEin*.00008/(dot(b,b)+.00001)); return c; } float arch(vec2 q){ float outer=sdBox(q-vec2(0.,.15),vec2(.75,.65)); float hole=min(sdBox(q-vec2(0.,-.2),vec2(.42,.35)),length(q-vec2(0.,.15))-.42); return max(outer,-hole); } vec3 day(vec2 p){ float hz=-.12; vec2 sp=vec2(.02,hz+.02+.12*uSun); vec3 c=mix(vec3(.95,.75,.55),vec3(.25,.45,.75),smoothstep(hz,.5,p.y)); float sd=length(p-sp); c+=vec3(1.,.85,.6)*.06/(sd+.05); c+=vec3(8.)*smoothstep(.032,.028,sd); if(p.y 10^35',{...ro,show:s.k(2,2,3,L)}); d.text('illustration',{x,y:y-124,size:24,font:'mono',color:'#a99f90',align:'right',style:'fade',show:s.k(0,.5,1.5,L)}); const sb=s.k(2,1.5,4,L); if(sb>0){ const c=d.ctx2d; c.save(); c.globalAlpha=sb; c.strokeStyle='#2a1c1c'; c.lineWidth=3; c.lineCap='round'; for(let i=0;i<6;i++){ const bx=1050+((s.t*22+i*131)%650), by=260+((i*53)%120)+6*Math.sin(s.t*1.3+i), w=10+(i%3)*4, f=4*Math.sin(s.t*6+i*2); c.beginPath(); c.moveTo(bx-w,by-f); c.quadraticCurveTo(bx-w*.4,by-3,bx,by+2); c.quadraticCurveTo(bx+w*.4,by-3,bx+w,by-f); c.stroke(); } c.restore(); } } });