Deck.transition('daybreak', { dur: 1.35, frag: `void main(){ if(p<=0.){o=texture(tA,vUv);return;} if(p>=1.){o=texture(tB,vUv);return;} vec2 q=design(vUv); float arc=q.y-590.-.00029*(q.x-1380.)*(q.x-1380.); float edge=mix(1220.,-1280.,p); float h=arc-edge; float dawn=1.-smoothstep(-62.,28.,h); float flare=sin(3.14159*p); vec3 c=mix(texture(tA,vUv).rgb,texture(tB,vUv).rgb,dawn); c+=vec3(1.,.58,.23)*flare*(.19*exp(-abs(h)*.012)+.64*exp(-abs(h)*.14)); o=vec4(c,1.); }` }); Deck.scene({ id:'selectall', title:'Select all', enterWith:'daybreak', post:{tone:'aces',bloom:.88,threshold:1.04,vignette:.12,grain:.016,exposure:1}, beats:[{dur:4.4,hold:4},{dur:4.8,hold:5},{dur:5.2,hold:5}], 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:{uEarth:[0,0,0],uStar:[0,0,0],uGrowth:0,uPull:0,uAssembly:0,uTurn:0}, orbit:d.pass(` uniform vec3 uEarth,uStar; uniform float uGrowth,uPull,uAssembly,uTurn; const float PI=3.14159265; vec3 stars(vec2 q,float pitch,float salt){ vec2 g=q/pitch; vec2 id=floor(g); float a=hash12(id+salt); vec2 off=vec2(hash12(id+3.1+salt),hash12(id+7.7+salt))*.76+.12; float dist=length((fract(g)-off)*pitch); float light=exp(-dist*dist/mix(.75,3.3,a))*step(.86,a); light*=.83+.17*sin(uTime*.54+a*106.); return mix(vec3(.36,.53,.87),vec3(.93,.77,.58),hash12(id+59.))*light*(.18+.5*pow(a,7.)); } vec2 sphereUV(vec3 n,float turn,float tilt){ n.yz=rot2(tilt)*n.yz; return vec2(atan(n.x,n.z)/6.2831853+.5+turn,.5-asin(clamp(n.y,-1.,1.))/PI); } float mass(vec2 q,vec2 at,vec2 stretch){ vec2 e=q-at; e.x-=floor(e.x+.5); return 1.-length(e/stretch); } vec3 nightEarth(vec3 bg,vec2 q){ vec2 p=(q-uEarth.xy)/uEarth.z; float r=length(p); if(r>1.10)return bg; float air=exp(-max(r-1.,0.)*79.); float lightSide=.34+.66*clamp(-p.x*.52-p.y*.48+.5,0.,1.); vec3 outside=bg+vec3(.038,.22,.58)*lightSide*air; if(r>=1.)return outside; float z=sqrt(max(0.,1.-dot(p,p))); vec3 n=vec3(p,z); vec2 uv=sphereUV(n,uTurn,-.18); vec2 terrain=uv+vec2(.031*sin(uv.y*36.+sin(uv.x*26.)),.028*sin(uv.x*38.)); float land=max(mass(terrain,vec2(.425,.33),vec2(.115,.17)), mass(rot2(.28)*(terrain-vec2(.495,.60))+vec2(.495,.60),vec2(.495,.60),vec2(.058,.15))); land=max(land,mass(terrain,vec2(.68,.43),vec2(.077,.128))); land=max(land,mass(terrain,vec2(.76,.28),vec2(.17,.103))); land=max(land,mass(terrain,vec2(.88,.65),vec2(.07,.064))); float rough=vnoise(uv*vec2(92.,66.)); land=smoothstep(-.15,.16,land+(rough-.5)*.55); float clouds=vnoise(uv*vec2(16.,29.)+vec2(uTime*.009,0.))*.66 +vnoise(uv*vec2(46.,82.)-vec2(uTime*.01,0.))*.34; vec3 globe=mix(vec3(.008,.022,.052),vec3(.029,.050,.061),land); globe+=vec3(.036,.060,.10)*smoothstep(.53,.88,clouds); globe*=.67+.33*z; vec2 city=uv*vec2(720.,405.), id=floor(city); float seed=hash12(id); float hubs=smoothstep(.30,.76,vnoise(uv*vec2(139.,102.))); float lit=step(.984-hubs*.28,seed)*land; vec2 off=vec2(hash12(id+23.),hash12(id+71.))*.52+.24; vec2 f=fract(city)-off; float dotLight=exp(-dot(f,f)*mix(26.,12.,hubs))*lit; float resolved=smoothstep(.11,.61,z)*smoothstep(42.,168.,uEarth.z); globe+=vec3(1.6,.56,.112)*(dotLight*(.65+2.1*hubs)*resolved+.045*hubs*land); vec2 arrayUV=uv*vec2(46.,26.); vec2 cell=floor(arrayUV); vec2 tile=fract(arrayUV)-.5; float key=hash12(cell+132.); float cut=mix(.25+.67*key,.06+.66*key,land); float power=smoothstep(cut,cut+.09,uGrowth); float plate=sdBox(tile,vec2(.405,.29)); float mask=1.-smoothstep(-.026,.018,plate); float glass=1.-smoothstep(-.023,.015,sdBox(tile,vec2(.347,.225))); float detail=(1.-smoothstep(.022,.047,abs(tile.y-.137)))*step(-.29,tile.x)*step(tile.x,.12); vec3 white=mix(vec3(.086,.18,.24),mix(vec3(.8,1.10,1.24),vec3(1.98,1.91,1.73),key),glass); white*=1.-.42*detail; globe=mix(globe,white*(.39+.72*z),mask*power*smoothstep(.045,.27,z)); globe+=vec3(.20,.39,.58)*power*exp(-max(plate,0.)*14.)*.16*z; globe+=vec3(.040,.23,.61)*exp(-z*9.)*lightSide; return mix(globe,outside,smoothstep(.995,1.,r)); } vec3 shell(vec3 base,vec3 n,float face,float z){ vec2 uv=sphereUV(n,.05+uTurn*.28,.25); vec2 g=uv*vec2(52.,29.); vec2 id=floor(g), f=fract(g)-.5; float h=hash12(id+48.); float wave=.57*h+.27*uv.y+.12*abs(sin(id.x*.17)); float lock=smoothstep(wave-.18,wave+.10,uAssembly); float present=smoothstep(wave-.34,wave-.22,uAssembly)*step(.13,h); f.y-=(1.-lock)*(.40+.18*h); float dist=sdBox(f,vec2(.410,.365)*( .52+.48*lock )); float aa=mix(.065,.014,smoothstep(.05,.60,z)); float plate=(1.-smoothstep(-aa,aa,dist))*present; float rim=smoothstep(-.12,-.034,dist); vec3 red=vec3(.17,.024,.016)*(.65+.67*max(dot(n,vec3(-.61,-.47,.63)),0.)); vec3 white=vec3(.68,.47,.33)*(.7+.9*max(dot(n,vec3(-.61,-.47,.63)),0.)); vec3 tile=mix(red,white,step(.70,h)); tile*=face; tile+=vec3(1.65,.43,.08)*rim*smoothstep(.85,.12,z)*.57; tile+=vec3(.26,.10,.04)*rim*(.5+.5*sin((f.x+f.y)*4.)); return mix(base,tile,plate); } vec3 solar(vec3 bg,vec2 q){ vec2 p=(q-uStar.xy)/uStar.z; float r=length(p); float a=atan(p.y,p.x); float beam=.5+.5*sin(a*39.+2.7*sin(a*13.)+.24*sin(uTime*.27)); float fine=.5+.5*sin(a*81.+2.3*sin(a*27.)); float longRay=pow(beam,17.)*(.2+.8*pow(.5+.5*sin(a*9.+1.),3.)); float rays=(longRay*.87+pow(fine,12.)*.12)*exp(-max(r-1.,0.)*1.55); float plume=exp(-max(r-1.,0.)*5.5)*(.27+.13*sin(a*15.+sin(a*7.))); float halo=.16*exp(-max(r-.87,0.)*2.15); float spread=smoothstep(.65,1.17,r); vec3 c=bg+vec3(1.,.35,.075)*(halo+plume+rays*spread)*( .75+.52*uAssembly ); float ring=1.24; if(r1.001){ float z=sqrt(max(0.,1.-r*r/(ring*ring))); c=shell(c,vec3(p/ring,-z),.53,z); } if(r<1.003){ float z=sqrt(max(0.,1.-r*r)); vec2 surface=sphereUV(vec3(p,z),.08,.18); vec2 g=surface*vec2(87.,68.); float billow=vnoise(g*.24+vec2(uTime*.036,-uTime*.024)); float mottling=vnoise(g+vec2(0.,uTime*.045)); float threads=vnoise(g*2.3+billow*1.57); float heat=smoothstep(.17,.88,.56*billow+.28*mottling+.16*threads); vec3 fire=mix(vec3(2.05,.27,.034),vec3(4.0,2.1,.58),heat); fire*=.53+.52*pow(z,.52); fire+=vec3(1.75,.61,.105)*pow(1.-z,9.); c=mix(c,fire,1.-smoothstep(.993,1.003,r)); } if(r0.001){ vec3 sun=solar(c,q); c=mix(c,sun,smoothstep(0.,.55,uPull)); } if(uPull<.997)c=mix(c,nightEarth(c,q),1.-smoothstep(.67,.997,uPull)); o=vec4(c,1.); } `,'Orbital night and solar shell') }; }, draw(s,d,r){ const E=d.E,L=E.lin,U=r.U; const orbit=s.k(1,0,4.8,E.io3), pull=s.k(2,0,5.2,E.io3); const retreat=s.k(2,.12,3.8,E.out3); const mx=s.mouse.x*9+3*Math.sin(s.t*.21), my=s.mouse.y*7; U.uEarth[0]=1480-96*orbit+570*retreat+mx; U.uEarth[1]=704-125*orbit+279*retreat+my; U.uEarth[2]=(452-137*orbit)*(1.-.93*retreat); U.uStar[0]=1384+249*(1.-retreat)+mx; U.uStar[1]=573+94*(1.-retreat)+my; U.uStar[2]=112+146*retreat; U.uGrowth=.08+.32*s.k(0,.35,4.4)+.60*s.k(1,.38,4.65); U.uPull=pull; U.uAssembly=s.k(2,.68,5.2,E.io3); U.uTurn=.026+s.t*.00135+orbit*.046+s.mouse.x*.003; r.orbit.draw(U); const ctx=d.ctx2d; const earthBox=s.k(1,2.55,3.35,L)*(1.-s.k(2,0,.77,L)); if(earthBox>0){ const b=U.uEarth[2]+31; ctx.save(); ctx.translate(U.uEarth[0],U.uEarth[1]); ctx.rotate(-.09); d.select(-b,-b,2*b,2*b,{a:earthBox}); ctx.restore(); } const starBox=s.k(2,3.58,4.79,L); if(starBox>0){ const b=U.uStar[2]*1.24+27; ctx.save(); ctx.translate(U.uStar[0],U.uStar[1]); ctx.rotate(.066); d.select(-b,-b,2*b,2*b,{a:.47*starBox}); ctx.restore(); } d.text('Farming economies doubled every thousand years.\nOurs, every twenty.',{ x:144,y:91,size:65,font:'display',color:'#f7f4ed',by:'line', show:s.k(0,.28,1.85,L),hide:s.k(1,0,.64,L) }); const h=d.text('Then every year.\nThen every month.',{ x:144,y:322,size:88,font:'display',color:'#f7f4ed',by:'line', show:s.k(1,.83,2.12,L),hide:s.k(2,0,.65,L) }); d.text('illustration',{ x:149,y:h.y+h.h+30,size:32,font:'mono',color:'#aebdce',style:'fade', show:s.k(1,1.88,2.55,L),hide:s.k(2,0,.65,L) }); d.text('Select all.',{ x:144,y:414,size:146,font:'display',color:'#fff1dd', show:s.k(2,.88,2.08,L) }); } });