Deck.transition('daybreak',{dur:1.4,frag:`void main(){ float h=mix(-.15,1.15,p)+.06*sin(vUv.x*3.14159); float dd=vUv.y-h; vec4 a=texture(tA,vUv), b=texture(tB,vUv); float m=smoothstep(.02,-.02,dd); vec4 col=mix(a,b,m); float glow=exp(-abs(dd)*30.)*sin(3.14159*p); col.rgb+=vec3(1.,.75,.45)*glow*.9; o=col; }`}); Deck.scene({ id:'selectall', title:'Select all', enterWith:'daybreak', post:{bloom:1.0,threshold:1,vignette:.35,grain:.04}, beats:[{dur:4,hold:5},{dur:4.5,hold:5},{dur:5,hold:6}], notes:[ 'Up to now it has only been editing screens. Then it gets hands: robots, factories, factories that build factories. Farming economies doubled about every thousand years. Ours doubles about every twenty.', 'Once machines build the machines, the doubling time falls to a year, then to a month. That is not a new law of physics. It is what any copying process does when nothing holds it back. This part is my speculation, not a published forecast.', 'And there is a great deal of room. Everything our civilisation uses is about one part in twenty trillion of what the Sun puts out. So: select all.' ], setup(d){ return { U:{uC:[0,0],uSc:[0,0],uR:1,uA:0,uB:0,uS:0,uSh:0,uSr:240}, orb:d.pass(`uniform vec2 uC,uSc; uniform float uR,uA,uB,uS,uSh,uSr; const vec3 L=vec3(.5535,.7548,-.3522); float landf(vec3 n){ return smoothstep(.47,.57,fbm(n.xz*1.6+n.y*vec2(1.3,-.9)+2.)); } vec3 stars(vec2 q){ vec2 g=floor(q/3.); float h=hash12(g); return vec3(.7,.8,1.)*step(.996,h)*(.3+.7*hash12(g+3.))*(.7+.3*sin(uTime*2.+h*80.)); } vec3 earth(vec2 q,out float m,out vec3 atm){ vec2 e=(q-uC)/uR; e.y=-e.y; float r=length(e); m=smoothstep(1.,1.-1.5/uR,r); vec2 dir=e/max(r,1e-4); float side=sat(.5+.5*dot(dir,normalize(L.xy))); float lw=smoothstep(10.,300.,uR); atm=mix(vec3(.08,.22,.8),vec3(.6,.75,1.3),side*side)*(exp(-abs(r-1.)*uR/5.)*(.5+.9*side)+.2*exp(-abs(r-1.)*uR/40.))*(.4+.6*lw); vec3 n=vec3(e,sqrt(max(1.-r*r,0.))); vec3 nr=n; nr.xz=rot2(uTime*.012+.8)*nr.xz; float land=landf(nr); float day=sat(dot(n,L)*1.4+.05); vec3 c=vec3(.008,.012,.025)+land*vec3(.008,.006,.004); c+=mix(vec3(.02,.05,.12),vec3(.08,.07,.05),land)*day*1.5; float city=land*smoothstep(.55,.85,vnoise(nr.xy*70.+nr.z*53.))*smoothstep(.35,.65,fbm(nr.yz*6.+nr.x*4.)); c+=vec3(1.,.48,.13)*city*1.8*(1.-day); float lat=asin(clamp(nr.y,-1.,1.)), lon=atan(nr.x,nr.z); vec2 g=vec2(lon*20.372,lat*33.), id=floor(g), f=fract(g)-.5; vec2 dl=vec2(dFdx(lon),dFdy(lon)); dl=mod(dl+3.1416,6.2832)-3.1416; float aa=(abs(dl.x)+abs(dl.y))*20.372+fwidth(g.y); float lc=(id.y+.5)/33., oc=(id.x+.5)/20.372; float cl=landf(vec3(cos(lc)*sin(oc),sin(lc),cos(lc)*cos(oc))); float rnd=hash12(id+vec2(7.,300.)); float thr=max(uA*.75*cl,uB*.96); float on=sat((thr-rnd)*25.); float bx=smoothstep(aa*.6,-aa*.6,sdBox(f,vec2(.4,.36))); bx=mix(bx,.58,sat(aa*1.2-.3)); float lum=(.55+.4*hash12(id+19.)+1.6*exp(-max(thr-rnd,0.)*30.))*(.45+.55*n.z); c=mix(c,vec3(1.,.95,.88)*lum,on*bx); return c; } vec3 sun(vec2 q){ vec2 e=(q-uSc)/uSr; e.y=-e.y; float r=length(e); float ang=atan(e.y,e.x); vec2 dir=vec2(cos(ang),sin(ang)); vec3 c=vec3(1.,.55,.25)*.18/(r*r*3.+.25); float disc=smoothstep(1.,1.-2./uSr,r); c=mix(c,vec3(1.,.72,.42)*(2.+3.5*sqrt(max(1.-r*r,0.)))*(.85+.3*fbm(e*7.+uTime*.04)),disc); float rays=pow(vnoise(dir*14.+vec2(uTime*.03,0.)),4.)*1.5+pow(vnoise(dir*37.+5.),6.)*2.; c+=vec3(1.,.68,.4)*rays*uSh*2.5*smoothstep(1.1,1.45,r)/(r*r*.8+.4); vec2 se=e/1.25; float sr=length(se); vec3 n=vec3(se,sqrt(max(1.-sr*sr,0.))); n.xz=rot2(uTime*.015)*n.xz; float lat=asin(clamp(n.y,-1.,1.)), lon=atan(n.x,n.z); vec2 g=vec2(lon*10.186,lat*12.), id=floor(g), f=fract(g)-.5; vec2 dl=vec2(dFdx(lon),dFdy(lon)); dl=mod(dl+3.1416,6.2832)-3.1416; float aa=(abs(dl.x)+abs(dl.y))*10.186+fwidth(g.y); float rnd=hash12(id+vec2(41.,9.)); float pres=sat((uSh*1.1-rnd)*12.); float tb=smoothstep(aa*.6,-aa*.6,sdBox(f,vec2(.42,.4)*mix(.3,1.,pres)))*smoothstep(1.,1.-2./uSr,sr); tb=mix(tb,.8*smoothstep(1.,.98,sr),sat(aa*1.2-.3)); vec3 tc=hash12(id+3.)<.3?vec3(.75,.72,.68):vec3(.14,.025,.015); float fz=sat(sqrt(max(1.-sr*sr,0.))); tc*=.35+.65*fz; tc+=vec3(1.,.5,.2)*.25*pow(1.-fz,2.); c=mix(c,tc,pres*tb); return c; } void main(){ vec2 q=design(vUv); vec3 bg=stars(q); float m; vec3 atm; vec3 ec=earth(q,m,atm); vec3 c=mix(bg,ec,m)+atm; c+=sun(q)*uS; c*=1.-.6*smoothstep(1150.,450.,q.x)*smoothstep(560.,220.,q.y); o=vec4(c,1.); }`,'selectall orbit') }}, draw(s,d,r){ const E=d.E, L=E.lin, U=r.U, c=d.ctx2d; const lerp=(a,b,t)=>a+(b-a)*t; const z=s.k(1,0,3.5,E.io3), out=s.k(2,0,3,E.io3); const mx=s.mouse.x*12, my=s.mouse.y*12; let R=1150*Math.pow(350/1150,z), cx=lerp(1500,1300,z), cy=lerp(1500,600,z); R=R*Math.pow(10/350,out); cx=lerp(cx,700,out); cy=lerp(cy,880,out); cx+=mx; cy+=my; const sx=1380+mx*.6, sy=540+my*.6, Sr=240*(.75+.25*out); U.uC[0]=cx; U.uC[1]=cy; U.uR=R; U.uSc[0]=sx; U.uSc[1]=sy; U.uSr=Sr; U.uA=s.k(0,.8,4,L); U.uB=s.k(1,.6,4.5,E.io3); U.uS=s.k(2,.3,2.5); U.uSh=s.k(2,1,5,E.io3); r.orb.draw(U); const aG=s.k(1,2.8,3.6,L)*(1-s.k(2,0,.6,L)); if(aG>0){ c.save(); c.translate(cx,cy); c.rotate(-.12); const sz=2*R+60; d.select(-sz/2,-sz/2,sz,sz,{a:aG}); c.restore(); } const aS=s.k(2,3.6,4.4,L); if(aS>0){ c.save(); c.globalAlpha=.55; c.translate(sx,sy); c.rotate(-.04); const sz=2*Sr*1.25+60; d.select(-sz/2,-sz/2,sz,sz,{a:aS}); c.restore(); } const col='#f4efe6'; d.text('Farming economies doubled\nevery thousand years.\nOurs, every twenty.',{x:150,y:130,size:76,font:'display',color:col,show:s.k(0,.3,1.8,L),hide:s.k(1,0,.6,L)}); const h=d.text('Then every year.\nThen every month.',{x:150,y:140,size:92,font:'display',color:col,show:s.k(1,.8,2,L),hide:s.k(2,0,.6,L)}); d.text('illustration',{x:150,y:h.y+h.h+30,size:32,font:'mono',color:'#b9bfc9',style:'fade',show:s.k(1,1.6,2.6,L),hide:s.k(2,0,.6,L)}); d.text('Select all.',{x:150,y:150,size:150,font:'display',color:col,show:s.k(2,1,2.2,L)}); } });