Deck.scene({ id:'lamp', title:'How far you can see', enterWith:'fade', post:{bloom:.9,threshold:1,vignette:.3,grain:.035,exposure:1,tone:'aces'}, beats:[{dur:4,hold:4},{dur:6,hold:5},{dur:5,hold:5}], 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 { sky:d.pass(`uniform float uA,uB; uniform vec2 uM; float ember(vec2 q,float cells,float seed,float dens){ vec2 g=q*cells; vec2 id=floor(g),f=fract(g)-.5; float r=hash12(id+seed); vec2 off=(vec2(hash12(id+seed+3.),hash12(id+seed+7.))-.5)*.5; float on=step(r,dens); return on*smoothstep(.3,.0,length(f-off))*(.6+.4*hash12(id+1.3)); } float ln(vec2 p,vec2 a,vec2 b,float w){ vec2 pa=p-a,ba=b-a; float h=sat(dot(pa,ba)/dot(ba,ba)); return smoothstep(w,w*.4,length(pa-ba*h)); } vec3 night1(vec2 p){ float hz=-.2; vec2 L=vec2(.28,.04); vec3 amber=vec3(1.,.55,.18); float dl=length(p-L); float fl=.88+.12*sin(uTime*7.+sin(uTime*3.)*2.); float dx=p.x-L.x, dy=(p.y+.26)*2.2; float pool=(exp(-(dx*dx*16.+dy*dy*10.))*1.3+exp(-dl*dl*22.)*.9)*fl; vec3 c=vec3(.003,.0025,.002)+amber*.012*pool; float h=.07+.2*vnoise(vec2(p.x*22.,3.)); float sway=sin(uTime*1.4+p.x*5.)*.01*sat((p.y-hz+.3)*2.); float bl=smoothstep(.3,.8,vnoise(vec2((p.x+sway)*110.,p.y*5.))); float gm=smoothstep(hz+h+.004,hz+h-.004,p.y); vec3 gc=vec3(.01,.008,.004)+amber*pool*(.1+.9*bl)*(.35+.65*sat((p.y-hz+.3)/(h+.3))); c=mix(c,gc,gm*.97); for(int i=0;i<3;i++){ float fi=float(i); vec2 rc=vec2(.08+.2*fi,-.31-.025*fi); float rr=.05+.017*fi; vec2 rq=(p-rc)/vec2(1.3,.7); float m=smoothstep(.004,-.004,length(rq)-rr); float face=sat(.5+(L.x-rc.x)*2.+(p.y-rc.y)*6.); float rp=exp(-((rc.x-L.x)*(rc.x-L.x)*16.))*fl; vec3 rcol=vec3(.4,.28,.2)*(.4+.9*fbm(p*40.+fi))*(.05+rp*face*1.6); c=mix(c,rcol,m); } vec2 q2=p-vec2(.14,-.36); float pm=smoothstep(.004,-.002,sdBox(vec2(q2.x+q2.y*.7,q2.y*2.6),vec2(.075,.06))); c=mix(c,vec3(1.,.9,.72)*(.05+exp(-((.14-L.x)*(.14-L.x))*16.)*1.4*fl)*(.85+.3*vnoise(q2*80.)),pm); float pole=ln(p,vec2(.4,-.36),vec2(.4,.17),.004)+ln(p,vec2(.4,.17),vec2(.28,.17),.003)+ln(p,vec2(.28,.17),vec2(.28,.075),.0013); c=mix(c,vec3(.12,.07,.035)+amber*.5*exp(-length(p-vec2(.4,.0))*8.)*pool,sat(pole)); vec2 lq=p-L; float lb=sdBox(lq,vec2(.022,.03)); float frame=smoothstep(.003,.0,abs(lb))+smoothstep(.0015,.0,abs(lq.x))*step(lb,0.)*.5; c+=amber*1.6*smoothstep(.002,-.004,lb)*(.7+.3*fl); c=mix(c,vec3(.05,.03,.015),frame*.9); c+=vec3(1.,.8,.5)*5.*smoothstep(.009,.0,length((lq+vec2(0.,.004))/vec2(.7,1.2)))*fl; c+=vec3(1.,.55,.2)*.003/(dl*dl+.0012)*fl; for(int i=0;i<5;i++){ float fi=float(i); float a=uTime*(1.+.3*fi)+fi*1.7; vec2 mp=L+vec2(cos(a),sin(a*1.3))*(.06+.012*fi); float wing=.5+.5*sin(uTime*30.+fi); c+=vec3(1.,.85,.6)*smoothstep(.007,.0,length((p-mp)/vec2(1.,.5+.8*wing)))*1.6; } return c; } vec3 night2(vec2 p){ vec3 amber=vec3(1.,.55,.18); float w1=smoothstep(.1,.45,uA),w2=smoothstep(.3,.7,uA),w3=smoothstep(.5,.95,uA); float r1=exp(-abs(fbm(p*2.2+3.)-.5)*16.); float r2=exp(-abs(fbm(p*1.5+11.)-.5)*20.); float cl=smoothstep(.55,.8,fbm(p*3.+9.)); float dens=.7*r1+.6*r2+1.1*cl; float e=ember(p,36.,1.,dens*.12)*w1*3.+ember(p,100.,5.,dens*.2)*w2*2.5+ember(p,260.,9.,dens*.4)*w3*3.; vec3 c=amber*e+amber*dens*.012*w3+vec3(.006,.003,.001); float dl=length(p); c+=vec3(1.,.8,.5)*.0012/(dl*dl+.0003)*mix(1.5,.6,uA); c+=vec3(1.,.75,.4)*9.*smoothstep(.011,.006,dl); c+=amber*.5*exp(-dl*dl*70.); return c*(1.-.5*dot(p,p)); } vec3 dayc(vec2 p){ float hz=-.12; float cx=.3; vec2 S=vec2(cx,hz-.05+.11*uB); float ds=length(p-S); vec3 mist=vec3(.5,.6,.82); vec3 c=mix(vec3(.9,.45,.3),vec3(.1,.25,.6),smoothstep(hz,.7,p.y)); c=mix(c,vec3(1.,.65,.4),exp(-ds*2.5)*.4); if(p.y=0;i--){ float fi=float(i); float sc=1.-fi*.17; vec2 q=(p-vec2(cx,hz))/sc; float R=.2+.012*fi; float outer=sdBox(q-vec2(0.,.2),vec2(.42,.2))-.025+.03*(fbm(q*7.+fi*3.)-.5); float hole=min(length(q-vec2(0.,.14))-R,sdBox(q-vec2(0.,.07),vec2(R,.07))); float mass=max(outer,-hole)*sc; float m=smoothstep(.0025,-.0025,mass)*step(hz-.002,p.y); float band=smoothstep(.3,.7,.5+.5*sin(q.y*60.+fbm(q*5.+fi)*6.)); vec3 col=mix(vec3(.3,.04,.02),vec3(1.,.3,.05),band)*(.55+.6*fbm(q*12.+fi)); col*=.55+.6*sat(.5+(q.x)*-.9+q.y*.5); col*=.5+.5*smoothstep(0.,.03,-mass/sc); col=mix(col,mist*.7,sat(.04+fi*.19)); c=mix(c,col,m); } float ang=atan(p.y-S.y,p.x-S.x); float rays=pow(fbm(vec2(ang*6.,uTime*.04)),2.)*exp(-ds*1.2)*step(hz,p.y); c+=vec3(1.,.82,.6)*rays*.35*uB; for(int i=0;i<4;i++){ float fi=float(i); vec2 bp=vec2(-.45+.2*fi,.2+.07*sin(fi*2.))+vec2(.03*sin(uTime*.5+fi),.01*cos(uTime*.7+fi)); vec2 q=p-bp; float fl=.6*(.6+.4*sin(uTime*6.+fi*2.)); float b=smoothstep(.004,0.,abs(q.y-abs(q.x)*fl))*step(abs(q.x),.02); c=mix(c,vec3(.02),b); } return c; } void main(){ vec2 p=(vUv-.5)*vec2(uRes.x/uRes.y,1.)+uM*.01; vec2 q=design(vUv); vec3 n=mix(night1(p*(1.+uA*5.)),night2(p),smoothstep(.05,.3,uA)); n*=1.-.85*uA*smoothstep(1150.,500.,q.x)*smoothstep(380.,200.,q.y); vec3 c=mix(n,dayc(p),smoothstep(0.,.35,uB)); c*=1.-.7*uB*smoothstep(1150.,300.,q.x)*smoothstep(700.,820.,q.y); o=vec4(c,1.); }`,'lamp sky') } }, draw(s,d,r){ const L=d.E.lin, cream='#f3ead6', c=d.ctx2d; r.sky.draw({uA:s.k(1,0,5),uB:s.k(2,0,4.5),uM:[s.mouse.x,s.mouse.y]}); d.text('Intelligence is\nhow far you can see.',{x:150,y:150,size:96,color:cream,show:s.k(0,.3,1.6,L),hide:s.k(1,0,.6,L)}); d.text('Everyone alive',{x:150,y:150,size:120,color:cream,show:s.k(1,.8,2,L),hide:s.k(2,0,.6,L)}); d.text('Superintelligence',{x:150,y:800,size:120,color:cream,show:s.k(2,1.2,2.6,L)}); const ya=s.k(0,1.4,2.2,L)*(1-s.k(1,0,.4,L)); if(ya>0.01){ c.save(); c.globalAlpha=ya; c.strokeStyle=cream; c.lineWidth=2; c.beginPath(); c.moveTo(1186,404); c.lineTo(1236,470); c.stroke(); c.restore(); d.text('You',{x:1180,y:350,size:44,font:'display',color:cream,align:'right',show:ya,style:'fade'}); } const x=d.view.x1-110, y=d.view.y1-130; d.text('1.6 × 10^19',{x,y,size:56,font:'mono',color:cream,align:'right',style:'fade',show:s.k(0,.5,1.5,L),hide:s.k(1,0,.5,L)}); d.text('1.6 × 10^22',{x,y,size:56,font:'mono',color:cream,align:'right',style:'fade',show:s.k(1,.8,1.8,L),hide:s.k(2,0,.5,L)}); d.text('1.6 × 10^30',{x,y,size:56,font:'mono',color:cream,align:'right',style:'fade',show:s.k(2,1.2,2.2,L)}); } });