Deck.transition('fold', { dur:1.65, frag:`vec2 corner(int i){ if(i==0)return vec2(0.,1.); if(i==1)return vec2(.5,1.); if(i==2)return vec2(1.,1.); if(i==3)return vec2(1.,0.); if(i==4)return vec2(.5,0.); return vec2(0.,0.); } vec2 crease(int i){ if(i==0)return vec2(-230.,-30.); if(i==1)return vec2(-15.,-175.); if(i==2)return vec2(240.,-30.); if(i==3)return vec2(148.,76.); if(i==4)return vec2(0.,83.); return vec2(-136.,76.); } float wedge(vec2 a,vec2 b){return a.x*b.y-a.y*b.x;} void main(){ if(p<=0.){o=texture(tA,vUv);return;} if(p>=1.){o=texture(tB,vUv);return;} vec2 q=design(vUv); float fold=smoothstep(0.,.59,p), drop=smoothstep(.46,.87,p); vec2 landing=vec2(1330.,566.); vec2 pin=landing+vec2(-58.,-300.)*(1.-drop); float scale=mix(1.22,.78,drop); vec2 c=mix(design(vec2(.5)),pin,fold); vec3 col=texture(tB,vUv).rgb; float splash=smoothstep(.77,.86,p)*(1.-smoothstep(.87,1.,p)); float ring=length((q-landing-vec2(0.,47.))*vec2(1.,3.5)); col+=vec3(.53,.63,.64)*splash*exp(-abs(ring-380.*(p-.76))*.13); for(int i=0;i<6;i++){ int j=(i+1)%6; vec2 ua=corner(i),ub=corner(j); vec2 ra=crease(i),rb=crease(j); float buckle=sin(3.14159*fold); ra.y+=buckle*(mod(float(i),2.)-.5)*98.; rb.y+=buckle*(mod(float(j),2.)-.5)*98.; vec2 a=mix(design(ua),pin+ra*scale,fold)-c; vec2 b=mix(design(ub),pin+rb*scale,fold)-c; float den=wedge(a,b); vec2 k=vec2(wedge(q-c,b),wedge(a,q-c))/(den<0.?min(den,-.01):max(den,.01)); float edge=min(min(k.x,k.y),1.-k.x-k.y); if(edge>=0.){ vec2 uv=vec2(.5)+k.x*(ua-.5)+k.y*(ub-.5); float lit=.79+.20*cos(float(i)*1.7); vec3 sheet=mix(texture(tA,uv).rgb,vec3(.91,.94,.93),smoothstep(.26,.72,p)); sheet*=mix(1.,lit,fold); sheet-=vec3(.11)*sin(3.14159*fold)*exp(-edge*34.); col=mix(col,sheet,1.-smoothstep(.77,.98,p)); } } o=vec4(col,1.); }` }); Deck.scene({ id:'boat', title:'Anchor', enterWith:'fold', post:{tone:'none',bloom:0,vignette:0,grain:0}, beats:[{dur:2.1,hold:4},{dur:4.5,hold:5},{dur:4.4,hold:5}], notes:[ 'This is how most of us forecast. We look at today, and we assume tomorrow will be about the same. Calm sea, small boat.', 'Psychologists call it anchoring. The sea is AI progress, and it keeps rising. The chain is exactly as long as it was when we first made up our minds, so it pulls us under.', 'You cannot make the chain longer fast enough. You can only let go of it.' ], setup(d){ return { U:{uBoat:[0,0,0,0],uStern:[0,0],uLook:[0,0],uDive:0,uGold:0,uRelease:0}, ocean:d.pass(` uniform vec4 uBoat; uniform vec2 uStern,uLook; uniform float uDive,uGold,uRelease; const vec3 ink=vec3(.058,.115,.146); float cross2(vec2 a,vec2 b){return a.x*b.y-a.y*b.x;} float edge(vec2 q,vec2 a,vec2 b){return cross2(b-a,q-a)/length(b-a);} float tri(vec2 q,vec2 a,vec2 b,vec2 c){ float s=sign(cross2(b-a,c-a)); float h=min(min(edge(q,a,b),edge(q,b,c)),edge(q,c,a))*s; if(s<0.)h=min(min(-edge(q,a,b),-edge(q,b,c)),-edge(q,c,a)); return smoothstep(-1.2,.8,h); } float stroke(vec2 q,vec2 a,vec2 b){ vec2 v=b-a; return length(q-a-v*clamp(dot(q-a,v)/dot(v,v),0.,1.)); } vec2 localBoat(vec2 p){ vec2 v=(p-uBoat.xy)/uBoat.w; float c=cos(uBoat.z),s=sin(uBoat.z); return vec2(c*v.x+s*v.y,-s*v.x+c*v.y); } vec4 paper(vec2 v){ vec2 a=vec2(-250.,-33.), b=vec2(-148.,-12.), m=vec2(-12.,-52.); vec2 t=vec2(-21.,-170.), n=vec2(101.,-22.), z=vec2(247.,-50.); vec2 l=vec2(-147.,66.), r=vec2(142.,69.), k=vec2(5.,45.); vec3 w=mix(vec3(.83,.88,.91),vec3(1.,.91,.74),uGold); vec3 col=w*.92; float aa=tri(v,b,t,m), ab=tri(v,m,t,n); col=mix(col,w*1.05,aa); col=mix(col,w*.72,ab); float ac=tri(v,a,m,z), ad=tri(v,a,l,k), ae=tri(v,a,k,z); float af=tri(v,k,r,z), ag=tri(v,l,r,k); col=mix(col,w*.39,ac); col=mix(col,w*.79,ad); col=mix(col,w*.98,ae); col=mix(col,w*.86,af); col=mix(col,w*.65,ag); float seam=min(stroke(v,a,k),stroke(v,k,z)); col+=w*.07*exp(-seam*.46); float tooth=hash12(floor(v*1.25)); col*=.963+.042*tooth+.023*vnoise(v*vec2(.018,.36)); return vec4(col,max(max(max(aa,ab),max(ac,ad)),max(max(ae,af),ag))); } vec3 sky(vec2 q,float h){ vec2 xy=vec2(q.x/1080.,h)+uLook*.009; vec3 dusk=mix(vec3(.49,.55,.57),vec3(.14,.20,.25),smoothstep(-.04,.49,h)); vec3 warm=mix(vec3(.81,.57,.36),vec3(.29,.38,.48),smoothstep(-.04,.53,h)); vec3 c=mix(dusk,warm,uGold); vec2 f=vec2(xy.x*2.55,xy.y*5.9); float cloud=fbm(f+vec2(uTime*.023,.8)); cloud+=.15*vnoise(f*2.75+vec2(-uTime*.016,4.)); float cover=smoothstep(.45-.095*(1.-uGold),.70+.08*uGold,cloud); vec2 sun=vec2((q.x-1590.)/1080.,h-.090); float ds=length(sun); vec3 lamp=mix(vec3(.71,.67,.57),vec3(1.,.68,.31),uGold); c+=lamp*exp(-ds*7.)*(.19+.40*uGold); vec3 body=mix(vec3(.115,.154,.195),vec3(.27,.27,.32),uGold); body+=lamp*(.09+.17*uGold)*exp(-ds*3.)*(1.-smoothstep(.03,.45,h)); c=mix(c,body,cover*.92); c+=lamp*(.10+.33*uGold)*exp(-ds*10.)*(1.-cover*.8); c=mix(c,vec3(1.,.91,.72), (1.-smoothstep(.013,.019,ds))*(.59+.41*uGold)*(1.-cover*.78)); return c; } vec3 surface(vec2 q,float horizon){ float dy=max(q.y-horizon,3.); float depth=5050./(dy+10.); float X=(q.x-960.+uLook.x*16.)*depth*.002; float tm=uTime; vec2 g=vec2(X,depth); float weather=.24+.76*uGold; float a=sin(.33*g.x+.71*g.y-tm*.78); float b=sin(-.42*g.x+1.14*g.y+tm*.91+.58*a); float f=vnoise(vec2(.98*g.x,2.9*g.y)+vec2(tm*.13,-tm*.31)); float fine=vnoise(vec2(g.x*3.3,g.y*9.6)+vec2(-tm*.21,tm*.43)); float relief=.43*a+.22*b+.23*(f-.5)+.17*(fine-.5); vec3 deep=mix(vec3(.096,.201,.247),vec3(.096,.197,.222),uGold); vec3 high=mix(vec3(.44,.55,.56),vec3(.67,.49,.32),uGold); vec3 c=mix(deep,high,clamp(.37+relief*(.37+.32*weather),0.,1.)); c*=1.-.26*weather*smoothstep(.04,.59,-relief); float track=(q.x-1590.)/(105.+dy*.49); float glare=exp(-track*track*1.24); float glint=smoothstep(.29,.61,relief+.28*(fine-.5))*(.25+.75*f); c+=mix(vec3(.26,.27,.21),vec3(.89,.54,.21),uGold)*glare*glint*(.45+.92*uGold); float ridge=smoothstep(.48,.66,relief)*smoothstep(.49,.79,fine); c+=vec3(.51,.57,.55)*weather*ridge*.37; vec3 haze=mix(vec3(.38,.45,.47),vec3(.64,.46,.34),uGold); c=mix(c,haze,exp(-dy*.032)*.89); return c; } float grass(vec2 q,float row,float span){ float xx=q.x+row*1.17; float id=floor(xx/span); float rnd=hash12(vec2(id,row)); float xx0=(id+.24+.46*rnd)*span; float base=row+34.*(rnd-.5); float tall=42.+rnd*112.; float y=(base-q.y)/tall; float bend=y*y*(19.+14.*sin(uTime*.65+rnd*7.)); float x=xx-xx0-bend; float blade=min(abs(x+y*13.),min(abs(x-y*(15.+18.*rnd)),abs(x-3.))); return (1.-smoothstep(1.,3.7,blade+1.4*y))*smoothstep(0.,.11,y)*(1.-smoothstep(.68,1.03,y))*step(.46,rnd); } vec3 below(vec2 q,float line){ float y=max(q.y-line,0.); vec3 c=mix(vec3(.175,.51,.535),vec3(.034,.168,.187),smoothstep(3.,580.,y)); float beams=sin((q.x-1630.)*.012+y*.008+sin(y*.004+uTime*.44)*.8); c+=vec3(.20,.45,.40)*(.11*exp(-y*.005)*pow(max(0.,beams),3.)); float floorY=771.+21.*sin(q.x*.004); float v=smoothstep(floorY-31.,floorY+161.,q.y); if(q.y>floorY-32.){ float z=1400./max(48.,q.y-floorY+100.); vec2 g=vec2((q.x-960.)*z*.011,z*3.1); float grit=vnoise(g*8.); float ripple=.5+.5*sin(g.y*4.2+g.x*.11+vnoise(g*.42)*6.); float caustic=pow(.5+.5*sin(g.y*2.+g.x*.61+uTime*.57)*sin(g.x*.36-g.y*.83-uTime*.38),7.); vec3 sand=mix(vec3(.17,.29,.252),vec3(.62,.59,.42),.37+.20*ripple+.18*grit); sand+=vec3(.27,.44,.30)*caustic*.48; float sh=length((q-vec2(1489.,921.))*vec2(.009,.037)); sand*=1.-.45*exp(-sh*sh); c=mix(c,sand,v*.89); } float weed=grass(q,861.,82.)*.46+grass(q,1001.,129.)*.68; c=mix(c,vec3(.064,.23,.163),sat(weed)); float left=smoothstep(90.,740.,q.x); c*=.55+.45*left; vec2 s=q+vec2(13.*sin(uTime*.32),-uTime*13.); vec2 cell=floor(s/54.); vec2 loc=fract(s/54.)-.5; float r=hash12(cell); c+=vec3(.25,.38,.33)*step(.966,r)*(1.-smoothstep(.017,.047,length(loc)))*smoothstep(0.,85.,y); return c; } float ironAnchor(vec2 q){ vec2 v=q-vec2(1490.,854.); v=vec2(v.x+.23*v.y,v.y-.23*v.x); float stem=stroke(v,vec2(0.,-57.),vec2(0.,57.))-7.; float eye=abs(length(v-vec2(0.,-67.))-12.)-4.4; float stock=stroke(v,vec2(-32.,-35.),vec2(32.,-35.))-5.5; vec2 a=(v-vec2(0.,7.))/vec2(1.22,.88); float arms=max(abs(length(a)-51.)-6.,5.-v.y); float shaft=min(min(stem,eye),min(stock,arms)); float fluke=tri(vec2(abs(v.x),v.y),vec2(57.,1.),vec2(34.,24.),vec2(71.,26.)); return max(1.-smoothstep(-1.,1.5,shaft),fluke); } void main(){ vec2 q=design(vUv); float horizon=455.-19.*uDive+uLook.y*6.; float h=(horizon-q.y)/1080.; vec3 c=q.y0.)c=mix(c,below(q,line),submerged); if(abs(q.x-uBoat.x)<325. && abs(q.y-uBoat.y)<255.){ float foot=uBoat.y+58.*uBoat.w; float gy=q.y-foot; if(gy>0. && submerged<.99){ float slip=sin(gy*.096+uTime*2.1)*(.10*gy+3.); float shadow=length(vec2((q.x-uBoat.x+slip)/188.,gy/43.)); c*=1.-.56*exp(-shadow*shadow*1.4)*(1.-submerged); vec2 rv=localBoat(vec2(q.x+slip,foot-gy*1.43)); vec4 refl=paper(rv); c=mix(c,refl.rgb,.31*refl.a*exp(-gy*.021)*(1.-submerged)); float wake=exp(-abs(gy-9.-.00023*pow(q.x-uBoat.x,2.)-2.*sin(q.x*.14-uTime*2.))*.21); c+=vec3(.19,.23,.20)*wake*exp(-abs(q.x-uBoat.x)*.008)*(1.-submerged); } vec4 sheet=paper(localBoat(q)); vec3 wet=sheet.rgb*vec3(.32,.63,.61); c=mix(c,mix(sheet.rgb,wet,submerged),sheet.a); } vec2 tip=mix(uStern,vec2(1398.,746.),smoothstep(0.,1.,uRelease)); vec2 end=vec2(1474.,789.); float span=max(20.,end.y-tip.y); float t=clamp((q.y-tip.y)/span,0.,1.); float bow=mix(-55.,-8.,uDive)+23.*uRelease; float cx=mix(tip.x,end.x,t)+bow*4.*t*(1.-t); float slope=(end.x-tip.x+4.*bow*(1.-2.*t))/span; float crosswise=(q.x-cx)*inversesqrt(1.+slope*slope); if(q.y>=tip.y-4. && q.y0. && q.y>755. && q.y<941. && abs(q.x-1490.)<109.){ float a=ironAnchor(q)*submerged; vec3 metal=mix(vec3(.066,.122,.123),vec3(.25,.317,.265),.22+.59*vnoise(q*.11)); c=mix(c,metal,a); } if(uDive>.03){ float lip=exp(-abs(q.y-line)*.19)*uDive; float fleck=vnoise(vec2(q.x*.067,q.y*.28)+uTime*.28); c=mix(c,vec3(.57,.76,.71),lip*(.22+.41*smoothstep(.43,.85,fleck))); c*=1.-.18*uDive*exp(-abs(q.y-line-9.)*.13); } float vign=dot((vUv-.5)*vec2(1.14,.91),(vUv-.5)*vec2(1.14,.91)); c*=1.-.31*vign; c+=(hash12(floor(q*1.14))-.5)*.021; o=vec4(clamp(c,0.,1.),1.); }`,'Anchor | folded paper and split sea') }; }, draw(s,d,r){ const E=d.E, U=r.U; const rise=s.k(1,.06,3.85,E.out3); const release=s.k(2,.36,1.72,E.out3); const retreat=s.k(2,.65,3.18,E.io3); const warm=s.k(2,.45,4.4,E.io3); const jump=s.k(2,.42,2.8,E.lin); const slack=s.k(2,.38,1.58,E.out3); U.uDive=rise*(1-retreat); U.uGold=warm; U.uRelease=slack; U.uLook[0]=s.mouse.x; U.uLook[1]=s.mouse.y; const bob=Math.sin(s.t*(1.03+.27*warm)); const heave=Math.sin(Math.PI*jump)*Math.exp(-1.48*jump); U.uBoat[0]=1330+35*rise-21*release+s.mouse.x*9; U.uBoat[1]=566-165*rise+167*release-208*heave+bob*(5+20*warm); U.uBoat[2]=-.04+.31*rise-.33*release-.32*heave+.025*bob+.08*warm*Math.sin(s.t*1.22+.7); U.uBoat[3]=.78+.16*rise+.11*warm; const a=U.uBoat[2], scale=U.uBoat[3]; U.uStern[0]=U.uBoat[0]+scale*(-180*Math.cos(a)-27*Math.sin(a)); U.uStern[1]=U.uBoat[1]+scale*(-180*Math.sin(a)+27*Math.cos(a)); r.ocean.draw(U); d.text('Your gut expects tomorrow\nto look like today.',{ x:147,y:133,size:78,font:'display',color:'#f5f4ea', show:s.k(0,.32,1.8,E.lin),hide:s.k(1,0,.61,E.lin) }); d.text('That is an anchor.',{ x:147,y:575,size:96,font:'display',color:'#edf7ed', show:s.k(1,1.34,2.53,E.lin),hide:s.k(2,0,.59,E.lin) }); d.text('Let go.',{ x:142,y:143,size:174,font:'display',color:'#fff3dc', show:s.k(2,.88,2.27,E.lin) }); } });