Deck.transition('fold',{dur:1.7,frag:` void main(){ if(p<=0.){o=texture(tA,vUv);return;} if(p>=1.){o=texture(tB,vUv);return;} float k=smoothstep(0.,.88,p); vec2 ctr=mix(vec2(.5),vec2(.718,.39),k); ctr.y+=.16*sin(3.14159*k); vec2 q=(vUv-ctr)/mix(vec2(1.),vec2(.246,.18),k)+.5; float crease=abs(q.x-.5)*2.; float top=1.-k*(.1+.62*(1.-abs(crease*2.-1.))); float bot=k*(.06+.32*crease); float m=step(0.,q.x)*step(q.x,1.)*step(bot,q.y)*step(q.y,top); vec2 uv=vec2(q.x,(q.y-bot)/max(top-bot,.01)); float f=uv.y-crease; uv=mix(uv,vec2(1.-uv.x,uv.y),k*step(0.,f)); vec3 paper=mix(texture(tA,clamp(uv,0.,1.)).rgb,vec3(.88,.86,.79),k*.79); paper*=1.-k*(.23*step(0.,f)+.12*step(q.x,.5)+.24*exp(-abs(f)*50.)); o=vec4(mix(texture(tB,vUv).rgb,paper,m*(1.-smoothstep(.84,1.,p))),1.); }`}); Deck.scene({ id:'boat',title:'Anchor',enterWith:'fold', post:{tone:'aces',exposure:1,bloom:.55,threshold:1.15,vignette:.18,grain:.022}, beats:[{dur:3,hold:4},{dur:4.8,hold:5},{dur:4.2,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 {sea:d.pass(` uniform float uDive,uGold,uRelease,uPop,uArr; uniform vec2 uMouse; float seg(vec2 p,vec2 a,vec2 b){vec2 v=b-a;return length(p-a-v*clamp(dot(p-a,v)/dot(v,v),0.,1.));} float crossv(vec2 a,vec2 b){return a.x*b.y-a.y*b.x;} float tri(vec2 p,vec2 a,vec2 b,vec2 c){ float k=sign(crossv(b-a,c-a)); float h=min(min(k*crossv(b-a,p-a)/length(b-a),k*crossv(c-b,p-b)/length(c-b)),k*crossv(a-c,p-c)/length(a-c)); return smoothstep(-1.,1.,h); } float swell(float x){return 5.*sin(x*.005+uTime*.75)+2.*sin(x*.011-uTime*.6);} float ridgeY(float x,float j){ float sc=1.+j*.55; float phase=x*.010/sc+2.17*j+uTime*(.49-.034*j); return 378.+19.*j+26.*j*j+(9.+10.*j+3.*j*j)* (sin(phase+.32*sin(.54*phase-j))+.27*sin(2.*phase-.8)+.18*sin(x*.007/sc+j)); } vec3 ocean(vec2 q,float hz,float sunx){ float h=max(1.,q.y-hz),z=170000./(h+4.); vec2 g=vec2((q.x-960.)*z*.001,z); float tm=uTime*.8; float a=sin(g.x*.013+g.y*.043+tm*1.8+sin(g.y*.025)); float b=sin(g.x*.017-g.y*.073-tm*2.+a*.9); float n=sin(g.x*.077+g.y*.13+2.*sin(g.x*.061-g.y*.03+tm)); float slope=(.48*a+.29*b+.19*n)*smoothstep(3.,55.,h); vec3 col=mix(vec3(.014,.057,.076),vec3(.22,.33,.35),smoothstep(-.62,1.05,slope)); float path=exp(-pow(abs(q.x-sunx)/(86.+h*.75),1.4)); col+=mix(vec3(1.1,.78,.48),vec3(2.3,1.36,.53),uGold)*path*(.04+smoothstep(.34,.98,slope)); col=mix(vec3(.27,.34,.35)+vec3(.45,.25,.09)*path,col,smoothstep(0.,48.,h)); if(uGold>.001){ vec3 waves=col; for(int i=0;i<6;i++){ float j=float(i),sc=1.+.55*j; float y=ridgeY(q.x,j); float dist=q.y-y; if(dist< -3.)continue; float slopeX=(ridgeY(q.x+4.,j)-y)*.25; float dep=max(0.,dist)/(13.+14.*j); float wav=sin(q.x*.035/sc+dist*.29/sc+1.5*sin(q.x*.018/sc-dist*.10/sc+tm)); float rip=.53*wav+.31*sin(q.x*.065/sc-dist*.51/sc+wav+tm)+.16*sin(q.x*.129/sc+dist*.61/sc-tm); float lit=sat(.55-1.38*slopeX+.21*rip); vec3 face=mix(vec3(.012,.064,.074),vec3(.105,.245,.232),lit)*(.73+.27*exp(-dep)); float skyRefl=.6*exp(-dep*.86)+.35*smoothstep(.6,2.4,dep); face+=mix(vec3(.12,.17,.17),vec3(.66,.37,.14),path)*skyRefl*(.65+.35*rip); float lip=exp(-max(dist,0.)/(2.+j*1.4)); face+=vec3(1.65,.85,.29)*lip*(.26+.74*lit)*(.66+.34*rip); face+=vec3(1.35,.77,.31)*path*smoothstep(.25,.97,rip)*(.18+.68*skyRefl); face=mix(vec3(.38,.38,.30),face,.51+.09*j); waves=mix(waves,face,smoothstep(-1.8,1.8,dist)); } col=mix(col,waves,uGold); } return col; } void main(){ vec2 q=design(vUv)+uMouse*vec2(5.,3.); float dive=uDive*(1.-uGold), hz=460.-158.*dive-117.*uGold; float cut=400.+swell(q.x)+3.*sin(q.x*.036+uTime); float sunx=1550.+95.*uGold; vec2 sp=vec2(sunx,hz-87.-24.*uGold); float altitude=clamp((hz-q.y)/550.,0.,1.); float ds=length((q-sp)/1080.); vec3 sky=mix(vec3(.54,.61,.60),vec3(.066,.109,.145),altitude); sky=mix(sky,mix(vec3(1.,.47,.19),vec3(.12,.24,.34),altitude),uGold*.93); sky+=vec3(.75,.45,.17)*exp(-ds*6.); vec2 cc=vec2(q.x*.0023+uTime*.013,q.y*.0063); float cl=fbm(cc+vec2(2.*vnoise(cc*.64),.4)); float gap=1.-smoothstep(.06,.34,ds+.12*(cl-.5)); float cloud=smoothstep(.26,.67,cl+.12*altitude-.09*uGold)*smoothstep(.0,.14,altitude)*(1.-gap*uGold); vec3 ash=mix(vec3(.052,.076,.093),vec3(.22,.16,.16),uGold); sky=mix(sky,ash*(.6+cl*.8)+vec3(.18,.12,.07)*exp(-ds*4.),cloud*.93); sky+=uGold*gap*vec3(.94,.46,.12); sky+=vec3(3.4,2.4,1.25)*(1.-smoothstep(.024,.026,ds))*(1.-cloud*.96); vec3 c=sky; if(q.y>hz)c=ocean(q,hz,sunx); float bx=1375.+36.*uGold; float ride=ridgeY(bx,3.); float tilt=atan((ridgeY(bx+70.,3.)-ridgeY(bx-70.,3.))/140.); float by=mix(mix(681.+swell(bx),452.+swell(bx),dive),ride-5.,uGold)-uPop*105.; vec2 pos=vec2(bx,by); float ang=mix(.015*sin(uTime*.72)+.69*dive,tilt-.048,uGold)-.14*uPop; mat2 turn=mat2(cos(ang),sin(ang),-sin(ang),cos(ang)); vec2 stern=pos+turn*vec2(-201.,-57.)*(1.+.06*uArr); vec2 an=vec2(1095.,894.); float below=smoothstep(cut-2.,cut+5.,q.y)*dive; if(below>.001){ float depth=clamp((q.y-cut)/580.,0.,1.); float beam=pow(.5+.5*sin(q.x*.019+q.y*.005+2.*sin(q.x*.007+uTime*.25)),5.); vec3 sub=mix(vec3(.042,.33,.31),vec3(.013,.114,.149),depth)+vec3(.09,.18,.115)*beam*(1.-depth)*.5; float floorY=873.+26.*sin(q.x*.0031)+14.*sin(q.x*.0073); float sand=smoothstep(floorY-12.,floorY+8.,q.y); float ridge=.5+.5*sin((q.y-floorY)*.13+4.*vnoise(q*.009)); sub=mix(sub,vec3(.20,.28,.208)*(.7+.26*ridge+.16*vnoise(q*.14)),sand); float cell=floor(q.x/19.),randv=hash12(vec2(cell,2.)); float ht=23.+70.*randv,gy=(floorY+37.+randv*36.-q.y)/ht; float gx=mod(q.x,19.)-9.5-sin(gy*2.6+uTime*.65+randv*4.)*gy*6.; float grass=(1.-smoothstep(1.,3.3,abs(gx)+2.*gy))*step(0.,gy)*step(gy,1.)*smoothstep(.31,.65,vnoise(vec2(cell*.13,8.))); sub=mix(sub,vec3(.021,.111,.097),grass*.9); sub*=.58+.42*smoothstep(580.,1180.,q.x); c=mix(c,sub,below); } vec2 ap=(q-an)/1.42; float metal=min(seg(ap,vec2(0.,-69.),vec2(0.,37.)),seg(ap,vec2(-23.,-49.),vec2(23.,-49.)))-6.; metal=min(metal,abs(length(ap-vec2(0.,-81.))-11.)-4.); metal=min(metal,max(abs(length(ap-vec2(0.,-16.))-53.)-5.,8.-ap.y)); float fluke=max(tri(ap,vec2(-55.,-5.),vec2(-55.,24.),vec2(-32.,15.)),tri(ap,vec2(55.,-5.),vec2(55.,24.),vec2(32.,15.))); vec3 iron=mix(vec3(.026,.064,.069),vec3(.29,.38,.32),.74*smoothstep(-4.,0.,metal)); c=mix(c,iron,below*max(fluke,1.-smoothstep(-1.,1.,metal))); vec2 endp=an+vec2(0.,-94.*1.42); vec2 startp=stern+vec2(0.,490.*uRelease); vec2 axis=endp-startp; float len=max(length(axis),1.); vec2 dir=axis/len; float along=dot(q-startp,dir),side=crossv(dir,q-startp); side-=20.*(1.-dive)*sin(3.14159*clamp(along/len,0.,1.)); float link=length(vec2((mod(along,15.)-7.5)/9.,side/(4.6+1.5*cos(floor(along/15.)*3.14159)))); float chain=(1.-smoothstep(.18,.48,abs(link-1.)))*step(0.,along)*step(along,len); float wet=smoothstep(by+8.,by+55.,q.y); c=mix(c,mix(vec3(.035,.055,.060),vec3(.44,.47,.40),smoothstep(0.,4.,side)),chain*mix(1.-wet,.93,dive)*(1.-uRelease)); vec2 bp=transpose(turn)*(q-pos)/(1.+.06*uArr); float shadow=exp(-pow((q.x-bx)/210.,2.)-pow((q.y-by-10.-(q.x-bx)*tilt*uGold)/21.,2.)); c*=1.-.49*shadow; vec2 l=vec2(-233.,-83.),rr=vec2(237.,-101.),bt=vec2(126.,6.),ft=vec2(-126.,12.),mid=vec2(-29.,-46.),peak=vec2(24.,-197.); float grain=.96+.073*hash12(floor(bp*1.6))+.019*vnoise(bp*.15); vec3 tint=mix(vec3(.88,.93,.91),vec3(1.,.87,.68),uGold)*grain; tint=mix(tint,vec3(.065,.34,.33)*grain,below*(.54+.37*smoothstep(0.,140.,q.y-cut))); c=mix(c,tint*.42,tri(bp,l,vec2(51.,-101.),rr)); c=mix(c,tint*1.12,tri(bp,vec2(-123.,-55.),peak,mid)); c=mix(c,tint*.77,tri(bp,peak,vec2(144.,-62.),mid)); c=mix(c,tint*.94,tri(bp,l,mid,ft)); c=mix(c,tint*.66,tri(bp,ft,mid,bt)); c=mix(c,tint*(.83+.18*clamp(bp.x/220.,0.,1.)),tri(bp,mid,rr,bt)); float rim=min(seg(bp,l,mid),seg(bp,mid,rr)); c=mix(c,tint*1.55,1.-smoothstep(.5,2.,rim)); float foam=exp(-abs(q.y-cut)*.36)*dive; c=mix(c,vec3(.68,.88,.79),foam*.8); c*=.63+.37*smoothstep(250.,1240.,q.x); o=vec4(c,1.); }`,'swell and folded paper')} }, draw(s,d,r){ const k=s.k(2,0,4.2),release=s.k(2,0,1.1); r.sea.draw({uDive:s.k(1,0,4.8),uGold:k,uRelease:release,uPop:Math.sin(Math.PI*s.k(2,.2,2.6)),uArr:s.k(0,0,3),uMouse:[s.mouse.x,s.mouse.y]}); const T={x:135,size:85,font:'display',color:'#fff7e6'}; d.text('Your gut expects tomorrow\nto look like today.',{...T,y:119,show:s.k(0,.18,1.8,d.E.lin),hide:s.k(1,0,.6)}); d.text('That is an anchor.',{...T,y:598,size:92,show:s.k(1,.94,2.1,d.E.lin),hide:s.k(2,0,.55)}); d.text('Let go.',{...T,y:137,size:166,show:s.k(2,.85,2.05,d.E.lin)}); } });