Deck.transition('fold',{dur:1.4,frag:`void main(){ vec2 q=(vUv-.5)*vec2(uRes.x/uRes.y,1.); float g=smoothstep(.12,.85,p), sc=.26*pow(160.,1.-g); // the sheet shrinks from full frame to boat size vec2 ctr=mix(vec2(0.),vec2(.42,-.19),g)+vec2(0.,.1*sin(3.1416*g)); // and arcs down to where the scene's boat floats vec2 l=(q-ctr)/sc; float ax=abs(l.x); float dh=max(max(-(l.y+.14),l.y-.24*ax),ax-.22-(l.y+.14)*1.1), dt=max(l.y-.3+ax*1.1,-l.y-.05), dd=min(dh,dt); // paper boat outline float m=smoothstep(.015,0.,dd)*(1.-smoothstep(.86,1.,p)); float cr=smoothstep(0.,.2,p); float ln=smoothstep(.004,0.,min(abs(q.x),min(abs(q.y),abs(abs(q.x)-abs(q.y)))))*cr*(1.-smoothstep(.3,.6,p)); // crease lines float sh=dh<0.?.62+.9*(l.y+.14)+.1*l.x:(l.x<0.?.5:.92); // folded facets vec3 a=texture(tA,vUv).rgb*(1.-.5*ln)*(1.-.18*cr*step(0.,q.x*q.y)); a=mix(a,vec3(.82,.85,.9)*sh,smoothstep(.25,.7,p)); // the old slide turns to white paper o=vec4(mix(texture(tB,vUv).rgb,a,m),1.); }`}); Deck.scene({ id:'boat', title:'Anchor', enterWith:'fold', post:{bloom:.8,threshold:1,vignette:.25,grain:.03}, beats:[{dur:2,hold:4},{dur:5,hold:5},{dur: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:{uS:-.75,uHz:-.02,uGold:0,uAmp:.007,uDrag:0,uTaut:0,uRel:0,uIn:1,uBig:0,uHang:0,uM:[0,0]}, sea:d.pass(`uniform float uS,uHz,uGold,uAmp,uDrag,uTaut,uRel,uIn,uBig,uHang; uniform vec2 uM; const vec2 A=vec2(.2,-.24); // anchor on the seabed vec2 rl(vec2 v,float a){ float c=cos(a),s=sin(a); return vec2(c*v.x+s*v.y,-s*v.x+c*v.y); } float wv(float x,float i){ float a=uAmp*(.3+.35*i), f=7.-1.1*i; // crest line of swell layer i (0 far, 4 near) return uHz-.035-.03*i-.022*i*i+a*(sin(x*f+i*1.7+uTime*(.5+.1*i))+.4*sin(x*f*2.3-i*2.+uTime*.8)); } vec3 lay(vec3 c,vec2 p,float i,float w,float gl,vec3 hzc,vec3 deep,float sx){ float dd=wv(p.x,i)-p.y, sunx=exp(-abs(p.x-sx)*2.5), dn=sat(dd/(.03+.035*i)); vec3 crest=mix(vec3(.2,.24,.27),vec3(.1,.34,.36)+vec3(.9,.5,.18)*sunx*.5,uGold); // backlit, translucent crest vec3 trough=mix(deep,vec3(.03,.09,.17),uGold); // cool reflected sky in the troughs vec3 col=mix(crest,trough,dn)*(.7+.6*w); col+=mix(vec3(.8,.7,.6),vec3(1.,.6,.25),uGold)*gl; float sp=fbm(vec2(p.x*60.+i*9.,dd*220.-uTime*.8)); col+=vec3(1.,.75,.4)*uGold*smoothstep(.62,.8,sp)*sunx*(1.2-dn)*1.5; // sun glitter float fo=smoothstep(.014+.006*i,.002,dd)*smoothstep(.42,.6,fbm(vec2(p.x*(26.-3.*i)+i*5.+uTime*.2,i*3.))); col=mix(col,vec3(.95,.92,.85),fo*uGold*sat(.35+.15*i)); // foam on the crests col=mix(col,hzc*.75,.6*exp(-i*.8)*(1.-.5*uGold)); return mix(c,col,smoothstep(0.,.003,dd)); } vec4 boat(vec2 p,vec2 B,float ang,float sc){ vec2 l=rl(p-B,ang)/sc; float ax=abs(l.x); float dh=max(max(-(l.y+.14),l.y-.24*ax),ax-.22-(l.y+.14)*1.1), dt=max(l.y-.3+ax*1.1,-l.y-.05), dd=min(dh,dt); float sh=dh<0.?.62+.9*(l.y+.14)+.1*l.x:(l.x<0.?.5:.92); return vec4(mix(vec3(.8,.84,.9),vec3(1.,.82,.6),uGold)*sh,smoothstep(.012,0.,dd)); } float chain(vec2 p,vec2 a,vec2 b,float sag){ vec2 ba=b-a; float t=sat(dot(p-a,ba)/dot(ba,ba)); vec2 c=mix(a,b,t)-vec2(0.,sag*4.*t*(1.-t)); return length(p-c)-(.005+.003*abs(sin(t*length(ba)*260.))); } float anchor(vec2 p){ vec2 q=rl(p-A,-.25)/1.6; float ax=abs(q.x); float dd=sdBox(q,vec2(.007,.06)); dd=min(dd,abs(length(q-vec2(0.,.072))-.013)-.004); dd=min(dd,sdBox(q-vec2(0.,.042),vec2(.032,.005))); dd=min(dd,max(abs(length(q-vec2(0.,-.008))-.052)-.007,q.y+.012)); dd=min(dd,sdBox(rl(vec2(ax,q.y)-vec2(.054,-.004),.6),vec2(.016,.008))); return dd*1.6; } float grass(vec2 p,float base,float n,float hs,float seed){ float x=p.x*n, id=floor(x), r=hash12(vec2(id,seed)); float y=(p.y-base)/(hs*(.3+r)); float fx=fract(x)-.5-.2*y*y*sin(uTime*.9+id*.7+r*6.)-(r-.5)*.3*y; float wd=.2*(1.-y); return step(0.,y)*step(y,1.)*smoothstep(.07,0.,abs(fx)-wd)*step(.2,r); } void main(){ vec2 p=(design(vUv)-vec2(960.,540.))*vec2(1.,-1.)/1080.; vec2 sun=vec2(.7+uM.x*.01,uHz+.07+uM.y*.005); float y=p.y-uHz; vec3 c=mix(mix(vec3(.42,.38,.34),vec3(.09,.12,.17),sat(y*2.2)),mix(vec3(1.,.55,.2),vec3(.1,.22,.48),pow(sat(y*1.8),.6)),uGold); float sd=length(p-sun); vec3 sc=mix(vec3(.9,.72,.55),vec3(1.,.6,.25),uGold); c+=sc*(.012/(sd*sd+.004))*(.5+.5*uGold)+sc*4.*smoothstep(.04,.034,sd); // low sun: the only thing above 1 float cl=fbm(vec2(p.x*1.6+uTime*.015+uM.x*.02,y*5.+p.x*.4)); float cov=smoothstep(mix(.25,.5,uGold),mix(.6,.8,uGold),cl)*mix(smoothstep(.03,.2,y),.75*smoothstep(.08,.4,y),uGold); vec3 cc=mix(vec3(.13,.14,.17)+vec3(.5,.34,.22)*exp(-sd*3.5),vec3(.5,.3,.25)+vec3(.9,.5,.2)*exp(-sd*2.5),uGold)*(.4+1.2*cl); c=mix(c,cc,cov); // heavy cloud, breaking as uGold rises vec3 hzc=mix(vec3(.36,.33,.3),vec3(.9,.5,.2),uGold); float z=1./(max(uHz-p.y,0.)+.05), w=fbm(vec2(p.x*z*3.,z*5.+uTime*.4)); float gl=smoothstep(.6,.85,w)*exp(-abs(p.x-sun.x)*5.)*(.5+.5*uGold); vec3 deep=mix(vec3(.02,.045,.06),vec3(.03,.07,.11),uGold); c=mix(c,mix(hzc*.7,deep,sat((uHz-p.y)*6.)),smoothstep(0.,.002,uHz-p.y)); c=lay(c,p,0.,w,gl,hzc,deep,sun.x); c=lay(c,p,1.,w,gl,hzc,deep,sun.x); c=lay(c,p,2.,w,gl,hzc,deep,sun.x); float bx=.42, sy=uS+.008*sin(p.x*9.+uTime*1.2)+.004*sin(p.x*23.-uTime*2.); // sy: the split line where the lens meets the water float wb=wv(bx,2.), sl=(wv(bx+.03,2.)-wv(bx-.03,2.))/.06, sb=uS+.008*sin(bx*9.+uTime*1.2); float bs=.26*(1.+.5*uBig); // the freed boat is bigger and rides higher vec2 B=vec2(bx,max(wb+.012+.02*uBig,sb+.03)-.1*uDrag+.03*(1.-uIn)); float ang=atan(sl)*(.7+.5*uBig)+.6*uDrag+.22*uBig; // the chained end is pulled under vec4 bt=boat(p,B,ang,bs); bt.a*=smoothstep(.7,.95,uIn); vec2 st=B+rl(vec2(-.47,.09)*bs,-ang), ring=A+rl(vec2(0.,.115),.25); vec2 ce=mix(st+vec2(-.1,-.2),ring,uHang); // hangs into the sea, then runs to the anchor ring float dc=chain(p,mix(st,A+vec2(.16,-.05),uRel),ce,.05*(1.-uTaut)+.06*uRel); float vis=smoothstep(-.003,.003,p.y-wv(p.x,2.)+.004); c=mix(c,vec3(.5,.52,.55)*(.7+.5*smoothstep(0.,-.004,dc)),smoothstep(.002,0.,dc)*(1.-uRel)*smoothstep(.7,.95,uIn)); // light chain; nearer swells hide its lower end c=mix(c,bt.rgb,bt.a*vis); c=lay(c,p,3.,w,gl,hzc,deep,sun.x); c=lay(c,p,4.,w,gl,hzc,deep,sun.x); if(p.y