0x1353…e4e8

All memos sent from and to 0x1353…e4e8.

(()=>{var d=Math.sin,b=Math.cos,n=Math.abs;let s=window,F=document;const D=F.body.appendChild(F.createElement("canvas")),S=D.getContext("2d",{colorSpace:"srgb",willReadFrequently:!0});let k,j,z,G,J,K=1,V=2400,X=1800,Z=52e3,Q=!0;const Y=2*Math.PI,$=3,_=4,ee=5,ae=8,ce=9,fe=10,te=12;let de={ci:0,ns:9,accs:0,fs:0,arch:-1,nl:1,oct2:.5,ca:1,maxa:2,perm:.5,yStr:1,vSpr:2,wind:0,fra:!1,cw:0,seq:[],felt:1,vamp:0,acol:"",aamp:0,astr:1,asty:0,bg:"#000000",pal:[],lum:0,accel:0,cont:0,rating:0,version:0};console.log(navigator.userAgent);let be=/Chrome/.test(navigator.userAgent),ne=/\bHeadlessChrome/.test(navigator.userAgent);console.log("isChrome="+be+", isHeadless="+ne);let se=!be,le=!0,re=0;const oe=(e=!0,a=!0,c=!1)=>{e&&(W=N()),pe(W,a),Pe(c)},ie=()=>{G=((e=Math.random)=>{const a=(e=>{const a=new Uint8Array(512);for(let e=0;e<256;e++)a[e]=e;for(let c=0;c<255;c++){const f=c+~~(e()*(256-c)),t=a[c];a[c]=a[f],a[f]=t}for(let e=256;e<512;e++)a[e]=a[e-256];return a})(e),c=new Float64Array(a).map((e=>T[e%12*3])),f=new Float64Array(a).map((e=>T[e%12*3+1])),t=new Float64Array(a).map((e=>T[e%12*3+2]));return(e,d,b)=>{let n,s,l,r;const o=(e+d+b)*(1/3),i=R(e+o),p=R(d+o),m=R(b+o),w=(i+p+m)*U,h=e-(i-w),g=d-(p-w),v=b-(m-w);let u,F,C,y,D,S;h>=g?g>=v?(u=1,F=0,C=0,y=1,D=1,S=0):h>=v?(u=1,F=0,C=0,y=1,D=0,S=1):(u=0,F=0,C=1,y=1,D=0,S=1):g<v?(u=0,F=0,C=1,y=0,D=1,S=1):h<v?(u=0,F=1,C=0,y=0,D=1,S=1):(u=0,F=1,C=0,y=1,D=1,S=0);const A=h-u+U,B=g-F+U,E=v-C+U,k=h-y+2*U,x=g-D+2*U,M=v-S+2*U,O=h-1+.5,q=g-1+.5,I=v-1+.5,T=255&i,L=255&p,P=255&m;let H=.6-h*h-g*g-v*v;if(0>H)n=0;else{const e=T+a[L+a[P]];H*=H,n=H*H*(c[e]*h+f[e]*g+t[e]*v)}let N=.6-A*A-B*B-E*E;if(0>N)s=0;else{const e=T+u+a[L+F+a[P+C]];N*=N,s=N*N*(c[e]*A+f[e]*B+t[e]*E)}let W=.6-k*k-x*x-M*M;if(0>W)l=0;else{const e=T+y+a[L+D+a[P+S]];W*=W,l=W*W*(c[e]*k+f[e]*x+t[e]*M)}let j=.6-O*O-q*q-I*I;if(0>j)r=0;else{const e=T+1+a[L+1+a[P+1]];j*=j,r=j*j*(c[e]*O+f[e]*q+t[e]*I)}return 32*(n+s+l+r)}})(i)},pe=(e,a=!0,c=0)=>{console.log(e),console.log("darker="+se),console.time("t"),((e,a)=>{if(0==a%7){let f=0>(c=~~(a/7))||c>=~~(H.length/4)?null:H.substr(4*c,4);null!=f&&(e="0x"+f)}var c;(e=>{o=!1,r=null;const a=~~((e.length-2)/2),c=[];for(let f=0;f<a;f++){const a=2+2*f;c.push(parseInt(e.slice(a,a+2),16))}const f=p(c,1690382925),t=p(c,72970470);l.setUint32(0,f),l.setUint32(4,t)})(e)})(e.hash,e.tokenId%1e5),ie(),ve(!a,c),console.log(de)},me=e=>{let a=0;return e.forEach((e=>{let c=L(B(e))[2];a+=c})),y(a/e.length)},we=(e,a=0)=>{de.ci=e,de.bg="#"+g(q);let c=0>e?ge():O[e].map((e=>"#"+e)),t=me(c);se&&(a=-.04),102>t&&(a+=(113-f(t))/100),de.pal=0==a?c:he(c,a),de.acol=de.pal[0]},he=(e,a)=>(console.log("ADJUSTING COLORS: "+a),e.map((e=>{let c,f=B(e),d=L(f);var b;c=C(d[2]*(1+a),0,255),se&&(c=255*(.5>(b=c/255)?8*b*b*b*b:1-t(-2*b+2,4)/2)),d[2]=c,0>a&&(d[1]=C(.94*d[1],-1,0));let n=P(d);return E(n)}))),ge=()=>{let e,a=y(i()),c=[],f=.03;for(let t,d=0;8>d;d++)t=[a,.7-.08*d,.88-d*f],e=M(P(t)),c.push(E(e)),f+=.01;let t=a+.5;return 1<t&&(t-=1),e=M(P([t,.1,.1])),c.unshift(E(e)),e=M(P([t,.08,.22])),c.push(E(e)),e=M(P([a,.7,.95])),c.unshift(E(e)),c},ve=(e=!1,a=0)=>{de.cw=v([50,1,2,2]),e||(de.pal=[],de.ci=m(.97)?h(0,O.length):-1,we(de.ci),de.acol=de.pal[m(.8)?0:de.pal.length-1]),de.fs=v([26,6,6,0,3,3,1,1]),de.wind=m(.1)?m()?-1:1:0,de.vSpr=y(j/V*(m(.05)?w(10,20):w(0,10)));let c=de.fs>=ae?[0,22]:[0,43];if(de.ns=28+h(...c),de.felt=h(0,5-f((70-de.ns)/10)),0<=[ae,ce,fe].indexOf(de.fs)?de.accs=0:10<de.ns&&m(.5)&&(de.accs=h(1,3)),de.maxa=y(w(1.1,1.6)+de.ns/100),Fe(),de.nl=y(w(.4,.6)),de.oct2=y(w(0,.15)),de.perm=y(w(.45,.72)),de.vamp=.02>de.ca?0:.05*v([3,2,2,2,2,1]),de.arch=-1,m(.75)){let e=I.map((e=>e.weight));de.arch=v(e);let a=I[de.arch];console.log(a.name),Object.keys(a).forEach((e=>{if(a[e])switch(e){case"ns":de[e]=h(a[e][0],a[e][1]);break;case"accs":case"felt":case"vamp":de[e]=g(a[e]);break;case"cw":case"fs":de[e]=v(a[e]);break;case"astr":case"ca":case"maxa":case"nl":case"perm":case"yStr":case"oct2":case"vSpr":de[e]=y(w(a[e][0],a[e][1])),"ca"==e&&(de.maxa=a[e][1]);break;case"wind":de[e]=m(a[e])?1:0;break;case"pals":let c=g(a[e]);we(c)}}))}de.lum=me(de.pal),de.asty=0<=[ae,ce].indexOf(de.fs)?0:de.fs,de.rating=0,de.version=11,de.spiralDepth=de.fs==ce?g([-20,40,100,160,180]):0,de.fra=0==de.fs&&.2<de.ca&&33<de.ns&&m(.3);let t=0<de.ca?0:1;if(de.fs==ce)t=1;else if(de.fs!=$&&0==de.ca){let e=v([0,4,3,1,1]);de.fs==ee?t=0==de.wind?e:1:de.fs==_?t=0==de.wind?e:2:0==de.fs&&(t=0==de.wind?e:1)}if(de.accel=t,1==de.cw)de.seq=ue(de.pal,de.ns);else if(3==de.cw){let e=m(.95);de.seq=ue(de.pal,de.ns,!0,!1,e)}},ue=(e,a,c=!1,f=!0,t=!1)=>{let d=[];if(c){let c=f?0:2,b=e.length,n=Math.ceil(a/b),s=c,l=s,r=0,o=0;for(let e=0;e<a;e++)r++,r>n?(s++,s>=b&&(s=c),l=s,o=t?0:l,r=0):o=0==e?t?0:l:r==n&&t?1:l,d.push(o)}else for(let c=0;c<a;c++)d.push(c%e.length);return d},Fe=()=>{de.ca=m(.2)&&de.fs!=$?0:y(w(.36,0!=de.wind||de.fs==$?.85:de.maxa)),de.yStr=y(w(.5,2.2)),de.aamp=.02>de.ca?0:de.ca*g([.5,.6,1,1.1,1.2]),de.astr=y(w(.5,2))};let Ce,ye;const De=2;let Se={0:(e,a,c,f,t)=>[e,a+t*c],1:(e,a,c,f,t)=>[e+.2*f*c,a+t*c],2:(e,a,c,f,t)=>[e+-.2*f*c,a+t*c],3:(e,a,c,f)=>[e+f*c,a],4:(e,a,c,f,t,d)=>[e+f*c*d,a-t*c],5:(e,a,c,f,t,d)=>[e+f*c*d,a+t*c],6:(e,a,c,f,t)=>[e+.56*f*c,a+t*c],7:(e,a,c,f,t)=>[e+-.56*f*c,a+t*c],8:(e,a,c,f,t,n)=>[e+d(c*Y-.3)*n,a+b(c*Y)*n*1.5],9:(e,a,f,t,n,s,l)=>[de.spiralDepth*t/X*(2-2*f)+e+d(l+(.02*f+.98*c(f+.01))*Y)*s*1.32,a+b(l+(.02*f+.98*c(f+.01))*Y)*s*2],10:(e,a,c,f,t,n)=>[e+d(.1+n*Y)*c*f*.76,a+b(n*Y)*c*t*.76],11:(e,a,c,f,t,n)=>[e+d((c+.25)*Y-.35)*n,a+b((c+.25)*Y)*n*.75],12:(e,a,c,f,t)=>.25>c?[e,a-t*c*2.4]:.75>c?[f/4+e-d((c+0)*Y)*(f/4),t/2.48+b((c+0)*Y)*(f/2)]:[e+f/2,a-t*(1-c)*2.4]};const Ae=(e,a)=>{let c=L(B(e));return c[2]*=1-a,E(P(c))};let Be,Ee,ke=0,xe=.1,Me=.05;const Oe=(a,f,t,s,l,r,o=!1)=>{let i=null;if(o)Be=de.acol;else if(1==de.cw||3==de.cw)de.seq&&de.seq.length>=de.ns?(ke=(ke+1)%de.seq.length,Be=de.pal[de.seq[ke]]):(ke=(ke+1)%de.pal.length,Be=de.pal[ke]);else{let e=h(0,de.pal.length);Be=de.pal[e],2==de.cw&&(i=de.pal[(e+1)%de.pal.length])}let p=f,v=t,F=0;o?(F=de.fs==ae||11==de.fs?.2:de.fs==ce?.8:g([.3,.35,.4]),p=f+(a+F)*s/de.accs):de.fs<ae||de.fs>=te?de.fs==$?v=t+(a+.5)*Ee:p=f+(a+.5)*Ee:11==de.fs&&(v=t-(a+.5)*Ee/2),((a,f,t,s,l,r,o=0,i=.1,p=.05,h=1,g=0,v=.1,F=0,C=0,D=!1,A=null)=>{let k,x,M,O=o;de.fra&&(.15>C||.85<C)&&(O=.2),J=function(a,f,t,s,l,r,o,i=0,p=.1,h=.05,g=1,v=0,F=.1,C=0,D=0,S=null){let A=Se[a],k=~~(.99*f),x=c(k/100),M=de.fs>=ae&&de.fs<te?.113:.073;se||(M+=.02),70<de.ns&&(M-=.01),M+=.04*z,M=y(M);let O,q=Ae(t,.5),I=re+80+10*de.felt,U=de.nl,R=2*U,T=de.oct2,L=.11*z;return Array(f).fill().map(((f,P,H)=>{const N=1>=H.length?0:P/(H.length-1),W=N*Y,j=b(W),J=d(W),K=h+w(0,.5);let V=0==de.accel?i:1==de.accel?.1+2.2*(1-N):2==de.accel?.1+2*N:3==de.accel?.2+2.4*e(.04,n(.5-N)):.2+2.4*e(.04,.5-n(N-.5));O=G(U*j*K,U*J*K*g,F);let X=G(R*j*K,R*J*K*g,F);O=O*(1-T)+X*T;const Z=.5*O+.5,Q=u(0,p)*z,te=0<=[_,ee,fe].indexOf(de.fs)?D:de.fs==ce?r*N/2:C,be=A(s,l,N,r,o,te,D*Y),ne=0!=v&&P<=k&&de.fs<ae?v*(x-c(P/100))*120:0,se=11>de.ns?.03:.004;let le,re,oe;return a==$?(le=be[0]+Q,re=be[1]+z*O*V*150):(le=be[0]+z*O*V*150+ne,re=be[1]+Q),oe=null==S?de.fs==ce&&m(.5-.5*N)?q:t:((e,a,c)=>{e=B(e),a=B(a);for(var f=0;3>f;f++)a[f]=a[f]*c+e[f]*(1-c);return E(a)})(t,S,N),{a:y(e(se,w(0,M)*(1-Z))),c:oe,lw:y(w(.2,.7))+L,l:y(u()*Z*I*z*(de.fs==fe?.5+3.6*N:1.2)),an:y(u()),x:le,y:re}}))}(D?de.asty:de.fs,a,f,t,s,l,r,O,i,p,h,g,v,F,C,A),J.forEach((a=>{S.save(),S.beginPath(),k=e(1,n(a.l)),x=k/2,M=k,S.ellipse(a.x,a.y,x,M,a.an,0,Y,!1),S.lineWidth=a.lw,S.strokeStyle=a.c,S.globalAlpha=a.a,S.stroke(),S.restore()}))})(r,Be,p,v,s,l,o?de.aamp:de.ca,de.vSpr,Me,o?de.astr:de.yStr,de.wind,xe,de.fs<ae?0:de.fs==te?s/4:de.fs<11?a*Ee*.5:.44*s,o?F:a/de.ns,o,i),m(de.perm)?(ie(),xe+=1,m(de.vamp)&&Fe()):Me+=.02},qe=(e,a)=>{let[c,f,t,d]=Ie(de.asty,e,a);for(var b=0;b<de.accs;b++)Oe(b,c,f,t,a,Z,!0)},Ie=(e,a,c)=>{let f=0,t=0,d=a;return 1===e?(d=1.2*a,f=.25*-a):2===e?(d=1.2*a,f=0):e===$?f=0:e===_?(d=.9*a,f=0,t=c):e===ee?(d=.9*a,f=0,t=0):6===e?(d=1.8*a,f=.9*-a):7===e?(d=1.8*a,f=.1*a):11===e?(f=a/2,t=.75*c):e===ae||e===ce?(f=a/2,t=c/2):e===fe?(f=a/2,t=~~(.42*c)):e===te&&(f=0,t=c),[f,t,d,c]};let Ue=0,Re=0,Te=0,Le=0;const Pe=async(e=!1)=>{(async(e,c,d,b=!1)=>{console.log("w,h = %d,%d",c,d),e.globalCompositeOperation="source-over",e.fillStyle=de.bg,e.fillRect(0,0,c,d),Me=.05,ke=0,xe=.1,[Ue,Re,Te,Le]=Ie(de.fs,c,d),Ee=(de.fs==$||11==de.fs?Le:Te)/de.ns,de.fs==te&&(Ee/=2);let s=Z;for(var l=0;l<de.ns;l++)de.fs==ae?s=~~(Z*(l+1)/de.ns):de.fs==te?s=62400:11>de.ns&&(s=78e3),Oe(l,Ue,Re,Te,d,s);0<de.accs&&Q&&qe(c,d),le&&await async function(e){let c=e.canvas.width,d=e.canvas.height,b=await(async(e,a,c,t=256,d=2)=>{let b=e.getImageData(0,0,a,c);d=~~(d*z);const n=b.data;Ce=Array(t).fill(0),ye=Array(t).fill(0);let s=0,l=0,r=0,o=255,i=0,p=0,m=0,w=0,h=1,g=0,v=0,u=100,F=0,C=0;for(let e=0;e<c;e+=d)for(let c=0;c<a;c+=d)C++,s=c+e*a,l=L([n[4*s],n[4*s+1],n[4*s+2],n[4*s+3]])[2],i+=l,m=x([n[4*s],n[4*s+1],n[4*s+2],n[4*s+3]])[0],p+=m,g=A([n[4*s],n[4*s+1],n[4*s+2],n[4*s+3]]),F+=g,Ce[f(l)]+=1,l>r&&(r=l),l<o&&(o=l),ye[~~(m*t)]+=1,m>w&&(w=m),m<h&&(h=m),g>v&&(v=g),g<u&&(u=g);let D=y(i/C),S=y(p/C),B=y(F/C);return{lum:[D,o,r,y(Ce[~~o]/C),y(Ce[~~r]/C)],ok:[S,h,w],rel:[B,u,v],sampleCount:C}})(e,c,d,256,4),s=b.lum,l=b.sampleCount;const r=e.getImageData(0,0,c,d),o=r.data;let i,p,m=0,w=~~(3e-4*l),h=0,g=f(s[De]);for(;h<w;)h+=Ce[g--];h=0;let v=0;for(;h<2*w;)h+=Ce[v++];if(244>g||12<v){10>v&&(v=0);let f=g-v,b=0<=[1,4,8,10,12,14,21,22,25,27,31,44,47,53,66].indexOf(de.ci)?.85:.94;se&&(b+=.04,v+=16),1<z&&(b+=.02*z,v+=~~(2*z));let s=a(2.5,y(256*b/f));de.cont=s;let l=1;if(1.02<s){for(let e=0;e<d;e++)for(let a=0;a<c;a++)m=a+e*c,i=L([o[4*m],o[4*m+1],o[4*m+2]]),1<z&&(l=1-t(n(128-i[2])/256,1.4)),se&&(i[1]=C(i[1]-.04,-1,1)),i[2]=C(-v+i[2]*s*l,0,255),p=P(i),o[4*m]=p[0],o[4*m+1]=p[1],o[4*m+2]=p[2];await e.putImageData(r,0,0)}}}(e)})(S,k,j,e),console.timeEnd("t")};let He=1;const Ne=(e,a,c)=>{K=e,D.height=j=~~(c*K),D.width=k=~~(a*K),S.scale(1,1),z=j/c,console.log("scale="+z);let f=D.style;f.position="absolute",f.display="block",f.top=f.left=f.right=f.bottom="0",f.width=f.margin="auto",f.height="100%",f.boxShadow="0 24px 24px 0 rgba(0, 0, 0, 0.64)"};Ne(K,X,V),pe(tokenData),Pe(),s.addEventListener("keydown",(e=>{68===e.keyCode?(console.log("D - darken/lighten"),e.preventDefault(),se=!se,oe(!1,!0,!1)):70===e.keyCode?(e.preventDefault(),re+=70,70<re&&(re=0),console.log("F - felting "+(0==re?"OFF":"ON")),oe(!1,!0,!1)):90===e.keyCode?(e.preventDefault(),He++,3<He&&(He=1),console.log("Z - zoom level "+He+"x"),((e=2)=>{D.style.transform="scale("+e+")"})(He)):88===e.keyCode?(console.log("X - toggle accents"),e.preventDefault(),Q=!Q,oe(!1,!0,!1)):67===e.keyCode?(console.log("C - toggle auto-contrast"),e.preventDefault(),le=!le,oe(!1,!0,!1)):83===e.keyCode?(e.preventDefault(),(async()=>{var e=D.toDataURL("image/png"),a=document.createElement("a");a.href=e,a.download="ww-"+W.tokenId+".png",document.body.appendChild(a),a.click()})()):85===e.keyCode&&(e.preventDefault(),3>K?K++:K=1,Ne(K,X,V),oe(!1,!0,!1))}))})()})();
(()=>{var d=Math.sin,b=Math.cos,n=Math.abs;let s=window,F=document;const D=F.body.appendChild(F.createElement("canvas")),S=D.getContext("2d",{colorSpace:"srgb",willReadFrequently:!0});let k,j,z,G,J,K=1,V=2400,X=1800,Z=52e3,Q=!0;const Y=2*Math.PI,$=3,_=4,ee=5,ae=8,ce=9,fe=10,te=12;let de={ci:0,ns:9,accs:0,fs:0,arch:-1,nl:1,oct2:.5,ca:1,maxa:2,perm:.5,yStr:1,vSpr:2,wind:0,fra:!1,cw:0,seq:[],felt:1,vamp:0,acol:"",aamp:0,astr:1,asty:0,bg:"#000000",pal:[],lum:0,accel:0,cont:0,rating:0,version:0};console.log(navigator.userAgent);let be=/Chrome/.test(navigator.userAgent),ne=/\bHeadlessChrome/.test(navigator.userAgent);console.log("isChrome="+be+", isHeadless="+ne);let se=!be,le=!0,re=0;const oe=(e=!0,a=!0,c=!1)=>{e&&(W=N()),pe(W,a),Pe(c)},ie=()=>{G=((e=Math.random)=>{const a=(e=>{const a=new Uint8Array(512);for(let e=0;e<256;e++)a[e]=e;for(let c=0;c<255;c++){const f=c+~~(e()*(256-c)),t=a[c];a[c]=a[f],a[f]=t}for(let e=256;e<512;e++)a[e]=a[e-256];return a})(e),c=new Float64Array(a).map((e=>T[e%12*3])),f=new Float64Array(a).map((e=>T[e%12*3+1])),t=new Float64Array(a).map((e=>T[e%12*3+2]));return(e,d,b)=>{let n,s,l,r;const o=(e+d+b)*(1/3),i=R(e+o),p=R(d+o),m=R(b+o),w=(i+p+m)*U,h=e-(i-w),g=d-(p-w),v=b-(m-w);let u,F,y,C,D,S;h>=g?g>=v?(u=1,F=0,y=0,C=1,D=1,S=0):h>=v?(u=1,F=0,y=0,C=1,D=0,S=1):(u=0,F=0,y=1,C=1,D=0,S=1):g<v?(u=0,F=0,y=1,C=0,D=1,S=1):h<v?(u=0,F=1,y=0,C=0,D=1,S=1):(u=0,F=1,y=0,C=1,D=1,S=0);const A=h-u+U,B=g-F+U,E=v-y+U,k=h-C+2*U,x=g-D+2*U,M=v-S+2*U,q=h-1+.5,I=g-1+.5,O=v-1+.5,T=255&i,L=255&p,P=255&m;let H=.6-h*h-g*g-v*v;if(0>H)n=0;else{const e=T+a[L+a[P]];H*=H,n=H*H*(c[e]*h+f[e]*g+t[e]*v)}let N=.6-A*A-B*B-E*E;if(0>N)s=0;else{const e=T+u+a[L+F+a[P+y]];N*=N,s=N*N*(c[e]*A+f[e]*B+t[e]*E)}let W=.6-k*k-x*x-M*M;if(0>W)l=0;else{const e=T+C+a[L+D+a[P+S]];W*=W,l=W*W*(c[e]*k+f[e]*x+t[e]*M)}let j=.6-q*q-I*I-O*O;if(0>j)r=0;else{const e=T+1+a[L+1+a[P+1]];j*=j,r=j*j*(c[e]*q+f[e]*I+t[e]*O)}return 32*(n+s+l+r)}})(i)},pe=(e,a=!0,c=0)=>{console.log(e),console.log("darker="+se),console.time("t"),((e,a)=>{if(0==a%7){let f=0>(c=~~(a/7))||c>=~~(H.length/4)?null:H.substr(4*c,4);null!=f&&(e="0x"+f)}var c;(e=>{o=!1,r=null;const a=~~((e.length-2)/2),c=[];for(let f=0;f<a;f++){const a=2+2*f;c.push(parseInt(e.slice(a,a+2),16))}const f=p(c,1690382925),t=p(c,72970470);l.setUint32(0,f),l.setUint32(4,t)})(e)})(e.hash,e.tokenId%1e5),ie(),ve(!a,c),console.log(de)},me=e=>{let a=0;return e.forEach((e=>{let c=L(B(e))[2];a+=c})),C(a/e.length)},we=(e,a=0)=>{de.ci=e,de.bg="#"+g(I);let c=0>e?ge():q[e].map((e=>"#"+e)),t=me(c);se&&(a=-.04),102>t&&(a+=(113-f(t))/100),de.pal=0==a?c:he(c,a),de.acol=de.pal[0]},he=(e,a)=>(console.log("ADJUSTING COLORS: "+a),e.map((e=>{let c,f=B(e),d=L(f);var b;c=y(d[2]*(1+a),0,255),se&&(c=255*(.5>(b=c/255)?8*b*b*b*b:1-t(-2*b+2,4)/2)),d[2]=c,0>a&&(d[1]=y(.94*d[1],-1,0));let n=P(d);return E(n)}))),ge=()=>{let e,a=C(i()),c=[],f=.03;for(let t,d=0;8>d;d++)t=[a,.7-.08*d,.88-d*f],e=M(P(t)),c.push(E(e)),f+=.01;let t=a+.5;return 1<t&&(t-=1),e=M(P([t,.1,.1])),c.unshift(E(e)),e=M(P([t,.08,.22])),c.push(E(e)),e=M(P([a,.7,.95])),c.unshift(E(e)),c},ve=(e=!1,a=0)=>{de.cw=v([50,1,2,2]),e||(de.pal=[],de.ci=m(.97)?h(0,q.length):-1,we(de.ci),de.acol=de.pal[m(.8)?0:de.pal.length-1]),de.fs=v([26,6,6,0,3,3,1,1]),de.wind=m(.1)?m()?-1:1:0,de.vSpr=C(j/V*(m(.05)?w(10,20):w(0,10)));let c=de.fs>=ae?[0,22]:[0,43];if(de.ns=28+h(...c),de.felt=h(0,5-f((70-de.ns)/10)),0<=[ae,ce,fe].indexOf(de.fs)?de.accs=0:10<de.ns&&m(.5)&&(de.accs=h(1,3)),de.maxa=C(w(1.1,1.6)+de.ns/100),Fe(),de.nl=C(w(.4,.6)),de.oct2=C(w(0,.15)),de.perm=C(w(.45,.72)),de.vamp=.02>de.ca?0:.05*v([3,2,2,2,2,1]),de.arch=-1,m(.75)){let e=O.map((e=>e.weight));de.arch=v(e);let a=O[de.arch];console.log(a.name),Object.keys(a).forEach((e=>{if(a[e])switch(e){case"ns":de[e]=h(a[e][0],a[e][1]);break;case"accs":case"felt":case"vamp":de[e]=g(a[e]);break;case"cw":case"fs":de[e]=v(a[e]);break;case"astr":case"ca":case"maxa":case"nl":case"perm":case"yStr":case"oct2":case"vSpr":de[e]=C(w(a[e][0],a[e][1])),"ca"==e&&(de.maxa=a[e][1]);break;case"wind":de[e]=m(a[e])?1:0;break;case"pals":let c=g(a[e]);we(c)}}))}de.lum=me(de.pal),de.asty=0<=[ae,ce].indexOf(de.fs)?0:de.fs,de.rating=0,de.version=11,de.spiralDepth=de.fs==ce?g([-20,40,100,160,180]):0,de.fra=0==de.fs&&.2<de.ca&&33<de.ns&&m(.3);let t=0<de.ca?0:1;if(de.fs==ce)t=1;else if(de.fs!=$&&0==de.ca){let e=v([0,4,3,1,1]);de.fs==ee?t=0==de.wind?e:1:de.fs==_?t=0==de.wind?e:2:0==de.fs&&(t=0==de.wind?e:1)}if(de.accel=t,1==de.cw)de.seq=ue(de.pal,de.ns);else if(3==de.cw){let e=m(.95);de.seq=ue(de.pal,de.ns,!0,!1,e)}},ue=(e,a,c=!1,f=!0,t=!1)=>{let d=[];if(c){let c=f?0:2,b=e.length,n=Math.ceil(a/b),s=c,l=s,r=0,o=0;for(let e=0;e<a;e++)r++,r>n?(s++,s>=b&&(s=c),l=s,o=t?0:l,r=0):o=0==e?t?0:l:r==n&&t?1:l,d.push(o)}else for(let c=0;c<a;c++)d.push(c%e.length);return d},Fe=()=>{de.ca=m(.2)&&de.fs!=$?0:C(w(.36,0!=de.wind||de.fs==$?.85:de.maxa)),de.yStr=C(w(.5,2.2)),de.aamp=.02>de.ca?0:de.ca*g([.5,.6,1,1.1,1.2]),de.astr=C(w(.5,2))};let ye,Ce;const De=2;let Se={0:(e,a,c,f,t)=>[e,a+t*c],1:(e,a,c,f,t)=>[e+.2*f*c,a+t*c],2:(e,a,c,f,t)=>[e+-.2*f*c,a+t*c],3:(e,a,c,f)=>[e+f*c,a],4:(e,a,c,f,t,d)=>[e+f*c*d,a-t*c],5:(e,a,c,f,t,d)=>[e+f*c*d,a+t*c],6:(e,a,c,f,t)=>[e+.56*f*c,a+t*c],7:(e,a,c,f,t)=>[e+-.56*f*c,a+t*c],8:(e,a,c,f,t,n)=>[e+d(c*Y-.3)*n,a+b(c*Y)*n*1.5],9:(e,a,f,t,n,s,l)=>[de.spiralDepth*t/X*(2-2*f)+e+d(l+(.02*f+.98*c(f+.01))*Y)*s*1.32,a+b(l+(.02*f+.98*c(f+.01))*Y)*s*2],10:(e,a,c,f,t,n)=>[e+d(.1+n*Y)*c*f*.76,a+b(n*Y)*c*t*.76],11:(e,a,c,f,t,n)=>[e+d((c+.25)*Y-.35)*n,a+b((c+.25)*Y)*n*.75],12:(e,a,c,f,t)=>.25>c?[e,a-t*c*2.4]:.75>c?[f/4+e-d((c+0)*Y)*(f/4),t/2.48+b((c+0)*Y)*(f/2)]:[e+f/2,a-t*(1-c)*2.4]};const Ae=(e,a)=>{let c=L(B(e));return c[2]*=1-a,E(P(c))};let Be,Ee,ke=0,xe=.1,Me=.05;const qe=(a,f,t,s,l,r,o=!1)=>{let i=null;if(o)Be=de.acol;else if(1==de.cw||3==de.cw)de.seq&&de.seq.length>=de.ns?(ke=(ke+1)%de.seq.length,Be=de.pal[de.seq[ke]]):(ke=(ke+1)%de.pal.length,Be=de.pal[ke]);else{let e=h(0,de.pal.length);Be=de.pal[e],2==de.cw&&(i=de.pal[(e+1)%de.pal.length])}let p=f,v=t,F=0;o?(F=de.fs==ae||11==de.fs?.2:de.fs==ce?.8:g([.3,.35,.4]),p=f+(a+F)*s/de.accs):de.fs<ae||de.fs>=te?de.fs==$?v=t+(a+.5)*Ee:p=f+(a+.5)*Ee:11==de.fs&&(v=t-(a+.5)*Ee/2),((a,f,t,s,l,r,o=0,i=.1,p=.05,h=1,g=0,v=.1,F=0,y=0,D=!1,A=null)=>{let k,x,M,q=o;de.fra&&(.15>y||.85<y)&&(q=.2),J=function(a,f,t,s,l,r,o,i=0,p=.1,h=.05,g=1,v=0,F=.1,y=0,D=0,S=null){let A=Se[a],k=~~(.99*f),x=c(k/100),M=de.fs>=ae&&de.fs<te?.113:.073;se||(M+=.02),70<de.ns&&(M-=.01),M+=.04*z,M=C(M);let q,I=Ae(t,.5),O=re+80+10*de.felt,U=de.nl,R=2*U,T=de.oct2,L=.11*z;return Array(f).fill().map(((f,P,H)=>{const N=1>=H.length?0:P/(H.length-1),W=N*Y,j=b(W),J=d(W),K=h+w(0,.5);let V=0==de.accel?i:1==de.accel?.1+2.2*(1-N):2==de.accel?.1+2*N:3==de.accel?.2+2.4*e(.04,n(.5-N)):.2+2.4*e(.04,.5-n(N-.5));q=G(U*j*K,U*J*K*g,F);let X=G(R*j*K,R*J*K*g,F);q=q*(1-T)+X*T;const Z=.5*q+.5,Q=u(0,p)*z,te=0<=[_,ee,fe].indexOf(de.fs)?D:de.fs==ce?r*N/2:y,be=A(s,l,N,r,o,te,D*Y),ne=0!=v&&P<=k&&de.fs<ae?v*(x-c(P/100))*120:0,se=11>de.ns?.03:.004;let le,re,oe;return a==$?(le=be[0]+Q,re=be[1]+z*q*V*150):(le=be[0]+z*q*V*150+ne,re=be[1]+Q),oe=null==S?de.fs==ce&&m(.5-.5*N)?I:t:((e,a,c)=>{e=B(e),a=B(a);for(var f=0;3>f;f++)a[f]=a[f]*c+e[f]*(1-c);return E(a)})(t,S,N),{a:C(e(se,w(0,M)*(1-Z))),c:oe,lw:C(w(.2,.7))+L,l:C(u()*Z*O*z*(de.fs==fe?.5+3.6*N:1.2)),an:C(u()),x:le,y:re}}))}(D?de.asty:de.fs,a,f,t,s,l,r,q,i,p,h,g,v,F,y,A),J.forEach((a=>{S.save(),S.beginPath(),k=e(1,n(a.l)),x=k/2,M=k,S.ellipse(a.x,a.y,x,M,a.an,0,Y,!1),S.lineWidth=a.lw,S.strokeStyle=a.c,S.globalAlpha=a.a,S.stroke(),S.restore()}))})(r,Be,p,v,s,l,o?de.aamp:de.ca,de.vSpr,Me,o?de.astr:de.yStr,de.wind,xe,de.fs<ae?0:de.fs==te?s/4:de.fs<11?a*Ee*.5:.44*s,o?F:a/de.ns,o,i),m(de.perm)?(ie(),xe+=1,m(de.vamp)&&Fe()):Me+=.02},Ie=(e,a,c)=>{let f=0,t=0,d=a;return 1===e?(d=1.2*a,f=.25*-a):2===e?(d=1.2*a,f=0):e===$?f=0:e===_?(d=.9*a,f=0,t=c):e===ee?(d=.9*a,f=0,t=0):6===e?(d=1.8*a,f=.9*-a):7===e?(d=1.8*a,f=.1*a):11===e?(f=a/2,t=.75*c):e===ae||e===ce?(f=a/2,t=c/2):e===fe?(f=a/2,t=~~(.42*c)):e===te&&(f=0,t=c),[f,t,d,c]};let Oe=0,Ue=0,Re=0,Te=0;const Le=async(e,c,d,b=!1)=>{console.log("render w,h = %d,%d",c,d),e.globalCompositeOperation="source-over",e.fillStyle=de.bg,e.fillRect(0,0,c,d),Me=.05,ke=0,xe=.1,[Oe,Ue,Re,Te]=Ie(de.fs,c,d),Ee=(de.fs==$||11==de.fs?Te:Re)/de.ns,de.fs==te&&(Ee/=2);let s=Z;for(var l=0;l<de.ns;l++)de.fs==ae?s=~~(Z*(l+1)/de.ns):de.fs==te?s=62400:11>de.ns&&(s=78e3),qe(l,Oe,Ue,Re,d,s);0<de.accs&&Q&&((e,a)=>{let[c,f,t,d]=Ie(de.asty,e,a);for(var b=0;b<de.accs;b++)qe(b,c,f,t,a,Z,!0)})(c,d),le&&await async function(e){let c=e.canvas.width,d=e.canvas.height,b=await(async(e,a,c,t=256,d=2)=>{let b=e.getImageData(0,0,a,c);d=~~(d*z);const n=b.data;ye=Array(t).fill(0),Ce=Array(t).fill(0);let s=0,l=0,r=0,o=255,i=0,p=0,m=0,w=0,h=1,g=0,v=0,u=100,F=0,y=0;for(let e=0;e<c;e+=d)for(let c=0;c<a;c+=d)y++,s=c+e*a,l=L([n[4*s],n[4*s+1],n[4*s+2],n[4*s+3]])[2],i+=l,m=x([n[4*s],n[4*s+1],n[4*s+2],n[4*s+3]])[0],p+=m,g=A([n[4*s],n[4*s+1],n[4*s+2],n[4*s+3]]),F+=g,ye[f(l)]+=1,l>r&&(r=l),l<o&&(o=l),Ce[~~(m*t)]+=1,m>w&&(w=m),m<h&&(h=m),g>v&&(v=g),g<u&&(u=g);let D=C(i/y),S=C(p/y),B=C(F/y);return{lum:[D,o,r,C(ye[~~o]/y),C(ye[~~r]/y)],ok:[S,h,w],rel:[B,u,v],sampleCount:y}})(e,c,d,256,4),s=b.lum,l=b.sampleCount;const r=e.getImageData(0,0,c,d),o=r.data;let i,p,m=0,w=~~(3e-4*l),h=0,g=f(s[De]);for(;h<w;)h+=ye[g--];h=0;let v=0;for(;h<2*w;)h+=ye[v++];if(244>g||12<v){10>v&&(v=0);let f=g-v,b=0<=[1,4,8,10,12,14,21,22,25,27,31,44,47,53,66].indexOf(de.ci)?.85:.94;se&&(b+=.04,v+=16),1<z&&(b+=.02*z,v+=~~(2*z));let s=a(2.5,C(256*b/f));de.cont=s;let l=1;if(1.02<s){for(let e=0;e<d;e++)for(let a=0;a<c;a++)m=a+e*c,i=L([o[4*m],o[4*m+1],o[4*m+2]]),1<z&&(l=1-t(n(128-i[2])/256,1.4)),se&&(i[1]=y(i[1]-.04,-1,1)),i[2]=y(-v+i[2]*s*l,0,255),p=P(i),o[4*m]=p[0],o[4*m+1]=p[1],o[4*m+2]=p[2];await e.putImageData(r,0,0)}}}(e)},Pe=async(e=!1)=>{Le(S,k,j,e),console.timeEnd("t")};let He=1;const Ne=(e,a,c)=>{K=e,D.height=j=~~(c*K),D.width=k=~~(a*K),S.scale(1,1),z=j/c,console.log("scale="+z);let f=D.style;f.position="absolute",f.display="block",f.top=f.left=f.right=f.bottom="0",f.width=f.margin="auto",f.height="100%",f.boxShadow="0 24px 24px 0 rgba(0, 0, 0, 0.64)"};Ne(K,X,V),pe(tokenData),Pe(),s.addEventListener("keydown",(e=>{68===e.keyCode?(console.log("D - darken/lighten"),e.preventDefault(),se=!se,oe(!1,!0,!1)):70===e.keyCode?(e.preventDefault(),re+=70,70<re&&(re=0),console.log("F - felting "+(0==re?"OFF":"ON")),oe(!1,!0,!1)):90===e.keyCode?(e.preventDefault(),He++,3<He&&(He=1),console.log("Z - zoom level "+He+"x"),((e=2)=>{D.style.transform="scale("+e+")"})(He)):88===e.keyCode?(console.log("X - toggle accents"),e.preventDefault(),Q=!Q,oe(!1,!0,!1)):67===e.keyCode?(console.log("C - toggle auto-contrast"),e.preventDefault(),le=!le,oe(!1,!0,!1)):83===e.keyCode?(e.preventDefault(),(async()=>{var e=D.toDataURL("image/png"),a=document.createElement("a");a.href=e,a.download="ww-"+W.tokenId+".png",document.body.appendChild(a),a.click()})()):85===e.keyCode&&(e.preventDefault(),3>K?K++:K=1,Ne(K,X,V),oe(!1,!0,!1))}))})()})();
(()=>{"use strict";var e=Math.max,a=Math.min,c=Math.log,f=Math.floor,t=Math.pow;const d=t(2,-32),b=32557,n=19605,s=new Uint16Array(4),l=new DataView(s.buffer);let r=null,o=!1;const i=()=>{const e=s[0],a=s[1],c=s[2],f=s[3],t=0|33103+b*e,l=0|63335+b*a+(n*e+(t>>>16)),r=0|31614+b*c+n*a+(62509*e+(l>>>16));s[0]=t,s[1]=l,s[2]=r,s[3]=5125+b*f+(n*c+62509*a)+(22609*e+(r>>>16));const o=(f<<21)+((f>>2^c)<<5)+((c>>2^a)>>11);return d*((o>>>(f>>11)|o<<(31&-(f>>11)))>>>0)},p=(e,a=0)=>{const c=16,f=65535,t=255;for(var d,b=1540483477,n=e.length,s=a^n,l=0;4<=n;)d=((d=e[l]&t|(e[++l]&t)<<8|(e[++l]&t)<<16|(e[++l]&t)<<24)&f)*b+(((d>>>c)*b&f)<<c),s=(s&f)*b+(((s>>>c)*b&f)<<c)^(d=((d^=d>>>24)&f)*b+(((d>>>c)*b&f)<<c)),n-=4,++l;switch(n){case 3:s^=(e[l+2]&t)<<c;case 2:s^=(e[l+1]&t)<<8;case 1:s=((s^=e[l]&t)&f)*b+(((s>>>c)*b&f)<<c)}return s=((s^=s>>>13)&f)*b+(((s>>>16)*b&f)<<16),(s^=s>>>15)>>>0},m=(e=.5)=>i()<e,w=(e,a)=>(void 0===a&&(a=e,e=0),i()*(a-e)+e),h=(e,a)=>f(w(e,a)),g=e=>e.length?e[h(e.length)]:void 0,v=e=>{var a,c=0;for(a=0;a<e.length;a++)c+=e[a];var f=i()*c;for(a=0;a<e.length;a++){if(f<e[a])return a;f-=e[a]}return 0},u=(e=0,a=1)=>{var f=Math.sqrt;if(o){o=!1;var t=r;return r=null,e+a*t}var d=0,b=0,n=0;do{n=(d=2*i()-1)*d+(b=2*i()-1)*b}while(1<=n||0===n);var s=f(-2*c(n)/n);return r=b*s,o=!0,e+a*(d*s)},F=()=>{let e="0x";for(let a=64;0<a;--a)e+="0123456789abcdef"[~~(16*Math.random())];return e},C=(c,f,t)=>e(a(c,t),f),y=(e,a=1e5)=>f(e*a)/a;var D=1/12.92;const S=e=>t((e+.055)/1.055,2.4),A=e=>{"string"==typeof e&&(e=B(e));var a=e[0]/255,c=e[1]/255,f=e[2]/255;return.2126*(.03928>=a?a*D:S(a))+.7152*(.03928>=c?c*D:S(c))+.0722*(.03928>=f?f*D:S(f))},B=e=>{var a=e.replace("#","");3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]);var c=parseInt(a,16);return[c>>16,255&c>>8,255&c]},E=e=>{var a=C(~~e[0],0,255),c=C(~~e[1],0,255);return"#"+(C(~~e[2],0,255)|c<<8|a<<16|16777216).toString(16).slice(1)},k=e=>.04045>e?e/12.92:t((e+.055)/1.055,2.4),x=e=>{var a=Math.cbrt;"string"==typeof e&&(e=B(e));let[c,f,t]=e;c=k(c/255),f=k(f/255),t=k(t/255);let d=a(.412165612*c+.536275208*f+.0514575653*t),b=a(.211859107*c+.6807189584*f+.107406579*t),n=a(.0883097947*c+.2818474174*f+.6302613616*t);return[.2104542553*d+.793617785*b-.0040720468*n,1.9779984951*d-2.428592205*b+.4505937099*n,.0259040371*d+.7827717662*b-.808675766*n]},M=e=>e.map((e=>~~(255*e))),O=[["ffeaa5","2e3333","3e9198","a16f8a","8e9d70","6ababf"],["ebb7c4","353c32","de90a3","c4aab5","b6bfc1","c4d0c0","e2dfb7","ffefae","f27291"],["FFF0D5","52607B","7CACCB","DC826A","F29E6D","F2CD88","ACD7F2","D97F77","F25270"],["f5ecc2","437742","836c48","b5584f","da525d","f78480","ffc9ae","d0d5a6","9ca271","6b7140"],["d5cda1","613a53","639aa0","ec6c26","e8ac52","639aa0"],["9a8684","101624","302e39","776968","383e4c","51647a","3f2c30","925e62","706e71","a38fab"],["e3c06c","0f282d","d96c4d","954447","436a4a","14948b","4e2434","269576","f1e4c5","d3b47c","e0aa8e","306b7a"],["f0e7d8","1a3854","598c4a","3998b6","7a5f70","8bb3d6","97c6cc"],["e2d5bc","5f7d81","e6b164","a64e55","402a01","e6b164"],["f4e6c4","6a6768","7a5f70","7dbaba","f2c744","bf4b54","f27e93","3e5d89","e8d2a7","e6dbd1"],["fff4e6","95b2b1","a6d0ce","c0ca6a","50712a","a6d0ce"],["bddef6","1c2027","3d89b2","5b6e4a","acb348","b69599","eac984","4f5e51","78c4e8","376d86"],["ffd693","d1bda6","d4e5e7","9cc1d9","4e411e","f27244","fd8c81","ab694d"],["e3d0b7","5d4242","c4c982","f2c572","d38f8f","d95970","78444f","fdcea0"],["ebd3a2","384557","cac5b7","a4b7ca","97acc8","b6a5a3","dda169","f99d1b"],["fee6c8","3a5d8c","f288a4","b19973","bbbf3f","b19973"],["e3c49c","30282d","8e9b77","5a716f","b6907c","9b5b59","85434e","99a777"],["eeb480","26231e","fad09e","ffedbe","f5ecc2","adb192","555f4d","253122","2f381d","7d6639","837e31","705c39","82866f","d49866"],["F2F0D8","504959","798C87","83A64E","B5AABF","A6728A","7B3E4D","E0D0AF","DFEEC7"],["fbe6a0","253122","dcb3a7","b6bfc1","769193","394e48","4c5135","9f9868","ec8a6b"],["252927","222222","e59c3d","8b9994","78a6a9","eafecb"],["F9F4E1","2E2C2F","11AEBF","F2AB27","012E40","F76C4F","F2EFBB","94C5C8","B5D9D9","E4C271","F8A293"],["e27487","2E2C2F","e6a88d","f7e5d8","b9d5f0","62b8bf"],["253122","6e7358","c0bc94","f5ecc2","ebe9d4","bac8d2","97acc8","9aa1ba","a99aa6","b59392"],["ead4bd","2b2c4b","9d7c47","edc69b","493e3a","cf7e60","c0a683","aaa348","6a721d","c8a957"],["7fa8e5","43343c","5c7faf","c7e8fc","a6ba89","e8f290","cdbd40","a98897","e7a18e","f9d071","e97180","f4a35f","b1624b"],["eddfca","594a61","a78190","ce8064","5c2e31","f7c566","d59146","ceb6a2","a3a097","835c3d","4b4a50"],["b5decc","225355","d6d5a8","efcc83","fdbf68","ffa75c","fe8b5c","f48067","df9281","b9b1a8","78cdd0"],["F2DABD","402D3F","B280A1","BF5A6C","9AA680","BECDCB","63678E","607860","E1A497"],["efdaba","22385D","D1C095","204473","BFB74B","F2A649","D97941","D92B2B","939228","DFB456","983820"],["ffeeda","222222","303637","cad6e2","fbb8bf","fa5158","e5c6b5","70a5bc"],["dcd396","283404","2c4207","407002","7d693d","68900a","7db02b","9e9c65"],["F2F1DC","5B584E","43CAD9","4D95A4","D5D962","A3A656","F29C94","F2F1DC"],["F3F0D1","2E2C2F","7D9AC0","B7B5B9","DCCEBB","D91111","ECECEC"],["F2F0D5","353D40","77806C","F2C53D","A6BF4B","668C4A","A3CDD9"],["FCEBC2","343D59","73395F","8AB0E0","ABCFF5","EDB594","A394BA","BF7E8A","F4C0C4","8FBABF"],["DBDDC8","57565B","F2DEA2","9FBFBF","ECBD87","959772","6A8481","D89990","C4706C"],["ece3da","281708","7F644C","8b766c","9b8c6f","b86d29","e5aa70","e8cbae","979287","a78869"],["EEF2CE","27272F","D93B58","FFE06C","608BA6","ACA9A4","739FBC","EBECE7","FF937E"],["c2e4e6","34474d","a0c3a0","829778","ff8780","e4c29d","6b6360","a4b4ce","d18671","b0b1b5"],["f3d4c7","282834","a2999f","e9aaa1","b06f74","80696b","58504f"],["f2e0bb","053236","efaa5f","4b677d","037c99","76a46f","e7a298","37aabc","85b6b4"],["90c1d1","062027","014d65","045542","2878b3","7ca3b2","0b6b5f","e59f22","b35764","c15e70"],["bdc0c7","2f3237","686763","848589","91877e","4d5154","9c9ca4","bfa185","444e57","aca7a4"],["eee1a0","2e3333","163755","3370a6","f27830","f24c3d","f2a03d","f2d230"],["ebd5bb","321c3b","b2655f","a5b266","535c3d","daa792","479999","265f6c","cd8653"],["fcffff","453551","787eb5","c4698c","6da298","ebbef2","aca1c1"],["f8f8f8","643575","de5a58","70a575","f7ad2e","ffcce7","ceb9c2"],["eea78c","819238","9e764c","b4535c","dc5876","f28a83","c3a090","f0c895","7d8991","007190","afc0c4"],["f99d1b","aa7a46","57585b","064f6e","3c6f88","9caba5","f5ecc2"],["ffebbe","2e262d","c83f45","ea6260","fa9c85","fdd3b9"],["313744","ab4530","d9743d","da9e59","ffb882","f0e5ce"],["d96629","a15746","65475b","40456a","645b71","a98173","d8a37b","dab492","c3beb1","a5c8d1"],["342e2a","ab574b","e19471","eec89a","d9e7d6","eec89a"],["f1e4c5","09324d","e0aa8e","ea775d","a26e6b","20a8b6","306b7a","4b2335"],["2d3551","1874fb","4993fb","b0cbfa","daebf2","b0cbfa"],["d8d3df","241f34","8da5c2","8e788f","d09fae","ce8597","4f445d","6c5e7c"],["efffdc","163a37","426176","07a3ba","a8648f","c2fa5e","d70632","ffc782","ffae58","5897b2","cdc46d"],["dabb82","26211e","4f663d","4b7d7a","b46f59","e3b673","924922","72876b"],["f7cfef","5c1d29","a12366","cf6fb2","577e6f","3a562e","ea7192","7ba291","cddace","f05f59"],["c0b6ab","2e425c","3a7ac6","71abe7","d098a4","c77963","c5af96","9e8166","2f67c0","80a3bf","ac6269"],["edcf8e","111314","f99d1b","cf7d40","a45e53","7a4456","4c2e42","241b26","413319","644b1e","be79b7","967e93"],["dbd5b8","1f0a0c","774145","ce9690","88605e","887f6e","e59d67","896684","3c3248","d09e99","ae6a64"],["f8f8fa","242427","646467","99999c","aaaaad","484850","78787e","dddde0"],["f8f8fa","242427","646467","99999c","f81008","aaaaad","484850","78787e","dddde0"],["c7cede","0c1a27","a3b1ba","94b3d2","9bc0ed","738db0","7e9dd3","57646d","454e55","3d4748","728484"],["ccbb7d","1e0e3f","f27291","9c4472","4b1b54","312737","5d5933","837e31","9a7b43","9b8e77","aa615d","b73f74","669c21","c7d179","ffca94"],["dbc397","102a33","4f5630","656c6a","5f8283","dda726","cd8210","c05b12","1d3840","745c3e","bca582"],["f3dcb1","1d0b18","f6a79a","f66a82","b7696b","8a5e85","3e292f","c49f4e","876a38","724530"],["eadfcf","562629","ebbf68","e7a92f","964a33","4e6c74","b7b4ab","a3927d","8f7969","5d3739"],["cee5eb","20353a","c27544","c0997a","b2bcb2","a5c8d1","adaec3","b77a9a","b73f74","6e1c40"],["bccdd6","454869","efb2a6","e1938f","c66f7b","94526b","603e5e","647d94"],["e9e4d6","14132b","98af7d","527f5b","346d67","3d899f","21495a","502a34","956062","7e704e","aaa97f"],["ccd4db","39333d","a5b1bd","7f8c9f","60677c","474759","6b5863","866c7c","9e8594","b49fac","c9bac4"],["f1fce4","1f3511","c9f19d","a0e25a","75c02a","4a7820","09030a","162934","2f5460","4b7d8a","719fa9","a0babf","ccd7d9"],["cebed3","664274","bfc4d5","9a9fbe","7c7ba8","6b5b90","6f355d","87364e","ab4548","d35f49","3a7489","1f5273"],["f8e1ac","4c3928","d2c9d1","ae96a8","8e697d","744a54","6a3f37","724e32","8d6b3c","b18f4b","dab662"],["d1d5cc","102627","a5b59e","7d9e83","61927e","54948d","55a5ad","65c2da","abe1f8","71c8ea","52accc","428fa9","357386","295864","1d3e45"],["a6a2db","1b2e2d","214044","275560","2c6c7f","2d84a0","317aa5","4077b8","617dc8","848bd2"],["fcebe6","515392","b5ada0","bdab94","cbac8f","dcb296","ebbea8","f6d2c5","ec9a8d","c1565b","803452","573064"],["fbe0d3","3a3d34","4a4433","6b573d","976f4c","c98a5f","edaf8d","f5c1ac","eca590","df8d80","d17b7a","c3707c","b76d85"],["e3c1ec","1d1721","c68dd6","a55eba","784588","493052","0a0b08","2c3220","4f6130","73973a","96ca46","b4e26e","d0f29c"],["bdd0f1","0d142e","82a5e2","4878d2","2a54a5","1d3469","742b67","aa459c","c47bbb","dab4d6","f4eaf3"],["ece1d5","171812","cfb8a0","af916e","7e694d","484031","263432","3e595f","527c8f","719cb7","9cbbd3","cbdceb"],["f3f0cc","141a16","dbd88e","babb59","787f41","3b432a","766e4d","a9905f","caac85","e4ccb2","f8efe6"],["aee3e5","171c22","7ecace","54acb3","417880","2e474e","67366a","9742a2","bb5dcb","d48ae3","eabef4"],["cecbbc","2c2b29","b6b0a1","958d7e","656059","7b655b","b59080","d3af9e","e2bda9"],["e2e2d8","382307","d2cdaa","cab66e","c0932d","885511","db832d","e2af7b","e9cfb0","efe2d0"],["a49a83","5c350c","ac8e62","ac793e","985c23","733b0e","c78019","e8b74b","f0d98a","f7f0c1"],["f5dca5","1e1008","e6c78b","dbad64","936f45","ebc277","ccae7b","6e4f2f","b19062","46301d"],["e9f6fb","1c1816","cae9f5","bce0ef","a8d3e5","8fc1d5","72a9bf","558a9f","435e69","273034","000000","463d39"]],q=["000000","060A12"],I=[{name:"Roving",weight:2,ns:[34,52],accs:[0,0,0,1],vamp:[0,.05,.1],fs:[16,2,2,0,1,1,1,1],nl:[.4,.5],oct2:[.04,.05],ca:[1.2,1.4],perm:[.4,.5],yStr:[.6,.9],vSpr:[2,6],astr:[1.2,1.4],wind:.02},{name:"Columns",weight:3,ns:[64,84],accs:[0,1,1,2],vamp:[.05,.1,.15,.2,.25],fs:[32,4,4,0,1,1,1,1],nl:[.44,.58],oct2:[.04,.14],perm:[.5,.7],ca:[1.2,1.6],yStr:[.5,2],vSpr:[2,8],astr:[.8,2.2],wind:.02},{name:"Finery",weight:3,ns:[72,84],accs:[0,1,2],felt:[0,1,2],vamp:[.15,.2],fs:[24,2,2,0,1,1,1,1],nl:[.5,.6],oct2:[.09,.11],perm:[.5,.7],ca:[.8,1.9],yStr:[1,1.5],vSpr:[4,9],astr:[.8,2.2],wind:.01,cw:[40,1,4,1]},{name:"Flurry",weight:5,ns:[35,56],accs:[0,1],vamp:[.05,.1,.15,.2],felt:[0,1,2],fs:[20,3,3,0,0,0,1,1],nl:[.4,.6],oct2:[.04,.12],ca:[1.6,2.6],perm:[.52,.72],yStr:[1.5,2.2],vSpr:[2,6],astr:[1,2],wind:.02},{name:"Tangled",weight:5,ns:[28,54],accs:[0,1,2],vamp:[0,.04,.06,.1,.2],felt:[0,1,2,3,4],fs:[8,1,1],nl:[.4,.65],oct2:[.04,.2],ca:[1.4,4],perm:[.5,.72],yStr:[.5,1.8],vSpr:[4,6],astr:[1,2],wind:.01,cw:[12,1,1,1]},{name:"Thermal",weight:18,ns:[32,58],accs:[0,1,1,1,2],vamp:[0,.1,.1],fs:[12,2,2,0,1,1,1,1],nl:[.4,.52],oct2:[.04,.14],ca:[0,0],maxa:[1,2],perm:[.5,.72],yStr:[1.6,2.2],vSpr:[2,6],astr:[.7,1.2],wind:.05},{name:"Blanket",weight:6,ns:[35,58],accs:[0,1,1],vamp:[0,.05,.1,.1],felt:[1,2,3],fs:[8,2,2,0,0,0,1,1],nl:[.48,.58],oct2:[.04,.05],ca:[.4,1.2],perm:[.5,.65],yStr:[.6,1],vSpr:[6,12],astr:[2,2.4],wind:.1,cw:[10,2,1]},{name:"Bridges",weight:8,ns:[34,54],accs:[0,1],felt:[0,1,2],vamp:[0,0,.05,.1],fs:[12,2,2,0,1,1,1,1],nl:[.44,.64],oct2:[.06,.09],ca:[.8,1.6],perm:[.4,.7],yStr:[1.4,1.9],vSpr:[2,7],astr:[.8,2],wind:.1},{name:"Bolts",weight:2,ns:[5,10],accs:[0],felt:[0,1],vamp:[0,0,0,0,.1],pals:[3,8,14,16,20,25,33,36,41,46,48,62],fs:[8,1,1],nl:[.4,.54],oct2:[0,.06],perm:[.4,.55],ca:[.7,1.3],yStr:[1,2],vSpr:[2,4],astr:[.6,2.1],wind:.3,cw:[5,1]},{name:"Tempest",weight:12,ns:[34,58],accs:[0,1,1,2],vamp:[0,.05,.1,.15],fs:[8,1,1],nl:[.44,.58],oct2:[.04,.14],perm:[.5,.7],ca:[.8,2.2],yStr:[1,2],vSpr:[2,8],astr:[.8,2.2],wind:.02},{name:"Felted",weight:6,ns:[32,52],accs:[0,0,1,2,3],felt:[2,3,3,4,4,4],vamp:[0,0,.1],fs:[16,3,3,0,1,1,1,1],nl:[.5,.64],oct2:[.07,.11],perm:[.44,.64],ca:[.6,1.5],yStr:[1.1,1.6],vSpr:[2,5],astr:[.8,2.2],wind:.02},{name:"Squall",weight:8,ns:[34,60],accs:[0,0,1,2],felt:[1,2,3],vamp:[.1,.2,.3,.4],fs:[16,3,3,0,1,1,1,1],nl:[.45,.66],oct2:[.05,.12],perm:[.44,.75],ca:[.5,2.1],yStr:[.8,1.9],vSpr:[2,8],astr:[.8,2.2],wind:.01,cw:[6,0,1,1]},{name:"Funnel",weight:2,ns:[44,72],accs:[0],felt:[0,1],vamp:[0,.02],pals:[2,3,8,14,15,16,25,28,29,30,33,35,36,41,44,45,46,48,56,60,69,80,82],fs:[0,0,0,0,0,0,0,0,0,0,1],nl:[.4,.6],oct2:[.04,.09],perm:[.1,.2],ca:[.3,1.4],yStr:[.8,1.9],vSpr:[2,6],astr:[.8,2.2],wind:.01,cw:[3,3,1,1]},{name:"Stranded",weight:4,ns:[28,38],accs:[0,1],felt:[0,1,2,3],vamp:[0,0,.02,.02],fs:[14,2,2,0,1,1],nl:[.36,.42],oct2:[.06,.08],perm:[.5,.56],ca:[1.4,1.6],yStr:[1,1.2],vSpr:[3,8],astr:[1.4,2],wind:.01,cw:[30,1,2,1]},{name:"Knitted",weight:4,ns:[33,60],accs:[0,1,2,3],felt:[0,1,2,3],vamp:[0,0,.05],fs:[12,2,2,0,1,1,1,1],nl:[.44,.54],oct2:[.05,.14],perm:[.2,.4],ca:[.4,.8],yStr:[.4,1],vSpr:[5,11],astr:[.8,2],wind:.01},{name:"Spun",weight:2,ns:[16,36],accs:[0],felt:[1,2,3,4],vamp:[0,.1,.1],pals:[2,3,8,14,15,16,20,22,24,25,28,29,30,33,35,36,41,44,45,46,48,56,60,66,67,69,80,82],fs:[0,0,0,0,0,0,0,0,1],nl:[.4,.6],oct2:[0,.12],perm:[.2,.5],ca:[.4,.9],yStr:[.8,1.9],vSpr:[2,4],astr:[.8,1.6],wind:.01,cw:[4,1,0,1]},{name:"Twisted",weight:2,ns:[16,32],accs:[0],felt:[1,2,3],vamp:[0,0,.1],pals:[2,3,8,14,15,16,20,22,24,25,28,29,30,33,35,36,41,44,45,46,48,56,60,66,67,69,80,82],fs:[0,0,0,0,0,0,0,0,0,1],nl:[.4,.5],oct2:[0,.1],perm:[.1,.6],ca:[.08,.12],yStr:[.8,1.9],vSpr:[2,4],astr:[.8,1.6],wind:.01,cw:[2,4,0,1]},{name:"Pulled",weight:6,ns:[44,60],accs:[0,0,1,2,3],felt:[0,1],vamp:[0,.05,.1],fs:[18,2,2,0,1,1],nl:[.1,.25],oct2:[.04,.08],perm:[.44,.6],ca:[.2,.44],yStr:[1.4,2.2],vSpr:[2,6],astr:[.8,2.2],wind:.01,cw:[12,1,2,1]},{name:"Folded",weight:4,ns:[26,56],accs:[0],felt:[0,0,1,2],vamp:[0,0,.1],fs:[0,0,0,1],nl:[.4,.54],oct2:[.06,.1],perm:[.44,.64],ca:[.36,.7],yStr:[1,2],vSpr:[2,6],wind:.001,cw:[10,1,1]},{name:"Waves",weight:5,ns:[28,40],accs:[0,0,1,2],felt:[0,1,2,3],vamp:[0],fs:[12,1,1],nl:[.42,.58],oct2:[.04,.1],perm:[.55,.68],ca:[.6,.9],yStr:[.8,2.2],vSpr:[2,6],astr:[.8,2.2],wind:.01,cw:[10,1,1,1]},{name:"Shawl",weight:1,ns:[48,64],accs:[0],pals:[2,3,6,8,9,12,13,14,15,16,20,22,24,25,26,29,35,41,44,45,48,61,66,67,70,74,80,82],felt:[3,4],vamp:[0],fs:[0,0,0,0,0,0,0,0,0,0,0,0,1],nl:[.2,.4],oct2:[.04,.08],perm:[.55,.66],ca:[.8,2],yStr:[1.4,2.2],vSpr:[2,6],astr:[.8,2.2],wind:.01,cw:[10,1,1,1]},{name:"Breakers",weight:8,ns:[38,44],accs:[0,1,2],felt:[0,1,2],vamp:[.15,.2],fs:[24,2,2,0,1,1,1,1],nl:[.55,.59],oct2:[.09,.11],perm:[.62,.63],ca:[1.6,1.8],yStr:[1.2,1.4],vSpr:[6,9],astr:[.8,2.2],wind:.01,cw:[30,1,2,1]}],U=1/6,R=e=>0|f(e),T=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),L=c=>{var f,t,d=c[0],b=c[1],n=c[2],s=a(d,b,n),l=e(d,b,n),r=l-s;return l===s?f=0:d===l?f=(b-n)/r:b===l?f=2+(n-d)/r:n===l&&(f=4+(d-b)/r),0>(f=a(60*f,360))&&(f+=360),t=(s+l)/2,[f/360,l===s?0:.5>=t?r/(l+s):r/(2-l-s),t]},P=e=>{var a,c,f,t,d,b=e[0],n=e[1],s=e[2];if(0===n)return[d=s,d,d];a=2*s-(c=.5>s?s*(1+n):s+n-s*n),t=[0,0,0];for(var l=0;3>l;l++)0>(f=b+1/3*-(l-1))&&f++,1<f&&f--,d=1>6*f?a+6*(c-a)*f:1>2*f?c:2>3*f?a+(c-a)*(2/3-f)*6:a,t[l]=d;return t},H="cec486eda3f6e33be51a2eb7e27d88abbfd6e539b645d99eb367d1df84ebd9a10ad02b8f31e1bbef7566158ee3ae9713cc7905f9c7f00c93103463f25d53675f6c1b6650bd36cc2bd8c6bc87ea27557ee3caedad09baefbfe308c6efcd260d1241ed547cc743a03702cb64f4d0f5b1b844a9dba2614fa2687e278413973ede025c21b752793b19bd81c1ff0e8684c6b5e161a4fba8deaf3a621baca7ca4351ee2002d2f73db188fa9ec33e0b173a7dbb02a7916a3752e538977aecbb065063ed0b1e6b947e776d0784113630776cccff4f65fbdd096992ddbbdf3f3c98527bdabc44ad32ea4bfba4873c5a59b5967e92430c1a49fe51fb5c37949fc0ede5910369a794563fbd0846a2d3918403111050af521894b619ae854ec67b8608766a2e";let N=(e=7,a=64,c=-1)=>({hash:F().substring(0,a+2),tokenId:1e6*e+(0<=c?c:f(1e3*Math.random()))}),W="undefined"==typeof tokenData?N():tokenData;
I}),o=e.max(o,i),n+=e.min(1e3*R.rmM(dP.hmM),1e3-n);let a=o*dP.tLR.length;dP.dLN=a>5e4?1:a>1e4?3:a>5e3?10:20,dP.lR=a>5e4?1:a>1e4?2:a>5e3?3:4,dP.tLR.push({thePosH:dP.sH,sW:void 0,dd:1,d1:2e3*dP.gAR/void 0}),dP.lp=!0,dP.totFrames=100,dP.rndArr=[];for(let e=0;e<50;e++)dP.rndArr.push(R.d());dP.shAB=!0,dP.shBx=(-1)**R.c([0,1])*1.25,dP.shBy=(-1)**R.c([0,1])*1.25,dP.shK=2.05,dP.shT=.4*R.d()*2,dP.shBlEqA=.4954,dP.shBlEqB=.648,dP.shBlEqC=1*(dP.shBW?.18:.25),dP.shG=2.5116*(dP.shBW?1.65:1.05),dP.shBr=.01515*(1+Math.log(dP.cK)),dP.shCon=.52*(1+Math.log(dP.cK)),dP.shBr=.15515*dP.cK,dP.shCon=.6,dP.shInv=R.b(.15),dP.shBW=R.b(.15),dP.shTime=1e3*R.d(),readURLParams(dP),(dP.oT>3||dP.oT<0)&&(dP.oT=0)},e.setupObjects=function(){let t,s,d,r,n,o,i,a;o=R.n(1,255);let c,u,h,l,P=R.dd()*e.PI;for(let o=0;o<dP.grid.length;o++)r=R.c(dP.objSides),a=R.rmM(dP.paintNmM),s=gC(dP.palettes,R.n(230,250)/a,"i",o,.1,!0),d=gC(dP.palettes,R.n(230,250)/a,"i",o+1,.1,!0),t=dP.grid[o].cP,n=R.rmM(dP.sWmM),i=e.min(dP.sW/3,e.min(dP.grid[o].w,dP.grid[o].h)),u=R.d(),l=R.d(),c=u<dP.prodDF,h=l<dP.prodDS,theObjects.push(new aP(r,s,d,n,c,t,i,P*(1+.1*R.dd()),R.rmM(dP.wKmM),r*R.rmM(dP.wKTmM),h,a))},e.drawRR=function(t){let s,d,r,n;e.push(),r=[R.c(Object.keys(pltLines))],dP.theLineColoursN=R.n(1,pltLines[r].length);let o,i=Math.sqrt();i=dP.lR;let a=a1=a2=a3=a4=!0;for(let t=0;t<dP.tLR.length-1;t++)if(0!=dP.ea||!R.b(dP.rndArr[45])){s=dP.tLR[t].sW,n=dP.tLR[t].oLK,d=R.i(20,150);for(let c=0;c<dP.tLR[t].numL;c++){for(let d=0;d<dP.lR;d++)e.push(),a=1==dP.ea||R.b(dP.rndArr[17]),a1=1==dP.ea||R.b(dP.rndArr[29]),a2=1==dP.ea||R.b(dP.rndArr[30]),a3=1==dP.ea||R.b(dP.rndArr[31]),a4=1==dP.ea||R.b(dP.rndArr[37]),e.strokeWeight(s*n*(.15+2*dP.rndArr[10]*e.sin(dP.rndArr[19]*(t+c)/20)+1.5*dP.rndArr[11]*e.cos(dP.rndArr[17]*(t+1.5*c)/30))),c>50&&c<70&&(tyty=!0),o=gC(r,e.constrain(c,0,dP.tLR[t].numL,100,dP.theLineT/i),"index",Math.floor(c)%dP.theLineColoursN,.1,!0,pltLines,1),e.stroke(o),e.line(dP.tLR[t].offset+a*c*s/dP.tLR[t].dd,dP.tLR[t].thePosH+a1*((dP.tLR[t+1].thePosH-dP.tLR[t].thePosH)*dP.lineStartK*R.d()),dP.lineSinK*(.25+e.cos(t*dP.rndArr[25]*dP.rndArr[33]))*e.sin(dP.rndArr[25]*(c/2+5+1*d/10)),dP.tLR[t].offset+a2*c*s/dP.tLR[t].dd+1*(dP.tLR[t+1].thePosH-dP.tLR[t].thePosH)*dP.tLR[t].inc,dP.tLR[t+1].thePosH*(1+.25*a3*R.dd()*dP.lineEndK),a4*dP.lineSinK*(.25+e.cos(t*dP.rndArr[25]*dP.rndArr[33]))*e.cos(dP.rndArr[25]*(c/2+5+1*d/11))),e.pop();(c+t)%d==0&&(r=[R.c(Object.keys(pltLines))],dP.theLineColoursN=R.n(1,pltLines[r].length))}}e.pop()},e.drawObjects=function(){for(let t=0;t<1;t++)e.push(),e.translate(2*R.dd(),2*R.dd(),2*R.dd()),e.drawRR(t),e.pop();e.push();for(let t=0;t<3;t++){e.translate(5*R.dd(),5*R.dd(),5*R.dd());for(let e=0;e<theObjects.length;e++)theObjects[e].draw(1,0)}e.pop()},e.setup=function(){if(window.p=e,R=new Random,fileNameBase="extranezas-",cV=e.createVector,(dP={}).gAR=.66,piAR=dP.gAR,e.windowWidth/e.windowHeight<=piAR?(dP.sW=e.windowWidth,dP.sH=e.windowWidth/piAR):(dP.sH=e.windowHeight,dP.sW=e.windowHeight*piAR),e.sAP(),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(dP.pd/=2,dP.pdA/=2,dP.pdC/=2,dP.pdD/=2),hC=/HeadlessChrome/.test(navigator.userAgent),e.pixelDensity(dP.pd),cnv=e.createCanvas(dP.sW,dP.sH,e.WEBGL),e.setAttributes({alpha:!0,premultipliedAlpha:!1}),sh=e.createShader(sh_vs,sh_fs),fboA=e.createFramebuffer({colorFormat:"float",preserveDrawingBuffer:!0,alpha:!0,premultipliedAlpha:!1}),fboC=e.createFramebuffer({colorFormat:"float",alpha:!0,premultipliedAlpha:!1}),fboD=e.createFramebuffer({colorFormat:"float",preserveDrawingBuffer:!0,alpha:!0,premultipliedAlpha:!1}),fboA.pixelDensity(dP.pd),fboC.pixelDensity(dP.pdB),fboD.pixelDensity(dP.pdC),e.smooth(),e.setupObjects(),e.loop(),fboA.draw(()=>{e.smooth(),e.translate(-dP.sW/2,-dP.sH/2),e.background(dP.bgC),e.drawObjects()}),fboC.draw(()=>{e.smooth(),e.translate(-dP.sW/2,-dP.sH/2);for(let t=0;t<dP.dLN;t++)e.drawRR(3*t)}),hC&&(dP.gameOn=!0),dP.gameOn){e.initgame();for(let t=0;t<dP.gameInitPos;t++)dP.gCDV=R.i(1,6),dP.gSDV=R.i(1,6),e.onePos()}document.body.style.margin=0,document.body.style.overflow="hidden",document.body.style.display="flex",document.body.style.justifyContent="center",document.body.style.alignItems="center",document.body.style.verticalAlign="center"},e.initgame=function(){e.ln=[],fboD.draw(()=>{e.clear(),e.resetMatrix(),e.push(),e.background(30,30,30),e.pop()}),dP.gamePosCount=0},e.onePos=function(t=!0){t&&fboD.draw(()=>{e.push(),e.translate(-dP.sW/2,-dP.sH/2),drawOne(t),e.pop(),e.loop()}),dP.gamePosCount++},e.shI=function(){e.shader(sh);let t=1+e.abs(e.sin(e.frameCount/10));dP.shBx=2.5*(-1)**e.frameCount*t,dP.shBy=2.5*(-1)**e.frameCount*t,sh.setUniform("tS",[dP.shT*(1+.25*R.d())/e.width*dP.shK,dP.shT*(1+.25*R.d())/e.height*dP.shK]),sh.setUniform("u_aB",dP.shAB),sh.setUniform("u_dir",[dP.shBx,dP.shBy]),sh.setUniform("u_time",e.millis()/1e3),sh.setUniform("u_pA",dP.shBlEqA),sh.setUniform("u_pB",dP.shBlEqB),sh.setUniform("u_pC",dP.shBlEqC),sh.setUniform("u_bw",1==dP.shBW),sh.setUniform("u_g",dP.shG),sh.setUniform("u_br",dP.shBr),sh.setUniform("u_con",dP.shCon),sh.setUniform("u_inv",dP.shInv),sh.setUniform("u_res",[dP.sW,dP.sH]),sh.setUniform("u_cK",Math.sqrt(dP.cK)),sh.setUniform("u_rndArr",dP.rndArr),sh.setUniform("o",dP.oT),sh.setUniform("gameOn",1==dP.gameOn)},e.draw=function(){if(e.push(),e.shI(),sh.setUniform("tex0",fboA.color),sh.setUniform("tex2",fboC.color),sh.setUniform("gtex",fboD.color),sh.setUniform("u_time",e.millis()),e.rect(-dP.sW/2,-dP.sH/2,dP.sW,dP.sH),e.pop(),2==e.frameCount){let e='You can interact with the piece. You can input commands by pressing keys in the keyboard, or set up the piece directly via the URL.\n\nKeyboard commands: press:\n\ns to save the current image\n\nv followed by 1,2,3 or 0 to see the different fragments that make up the whole piece. This piece uses 3 separate layers to compose the final image. You can see them with numbers 1,2 and 3, then use v 0 to see again the full, final result. If you press "s" at any moment, you will save the image you see (i.e., you can save all components of the artwork separately if you want)\n\nl to pause the piece. When paused, you will see a static image instead of the varying noise.\n\nIt has also colour controls: z for brightness, x for contrast, g for gamma, b for blur, n for noise followed by + or - (repeatedly if you want) to alter their values. You might get some simple variations that you might enjoy.\n\nAs stated, you can try to summon the piece to reveal its hidden _ game _ If you do, further instructions will be revealed in the browser console.\n\nURL parameters: in live view, you have to append the 1st parameter using ? instead of &, and the rest using & as indicated below\n\n&pd=N uses pixel density N to arbitrarily set the resolution. Go as high as your hardware allows you to. Nice for high resolution stills and if you intend to print.\n\n&oT=N with N being 1,2,3 or 0: sets the view of the desired component, or the final composed piece (it\'s 0 by default, no need to set that)\n\n&ea=0 tells the piece to skip certain instructions. It is 1 by default.\n\n&theSecretWayToSummonTheGame followed by "On" and equal 1: it shows the piece with the game on and also with some moves already made. For example, if the secret way to summon the game would be "learn", then the URL parameter would be &learnOn=1 (it\'s not learn... but surely a game is a way to learn)\n\n';console.clear(),console.log("extrañezas / marcelo soria-rodríguez @msoriaro 2023"),console.log("CC BY-NC-SA 4.0, https://creativecommons.org/licenses/by-nc-sa/4.0/"),console.log("uses p5js and p5.Framebuffer (MIT License) by Dave Pagurek (thanks so much)"),console.log("always try to find the little game in what you do"),console.log("for example, you can try to ask this piece for a game... the same way you introduce other commands (see below)... but a _game_... "),console.log(e),console.log("and thanks for inspecting the console!")}},e.ln=[],e.keyTyped=function(t){var s=new Date;if("s"==t.key)e.save(`extranezas_${tD.tokenId}_${tD.hash}_${s.toISOString()}.png`);else if("l"==t.key)dP.lp?e.noLoop():e.loop(),dP.lp=!dP.lp;else if("d"==t.key)dP.gCDV=R.i(1,4),dP.gSDV=R.i(1,6),e.onePos();else if("j"==t.key)e.onePos(!1);else if("r"==t.key)e.onePos(!0);else if("h"==t.key)for(let t=0;t<R.i(50,250);t++)dP.gCDV=R.i(1,6),dP.gSDV=R.i(1,6),e.onePos();let d=lt.slice(-1)[0];if(dP.gameOn&&-1!="123456789".indexOf(t.key)){if(e.ln.push(t.key),3==e.ln.length){dP.gSDV=e.int(e.ln[0]),dP.gCDV=e.int(e.ln[1]);for(let t=0;t<e.int(e.ln[2]);t++)e.onePos();e.ln=[]}}else"v"==d&&-1!="1230".indexOf(t.key)?dP.oT=e.int(t.key):"+"===t.key?("g"===d&&(dP.shG*=1.1),"z"===d&&(dP.shBr+=.03),"x"===d&&(dP.shCon*=1.1),"n"===d&&(dP.shBlEqC*=1.1),"m"===d&&(dP.shT*=1.1),"b"===d&&(dP.shBlEqA*=1.03,dP.shBlEqB/=1.025),"k"===d&&(dP.gOSK*=1.05),"w"===d&&(dP.gOWK*=1.05)):"-"===t.key?("g"===d&&(dP.shG/=1.1),"z"===d&&(dP.shBr-=.03),"x"===d&&(dP.shCon/=1.1),"n"===d&&(dP.shBlEqC/=1.1),"m"===d&&(dP.shT/=1.1),"b"===d&&(dP.shBlEqA/=1.03,dP.shBlEqB*=1.025),"k"===d&&(dP.gOSK/=1.05),"w"===d&&(dP.gOWK/=1.05)):lt.push(t.key);if("game"===lt.join("").slice(-4)){if(dP.gameOn)return;e.initgame(),dP.gameOn=!0,e.pi(),e.loop()}else"quit"===lt.join("").slice(-4)&&(e.initgame(),dP.gameOn=!1,e.loop())},e.pi=function(){g1&&(console.log('\n\n\n\nGreetings Professor Falken.\n\nHow about a nice game of creating your own piece rolling the dice?\n\nPress "d" to roll the dice two times: this will choose automatically a shape and a colour and draw the corresponding result.\n\nPress "h" to roll the dice a random number of times to create a random number of positions (like rolling a "h"eap of dices).\n\nYou can press "j" to jump a position without drawing anything.\n\nFinally, you can be in total control by choosing first the shape, then the colour and then the number of times you want that combination to be drawn. To do this, first press a number between 1 and 6 (chooses a shape), then a number between 1 and 9 (chooses a colour) then a number between 1 and 9 (repeats that combination the specified number of times).\n\nYou can also press "w" followed by + or - repeatedly to alter the line width of the shapes. You can also press "k" followed by + or - repeatedly to alter the scale factor of each shape size and position.\n\nTo clear your game, choose to _quit_ just like you summoned the _game_. You can enter into the _game_ again if you wish, doing the same thing you did to enter the 1st time.\n\nYou can display the piece directly in game mode appending the following parameters to the URL:\n\n&gameOn=1 to enable the game\n&gameInitPos=N to use N positions already randomly played. Go as high as you want with the number.\n\nIt\'s an exploration game. The only winning move is to learn. Much like in life.\n\n\n\n'),g1=0)}};new p5(sketch);
const _createFramebuffer=function(e){const t=new Framebuffer(this,e),r=this._renderer.resize;return this._renderer.resize=(e,i)=>{r.call(this._renderer,e,i),t.handleResize()},t};p5.prototype.createFramebuffer=_createFramebuffer,p5.Graphics.prototype.createFramebuffer=_createFramebuffer,p5.RendererGL.prototype._initContext=function(){try{if(Framebuffer.forceWebGL1||(this.drawingContext=this.canvas.getContext("webgl2",this._pInst._glAttributes)),this.hasWebGL2=!!this.drawingContext,this.drawingContext||(this.drawingContext=this.canvas.getContext("webgl",this._pInst._glAttributes)||this.canvas.getContext("experimental-webgl",this._pInst._glAttributes)),null===this.drawingContext)throw new Error("Error creating webgl context");{const e=this.drawingContext;e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),this._viewport=this.drawingContext.getParameter(this.drawingContext.VIEWPORT)}}catch(e){throw e}};const parentGetTexture=p5.RendererGL.prototype.getTexture;p5.RendererGL.prototype.getTexture=function(e){return e instanceof p5.Texture?e:parentGetTexture.call(this,e)};class RawTextureWrapper extends p5.Texture{constructor(e,t,r,i,a){return super(e,t,r),this.width=i,this.height=a,this}_getTextureDataFromSource(){return this.src}init(e){this._renderer.GL;this.glTex=e,this.glWrapS=this._renderer.textureWrapX,this.glWrapT=this._renderer.textureWrapY,this.setWrapMode(this.glWrapS,this.glWrapT),this.setInterpolation(this.glMinFilter,this.glMagFilter)}update(){return!1}}class FramebufferCamera extends p5.Camera{constructor(e){super(e._renderer),this.fbo=e}_computeCameraDefaultSettings(){super._computeCameraDefaultSettings(),this.defaultAspectRatio=this.fbo.width/this.fbo.height,this.defaultEyeZ=this.fbo.height/2/Math.tan(this.defaultCameraFOV/2),this.defaultCameraNear=.1*this.defaultEyeZ,this.defaultCameraFar=10*this.defaultEyeZ}resize(){"default"===this.cameraType?(this._computeCameraDefaultSettings(),this._setDefaultCamera()):this.perspective(this.cameraFOV,this.fbo.width/this.fbo.height)}}class Framebuffer{static forceWebGL1=!1;constructor(e,t={}){this.canvas=e,this._renderer=e._renderer;const r=this._renderer.GL;if(!this._renderer.hasWebGL2&&!r.getExtension("WEBGL_depth_texture"))throw new Error("Unable to create depth textures in this environment");const i=t.size;this.autoSized=!i,i&&(this.width=i.width||400,this.height=i.height||400,this.density=i.pixelDensity||e.pixelDensity()),this.antialias=t.antialias||!1,this.colorFormat=this.glColorFormat(t.colorFormat),this.depthFormat=this.glDepthFormat(t.depthFormat),"float"!==t.colorFormat&&"float"!==t.depthFormat||(this._renderer.hasWebGL2?r.getExtension("EXT_color_buffer_float"):r.getExtension("OES_texture_float")&&r.getExtension("OES_texture_float_linear")&&r.getExtension("WEBGL_color_buffer_float"))||("float"===t.colorFormat&&(this.colorFormat=this.glColorFormat()),"float"===t.depthFormat&&(this.depthFormat=this.glDepthFormat()),console.warn("Warning: Unable to create floating point textures in this environment. Falling back to integers"));const a=r.createFramebuffer();if(!a)throw new Error("Unable to create a framebuffer");if(this.framebuffer=a,this.antialias&&this._renderer.hasWebGL2&&(this.aaFramebuffer=r.createFramebuffer(),!this.aaFramebuffer))throw new Error("Unable to create a framebuffer");this.recreateTextures();const s=this._renderer._curCamera;this.cam=this.createCamera(),e.setCamera(s)}createCamera(){const e=new FramebufferCamera(this);return e._computeCameraDefaultSettings(),e._setDefaultCamera(),this._renderer._curCamera=e,e}defaultCamera(){return this.cam}resizeCanvas(e,t){this.autoSized=!1,this.width=e,this.height=t,this.handleResize()}pixelDensity(e){if(!e)return this.density*this.aaDensity;this.autoSized=!1,this.density=e,this.handleResize()}autoSized(e){if(void 0===e)return this.autoSized;this.autoSized=e,this.handleResize()}glColorFormat(e){const t=this._renderer.GL;return"float"===e?t.FLOAT:t.UNSIGNED_BYTE}glDepthFormat(e){const t=this._renderer.GL;return"float"===e?t.FLOAT:t.UNSIGNED_INT}glInternalFormat(e){if(this.antialias&&this._renderer.hasWebGL2)return this.glInternalRenderbufferFormat(e);const t=this._renderer.GL;return this._renderer.hasWebGL2&&this.colorFormat===t.FLOAT?e?t.RGBA16F:t.RGB16F:e?t.RGBA:t.RGB}glInternalRenderbufferFormat(e){const t=this._renderer.GL;if(this.colorFormat===t.FLOAT){if(this._renderer.hasWebGL2)return t.RGBA16F;throw new Error("Antialiased floating point values are not available in WebGL 1 mode")}return e?t.RGBA4:t.RGB565}glDepthInternalFormat(){const e=this._renderer.GL;return this._renderer.hasWebGL2?e.DEPTH_COMPONENT24:e.DEPTH_COMPONENT}glDepthInternalRenderbufferFormat(){const e=this._renderer.GL;return this._renderer.hasWebGL2?e.DEPTH_COMPONENT24:e.DEPTH_COMPONENT16}glFormat(e){const t=this._renderer.GL;return e?t.RGBA:t.RGB}handleResize(){this.cam.resize();const e=this.colorTexture,t=this.depthTexture,r=this.colorRenderbuffer,i=this.depthRenderbuffer;this.recreateTextures(),this.deleteTexture(e),this.deleteTexture(t);const a=this._renderer.GL;r&&a.deleteRenderbuffer(r),i&&a.deleteRenderbuffer(i)}updateSize(){this.autoSized&&(this.width=this._renderer.width,this.height=this._renderer.height,this.density=this._renderer._pInst._pixelDensity),this.aaDensity=this.antialias&&!this._renderer.hasWebGL2?2:1}recreateTextures(){const e=this._renderer.GL;this.updateSize();const t=this._renderer._pInst._glAttributes.alpha,r=e.getParameter(e.TEXTURE_BINDING_2D),i=e.getParameter(e.FRAMEBUFFER_BINDING),a=e.createTexture();if(!a)throw new Error("Unable to create color texture");e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,this.glInternalFormat(t),this.width*this.density*this.aaDensity,this.height*this.density*this.aaDensity,0,this.glFormat(t),this.colorFormat,null);const s=e.createTexture();if(!s)throw new Error("Unable to create depth texture");e.bindTexture(e.TEXTURE_2D,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,this.glDepthInternalFormat(),this.width*this.density*this.aaDensity,this.height*this.density*this.aaDensity,0,e.DEPTH_COMPONENT,this.depthFormat,null),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,a,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,s,0),this.antialias&&this._renderer.hasWebGL2&&(this.colorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.colorRenderbuffer),this._renderer.hasWebGL2?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,this.glInternalRenderbufferFormat(t),this.width*this.density,this.height*this.density):e.renderbufferStorage(e.RENDERBUFFER,Math.min(4,e.getParameter(e.MAX_SAMPLES)),this.glInternalRenderbufferFormat(t),this.width*this.density,this.height*this.density),this.depthRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.depthRenderbuffer),this._renderer.hasWebGL2?e.renderbufferStorageMultisample(e.RENDERBUFFER,Math.min(4,e.getParameter(e.MAX_SAMPLES)),this.glDepthInternalRenderbufferFormat(),this.width*this.density,this.height*this.density):e.renderbufferStorage(e.RENDERBUFFER,e.getParameter(e.MAX_SAMPLES),this.glDepthInternalRenderbufferFormat(),this.width*this.density,this.height*this.density),e.bindFramebuffer(e.FRAMEBUFFER,this.aaFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,this.colorRenderbuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthRenderbuffer));const h=new RawTextureWrapper(this._renderer,s,{minFilter:"nearest",magFilter:"nearest"},this.width*this.density*this.aaDensity,this.height*this.density*this.aaDensity);this._renderer.textures.push(h);const n=new RawTextureWrapper(this._renderer,a,{glMinFilter:"nearest",glMagFilter:"nearest"},this.width*this.density*this.aaDensity,this.height*this.density*this.aaDensity);this._renderer.textures.push(n),e.bindTexture(e.TEXTURE_2D,r),e.bindFramebuffer(e.FRAMEBUFFER,i),this.depthTexture=s,this.depth=h,this.colorTexture=a,this.color=n}deleteTexture(e){this._renderer.GL.deleteTexture(e);const t=this._renderer.textures.findIndex((t=>t.src===e));-1!==t&&this._renderer.textures.splice(t,1)}draw(e){const t=this._renderer.GL,r=t.getParameter(t.FRAMEBUFFER_BINDING);this.antialias&&this._renderer.hasWebGL2?t.bindFramebuffer(t.FRAMEBUFFER,this.aaFramebuffer):t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer);const i=t.getParameter(t.VIEWPORT);if(t.viewport(0,0,this.width*this.density*this.aaDensity,this.height*this.density*this.aaDensity),this.canvas.push(),this.canvas.setCamera(this.cam),this._renderer.uMVMatrix.set(this._renderer._curCamera.cameraMatrix.mat4[0],this._renderer._curCamera.cameraMatrix.mat4[1],this._renderer._curCamera.cameraMatrix.mat4[2],this._renderer._curCamera.cameraMatrix.mat4[3],this._renderer._curCamera.cameraMatrix.mat4[4],this._renderer._curCamera.cameraMatrix.mat4[5],this._renderer._curCamera.cameraMatrix.mat4[6],this._renderer._curCamera.cameraMatrix.mat4[7],this._renderer._curCamera.cameraMatrix.mat4[8],this._renderer._curCamera.cameraMatrix.mat4[9],this._renderer._curCamera.cameraMatrix.mat4[10],this._renderer._curCamera.cameraMatrix.mat4[11],this._renderer._curCamera.cameraMatrix.mat4[12],this._renderer._curCamera.cameraMatrix.mat4[13],this._renderer._curCamera.cameraMatrix.mat4[14],this._renderer._curCamera.cameraMatrix.mat4[15]),e(),this.antialias&&this._renderer.hasWebGL2){t.bindFramebuffer(t.READ_FRAMEBUFFER,this.aaFramebuffer),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.framebuffer);for(const[e,r]of[[t.COLOR_BUFFER_BIT,t.LINEAR],[t.DEPTH_BUFFER_BIT,t.NEAREST]])t.blitFramebuffer(0,0,this.width*this.density*this.aaDensity,this.height*this.density*this.aaDensity,0,0,this.width*this.density*this.aaDensity,this.height*this.density*this.aaDensity,e,r)}t.bindFramebuffer(t.FRAMEBUFFER,r),t.viewport(...i),this.canvas.pop()}remove(){const e=this._renderer.GL;this.deleteTexture(this.colorTexture),this.deleteTexture(this.depthTexture),e.deleteFramebuffer(this.framebuffer),this.aaFramebuffer&&e.deleteFramebuffer(this.aaFramebuffer),this.depthRenderbuffer&&e.deleteRenderbuffer(this.depthRenderbuffer),this.colorRenderbuffer&&e.deleteRenderbuffer(this.colorRenderbuffer)}} var tD=tokenData,nmR=0,gCcount=0,g1=1,hC=!0;class Random{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substring(0,8),16),s=parseInt(e.substring(8,16),16),d=parseInt(e.substring(16,24),16),r=parseInt(e.substring(24,32),16);return function(){let e=((t|=0)+(s|=0)|0)+(r|=0)|0;return r=r+1|0,t=s^s>>>9,s=(d|=0)+(d<<3)|0,d=(d=d<<21|d>>>11)+e|0,(e>>>0)/4294967296}};this.pA=new e(tokenData.hash.substring(2,34)),this.pB=new e(tokenData.hash.substring(34,66));for(let e=0;e<1e6;e+=2)this.pA(),this.pB()}d(){return nmR++,this.uA=!this.uA,this.uA?this.pA():this.pB()}dd(){return 2*this.d()-1}n(e,t){return e+(t-e)*this.d()}b(e){return this.d()<e}i(e,t){return Math.floor(this.n(e,t+1))}c(e){return e[this.i(0,e.length-1)]}rmM(e){return this.n(e[0],e[1])}rSign(){return(-1)**this.c([0,1])}rNd(){let e=this.d();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*e)}}let R=new Random;var tyty=!1;function gC(e,t=255,s="rand",d=0,r=.1,n=!0,o=pltArr,i=0){gCcount++,pn=R.c(e),tp=o[pn];let a=Math.abs(Math.round(R.rNd()+d))%tp.length;cS="rand"==s?R.c(tp):1==i?tp[a]:tp[d%tp.length];let c=p.color("#"+cS+p.hex(p.int(t)).slice(-2));return p.color(p.red(c)*(1+R.n(-r,r)),p.green(c)*(1+R.n(-r,r)),p.blue(c)*(1+R.n(-r,r)),t)}function gCwN(e,t=0,s=1){return p.color(p.red(e)*(1+R.n(-t,t)),p.green(e)*(1+R.n(-t,t)),p.blue(e)*(1+R.n(-t,t)),p.alpha(e)*s)}const pltArrBG={bgColors:["fef9ea"]},pltArr={marine:["e63946","f1faee","a8dadc","457b9d","1d3557"],gold:["ffdc73","ffcf40","ffbf00","bf9b30","a67c00","FFF9CB"],"in between scales":["3c91e6","9BC8F2","38608f","99B0C6","fafffd","342e37","653C2F","954927","f56416","ee902c","EBA637","e7bb41"],"warm tones":["e53d00","f29300","f9be00","ffe900","fef47c","fcfff7","8fd0cc","21a0a0","046865"],"c-2":["e6c229","f17105","d11149","6610f2","1a8fe3"],"c-3":["e6c229","f17105","d11111","274d70","0f803d","374007"],"c-4":["e6c229","fffbda","fff4cc","d11111","274d70","0f803d","374007","201510"],"c-6":["fbfef9","8a8c8e","191923","14496b","0e79b2","67468b","bf1363","d9534d","e67342","f39237"],"c-7":["ffe74c","ffa058","ff7d5e","ff5964","ffacb2","ffffff","b5f8bc","6bf178","50ccbc","35a7ff"]},pltLines={a:["fef9ea","303030","303030","303030","3445ca","303030","fef9ea","fef9ea","fef9ea","3445ca"]};class aP{constructor(e,t,s,d,r,n,o,i,a,c,u,h){this.n=e,this.c1=t,this.c2=s,this.sW=d,this.dF=r,this.nK=R.n(.01,.1),this.cP=n,this.w=o,this.rot=i,this.rot2=this.cP.angleBetween(dP.fP),this.dS=u,this.distN=this.cP.dist(dP.fP),this.paintN=h,this.wK=a,this.wKT=c,this.accents=[];let l=R.n(1,p.min(5,this.n/2));l=1;for(let e=0;e<1;e++)this.accents.push(R.i(0,this.n))}draw(e,t,s=this.c1,d=this.c2){let r,n=this.nK,o=0,i=2*p.PI/this.n;p.push(),p.translate(this.cP.x,this.cP.y,0),dP.ea&&R.b(dP.rndArr[32])&&p.rotateY(this.rot2),this.dF?p.fill(gCwN(s,.1,10*Math.abs(p.sin(nmR/2e3)))):p.noFill(),this.dS?(p.stroke(gCwN(d,.1,1)),p.strokeWeight(this.sW)):p.noStroke();this.wK;for(let e=0;e<this.paintN;e++){p.push(),p.translate(R.n(-10,10)*this.distN/100,R.n(-10,10)*this.distN/100,2*R.dd()),0==t&&p.beginShape(),o=.01*R.d();for(let e=0;e<this.n+1;e++)r=o,o+=i*(1+.02*n*R.d()),0==t&&dP.ea&&R.b(dP.rndArr[14])&&p.vertex(this.w*p.sin(o)+Math.sqrt(10*R.d()*dP.sW/this.distN),this.w*p.cos(o)+Math.sqrt(10*R.d()*dP.sH/this.distN));0==t&&p.endShape(),p.pop(),0==t&&R.b(.992503)&&(p.push(),p.translate(R.n(-1,1)*R.n(1,10),R.n(-1,1)*R.n(1,10),2*R.dd()),p.strokeWeight(this.sW*(1+.15*R.dd())),p.stroke(gCwN(this.c2,.25,3*Math.abs(p.sin(nmR/150+e/10)))),dP.ea&&R.b(dP.rndArr[22])&&p.rotateZ(this.rot2*(1+.1*R.dd())),p.line(2*R.d(),2*R.d(),this.w*(1+R.d())+2*R.d(),0+2*R.d()),p.pop())}p.pop()}}function q(e,t){return Math.floor(e*t)/t}class aRect{constructor(e,t,s,d,r){this.a=e,this.b=t,this.c=s,this.d=d,this.recursionLevel=r,this.w=Math.abs(this.b.x-this.a.x),this.h=Math.abs(this.c.y-this.a.y),this.cP=cV((this.a.x+this.b.x+this.c.x+this.d.x)/4,(this.a.y+this.b.y+this.c.y+this.d.y)/4),this.ar=this.w*this.h,this.col=R.c(pltArr)}divide(e,t){let s=this.a,d=this.b,r=this.c,n=this.d;return t>0?[new aRect(s,d,cV(r.x,s.y+this.h*e),cV(n.x,d.y+this.h*e),this.recursionLevel+1),new aRect(cV(r.x,s.y+this.h*e),cV(n.x,d.y+this.h*e),r,n,this.recursionLevel+1)]:[new aRect(s,cV(s.x+this.w*e,d.y),r,cV(r.x+this.w*e,n.y),this.recursionLevel+1),new aRect(cV(s.x+this.w*e,d.y),d,cV(r.x+this.w*e,n.y),n,this.recursionLevel+1)]}mult(e){this.a=this.a*e,this.b*=e,this.c*=e,this.d*=e,this.w*=e,this.h*=e,this.cP.x*=e,this.cP.y*=e,this.ar*=e*e}}function qt(e,t,s,d,r,n=0,o=[.5]){if(0==s)return[e];if(t>s||R.d()<r)return[e];let i=[],a=[];if(1==(a=e.divide(o,d)).length)return[e];for(let e=0;e<a.length;e++){let r=[];r=qt(a[e],t+1,s,-d,dP.baseGridProbSplit,n),i.push(...r)}return i}function readURLParams(e){const t=window.location.search,s=new URLSearchParams(t);for(var d of s.entries())e[d[0]]=p.float(d[1])}function drawOne(){let e=1e3*dP.gAR*dP.gameMarginPct.x*dP.yK,t=1e3*dP.gameMarginPct.y*dP.yK,s=dP.gOSK*dP.bOS,d=dP.gAR*dP.yK,r=1-2*dP.gameMarginPct.x,n=1-2*dP.gameMarginPct.y,o=cV(e+dP.gamePosCount*s%(1e3*d*r),t+dP.gameUD*(1e3*dP.yK*n)+(1==dP.gameUD?-1:1)*(dP.bOS*Math.floor(dP.gamePosCount*s/(1e3*d*r))%(1e3*dP.yK*n)),0);p.push(),p.translate(o),paintOnePos(),p.pop()}function paintOnePos(){let e=["#ee5544","#4455ee","#55ee44","#eeee22"];e=[];for(let t=0;t<6;t++)e.push(gC(dP.palettes,R.n(210,250),"i",t,.1,!0));let t=dP.gSDV,s=dP.gCDV,d=p.color(e[(s-1)%e.length]);p.noFill();let r=R.n(1,dP.maxNumOnePosDraw),n=dP.bOS*dP.gOSK;for(let e=0;e<r;e++)p.push(),p.strokeWeight(dP.yK*dP.gOWK*3*(1+R.dd())),p.stroke(gCwN(d,.15,1.5/r)),p.translate(cV(R.dd(),R.dd(),R.dd())),1==t?p.line(0+R.d()*dP.basicObjNoise,0+R.d()*dP.basicObjNoise,n+R.d()*dP.basicObjNoise,0+R.d()*dP.basicObjNoise):2==t?p.line(0+R.d()*dP.basicObjNoise,0+R.d()*dP.basicObjNoise,0+R.d()*dP.basicObjNoise,n+R.d()*dP.basicObjNoise):3==t?p.line(0+R.d()*dP.basicObjNoise,0+R.d()*dP.basicObjNoise,n+R.d()*dP.basicObjNoise,n+R.d()*dP.basicObjNoise):4==t?p.line(n+R.d()*dP.basicObjNoise,0+R.d()*dP.basicObjNoise,0+R.d()*dP.basicObjNoise,n+R.d()*dP.basicObjNoise):5==t?p.rect(0+R.d()*dP.basicObjNoise,0+R.d()*dP.basicObjNoise,n+R.d()*dP.basicObjNoise,n+R.d()*dP.basicObjNoise):6==t&&p.circle(n/2+R.d()*dP.basicObjNoise,n/2+R.d()*dP.basicObjNoise,n+R.d()*dP.basicObjNoise),p.pop()}var sh_fs,sh_vs,sh,fboA,fboB,fboC,fboD,theObjects=[],dP={},lt=[];sh_fs="\nprecision mediump float;varying vec2 vTexCoord;uniform sampler2D tex0, tex1,tex2,gtex;uniform vec2 tS, u_dir,u_res;uniform bool u_aB, u_bw, u_sS, u_f,gameOn;uniform float u_time, u_pA, u_pB, u_pC, u_g, u_br, u_con,u_cK;uniform float u_rndArr[50];uniform int o;float rd(vec2 st) { return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);}vec3 gB(sampler2D t, vec2 texUV, vec2 sS) { vec3 colOut=vec3(0.0); const int sC=9; float gW[sC]; gW[0]=0.10855; gW[1]=0.13135; gW[2]=0.10406; gW[3]=0.07216; gW[4]=0.04380; gW[5]=0.02328; gW[6]=0.01083; gW[7]=0.00441; gW[8]=0.00157; float gO[sC]; gO[0]=0.66293; gO[1]=2.47904; gO[2]=4.46232; gO[3]=6.44568; gO[4]=8.42917; gO[5]=10.41281; gO[6]=12.39664; gO[7]=14.38070; gO[8]=16.36501; for(int i=0; i < sC; i++) { vec2 tCO=gO[i] * sS; vec3 col=texture2D(t, texUV + tCO).xyz + texture2D(t, texUV - tCO).xyz; col *= gW[i]; colOut += col; } return colOut;}float dc(vec2 c, float r) { return step(length(c), r);}vec3 g(vec3 v, float p) { return vec3(pow(abs(v.r), p), pow(abs(v.g), p), pow(abs(v.b), p));}vec3 bC(vec3 v, float b, float c) { return (v - 0.5) * c + 0.5 + b;}float modm(float x, float y) { return x - y * floor(x / y);}float q(float x,float s) { return floor(x*s)/s;}void main() { vec2 uv=vTexCoord; float multK=3000.*150.*u_rndArr[17]; float resK=100.5; float resK2=2300.; vec2 uvN=vec2(float(int(multK*uv.x/resK)),float(int(multK*uv.y/resK))); vec2 uvN2=vec2(float(int(multK*uv.x/resK2)),float(int(multK*uv.y/resK2))); vec2 uv2=uv; vec2 uv3=uv; float q1=.105*u_rndArr[10],q2=.105*u_rndArr[12],q3=.105*u_rndArr[13]; float xk=u_rndArr[41]*1.591*abs(10.*q(sin(0.25*20.*(uv.x+uv.y*0.175)*u_rndArr[10]+u_rndArr[32]*10.),q1)+2.525*q(cos(0.25*10.*(uv.x*2.*u_rndArr[12])+u_rndArr[34]*10.),q2)+4.*q(sin(0.25*5.*(uv.x*0.05+uv.y*0.05)+u_rndArr[26]*10.),q3)); float yk=u_rndArr[42]*1.591*abs(10.*q(sin(0.25*18.*(uv.y+uv.x*0.075)*u_rndArr[11]+u_rndArr[33]*10.),q1)+2.525*q(cos(0.25*12.*(uv.y*2.*u_rndArr[21])+u_rndArr[32]*10.),q2)+4.*q(sin(0.25*8.*(uv.y*0.05+uv.x*0.10)+u_rndArr[27]*10.),q3)); uv3.x=floor(uv.x*xk)/xk; uv3.y=floor(uv.y*yk)/yk; uv3.x += modm(uv3.x,u_rndArr[5]*u_rndArr[2]*u_rndArr[0]); uv3.y += modm(uv3.y,u_rndArr[4]*u_rndArr[3]*u_rndArr[1]); uv3.x += u_rndArr[15]*uv3.y +u_rndArr[44]*uv3.x/2.; uv2.x=uv.x+0.21432*fract(uv.x)/2.; uv2.x=uv.x+0.15*modm(uv.x,5.); uv2.y=uv.x+0.171432*fract(uv.y)/3.; uv2.y=uv.x+0.15*modm(uv.y,4.); vec2 uvCh=vec2(1. - uv.x - sin(u_time / 2.), 1. - uv.y - sin(u_time / 2.)); float rnd=rd(uv * u_time); float rnd2=rd( (1.-uvN)*u_time*0.00001*u_rndArr[2]*u_rndArr[0]); vec3 tN=vec3(0.5, 0.5, 0.5) * rnd; vec3 tN2=vec3(0.5, 0.5, 0.5) * rnd2; tN=tN2; vec3 tI,tI3,tI2; tI=0.995*texture2D(tex0, vec2(uv.x, 1. - uv.y)).xyz; tI3=texture2D(tex2, vec2(uv.x, 1. - uv.y)).xyz; tI += 0.325*texture2D(tex0, vec2(uv2.x, 1. - uv2.y)).xyz; tI2=texture2D(tex0, vec2(uv3.x, 1. - uv3.y)).xyz; tI *= (vec3(.4505)+0.95*tI2); tI *=(0.15+.95*tI3 +u_cK*.85*(tI2*tI3)); vec3 cOut; if(u_aB) { vec3 b1=gB(tex0, vec2(uv.x, 1. - uv.y), tS * u_dir); vec3 b2=gB(tex0, vec2(uv.x, 1. - uv.y), tS * vec2(u_dir.x, u_dir.x)); vec3 b3=gB(tex0, vec2(uv.x, 1. - uv.y), tS * vec2((u_dir.y + u_dir.x) / 2., (u_dir.y + u_dir.x) / 2.)); b1=0.6 * b1 + 0.42 * b2 + 0.42 * b3; cOut=0.75 * bC(tI * (b1 * u_pA + u_pB) + tN * u_pC + 0.03 * tN * (0.5 + b1), u_br, u_con); b1=gB(tex1, vec2(uv.x, 1. - uv.y), tS * u_dir); b2=gB(tex1, vec2(uv.x, 1. - uv.y), tS * vec2(u_dir.x, u_dir.x)); b3=gB(tex1, vec2(uv.x, 1. - uv.y), tS * vec2((u_dir.y + u_dir.x) / 2., (u_dir.y + u_dir.x) / 2.)); b1=0.6 * b1 + 0.42 * b2 + 0.42 * b3; cOut += 0.25 * bC(tI2 * (b1 * u_pA + u_pB) + tN * u_pC + 0.03 * tN * (0.5 + b1), u_br, u_con); } else { cOut=0.99 * tI + tN * u_pC; } bool doBW=u_bw; if(doBW) { float tot=u_rndArr[23]+u_rndArr[6]+u_rndArr[16]; cOut=vec3(u_rndArr[23] * cOut.r +u_rndArr[6] * cOut.g + u_rndArr[16] * cOut.b)/vec3(tot); if (gl_FragCoord.x > (0.5+u_rndArr[26]+0.25*u_rndArr[27])*u_res[0]) cOut=1. - cOut; } cOut=g(cOut, u_g); if (o==1) { cOut=texture2D(tex0, vec2(uv.x, 1. - uv.y)).xyz; } else if (o==2) { cOut=tI2; } else if (o==3) { cOut=tI3; } if (gameOn) { vec3 tg=texture2D(gtex, vec2(uv.x, 1.-uv.y)).xyz; vec3 b1=gB(gtex, vec2(uv.x, 1. - uv.y), 0.25*tS * u_dir); vec3 b2=gB(gtex, vec2(uv.x, 1. - uv.y), 0.25*tS * vec2(u_dir.x, u_dir.x)); vec3 b3=gB(gtex, vec2(uv.x, 1. - uv.y), 0.25*tS * vec2((u_dir.y + u_dir.x) / 2., (u_dir.y + u_dir.x) / 2.)); b1=0.6 * b1 + 0.42 * b2 + 0.42 * b3; tg=g(0.5*b1+0.7*tg+0.25*tN,u_g/1.15); cOut *= (0.5+0.75*tg); cOut += 0.75*tg; } gl_FragColor=vec4(cOut, 1.0);}\n",sh_vs="precision highp float; attribute vec3 aPosition; varying vec2 vTexCoord; void main() { vec4 positionVec4 = vec4(aPosition, 1.0); positionVec4.xy = positionVec4.xy * 2.0-1.; positionVec4.y = -positionVec4.y; vTexCoord = vec2(aPosition); gl_Position = positionVec4; }";let sketch=function(e){e.sAP=function(){dP.ea=1,dP.oT=0,dP.gSDV=0,dP.gCDV=0,dP.gOSK=.95,dP.gOWK=1,dP.gameInitPos=R.i(25,250),dP.gameUD=R.c([0,1,1]),dP.gamePosCount=0,dP.yK=dP.sH/1e3,dP.bOS=1e3*R.n(.025,.05)*dP.gAR*dP.yK,dP.oneMove={color:0,type:0,direction:0},dP.gameMarginPct=cV(R.c([.01,.05,.1,.2]),R.c([.01,.05,.1,.2])),dP.basicObjNoise=5,dP.maxNumOnePosDraw=R.i(3,8),dP.gameOn=!1,dP.pd=e.pixelDensity(),dP.pdA=dP.pd,dP.pdB=dP.pd,dP.pdC=dP.pd,dP.baseGridMaxIter=R.i(3,8),dP.baseGridProbSplit=R.n(.15,.25),dP.baseGridProbSkipThis=R.n(0,.15),dP.qtT=R.c([.33,.5,.66]);let t=new aRect(cV(0,0),cV(660,0),cV(0,1e3),cV(660,1e3),0);dP.fP=cV(R.d()*dP.sW,R.d()*dP.sH,0);let s=R.rSign();dP.grid=[],dP.grid=qt(t,0,dP.baseGridMaxIter,s,0,dP.baseGridProbSkipThis,dP.qtT);for(let e=0;e<dP.grid.length;e++)dP.grid[e].mult(dP.yK);dP.objSides=R.c([[3,4,5,6,10,20],[3,4,10],[3,4,6],[3,4]]),dP.paintNmM=R.c([[1,1],[1,20],[10,20]]),dP.wKmM=R.c([[1,1],[.5,2],[.25,4],[.75,1.5]]),dP.wKTmM=R.c([[.1,.25],[.5,1]]),dP.objSizemM=[10,50],dP.bgC=gC(["bgColors"],255,"rand",0,.1,!0,pltArrBG),dP.cK=1;let d=(e.red(dP.bgC)+e.green(dP.bgC)+e.blue(dP.bgC))/765;d>600/765?dP.cK=(1/d)**2:d<300/765&&(dP.cK=(1/d)**1.5),dP.cK=(3.5-2*Math.exp(.45*d))**4,dP.cK=Math.cos(d*e.PI/2),dP.palettes=[R.c(Object.keys(pltArr))],dP.prodDF=R.n(.25,1),dP.prodDS=R.n(.15,1),dP.sWmM=R.c([[.5,.75],[.5,2],[2,4],[1,10]]),dP.hmM=R.c([[.01,.02],[.025,.1],[.05,.2],[.1,.25],[.21,.5]]),dP.tLR=[],dP.theLineT=R.c([205,235]),dP.theLineColoursN=R.c([1,R.i(1,dP.palettes[0].length)]),dP.theLineColoursN=dP.palettes[0].length,dP.lineStartK=R.c([0,.15,.3]),dP.lineEndK=R.c([0,.1,.5]),dP.lineSinK=R.c([1,5,5,10,25]),dP.theLineRot=R.dd()*e.PI,dP.lineI=R.c([.01,.1,.05]),dP.lineI=.1,dP.numLmM=R.c([[20,60],[30,80],[10,100],[50,250]]),dP.hmM[0]>.2&&(dP.numLmM=[3,50]);let r,n=0,o=0,i=0;for(;n<1e3;)oLK=R.n(1,1.35)*dP.hmM[0]>.28?1.15:1,r=R.n(.25,.95),i=R.rmM(dP.numLmM),dP.tLR.push({thePosH:n*dP.yK,oLK:oLK,dd:r,numL:i,sW:r*dP.sW/i,offset:R.c([0,0,0,-dP.sW*R.n(.05,.5),dP.sW*R.n(.05,.5)]),inc:R.n(-1,1)*dP.line
I have been long interested in education and generative art, approaching them separately most of the time. This artwork tries to get them closer in my practice, by letting the experiencer of the piece finish it by creating a part of it with a rule-based system, to mimic what the system does but at a smaller scale. This little game is not just a playful addition, but a fundamental part of the artwork, without which the piece is not complete. The title is drawn from the idea that generative art can take you to explore every corner of a given space of possibilities, finding the strange things (extrañezas) along the way. Also, exploring the what ifs when some rules are broken. And experiencing it in first person. The piece aims to show various parts of how I create my pieces, by showing the different layers it is composed of and letting the experiencer finalise the artwork by having to recreate step by step what the algorithm has done to create the intermediate work. Art has this tremendous power to engage, to attract, to let the observer get carried away in their own inner world as a reaction to what the piece proposes. I believe the positive impact of a piece in the experiencer can be then increased if they can understand better the process that creates the piece. The piece creates a base layer of colour shapes, rather informal and basic. It then uses vertical lines to add rhythm to it, and a distortion layer to generate a more intricate canvas. The lines layer is then used again to act as a mask, effectively creating windows into the layer with the simple shapes. The experiencer then has to find the way to ask the piece to play a game (hint: most of my pieces accept written commands). When they are rewarded with this possibility, the piece writes in the browser console (press cmd+shift+i / ctrl+shift+i to see it in most browsers) a set of instructions of what to to next. The experiencer can then finish the piece with their own intent. In a way, it's a performance of the piece. A way to make it more personal. Or to just wander around with no intention. Relaxing our thoughts with pure play is something we seldom do as adults, yet it is the source of new thoughts, ideas, or a way to find inner equilibrium. Aesthetically, it is furthering the exploration of colour that I have been doing in most of my pieces. A clear reference to me is František Kupka series of paintings made of vertical lines, of which "The cathedral" is one of the best known. While I had this in mind, I abandoned my original intention of creating a tribute to that series, but ended up visually close in some outputs. The piece allows for further control. The instructions are written to the browser console when loading the piece. They can also be found in the Display Notes section, or in my website, https://www.iillucid.com/extranezas. A quick summary: press s to save current image, v followed by 1, 2, 3 or 0 to see all the layers in the image. Please try to find the hidden _game_. The piece is not complete without it.
!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).earcut=e()}((function(){return function e(n,t,r){function x(u,f){if(!t[u]){if(!n[u]){var o="function"==typeof require&&require;if(!f&&o)return o(u,!0);if(i)return i(u,!0);throw(f=new Error("Cannot find module '"+u+"'")).code="MODULE_NOT_FOUND",f}o=t[u]={exports:{}},n[u][0].call(o.exports,(function(e){return x(n[u][1][e]||e)}),o,o.exports,e,n,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)x(r[u]);return x}({1:[function(e,n,t){"use strict";function r(e,n,t){t=t||2;var r,o,y,a,l,h=n&&n.length,d=h?n[0]*t:e.length,Z=x(e,0,d,t,!0),g=[];if(Z&&Z.next!==Z.prev){if(h&&(Z=function(e,n,t,r){var u,o,y,a=[];for(u=0,o=n.length;u<o;u++)(y=x(e,y=n[u]*r,u<o-1?n[u+1]*r:e.length,r,!1))===y.next&&(y.steiner=!0),a.push(function(e){for(var n=e,t=e;(n.x<t.x||n.x===t.x&&n.y<t.y)&&(t=n),(n=n.next)!==e;);return t}(y));for(a.sort(f),u=0;u<a.length;u++)t=function(e,n){var t=function(e,n){var t,r=n,x=e.x,i=e.y,u=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var f=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(f<=x&&u<f&&(u=f,t=r.x<r.next.x?r:r.next,f===x))return t}}while((r=r.next)!==n);if(!t)return null;var o,y=t,a=t.x,l=t.y,h=1/0;for(r=t;x>=r.x&&r.x>=a&&x!==r.x&&v(i<l?x:u,i,a,l,i<l?u:x,i,r.x,r.y)&&(o=Math.abs(i-r.y)/(x-r.x),s(r,e)&&(o<h||o===h&&(r.x>t.x||r.x===t.x&&function(e,n){return p(e.prev,e,n.prev)<0&&p(n.next,e,e.next)<0}(t,r)))&&(t=r,h=o)),(r=r.next)!==y;);return t}(e,n);return t?(i(n=c(t,e),n.next),i(t,t.next)):n}(a[u],t);return t}(e,n,Z,t)),e.length>80*t){for(var w=r=e[0],M=o=e[1],b=t;b<d;b+=t)(y=e[b])<w&&(w=y),(a=e[b+1])<M&&(M=a),r<y&&(r=y),o<a&&(o=a);l=0!==(l=Math.max(r-w,o-M))?32767/l:0}u(Z,g,t,w,M,l,0)}return g}function x(e,n,t,r,x){var i,u;if(x===0<w(e,n,t,r))for(i=n;i<t;i+=r)u=d(i,e[i],e[i+1],u);else for(i=t-r;n<=i;i-=r)u=d(i,e[i],e[i+1],u);return u&&y(u,u.next)&&(Z(u),u=u.next),u}function i(e,n){if(!e)return e;n=n||e;var t,r=e;do{if(t=!1,r.steiner||!y(r,r.next)&&0!==p(r.prev,r,r.next))r=r.next;else{if(Z(r),(r=n=r.prev)===r.next)break;t=!0}}while(t||r!==n);return n}function u(e,n,t,r,x,f,l){if(e){if(!l&&f){for(var h=e,d=r,g=x,w=f,M=h;0===M.z&&(M.z=o(M.x,M.y,d,g,w)),M.prevZ=M.prev,M.nextZ=M.next,(M=M.next)!==h;);M.prevZ.nextZ=null,M.prevZ=null;var b,m,z,q,O,k,D,E,N=M,U=1;do{for(m=N,O=N=null,k=0;m;){for(k++,z=m,b=D=0;b<U&&(D++,z=z.nextZ);b++);for(E=U;0<D||0<E&&z;)0!==D&&(0===E||!z||m.z<=z.z)?(m=(q=m).nextZ,D--):(z=(q=z).nextZ,E--),O?O.nextZ=q:N=q,q.prevZ=O,O=q;m=z}}while(O.nextZ=null,U*=2,1<k)}for(var _,j,C=e;e.prev!==e.next;)if(_=e.prev,j=e.next,f?function(e,n,t,r){var x=e.prev,i=e,u=e.next;if(!(0<=p(x,i,u))){for(var f=x.x,y=i.x,a=u.x,l=x.y,h=i.y,s=u.y,c=f<y?f<a?f:a:y<a?y:a,d=l<h?l<s?l:s:h<s?h:s,Z=y<f?a<f?f:a:a<y?y:a,g=h<l?s<l?l:s:s<h?h:s,w=o(c,d,n,t,r),M=o(Z,g,n,t,r),b=e.prevZ,m=e.nextZ;b&&b.z>=w&&m&&m.z<=M;){if(b.x>=c&&b.x<=Z&&b.y>=d&&b.y<=g&&b!==x&&b!==u&&v(f,l,y,h,a,s,b.x,b.y)&&0<=p(b.prev,b,b.next))return;if(b=b.prevZ,m.x>=c&&m.x<=Z&&m.y>=d&&m.y<=g&&m!==x&&m!==u&&v(f,l,y,h,a,s,m.x,m.y)&&0<=p(m.prev,m,m.next))return;m=m.nextZ}for(;b&&b.z>=w;){if(b.x>=c&&b.x<=Z&&b.y>=d&&b.y<=g&&b!==x&&b!==u&&v(f,l,y,h,a,s,b.x,b.y)&&0<=p(b.prev,b,b.next))return;b=b.prevZ}for(;m&&m.z<=M;){if(m.x>=c&&m.x<=Z&&m.y>=d&&m.y<=g&&m!==x&&m!==u&&v(f,l,y,h,a,s,m.x,m.y)&&0<=p(m.prev,m,m.next))return;m=m.nextZ}return 1}}(e,r,x,f):function(e){var n=e.prev,t=e;if(!(0<=p(n,t,e=e.next))){for(var r=n.x,x=t.x,i=e.x,u=n.y,f=t.y,o=e.y,y=r<x?r<i?r:i:x<i?x:i,a=u<f?u<o?u:o:f<o?f:o,l=x<r?i<r?r:i:i<x?x:i,h=f<u?o<u?u:o:o<f?f:o,s=e.next;s!==n;){if(s.x>=y&&s.x<=l&&s.y>=a&&s.y<=h&&v(r,u,x,f,i,o,s.x,s.y)&&0<=p(s.prev,s,s.next))return;s=s.next}return 1}}(e))n.push(_.i/t|0),n.push(e.i/t|0),n.push(j.i/t|0),Z(e),e=j.next,C=j.next;else if((e=j)===C){l?1===l?u(e=function(e,n,t){var r=e;do{var x=r.prev,u=r.next.next}while(!y(x,u)&&a(x,r,r.next,u)&&s(x,u)&&s(u,x)&&(n.push(x.i/t|0),n.push(r.i/t|0),n.push(u.i/t|0),Z(r),Z(r.next),r=e=u),(r=r.next)!==e);return i(r)}(i(e),n,t),n,t,r,x,f,2):2===l&&function(e,n,t,r,x,f){var o=e;do{for(var v,l=o.next.next;l!==o.prev;){if(o.i!==l.i&&function(e,n){return e.next.i!==n.i&&e.prev.i!==n.i&&!function(e,n){var t=e;do{if(t.i!==e.i&&t.next.i!==e.i&&t.i!==n.i&&t.next.i!==n.i&&a(t,t.next,e,n))return 1}while((t=t.next)!==e)}(e,n)&&(s(e,n)&&s(n,e)&&function(e,n){for(var t=e,r=!1,x=(e.x+n.x)/2,i=(e.y+n.y)/2;t.y>i!=t.next.y>i&&t.next.y!==t.y&&x<(t.next.x-t.x)*(i-t.y)/(t.next.y-t.y)+t.x&&(r=!r),(t=t.next)!==e;);return r}(e,n)&&(p(e.prev,e,n.prev)||p(e,n.prev,n))||y(e,n)&&0<p(e.prev,e,e.next)&&0<p(n.prev,n,n.next))}(o,l))return v=c(o,l),o=i(o,o.next),v=i(v,v.next),u(o,n,t,r,x,f,0),u(v,n,t,r,x,f,0);l=l.next}}while((o=o.next)!==e)}(e,n,t,r,x,f):u(i(e),n,t,r,x,f,1);break}}}function f(e,n){return e.x-n.x}function o(e,n,t,r,x){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-t)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*x|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function v(e,n,t,r,x,i,u,f){return(e-u)*(i-f)<=(x-u)*(n-f)&&(t-u)*(n-f)<=(e-u)*(r-f)&&(x-u)*(r-f)<=(t-u)*(i-f)}function p(e,n,t){return(n.y-e.y)*(t.x-n.x)-(n.x-e.x)*(t.y-n.y)}function y(e,n){return e.x===n.x&&e.y===n.y}function a(e,n,t,r){var x=h(p(e,n,t)),i=h(p(e,n,r)),u=h(p(t,r,e)),f=h(p(t,r,n));return x!==i&&u!==f||0===x&&l(e,t,n)||0===i&&l(e,r,n)||0===u&&l(t,e,r)||!(0!==f||!l(t,n,r))}function l(e,n,t){return n.x<=Math.max(e.x,t.x)&&n.x>=Math.min(e.x,t.x)&&n.y<=Math.max(e.y,t.y)&&n.y>=Math.min(e.y,t.y)}function h(e){return 0<e?1:e<0?-1:0}function s(e,n){return p(e.prev,e,e.next)<0?0<=p(e,n,e.next)&&0<=p(e,e.prev,n):p(e,n,e.prev)<0||p(e,e.next,n)<0}function c(e,n){var t=new g(e.i,e.x,e.y),r=new g(n.i,n.x,n.y),x=e.next,i=n.prev;return(e.next=n).prev=e,(t.next=x).prev=t,(r.next=t).prev=r,(i.next=r).prev=i,r}function d(e,n,t,r){return e=new g(e,n,t),r?(e.next=r.next,(e.prev=r).next.prev=e,r.next=e):(e.prev=e).next=e,e}function Z(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function g(e,n,t){this.i=e,this.x=n,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function w(e,n,t,r){for(var x=0,i=n,u=t-r;i<t;i+=r)x+=(e[u]-e[i])*(e[i+1]+e[u+1]),u=i;return x}n.exports=r,(n.exports.default=r).deviation=function(e,n,t,r){var x=n&&n.length,i=x?n[0]*t:e.length,u=Math.abs(w(e,0,i,t));if(x)for(var f=0,o=n.length;f<o;f++){var v=n[f]*t,p=f<o-1?n[f+1]*t:e.length;u-=Math.abs(w(e,v,p,t))}var y=0;for(f=0;f<r.length;f+=3){var a=r[f]*t,l=r[f+1]*t,h=r[f+2]*t;y+=Math.abs((e[a]-e[h])*(e[1+l]-e[1+a])-(e[a]-e[l])*(e[1+h]-e[1+a]))}return 0===u&&0===y?0:Math.abs((y-u)/u)},r.flatten=function(e){for(var n=e[0][0].length,t={vertices:[],holes:[],dimensions:n},r=0,x=0;x<e.length;x++){for(var i=0;i<e[x].length;i++)for(var u=0;u<n;u++)t.vertices.push(e[x][i][u]);0<x&&(r+=e[x-1].length,t.holes.push(r))}return t}},{}]},{},[1])(1)}));
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";const i=134217729;function e(t,i,e,n,s){let l,h,r,o,a=i[0],c=n[0],u=0,f=0;c>a==c>-a?(l=a,a=i[++u]):(l=c,c=n[++f]);let _=0;if(u<t&&f<e)for(c>a==c>-a?(h=a+l,r=l-(h-a),a=i[++u]):(h=c+l,r=l-(h-c),c=n[++f]),l=h,0!==r&&(s[_++]=r);u<t&&f<e;)c>a==c>-a?(h=l+a,o=h-l,r=l-(h-o)+(a-o),a=i[++u]):(h=l+c,o=h-l,r=l-(h-o)+(c-o),c=n[++f]),l=h,0!==r&&(s[_++]=r);for(;u<t;)h=l+a,o=h-l,r=l-(h-o)+(a-o),a=i[++u],l=h,0!==r&&(s[_++]=r);for(;f<e;)h=l+c,o=h-l,r=l-(h-o)+(c-o),c=n[++f],l=h,0!==r&&(s[_++]=r);return 0===l&&0!==_||(s[_++]=l),_}function n(t){return new Float64Array(t)}const s=n(4),l=n(8),h=n(12),r=n(16),o=n(4);function a(t,n,a,c,u,f){const _=(n-f)*(a-u),d=(t-u)*(c-f),g=_-d;if(0===_||0===d||_>0!=d>0)return g;const y=Math.abs(_+d);return Math.abs(g)>=33306690738754716e-32*y?g:-function(t,n,a,c,u,f,_){let d,g,y,m,x,p,w,v,b,T,M,A,k,$,P,S,I,z;const F=t-u,U=a-u,K=n-f,L=c-f;$=F*L,p=i*F,w=p-(p-F),v=F-w,p=i*L,b=p-(p-L),T=L-b,P=v*T-($-w*b-v*b-w*T),S=K*U,p=i*K,w=p-(p-K),v=K-w,p=i*U,b=p-(p-U),T=U-b,I=v*T-(S-w*b-v*b-w*T),M=P-I,x=P-M,s[0]=P-(M+x)+(x-I),A=$+M,x=A-$,k=$-(A-x)+(M-x),M=k-S,x=k-M,s[1]=k-(M+x)+(x-S),z=A+M,x=z-A,s[2]=A-(z-x)+(M-x),s[3]=z;let j=function(t,i){let e=i[0];for(let t=1;t<4;t++)e+=i[t];return e}(0,s),H=22204460492503146e-32*_;if(j>=H||-j>=H)return j;if(x=t-F,d=t-(F+x)+(x-u),x=a-U,y=a-(U+x)+(x-u),x=n-K,g=n-(K+x)+(x-f),x=c-L,m=c-(L+x)+(x-f),0===d&&0===g&&0===y&&0===m)return j;if(H=11093356479670487e-47*_+33306690738754706e-32*Math.abs(j),j+=F*m+L*d-(K*y+U*g),j>=H||-j>=H)return j;$=d*L,p=i*d,w=p-(p-d),v=d-w,p=i*L,b=p-(p-L),T=L-b,P=v*T-($-w*b-v*b-w*T),S=g*U,p=i*g,w=p-(p-g),v=g-w,p=i*U,b=p-(p-U),T=U-b,I=v*T-(S-w*b-v*b-w*T),M=P-I,x=P-M,o[0]=P-(M+x)+(x-I),A=$+M,x=A-$,k=$-(A-x)+(M-x),M=k-S,x=k-M,o[1]=k-(M+x)+(x-S),z=A+M,x=z-A,o[2]=A-(z-x)+(M-x),o[3]=z;const E=e(4,s,4,o,l);$=F*m,p=i*F,w=p-(p-F),v=F-w,p=i*m,b=p-(p-m),T=m-b,P=v*T-($-w*b-v*b-w*T),S=K*y,p=i*K,w=p-(p-K),v=K-w,p=i*y,b=p-(p-y),T=y-b,I=v*T-(S-w*b-v*b-w*T),M=P-I,x=P-M,o[0]=P-(M+x)+(x-I),A=$+M,x=A-$,k=$-(A-x)+(M-x),M=k-S,x=k-M,o[1]=k-(M+x)+(x-S),z=A+M,x=z-A,o[2]=A-(z-x)+(M-x),o[3]=z;const C=e(E,l,4,o,h);$=d*m,p=i*d,w=p-(p-d),v=d-w,p=i*m,b=p-(p-m),T=m-b,P=v*T-($-w*b-v*b-w*T),S=g*y,p=i*g,w=p-(p-g),v=g-w,p=i*y,b=p-(p-y),T=y-b,I=v*T-(S-w*b-v*b-w*T),M=P-I,x=P-M,o[0]=P-(M+x)+(x-I),A=$+M,x=A-$,k=$-(A-x)+(M-x),M=k-S,x=k-M,o[1]=k-(M+x)+(x-S),z=A+M,x=z-A,o[2]=A-(z-x)+(M-x),o[3]=z;const N=e(C,h,4,o,r);return r[N-1]}(t,n,a,c,u,f,y)}const c=Math.pow(2,-52),u=new Uint32Array(512);class f{static from(t,i=x,e=p){const n=t.length,s=new Float64Array(2*n);for(let l=0;l<n;l++){const n=t[l];s[2*l]=i(n),s[2*l+1]=e(n)}return new f(s)}constructor(t){const i=t.length>>1;if(i>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*i-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(i)),this._hullPrev=new Uint32Array(i),this._hullNext=new Uint32Array(i),this._hullTri=new Uint32Array(i),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(i),this._dists=new Float64Array(i),this.update()}update(){const{coords:t,_hullPrev:i,_hullNext:e,_hullTri:n,_hullHash:s}=this,l=t.length>>1;let h=1/0,r=1/0,o=-1/0,u=-1/0;for(let i=0;i<l;i++){const e=t[2*i],n=t[2*i+1];e<h&&(h=e),n<r&&(r=n),e>o&&(o=e),n>u&&(u=n),this._ids[i]=i}const f=(h+o)/2,d=(r+u)/2;let m,x,p,w=1/0;for(let i=0;i<l;i++){const e=_(f,d,t[2*i],t[2*i+1]);e<w&&(m=i,w=e)}const v=t[2*m],b=t[2*m+1];w=1/0;for(let i=0;i<l;i++){if(i===m)continue;const e=_(v,b,t[2*i],t[2*i+1]);e<w&&e>0&&(x=i,w=e)}let T=t[2*x],M=t[2*x+1],A=1/0;for(let i=0;i<l;i++){if(i===m||i===x)continue;const e=g(v,b,T,M,t[2*i],t[2*i+1]);e<A&&(p=i,A=e)}let k=t[2*p],$=t[2*p+1];if(A===1/0){for(let i=0;i<l;i++)this._dists[i]=t[2*i]-t[0]||t[2*i+1]-t[1];y(this._ids,this._dists,0,l-1);const i=new Uint32Array(l);let e=0;for(let t=0,n=-1/0;t<l;t++){const s=this._ids[t];this._dists[s]>n&&(i[e++]=s,n=this._dists[s])}return this.hull=i.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(a(v,b,T,M,k,$)<0){const t=x,i=T,e=M;x=p,T=k,M=$,p=t,k=i,$=e}const P=function(t,i,e,n,s,l){const h=e-t,r=n-i,o=s-t,a=l-i,c=h*h+r*r,u=o*o+a*a,f=.5/(h*a-r*o);return{x:t+(a*c-r*u)*f,y:i+(h*u-o*c)*f}}(v,b,T,M,k,$);this._cx=P.x,this._cy=P.y;for(let i=0;i<l;i++)this._dists[i]=_(t[2*i],t[2*i+1],P.x,P.y);y(this._ids,this._dists,0,l-1),this._hullStart=m;let S=3;e[m]=i[p]=x,e[x]=i[m]=p,e[p]=i[x]=m,n[m]=0,n[x]=1,n[p]=2,s.fill(-1),s[this._hashKey(v,b)]=m,s[this._hashKey(T,M)]=x,s[this._hashKey(k,$)]=p,this.trianglesLen=0,this._addTriangle(m,x,p,-1,-1,-1);for(let l,h,r=0;r<this._ids.length;r++){const o=this._ids[r],u=t[2*o],f=t[2*o+1];if(r>0&&Math.abs(u-l)<=c&&Math.abs(f-h)<=c)continue;if(l=u,h=f,o===m||o===x||o===p)continue;let _=0;for(let t=0,i=this._hashKey(u,f);t<this._hashSize&&(_=s[(i+t)%this._hashSize],-1===_||_===e[_]);t++);_=i[_];let d,g=_;for(;d=e[g],a(u,f,t[2*g],t[2*g+1],t[2*d],t[2*d+1])>=0;)if(g=d,g===_){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,o,e[g],-1,-1,n[g]);n[o]=this._legalize(y+2),n[g]=y,S++;let w=e[g];for(;d=e[w],a(u,f,t[2*w],t[2*w+1],t[2*d],t[2*d+1])<0;)y=this._addTriangle(w,o,d,n[o],-1,n[w]),n[o]=this._legalize(y+2),e[w]=w,S--,w=d;if(g===_)for(;d=i[g],a(u,f,t[2*d],t[2*d+1],t[2*g],t[2*g+1])<0;)y=this._addTriangle(d,o,g,-1,n[g],n[d]),this._legalize(y+2),n[d]=y,e[g]=g,S--,g=d;this._hullStart=i[o]=g,e[g]=i[w]=o,e[o]=w,s[this._hashKey(u,f)]=o,s[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(S);for(let t=0,i=this._hullStart;t<S;t++)this.hull[t]=i,i=e[i];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,i){return Math.floor(function(t,i){const e=t/(Math.abs(t)+Math.abs(i));return(i>0?3-e:1+e)/4}(t-this._cx,i-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:i,_halfedges:e,coords:n}=this;let s=0,l=0;for(;;){const h=e[t],r=t-t%3;if(l=r+(t+2)%3,-1===h){if(0===s)break;t=u[--s];continue}const o=h-h%3,a=r+(t+1)%3,c=o+(h+2)%3,f=i[l],_=i[t],g=i[a],y=i[c];if(d(n[2*f],n[2*f+1],n[2*_],n[2*_+1],n[2*g],n[2*g+1],n[2*y],n[2*y+1])){i[t]=y,i[h]=f;const n=e[c];if(-1===n){let i=this._hullStart;do{if(this._hullTri[i]===c){this._hullTri[i]=t;break}i=this._hullPrev[i]}while(i!==this._hullStart)}this._link(t,n),this._link(h,e[l]),this._link(l,c);const r=o+(h+1)%3;s<u.length&&(u[s++]=r)}else{if(0===s)break;t=u[--s]}}return l}_link(t,i){this._halfedges[t]=i,-1!==i&&(this._halfedges[i]=t)}_addTriangle(t,i,e,n,s,l){const h=this.trianglesLen;return this._triangles[h]=t,this._triangles[h+1]=i,this._triangles[h+2]=e,this._link(h,n),this._link(h+1,s),this._link(h+2,l),this.trianglesLen+=3,h}}function _(t,i,e,n){const s=t-e,l=i-n;return s*s+l*l}function d(t,i,e,n,s,l,h,r){const o=t-h,a=i-r,c=e-h,u=n-r,f=s-h,_=l-r,d=c*c+u*u,g=f*f+_*_;return o*(u*g-d*_)-a*(c*g-d*f)+(o*o+a*a)*(c*_-u*f)<0}function g(t,i,e,n,s,l){const h=e-t,r=n-i,o=s-t,a=l-i,c=h*h+r*r,u=o*o+a*a,f=.5/(h*a-r*o),_=(a*c-r*u)*f,d=(h*u-o*c)*f;return _*_+d*d}function y(t,i,e,n){if(n-e<=20)for(let s=e+1;s<=n;s++){const n=t[s],l=i[n];let h=s-1;for(;h>=e&&i[t[h]]>l;)t[h+1]=t[h--];t[h+1]=n}else{let s=e+1,l=n;m(t,e+n>>1,s),i[t[e]]>i[t[n]]&&m(t,e,n),i[t[s]]>i[t[n]]&&m(t,s,n),i[t[e]]>i[t[s]]&&m(t,e,s);const h=t[s],r=i[h];for(;;){do{s++}while(i[t[s]]<r);do{l--}while(i[t[l]]>r);if(l<s)break;m(t,s,l)}t[e+1]=t[l],t[l]=h,n-s+1>=l-e?(y(t,i,s,n),y(t,i,e,l-1)):(y(t,i,e,l-1),y(t,i,s,n))}}function m(t,i,e){const n=t[i];t[i]=t[e],t[e]=n}function x(t){return t[0]}function p(t){return t[1]}const w=1e-6;class v{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+i}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,i){this._+=`L${this._x1=+t},${this._y1=+i}`}arc(t,i,e){const n=(t=+t)+(e=+e),s=i=+i;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${n},${s}`:(Math.abs(this._x1-n)>w||Math.abs(this._y1-s)>w)&&(this._+="L"+n+","+s),e&&(this._+=`A${e},${e},0,1,1,${t-e},${i}A${e},${e},0,1,1,${this._x1=n},${this._y1=s}`)}rect(t,i,e,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+i}h${+e}v${+n}h${-e}Z`}value(){return this._||null}}class b{constructor(){this._=[]}moveTo(t,i){this._.push([t,i])}closePath(){this._.push(this._[0].slice())}lineTo(t,i){this._.push([t,i])}value(){return this._.length?this._:null}}class T{constructor(t,[i,e,n,s]=[0,0,960,500]){if(!((n=+n)>=(i=+i)&&(s=+s)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=n,this.xmin=i,this.ymax=s,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:i,triangles:e},vectors:n}=this;let s,l;const h=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let n,r,o=0,a=0,c=e.length;o<c;o+=3,a+=2){const c=2*e[o],u=2*e[o+1],f=2*e[o+2],_=t[c],d=t[c+1],g=t[u],y=t[u+1],m=t[f],x=t[f+1],p=g-_,w=y-d,v=m-_,b=x-d,T=2*(p*b-w*v);if(Math.abs(T)<1e-9){if(void 0===s){s=l=0;for(const e of i)s+=t[2*e],l+=t[2*e+1];s/=i.length,l/=i.length}const e=1e9*Math.sign((s-_)*b-(l-d)*v);n=(_+m)/2-e*b,r=(d+x)/2+e*v}else{const t=1/T,i=p*p+w*w,e=v*v+b*b;n=_+(b*i-w*e)*t,r=d+(p*e-v*i)*t}h[a]=n,h[a+1]=r}let r,o,a,c=i[i.length-1],u=4*c,f=t[2*c],_=t[2*c+1];n.fill(0);for(let e=0;e<i.length;++e)c=i[e],r=u,o=f,a=_,u=4*c,f=t[2*c],_=t[2*c+1],n[r+2]=n[u]=a-_,n[r+3]=n[u+1]=f-o}render(t){const i=null==t?t=new v:void 0,{delaunay:{halfedges:e,inedges:n,hull:s},circumcenters:l,vectors:h}=this;if(s.length<=1)return null;for(let i=0,n=e.length;i<n;++i){const n=e[i];if(n<i)continue;const s=2*Math.floor(i/3),h=2*Math.floor(n/3),r=l[s],o=l[s+1],a=l[h],c=l[h+1];this._renderSegment(r,o,a,c,t)}let r,o=s[s.length-1];for(let i=0;i<s.length;++i){r=o,o=s[i];const e=2*Math.floor(n[o]/3),a=l[e],c=l[e+1],u=4*r,f=this._project(a,c,h[u+2],h[u+3]);f&&this._renderSegment(a,c,f[0],f[1],t)}return i&&i.value()}renderBounds(t){const i=null==t?t=new v:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),i&&i.value()}renderCell(t,i){const e=null==i?i=new v:void 0,n=this._clip(t);if(null===n||!n.length)return;i.moveTo(n[0],n[1]);let s=n.length;for(;n[0]===n[s-2]&&n[1]===n[s-1]&&s>1;)s-=2;for(let t=2;t<s;t+=2)n[t]===n[t-2]&&n[t+1]===n[t-1]||i.lineTo(n[t],n[t+1]);return i.closePath(),e&&e.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let i=0,e=t.length/2;i<e;++i){const t=this.cellPolygon(i);t&&(t.index=i,yield t)}}cellPolygon(t){const i=new b;return this.renderCell(t,i),i.value()}_renderSegment(t,i,e,n,s){let l;const h=this._regioncode(t,i),r=this._regioncode(e,n);0===h&&0===r?(s.moveTo(t,i),s.lineTo(e,n)):(l=this._clipSegment(t,i,e,n,h,r))&&(s.moveTo(l[0],l[1]),s.lineTo(l[2],l[3]))}contains(t,i,e){return(i=+i)==i&&(e=+e)==e&&this.delaunay._step(t,i,e)===t}*neighbors(t){const i=this._clip(t);if(i)for(const e of this.delaunay.neighbors(t)){const t=this._clip(e);if(t)t:for(let n=0,s=i.length;n<s;n+=2)for(let l=0,h=t.length;l<h;l+=2)if(i[n]===t[l]&&i[n+1]===t[l+1]&&i[(n+2)%s]===t[(l+h-2)%h]&&i[(n+3)%s]===t[(l+h-1)%h]){yield e;break t}}}_cell(t){const{circumcenters:i,delaunay:{inedges:e,halfedges:n,triangles:s}}=this,l=e[t];if(-1===l)return null;const h=[];let r=l;do{const e=Math.floor(r/3);if(h.push(i[2*e],i[2*e+1]),r=r%3==2?r-2:r+1,s[r]!==t)break;r=n[r]}while(r!==l&&-1!==r);return h}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const i=this._cell(t);if(null===i)return null;const{vectors:e}=this,n=4*t;return this._simplify(e[n]||e[n+1]?this._clipInfinite(t,i,e[n],e[n+1],e[n+2],e[n+3]):this._clipFinite(t,i))}_clipFinite(t,i){const e=i.length;let n,s,l,h,r=null,o=i[e-2],a=i[e-1],c=this._regioncode(o,a),u=0;for(let f=0;f<e;f+=2)if(n=o,s=a,o=i[f],a=i[f+1],l=c,c=this._regioncode(o,a),0===l&&0===c)h=u,u=0,r?r.push(o,a):r=[o,a];else{let i,e,f,_,d;if(0===l){if(null===(i=this._clipSegment(n,s,o,a,l,c)))continue;[e,f,_,d]=i}else{if(null===(i=this._clipSegment(o,a,n,s,c,l)))continue;[_,d,e,f]=i,h=u,u=this._edgecode(e,f),h&&u&&this._edge(t,h,u,r,r.length),r?r.push(e,f):r=[e,f]}h=u,u=this._edgecode(_,d),h&&u&&this._edge(t,h,u,r,r.length),r?r.push(_,d):r=[_,d]}if(r)h=u,u=this._edgecode(r[0],r[1]),h&&u&&this._edge(t,h,u,r,r.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(t,i,e,n,s,l){const h=s<l;for(h&&([t,i,e,n,s,l]=[e,n,t,i,l,s]);;){if(0===s&&0===l)return h?[e,n,t,i]:[t,i,e,n];if(s&l)return null;let r,o,a=s||l;8&a?(r=t+(e-t)*(this.ymax-i)/(n-i),o=this.ymax):4&a?(r=t+(e-t)*(this.ymin-i)/(n-i),o=this.ymin):2&a?(o=i+(n-i)*(this.xmax-t)/(e-t),r=this.xmax):(o=i+(n-i)*(this.xmin-t)/(e-t),r=this.xmin),s?(t=r,i=o,s=this._regioncode(t,i)):(e=r,n=o,l=this._regioncode(e,n))}}_clipInfinite(t,i,e,n,s,l){let h,r=Array.from(i);if((h=this._project(r[0],r[1],e,n))&&r.unshift(h[0],h[1]),(h=this._project(r[r.length-2],r[r.length-1],s,l))&&r.push(h[0],h[1]),r=this._clipFinite(t,r))for(let i,e=0,n=r.length,s=this._edgecode(r[n-2],r[n-1]);e<n;e+=2)i=s,s=this._edgecode(r[e],r[e+1]),i&&s&&(e=this._edge(t,i,s,r,e),n=r.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(r=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return r}_edge(t,i,e,n,s){for(;i!==e;){let e,l;switch(i){case 5:i=4;continue;case 4:i=6,e=this.xmax,l=this.ymin;break;case 6:i=2;continue;case 2:i=10,e=this.xmax,l=this.ymax;break;case 10:i=8;continue;case 8:i=9,e=this.xmin,l=this.ymax;break;case 9:i=1;continue;case 1:i=5,e=this.xmin,l=this.ymin}n[s]===e&&n[s+1]===l||!this.contains(t,e,l)||(n.splice(s,0,e,l),s+=2)}return s}_project(t,i,e,n){let s,l,h,r=1/0;if(n<0){if(i<=this.ymin)return null;(s=(this.ymin-i)/n)<r&&(h=this.ymin,l=t+(r=s)*e)}else if(n>0){if(i>=this.ymax)return null;(s=(this.ymax-i)/n)<r&&(h=this.ymax,l=t+(r=s)*e)}if(e>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/e)<r&&(l=this.xmax,h=i+(r=s)*n)}else if(e<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/e)<r&&(l=this.xmin,h=i+(r=s)*n)}return[l,h]}_edgecode(t,i){return(t===this.xmin?1:t===this.xmax?2:0)|(i===this.ymin?4:i===this.ymax?8:0)}_regioncode(t,i){return(t<this.xmin?1:t>this.xmax?2:0)|(i<this.ymin?4:i>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let i=0;i<t.length;i+=2){const e=(i+2)%t.length,n=(i+4)%t.length;(t[i]===t[e]&&t[e]===t[n]||t[i+1]===t[e+1]&&t[e+1]===t[n+1])&&(t.splice(e,2),i-=2)}t.length||(t=null)}return t}}const M=2*Math.PI,A=Math.pow;function k(t){return t[0]}function $(t){return t[1]}function P(t,i,e){return[t+Math.sin(t+i)*e,i+Math.cos(t-i)*e]}class S{static from(t,i=k,e=$,n){return new S("length"in t?function(t,i,e,n){const s=t.length,l=new Float64Array(2*s);for(let h=0;h<s;++h){const s=t[h];l[2*h]=i.call(n,s,h,t),l[2*h+1]=e.call(n,s,h,t)}return l}(t,i,e,n):Float64Array.from(function*(t,i,e,n){let s=0;for(const l of t)yield i.call(n,l,s,t),yield e.call(n,l,s,t),++s}(t,i,e,n)))}constructor(t){this._delaunator=new f(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,i=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:i,coords:e}=t;for(let t=0;t<i.length;t+=3){const n=2*i[t],s=2*i[t+1],l=2*i[t+2];if((e[l]-e[n])*(e[s+1]-e[n+1])-(e[s]-e[n])*(e[l+1]-e[n+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:i.length/2},((t,i)=>i)).sort(((t,e)=>i[2*t]-i[2*e]||i[2*t+1]-i[2*e+1]));const t=this.collinear[0],e=this.collinear[this.collinear.length-1],n=[i[2*t],i[2*t+1],i[2*e],i[2*e+1]],s=1e-8*Math.hypot(n[3]-n[1],n[2]-n[0]);for(let t=0,e=i.length/2;t<e;++t){const e=P(i[2*t],i[2*t+1],s);i[2*t]=e[0],i[2*t+1]=e[1]}this._delaunator=new f(i)}else delete this.collinear;const e=this.halfedges=this._delaunator.halfedges,n=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,l=this.inedges.fill(-1),h=this._hullIndex.fill(-1);for(let t=0,i=e.length;t<i;++t){const i=s[t%3==2?t-2:t+1];-1!==e[t]&&-1!==l[i]||(l[i]=t)}for(let t=0,i=n.length;t<i;++t)h[n[t]]=t;n.length<=2&&n.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=n[0],l[n[0]]=1,2===n.length&&(l[n[1]]=0,this.triangles[1]=n[1],this.triangles[2]=n[1]))}voronoi(t){return new T(this,t)}*neighbors(t){const{inedges:i,hull:e,_hullIndex:n,halfedges:s,triangles:l,collinear:h}=this;if(h){const i=h.indexOf(t);return i>0&&(yield h[i-1]),void(i<h.length-1&&(yield h[i+1]))}const r=i[t];if(-1===r)return;let o=r,a=-1;do{if(yield a=l[o],o=o%3==2?o-2:o+1,l[o]!==t)return;if(o=s[o],-1===o){const i=e[(n[t]+1)%e.length];return void(i!==a&&(yield i))}}while(o!==r)}find(t,i,e=0){if((t=+t)!=t||(i=+i)!=i)return-1;const n=e;let s;for(;(s=this._step(e,t,i))>=0&&s!==e&&s!==n;)e=s;return s}_step(t,i,e){const{inedges:n,hull:s,_hullIndex:l,halfedges:h,triangles:r,points:o}=this;if(-1===n[t]||!o.length)return(t+1)%(o.length>>1);let a=t,c=A(i-o[2*t],2)+A(e-o[2*t+1],2);const u=n[t];let f=u;do{let n=r[f];const u=A(i-o[2*n],2)+A(e-o[2*n+1],2);if(u<c&&(c=u,a=n),f=f%3==2?f-2:f+1,r[f]!==t)break;if(f=h[f],-1===f){if(f=s[(l[t]+1)%s.length],f!==n&&A(i-o[2*f],2)+A(e-o[2*f+1],2)<c)return f;break}}while(f!==u);return a}render(t){const i=null==t?t=new v:void 0,{points:e,halfedges:n,triangles:s}=this;for(let i=0,l=n.length;i<l;++i){const l=n[i];if(l<i)continue;const h=2*s[i],r=2*s[l];t.moveTo(e[h],e[h+1]),t.lineTo(e[r],e[r+1])}return this.renderHull(t),i&&i.value()}renderPoints(t,i){void 0!==i||t&&"function"==typeof t.moveTo||(i=t,t=null),i=null==i?2:+i;const e=null==t?t=new v:void 0,{points:n}=this;for(let e=0,s=n.length;e<s;e+=2){const s=n[e],l=n[e+1];t.moveTo(s+i,l),t.arc(s,l,i,0,M)}return e&&e.value()}renderHull(t){const i=null==t?t=new v:void 0,{hull:e,points:n}=this,s=2*e[0],l=e.length;t.moveTo(n[s],n[s+1]);for(let i=1;i<l;++i){const s=2*e[i];t.lineTo(n[s],n[s+1])}return t.closePath(),i&&i.value()}hullPolygon(){const t=new b;return this.renderHull(t),t.value()}renderTriangle(t,i){const e=null==i?i=new v:void 0,{points:n,triangles:s}=this,l=2*s[t*=3],h=2*s[t+1],r=2*s[t+2];return i.moveTo(n[l],n[l+1]),i.lineTo(n[h],n[h+1]),i.lineTo(n[r],n[r+1]),i.closePath(),e&&e.value()}*trianglePolygons(){const{triangles:t}=this;for(let i=0,e=t.length/3;i<e;++i)yield this.trianglePolygon(i)}trianglePolygon(t){const i=new b;return this.renderTriangle(t,i),i.value()}}t.Delaunay=S,t.Voronoi=T,Object.defineProperty(t,"__esModule",{value:!0})}));
indow.$.BkgGradientSpeed=window.$styles[window.$.Style].BkgGradientSpeed,window.$.FixEdge=window.$styles[window.$.Style].FixEdge,window.$.FlowOrientation=window.$styles[window.$.Style].FlowOrientation,window.$.CellsOnTop=window.$styles[window.$.Style].CellsOnTop,window.$.SuperFlow=window.$styles[window.$.Style].SuperFlow,window.$.GradMode=window.$styles[window.$.Style].GradMode,window.$.FadeCellFillFn=window.$styles[window.$.Style].FadeCellFillFn,window.$.FadeCellStrokeFn=window.$styles[window.$.Style].FadeCellStrokeFn,window.$.CellDivideCount=window.$styles[window.$.Style].CellDivideCount,window.$.AreaWeight=window.$styles[window.$.Style].AreaWeight,window.$.AreaCurve=window.$styles[window.$.Style].AreaCurve,window.$.FlowBatches=window.$styles[window.$.Style].FlowBatches,window.$.TwistBkgSize=window.$styles[window.$.Style].TwistBkgSize,window.$.TwistBkgCurve=window.$styles[window.$.Style].TwistBkgCurve,window.$.Travel=window.$styles[window.$.Style].Travel,window.$.TwistBkg=window.$styles[window.$.Style].TwistBkg,window.$.TwistFlow=window.$styles[window.$.Style].TwistFlow,window.$.FlowWarp=window.$styles[window.$.Style].FlowWarp,window.$.BkgWarp=window.$styles[window.$.Style].BkgWarp,window.$.BkgFadeAmt=window.$styles[window.$.Style].BkgFadeAmt,window.$.Vignette=window.$styles[window.$.Style].Vignette,window.$.BkgFadeFn=window.$styles[window.$.Style].BkgFadeFn,window.$.CrayonTheme=window.$styles[window.$.Style].CrayonTheme,window.$.UseBkgCrayons=window.$styles[window.$.Style].UseBkgCrayons,window.$.UseBkgCrayonsMulti=window.$styles[window.$.Style].UseBkgCrayonsMulti,window.$.UseCellBkgCrayons=window.$styles[window.$.Style].UseCellBkgCrayons,window.$.UseCellLineCrayons=window.$styles[window.$.Style].UseCellLineCrayons,window.$.UseFlowCrayons=window.$styles[window.$.Style].UseFlowCrayons,window.$.CellShakeScale=window.$styles[window.$.Style].CellShakeScale,window.$.CellShakeStrength=window.$styles[window.$.Style].CellShakeStrength??null,window.$.BkgShakeScale=window.$styles[window.$.Style].BkgShakeScale,window.$.BkgShakeStrength=window.$styles[window.$.Style].BkgShakeStrength??null,window.$.FlowShakeScale=window.$styles[window.$.Style].FlowShakeScale,window.$.FlowShakeStrength=window.$styles[window.$.Style].FlowShakeStrength??null,window.$.NoiseTypeBkg=window.$styles[window.$.Style].NoiseTypeBkg,window.$.NoiseTypeFlow=window.$styles[window.$.Style].NoiseTypeFlow,window.$.CellHatchThresh=window.$styles[window.$.Style].CellHatchThresh,window.$.ColorBkgThinLineColorThresh=window.$styles[window.$.Style].ColorBkgThinLineColorThresh,window.$.CellThreshDir=window.$styles[window.$.Style].CellThreshDir,window.$.CellLineRender=window.$styles[window.$.Style].CellLineRender,window.$.LineVariance=window.$styles[window.$.Style].LineVariance,window.$.BkgRender=window.$styles[window.$.Style].BkgRender,window.$.CellOptimize=window.$styles[window.$.Style].CellOptimize,window.$.GlobalOffsetFlow=window.$styles[window.$.Style].GlobalOffsetFlow??360*random(),window.$.GlobalOffsetBkg=window.$styles[window.$.Style].GlobalOffsetBkg??360*random(),window.$.GlobalOffsetCell=window.$styles[window.$.Style].GlobalOffsetCell??360*random(),window.$.BaseSize=window.$styles[window.$.Style].BaseSize,window.$.LineThickness=window.$styles[window.$.Style].LineThickness,window.$.Spacing=window.$styles[window.$.Style].Spacing,window.$.BkgColor=color(window.$styles[window.$.Style].BkgColor),window.$.BkgGradient=window.$styles[window.$.Style].BkgGradient,window.$.BkgCellHatchThresh=window.$styles[window.$.Style].BkgCellHatchThresh,window.$.BkgLineRamp=window.$styles[window.$.Style].BkgLineRamp,window.$.ColorBkgThinLine=color(window.$styles[window.$.Style].ColorBkgThinLine),window.$.ColorSweepAlt=color(window.$styles[window.$.Style].ColorSweepAlt),window.$.ColorSweepAccent=color(window.$styles[window.$.Style].ColorSweepAccent),window.$.ColorSweepAccentAlt=color(window.$styles[window.$.Style].ColorSweepAccentAlt),window.$.ColorBkgLineFill=color(window.$styles[window.$.Style].ColorBkgLineFill),window.$.ColorSweep=color(window.$styles[window.$.Style].ColorSweep),window.$.ColorCellLines=color(window.$styles[window.$.Style].ColorCellLines),window.$.ColorCellBkg=color(window.$styles[window.$.Style].ColorCellBkg),window.$.ColorCellOutline=window.$styles[window.$.Style].ColorCellOutline?color(window.$styles[window.$.Style].ColorCellOutline):null,window.$.FlowBatchSize=window.$styles[window.$.Style].FlowBatchSize,window.$.CellRamp=window.$styles[window.$.Style].CellRamp,window.$.CellLineThickness=window.$styles[window.$.Style].CellLineThickness,window.$.CellLineSpacing=window.$styles[window.$.Style].CellLineSpacing,window.$.CellThresh=window.$styles[window.$.Style].CellThresh,window.$.CellHatch=window.$styles[window.$.Style].CellHatch,window.$.CellZoom=window.$styles[window.$.Style].CellZoom,window.$.BkgLineFillThresh=window.$styles[window.$.Style].BkgLineFillThresh,window.$.NoiseScale=window.$styles[window.$.Style].NoiseScale,window.$.NoiseStrength=window.$styles[window.$.Style].NoiseStrength,window.$.GradientBand=window.$styles[window.$.Style].GradientBand,window.$.GradientBandOffset=window.$styles[window.$.Style].GradientBandOffset,window.$.FlowScale=window.$styles[window.$.Style].FlowScale,window.$.FlowStrength=window.$styles[window.$.Style].FlowStrength,window.$.FlowZ=window.$styles[window.$.Style].FlowZ,window.$.FlowCells=window.$styles[window.$.Style].FlowCells,window.$.FlowGradient=window.$styles[window.$.Style].FlowGradient,window.$.FlowGradientFn=window.$styles[window.$.Style].FlowGradientFn,window.$.FlowGradientBand=window.$styles[window.$.Style].FlowGradientBand,window.$.FlowGradientOffset=window.$styles[window.$.Style].FlowGradientOffset,window.$.FlowSpeed=window.$styles[window.$.Style].FlowSpeed,window.$.FlowRender=window.$styles[window.$.Style].FlowRender,window.$.FlowWeight=window.$styles[window.$.Style].FlowWeight,window.$.CellRender=window.$styles[window.$.Style].CellRender,window.$.Pad=window.$styles[window.$.Style].Pad,window.$.PadOuter=random(.15,.75),window.$.BkgColorFlip=!1,window.$.CellHasGradient=window.$styles[window.$.Style].CellHasGradient,window.$.CellGradientStrokeA=window.$styles[window.$.Style].CellGradientStrokeA,window.$.CellGradientStrokeB=window.$styles[window.$.Style].CellGradientStrokeB,window.$.CellGradientFillA=window.$styles[window.$.Style].CellGradientFillA,window.$.CellGradientFillB=window.$styles[window.$.Style].CellGradientFillB,window.$.SweepAccentRatio=window.$styles[window.$.Style].SweepAccentRatio,window.$.DimChance=window.$styles[window.$.Style].DimChance,window.$.DimRange=window.$styles[window.$.Style].DimRange,window.$.CellOutlineWeight=window.$styles[window.$.Style].CellOutlineWeight,window.$.BkgColorFlip&&random()<.5){const e=window.$.BkgColor;window.$.BkgColor=window.$.ColorBkgThinLine,window.$.ColorBkgThinLine=e}return window.$.UseCellBkgCrayons&&(window.$.CellHasGradient=!1),window.$.UseFlowCrayons&&(window.$.ColorSweepAccent=color(0),window.$.ColorSweepAccentAlt=color(0)),window.$})(window.$f),window.windowResized(),colorMode(HSB,360,100,100),frameRate(60)};const se=({reset:e,cells:i,speed:o,scale:n,strength:l,col:t,weight:r,skip:w})=>{e&&re();const s=Array(i*i).fill().map(((e,o)=>[o%i/i+.5/i,~~(o/i)/i+.5/i]));Q(s);const a=te();let d=[];const h="Radial"===window.$.NoiseTypeFlow?N:noise,c=window.$.FlowWarp,g=window.$.FlowZ,$=window.$.FlowShakeStrength,C=window.$.FlowShakeScale,y=window.$.Pad;for(let[e,i]of s){let s=[];const p=~~((1-(.5*i+.25))*window.$.Travel);for(let t=0;t<p;t++){K++;const t=2*e-1,r=2*i-1;let w=h(e/n,i/n*c,K*g+($??h(e/C,i/C,0)*$))*l;if(window.$.TwistFlow&&(w+=J(t,r,1,window.$.TwistFlow,2)),e+=cos(w)*o,i+=sin(w)*o,e<y||i<y||e>1-y||i>1-y)continue;const d=~~(e*a),p=~~(i*a);if(p>I.length-1||d>I[0].length-1||I[p][d])break;let u=!1;for(let e=-1;e<1&&!u;e++)for(let i=-1;i<1&&!u;i++){const o=d+i,n=p+e;n<0||o<0||n>I.length-1||o>I[0].length-1||I[n][o]&&(u=!0)}if(u)break;s.push([e,i])}const u=s.length;for(let e=0;e<u;e++){const[i,o]=s[e],n=~~(i*a);I[~~(o*a)][n]=!0,e===u-1&&d.push(s[e])}if(w&&random()<w)continue;const f=window.$.FlowGradient?color(0):u<p*window.$.SweepAccentRatio?random()<.5?window.$.ColorSweepAlt:window.$.UseFlowCrayons?X(0):window.$.ColorSweep:u<p?random()<.5?window.$.ColorSweepAlt:window.$.UseFlowCrayons?X(0):window.$.ColorSweepAccent:t,S=window.$.FlowGradientBand?random(...window.$.FlowGradientBand):0,k=(random(-window.$.FlowGradientOffset,window.$.FlowGradientOffset)+window.$.GlobalOffsetFlow)%360;ne(s,f,r,S,k)}return d};function ae(e,i,o,n,l,t,r=1,w=!1,s=!1){const a=cos(i),d=sin(i),h=sqrt(width*width+height*height),c=Math.ceil(2*h/(o*width));let g=0;const $=[];for(let i=0;i<=c;i++){const n=i*o*width-h,l=width/2-h*a+n*d,t=height/2-h*d-n*a,r=width/2+h*a+n*d,w=height/2+h*d-n*a;he(l,t,r,w,e)&&($.push({x1:l,y1:t,x2:r,y2:w}),g++)}$.forEach(((i,o)=>{const a=(w?g-1-o:o)/(g-1),d=l+Math.pow(a,r)*t*width;!function(e,i,o,n,l,t,r){const w=l.length;let s=[];for(let t=0,r=w-1;t<w;r=t++){const w=l[t][0],a=l[t][1],d=l[r][0],h=l[r][1],c=ce(e,i,o,n,w,a,d,h);c&&s.push(c)}s.sort(((o,n)=>{const l=e-o[0],t=i-o[1],r=e-n[0],w=i-n[1];return l*l+t*t-(r*r+w*w)}));for(let e=1;e<s.length;e+=2)de(s[e-1][0],s[e-1][1],s[e][0],s[e][1],t,r)}(i.x1,i.y1,i.x2,i.y2,e,s?X():n,d)}))}function de(e,i,o,n,l,t){const r=atan2(n-i,o-e),w=t/2,s=w*sin(r),a=w*cos(r),d=e-s,h=i+a,c=e+s,g=i-a,$=o+s,C=n-a,y=o-s,p=n+a;fill(l),noStroke(),quad(d,h,c,g,$,C,y,p)}function he(e,i,o,n,l){const t=l.length;for(let r=0,w=t-1;r<t;w=r++){const t=l[r][0],s=l[r][1],a=l[w][0],d=l[w][1],h=(e-o)*(s-d)-(i-n)*(t-a);if(0!==h){const l=((e-t)*(s-d)-(i-s)*(t-a))/h,r=((o-t)*(i-s)-(n-s)*(e-t))/h;if(l>=0&&l<=1&&r>=0&&r<=1)return!0}}return!1}function ce(e,i,o,n,l,t,r,w){const s=o-e,a=n-i,d=r-l,h=w-t,c=e-l,g=i-t,$=h*s-d*a;if(0!==$){const o=(d*g-h*c)/$,n=(s*g-a*c)/$;if(o>=0&&o<=1&&n>=0&&n<=1)return[e+o*s,i+o*a]}return null}const ge=()=>{const{NoiseTypeFlow:e,FlowCells:i,FlowSpeed:o,FlowScale:n,FlowStrength:l,ColorSweepAccentAlt:t,FlowWeight:r,FlowZ:w,FlowBatchSize:s,FlowBatches:a,SuperFlow:d}=window.$,h="Radial"===e?N:noise;let c=[];le();const g=se({reset:!0,cells:i,speed:o,scale:n,strength:l,col:t,weight:r,z:0,skip:d?0:1}),$=se({reset:!0,cells:i,speed:o,scale:n,strength:l,col:t,weight:r,z:w*(s*a),skip:d?0:1});Array.prototype.push.apply(c,g),Array.prototype.push.apply(c,$),E=R.from(c);const{CellOptimize:C,CellShakeStrength:y,CellShakeScale:p,Pad:u,FlowOrientation:f}=window.$;if(C||y){for(let e=0;e<c.length;e++){let i=[...E.neighbors(e)],o=0,n=0,l=i.length;for(let e=0;e<l;e++){let t=i[e];o+=c[t][0]/l,n+=c[t][1]/l}if(y){const e=h(o/p,n/p,0)*y,i=random(.1,1);o+=o*Math.sin(e)*i,n+=n*Math.sin(e)*i}c[e][0]=o,c[e][1]=n}c=function(e,i,o,n){let l=1/0,t=1/0,r=-1/0,w=-1/0;for(let i of e)l=Math.min(l,i[0]),t=Math.min(t,i[1]),r=Math.max(r,i[0]),w=Math.max(w,i[1]);const s=1*(1-2*n)/(r-l),a=1*(1-2*n)/(w-t),d=(1-(r-l)*s)/2,h=(1-(w-t)*a)/2;return e.map((([e,i])=>[(e-l)*s+d,(i-t)*a+h]))}(c,0,0,u),f&&(c=function(e,i,o){const n=[.5,.5],l=n[0],t=n[1],r=e=>[l-(e[1]-t),t+(e[0]-l)],w=e=>[2*l-e[0],e[1]],s=[e=>e,w,r,e=>w(r(e)),e=>r(r(e)),e=>w(r(r(e))),e=>r(r(r(e)))][i];return e.map(s)}(c,f))}if(E=R.from(c),V=E.voronoi([0,0,width,height]),window.$.CellRender){const{Pad:e,CellDivideCount:i,CellThreshDir:o,CellThresh:n}=window.$;let l=[];const t=Array.from({length:i||1},((e,i)=>n/2**i));for(let n=0;n<(i||1);n++){const r=t[n];for(let n of V.cellPolygons())if(n){let t=!0;for(let i of n)if(i[0]<=e||i[1]<=e||i[0]>=1-e||i[1]>=1-e){t=!1;break}if(!t)continue;const w=ie(n);if(!window.$.Ghost&&(-1===o&&w>r||-1!==o&&w<r))continue;if(l.push(n),i<2)continue;const s=n.flatMap((e=>[e[0],e[1]])),a=O()(s);for(let e=0;e<a.length;e+=3){const i=[[s[2*a[e]],s[2*a[e]+1]],[s[2*a[e+1]],s[2*a[e+1]+1]],[s[2*a[e+2]],s[2*a[e+2]+1]],[s[2*a[e]],s[2*a[e]+1]]];l.push(i)}}}window.$.FixEdge&&(l=function(e,i,o,n){let l=1/0,t=1/0,r=-1/0,w=-1/0;e.forEach((e=>{e.forEach((e=>{e[0]<l&&(l=e[0]),e[1]<t&&(t=e[1]),e[0]>r&&(r=e[0]),e[1]>w&&(w=e[1])}))}));const s=1*(1-2*n)/(r-l),a=1*(1-2*n)/(w-t),d=(1-(r-l)*s)/2,h=(1-(w-t)*a)/2;return e.map((e=>e.map((([e,i])=>[(e-l)*s+d,(i-t)*a+h]))))}(l,0,0,1-window.$.Pad/2));for(let e of l){let i=e.map((([e,i])=>[e*width,i*height]));if(!window.$.FixEdge){let o=1/0,n=1/0,l=-1/0,t=-1/0;for(let e of c)o=Math.min(o,e[0]),n=Math.min(n,e[1]),l=Math.max(l,e[0]),t=Math.max(t,e[1]);const r=width/(l-o),w=height/(t-n),s=(width-(l-o)*r)/2,a=(height-(t-n)*w)/2;i=e.map((([e,i])=>[(e-o)*r+s,(i-n)*w+a]))}let o=window.$.UseCellBkgCrayons?X():window.$.ColorCellBkg;window.$.ColorCellBkg?fill(color((hue(o)+window.$.GlobalOffsetCell)%360,saturation(o),brightness(o))):noFill();const n=ee(e);let l=window.$.CellHasGradient?lerpColor(color((hue(window.$.CellGradientStrokeA)+window.$.GlobalOffsetCell)%360,saturation(window.$.CellGradientStrokeA),brightness(window.$.CellGradientStrokeA)),color((hue(window.$.CellGradientStrokeB)+window.$.GlobalOffsetCell)%360,saturation(window.$.CellGradientStrokeB),brightness(window.$.CellGradientStrokeB)),we(n,"stroke")):window.$.ColorCellLines;l=window.$.UseCellLineCrayons?X():l,window.$.ColorCellOutline?stroke(color((hue(window.$.ColorCellOutline)+window.$.GlobalOffsetCell)%360,saturation(window.$.ColorCellOutline),brightness(window.$.ColorCellOutline))):noStroke(),window.$.CellHasGradient&&fill(lerpColor(window.$.CellGradientFillA,window.$.CellGradientFillB,we(n,"fill")));const t=ie(e);let r=window.$.CellOutlineWeight*width+(window.$.AreaWeight?t**window.$.AreaCurve*window.$.AreaWeight*width:0);strokeWeight(r),noStroke(),window.$.Ghost&&(window.$.HyperGhost?t>=window.$.CellThresh:t<window.$.CellThresh)&&noFill(),beginShape();for(const e of i)vertex(...e);endShape(),noFill();const w=oe(i),s=h(e[0][0]/window.$.FlowScale,e[0][1]/window.$.FlowScale*window.$.FlowWarp,0)*window.$.FlowStrength,a=Math.cos(s)/2+.5,d=window.$.CellZoom?Math.pow(a,2)*window.$.CellZoom+1:1,g=window.$.CellLineThickness;if(noFill(),window.$.Ghost&&!(window.$.HyperGhost?t<window.$.CellThresh:t>=window.$.CellThresh)||(window.$.CellLineRender&&ae(i,w,window.$.CellLineSpacing*d,l,.001,.001*g,window.$.CellRamp*a,!1,!1),window.$.CellLineRender&&(window.$.CellHatch&&!window.$.CellHatchThresh||window.$.CellHatchThresh&&t>window.$.CellHatchThresh)&&ae(i,w+PI/2,window.$.CellLineSpacing*d,l,.001,.001*g,window.$.CellRamp*a,!1,!1)),window.$.ColorCellOutline){let e=color((hue(window.$.ColorCellOutline)+window.$.GlobalOffsetCell)%360,saturation(window.$.ColorCellOutline),brightness(window.$.ColorCellOutline));window.$.Ghost&&(window.$.HyperGhost?t>=window.$.CellThresh:t<window.$.CellThresh)&&(e=window.$.GhostInvert?100:0,strokeWeight(r*(window.$.GhostWeight||1.125))),noFill(),stroke(e),beginShape();for(const e of i)vertex(...e);endShape()}}}},$e=()=>{if(window.$.FlowRender)for(let e=0;e<window.$.FlowBatchSize/window.$.FlowBatches;e++){let e=random()<.5?window.$.UseFlowCrayons?X(2):window.$.ColorSweep:window.$.ColorSweepAccentAlt;se({reset:!0,cells:window.$.FlowCells,speed:window.$.FlowSpeed,scale:window.$.FlowScale,strength:window.$.FlowStrength,col:color(hue(e),saturation(e)+random(-15,15),brightness(e)+random(-15,15)),weight:window.$.FlowWeight})}};function Ce(e){const i=window.$.Spacing+window.$.LineThickness,o=window.$.BaseSize,n=o*window.$.Pad*window.$.PadOuter,l=o-n,t=i*o,r=Z.query({x:e.x-t,y:e.y-t,width:2*t,height:2*t});if(e.x<n||e.x>l||e.y<n||e.y>l)return!1;for(const i of r)if(dist(e.x,e.y,i.x,i.y)<=t)return!1;return!0}function ye(e,i,o,n){const l="Radial"===window.$.NoiseTypeBkg?N:noise,t=[e];let r=e.copy();const w=window.$.StreamFactor||.1;for(;;){let e=r.x/window.$.BaseSize*2-1,i=r.y/window.$.BaseSize*2-1,o=l(e/window.$.NoiseScale,i/window.$.NoiseScale*window.$.BkgWarp,window.$.BkgShakeStrength?l(e/window.$.BkgShakeScale,i/window.$.BkgShakeScale,0)*window.$.BkgShakeStrength:0)*window.$.NoiseStrength;window.$.TwistBkgCurve&&(o+=J(e,i,window.$.TwistBkgSize,window.$.TwistBkg,window.$.TwistBkgCurve));const n=cos(o),s=sin(o);if(r.add(n*window.$.Spacing*window.$.BaseSize*w,s*window.$.Spacing*window.$.BaseSize*w),!Ce(r)||r.x<0||r.x>window.$.BaseSize||r.y<0||r.y>window.$.BaseSize)break;t.push(r.copy())}const s=360*random();if(!(t.length<2))if(Z.insert({x:e.x,y:e.y}),t.forEach((e=>Z.insert({x:e.x,y:e.y}))),2===window.$.GradMode?t.length<window.$.StreamThresh:1===window.$.GradMode?i<window.$.BkgLineFillThresh:i>=window.$.BkgLineFillThresh){noStroke(),fill(0);const e=function(e,i){const o=[],n=[];return e.forEach(((l,t)=>{let r,w,s,a;const d=e[(t-1+e.length)%e.length],h=e[(t+1)%e.length];if(0===t){const e=Math.atan2(h[1]-l[1],h[0]-l[0]);r=i/2*Math.cos(e+Math.PI/2),w=i/2*Math.sin(e+Math.PI/2),s=i/2*Math.cos(e-Math.PI/2),a=i/2*Math.sin(e-Math.PI/2)}else if(t===e.length-1){const e=Math.atan2(l[1]-d[1],l[0]-d[0]);r=i/2*Math.cos(e+Math.PI/2),w=i/2*Math.sin(e+Math.PI/2),s=i/2*Math.cos(e-Math.PI/2),a=i/2*Math.sin(e-Math.PI/2)}else{const e=(Math.atan2(l[1]-d[1],l[0]-d[0])+Math.atan2(h[1]-l[1],h[0]-l[0]))/2;r=i/2*Math.cos(e+Math.PI/2),w=i/2*Math.sin(e+Math.PI/2),s=i/2*Math.cos(e-Math.PI/2),a=i/2*Math.sin(e-Math.PI/2)}o.push([l[0]+r,l[1]+w]),n.push([l[0]+s,l[1]+a])})),o.concat(n.reverse())}(t.map((({x:e,y:i})=>[e*(width/window.$.BaseSize),i*(height/window.$.BaseSize)])),i*width);ae(e,s,.005,n,.001,.002,window.$.BkgLineRamp,random()<.5,window.$.UseBkgCrayonsMulti),random()<window.$.BkgCellHatchThresh&&ae(e,s+PI/2,.005,n,.001,.002,window.$.BkgLineRamp,random()<.5,window.$.UseBkgCrayonsMulti)}else{const e=i*window.$.BaseSize*(width/window.$.BaseSize);noStroke(),fill(o),strokeWeight(e);const n=random(-window.$.GradientBandOffset,window.$.GradientBandOffset);let l=window.$.BkgGradientSpeed||t.length;t.forEach(((i,o)=>{window.$.BkgGradient&&fill(color((o/l*window.$.GradientBand+n+(window.$.BkgGradientShift??0))%360,100,100)),circle(i.x*(width/window.$.BaseSize),i.y*(height/window.$.BaseSize),e)}))}}window.draw=()=>{let e=0;if(0===q&&window.$.BkgRender)for(;e<1e3;){const i=random(window.$.BaseSize),o=random(window.$.BaseSize),n=createVector(i,o);if(Ce(n)){let e=1;(1===window.$.BkgFadeFn||-1===window.$.BkgFadeFn)&&(e=o/window.$.BaseSize*window.$.BkgFadeAmt+(1-window.$.BkgFadeAmt));let i,l=color(hue(window.$.ColorBkgThinLine),saturation(window.$.ColorBkgThinLine),brightness(window.$.ColorBkgThinLine)*(random()<window.$.DimChance?random(...window.$.DimRange):1)*e);random()>window.$.ColorBkgThinLineColorThresh&&(l=color(hue(l),0,brightness(l)*e)),window.$.UseBkgCrayons&&(i=X(),i=color(hue(i),saturation(i),brightness(i)*e)),ye(n,window.$.LineThickness*("None"===window.$.LineVariance?1:"Random"===window.$.LineVariance?random(.5,1.5):"Alternate"===window.$.LineVariance?random()<.5?.2:1:void 0),window.$.UseBkgCrayons?i:l,window.$.UseBkgCrayons?color(hue(i),saturation(i),brightness(i)*e):color(hue(window.$.ColorBkgLineFill),saturation(window.$.ColorBkgLineFill),brightness(window.$.ColorBkgLineFill)*e)),j=0}else j++;if(e++,j>=150)break}if(q>0||!window.$.BkgRender||j>=150){if(0===q)return q++;if(1===q)return window.$.Vignette&&ue(),q++;if(2===q)return K=0,window.$.CellsOnTop||ge(),q++;if(3===q&&le(),q<window.$.FlowBatches+3){for(let e=0;e<1;e++)K=0,$e(),q++;return}window.$.CellsOnTop&&(K=0,ge()),noLoop(),"saving"===window.renderStatus?(window.renderStatus="complete",saveCanvas("ephemeral_tides","png")):window.renderStatus="complete",q=4}};const pe=(e,i,o)=>((e,i,o,n)=>{const l=Math.min(o/e,n/1);return[e*l,1*l]})(e,0,i,o),ue=()=>{let e=random(.95,.98),i=random(.45,.5),o=random(1,2);const n=pixelDensity();loadPixels();for(let l=0;l<height*n;l++)for(let t=0;t<width*n;t++){const r=4*(t+l*width*n),w=dist(t/n,l/n,width/2,height/2),s=dist(0,0,width/2,height/2),a=pow(w/(s*i),o),d=map(a,0,1,1,e);pixels[r]*=d,pixels[r+1]*=d,pixels[r+2]*=d}updatePixels()},fe=()=>{background(window.$.BkgColor),window.$.Vignette&&ue(),Z=new l(0,0,window.$.BaseSize,window.$.BaseSize,16),le(),q=0,K=0,j=0};window.windowResized=()=>{if("saving"===window.renderStatus)return;le();const[e,i]=pe(1,windowWidth,windowHeight);resizeCanvas(e,i),fe(),loop()};const Se=e=>{if("saving"===window.renderStatus)return;const i=pixelDensity();resizeCanvas(e/i,e/i*1),window.renderStatus="saving",fe(),loop()};window.keyTyped=()=>{switch(key){case"p":Se(12288);break;case"s":Se(2560)}}})()})();
8,CellThresh:.002,CellHatch:random()<.5,BkgLineFillThresh:.0125,NoiseScale:random([.25,.5,.75]),NoiseStrength:random([2,3,4]),FlowScale:.5,FlowStrength:7,FlowZ:5e-8,FlowCells:24,FlowGradient:!1,FlowGradientBand:null,FlowGradientOffset:0,FlowGradientFn:"constant",FlowSpeed:1e-4,FlowWeight:5e-4,FlowRender:!0,CellRender:!0,BkgLineRamp:0,BkgCellHatchThresh:random(0,.01,.1),CellHasGradient:!1,CellGradientFillA:color((0+window.$.Shift)%360,45,90),CellGradientFillB:color((280+window.$.Shift)%360,90,90),CellGradientStrokeA:color((300+window.$.Shift)%360,100,100),CellGradientStrokeB:color((340+window.$.Shift)%360,100,80),SweepAccentRatio:.33},2:{Ghost:window.$.isMirage&&!window.$.isHyper,GhostInvert:window.$.isMirage&&!window.$.isHyper,FixEdge:!0,CrayonTheme:"Red",FlowOrientation:0,FadeCellFillFn:4,FadeCellStrokeFn:0,CellsOnTop:window.$.isHyper&&window.$.isMirage,CellDivideCount:window.$.isMirage?2:window.$.isHyper?random([1,2]):1,Pad:random([.05,.1]),AreaWeight:0,AreaCurve:1.75,FlowBatches:16,TwistBkgSize:1,TwistBkgCurve:0,Travel:window.$.isHyper?100:~~random(150,200),TwistBkg:0,TwistFlow:0,FlowWarp:1,BkgWarp:1,BkgFadeAmt:window.$.isHyper||window.$.isMirage?1:0,Vignette:window.$.isHyper||window.$.isMirage,BkgFadeFn:window.$.isHyper?random([-1,1]):0,UseBkgCrayons:!window.$.isHyper&&window.$.isMirage,UseBkgCrayonsMulti:!1,UseFlowCrayons:!1,UseCellBkgCrayons:!1,UseCellLineCrayons:!1,CellShakeScale:window.$.isHyper?.5:0,CellShakeStrength:window.$.isHyper?random(.5,1):null,FlowOrientation:window.$.isHyper?Math.floor(7*random()):0,BkgShakeScale:.1,FlowShakeScale:0,NoiseTypeBkg:"Radial",NoiseTypeFlow:"Radial",CellHatchThresh:null,CellThreshDir:window.$.isHyper&&window.$.isMirage?1:-1,CellLineRender:!0,LineVariance:"Random",BkgRender:!0,CellOutlineWeight:window.$.isMirage&&!window.$isHyper?5e-4:75e-5,DimChance:window.$.isHyper||window.$.isMirage?.8:.75,DimRange:window.$.isHyper||window.$.isMirage?[.15,.45]:[.2,.6],CellOptimize:!0,GlobalOffsetFlow:window.$.isHyper?random(0,360):0,GlobalOffsetBkg:0,GlobalOffsetCell:0,BaseSize:~~random(256,512),LineThickness:window.$.isMirage||window.$.isHyper?5e-4:random(5e-4,.002),Spacing:window.$.isMirage?.002:random(.001,.0015),BkgColor:color(0),GradientBand:window.$.isHyper?random(360):0,GradientBandOffset:window.$.isHyper?random([0,360]):0,ColorSweep:color(window.$.isMirage&&!window.$.isHyper?random(0,5):random(195,210),100,60),ColorSweepAlt:color(0),ColorSweepAccent:color(window.$.isMirage&&!window.$.isHyper?random(0,5):random(170,185),window.$.isMirage&&!window.$.isHyper?100:90,window.$.isMirage&&!window.$.isHyper?35:85),ColorSweepAccentAlt:color(0),ColorBkgThinLine:color(100),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(0),ColorCellLines:color(window.$.isHyper?100:0),ColorCellBkg:color(window.$.isHyper?0:100),ColorCellOutline:color(0),FlowBatchSize:64,CellZoom:0,CellRamp:window.$.isHyper?1:0,CellLineThickness:window.$.isHyper?1:1.1,CellLineSpacing:random(.002,.004),CellThresh:window.$.isHyper?random(1e-4,2e-4):window.$.isMirage?random(5e-4,75e-5):random(2e-4,25e-5),CellHatch:!window.$.isHyper&&!window.$.isMirage,BkgLineFillThresh:.05,NoiseScale:window.$.isMirage&&!window.$.isHyper?random(2,3):.5,NoiseStrength:window.$.isMirage&&!window.$.isHyper?random(1,2):3,FlowScale:random(.125,.5),FlowStrength:window.$.isMirage?4:8,FlowZ:window.$.isMirage?1e-7:1e-8,FlowCells:window.$.isMirage?54:64,FlowGradient:window.$.isHyper,FlowGradientBand:window.$.isHyper?[.5,.5]:null,FlowGradientOffset:window.$.isHyper?random([0,30]):0,FlowGradientFn:window.$.isHyper?"lighten":"constant",FlowSpeed:.001,FlowWeight:window.$.isMirage?.0015:.001,FlowRender:!0,CellRender:!0,BkgLineRamp:0,BkgCellHatchThresh:0,CellHasGradient:window.$.isHyper,CellGradientFillA:window.$.isHyper?color((0+window.$.Shift+window.$.ShiftLargest)%360,100,100):color(0,45,90),CellGradientFillB:window.$.isHyper?color((180+window.$.Shift+window.$.ShiftLargest)%360,100,100):color(280,90,90),CellGradientStrokeA:window.$.isHyper?color((180+window.$.Shift+window.$.ShiftLargest)%360,100,100):color(300,100,100),CellGradientStrokeB:window.$.isHyper?color((360+window.$.Shift+window.$.ShiftLargest)%360,100,100):color(340,100,80),SweepAccentRatio:.15},3:{FlowOrientation:0,FadeCellFillFn:4,FadeCellStrokeFn:0,Pad:random([.05,.1]),AreaWeight:0,AreaCurve:1.75,FlowBatches:16,TwistBkgSize:random([.1,.5,1,2]),TwistBkgCurve:window.$.isHyper?random(2,5):1,CrayonTheme:"Riptide",Travel:random([250,500,750,1e3,2e3]),TwistBkg:window.$.isHyper?random(25,75):0,TwistFlow:window.$.isHyper?random(0,25):0,FlowWarp:1,BkgWarp:window.$.isHyper?1:random([-.5,1,2,4]),BkgFadeAmt:0,Vignette:!1,BkgFadeFn:0,UseBkgCrayons:!1,UseBkgCrayonsMulti:!1,UseFlowCrayons:!1,UseCellBkgCrayons:!1,UseCellLineCrayons:!1,CellShakeScale:0,BkgShakeScale:0,FlowShakeScale:0,NoiseTypeBkg:"Radial",NoiseTypeFlow:"Radial",CellHatchThresh:null,CellThreshDir:1,CellLineRender:!0,LineVariance:"Random",BkgRender:!0,CellOutlineWeight:.001,DimChance:.5,DimRange:[.2,.8],CellOptimize:!0,GlobalOffsetFlow:0,GlobalOffsetBkg:0,GlobalOffsetCell:0,BaseSize:random([512,1024]),LineThickness:random(.001,.0016)*(window.$.isMirage?.75:1),Spacing:window.$.isMirage?random(.002,.003):random(.006,.007),BkgColor:window.$.isMirage?color((210+window.$.Shift)%360,100,15):color((220+window.$.Shift)%360,100,15),BkgGradient:!0,GradientBand:10,GradientBandOffset:30,ColorSweep:window.$.isHyper?color((205+window.$.Shift/4)%360,0,100):color(random(10,50),random(0,12),random(98,100)),ColorSweepAlt:color(0),ColorSweepAccent:window.$.isHyper?color((180+window.$.Shift/4)%360,100,70):window.$.isMirage?color(100):color(random((335+window.$.Shift/4)%360,345),random(85,95),random(90,100)),ColorSweepAccentAlt:color(0),ColorBkgThinLine:color(random((190+window.$.Shift)%360,200),random(90,100),random(90,100)),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(100),ColorCellLines:color(0),ColorCellBkg:color(128),ColorCellOutline:color(0),FlowBatchSize:32,CellZoom:1.5,CellRamp:.5,CellLineThickness:1,CellLineSpacing:.001,CellThresh:25e-5,CellHatch:!1,BkgLineFillThresh:.0125,NoiseScale:window.$.isHyper?0:2,NoiseStrength:window.$.isHyper?0:10,FlowScale:window.$.isHyper?random(.4,.6):random(.2,.25),FlowStrength:random(7,9),FlowZ:8e-8,FlowCells:~~random(24,32),FlowGradient:!1,FlowGradientBand:null,FlowGradientOffset:0,FlowGradientFn:"constant",FlowSpeed:8e-4,FlowWeight:75e-5*(window.$.isMirage?1.25:1),FlowRender:!0,CellRender:!1,BkgLineRamp:0,BkgCellHatchThresh:0,CellHasGradient:!1,CellGradientFillA:color(0,45,90),CellGradientFillB:color(280,90,90),CellGradientStrokeA:color(300,100,100),CellGradientStrokeB:color(340,100,80),SweepAccentRatio:.33,BkgGradientShift:random((190+window.$.Shift)%360,200)},4:{Ghost:window.$.isHyper&&window.$.isMirage,HyperGhost:window.$.isHyper&&window.$.isMirage,GhostWeight:random(2.5,3),FlowOrientation:0,FadeCellFillFn:4,FadeCellStrokeFn:0,Pad:random([.05,.1]),AreaWeight:0,AreaCurve:1.75,FlowBatches:16,TwistBkgSize:1,TwistBkgCurve:0,Travel:window.$.isHyper&&window.$.isMirage?100:~~random(window.$.isMirage?50:100,500),TwistBkg:0,TwistFlow:0,FlowWarp:window.$.isMirage&&window.$.isHyper?random(.5,2):1,BkgWarp:1,BkgFadeAmt:0,Vignette:!1,BkgFadeFn:0,CrayonTheme:null,UseBkgCrayons:!1,UseBkgCrayonsMulti:!1,UseFlowCrayons:!1,UseCellBkgCrayons:!1,UseCellLineCrayons:!1,CellShakeScale:0,BkgShakeScale:0,FlowShakeScale:0,NoiseTypeBkg:window.$.isMirage?"Linear":"Radial",NoiseTypeFlow:"Radial",CellHatchThresh:null,CellThreshDir:-1,CellLineRender:!0,LineVariance:"Random",BkgRender:!0,CellOutlineWeight:window.$.isHyper&&window.$.isMirage?8e-4:9e-4,DimChance:.5,DimRange:[.2,.8],CellOptimize:!0,GlobalOffsetFlow:0,GlobalOffsetBkg:0,GlobalOffsetCell:0,BaseSize:512,LineThickness:.001,Spacing:.001,BkgColor:window.$.isHyper?color(0):color(174,72,56),BkgGradient:!0,GradientBand:60,GradientBandOffset:30,ColorSweep:color(0,0,100),ColorSweepAlt:color(0),ColorSweepAccent:color(340,90,100),ColorSweepAccentAlt:color(P.Black),ColorBkgThinLine:color(340,100,100),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(100),ColorCellLines:color(0),ColorCellBkg:color(174,72,56),ColorCellOutline:window.$.isMirage?color(0):null,FlowBatchSize:32,CellZoom:0,CellRamp:2,CellLineThickness:1,CellLineSpacing:.002,CellThresh:window.$.isHyper&&window.$.isMirage?15e-5:25e-5,CellHatch:random([!1,!0]),BkgLineFillThresh:.0125,NoiseScale:2,NoiseStrength:10,FlowScale:random(.25,.33),FlowStrength:8,FlowZ:8e-8,FlowCells:~~random(48,64),FlowGradient:!0,FlowGradientBand:[.1,.2],FlowGradientOffset:30,FlowGradientFn:"constant",FlowSpeed:.001,FlowWeight:.001,FlowRender:!0,CellRender:!0,BkgLineRamp:0,BkgCellHatchThresh:0,CellHasGradient:!1,CellGradientFillA:color(0,45,90),CellGradientFillB:color(280,90,90),CellGradientStrokeA:color(300,100,100),CellGradientStrokeB:color(340,100,80),SweepAccentRatio:.33,BkgGradientShift:340},5:{GhostInvent:!0,FixEdge:!0,FlowOrientation:window.$.isHyper&&window.$.isMirage?Math.floor(7*random()):0,CellsOnTop:!0,SuperFlow:window.$.isHyper&&window.$.isMirage,GradMode:2,StreamThresh:50,StreamFactor:.01,FadeCellFillFn:4,FadeCellStrokeFn:0,Pad:window.$.isHyper||window.$.isMirage?random([.05,.1]):.15,AreaWeight:1.5,AreaCurve:1.75,FlowBatches:16,TwistBkgSize:1,TwistBkgCurve:0,CellDivideCount:2,Travel:random(1e3,2e3),TwistBkg:0,TwistFlow:0,FlowWarp:random([.5,1,2]),BkgWarp:window.$.isMirage?.5:1,BkgFadeAmt:1,Vignette:window.$.isHyper,BkgFadeFn:0,CrayonTheme:null,UseBkgCrayons:!1,UseBkgCrayonsMulti:!1,UseFlowCrayons:!1,UseCellBkgCrayons:!1,UseCellLineCrayons:!1,CellShakeScale:window.$.isHyper&&window.$.isMirage?random(.5,1.5):0,CellShakeStrength:window.$.isHyper&&window.$.isMirage?random(1,2):null,BkgShakeScale:window.$.isHyper?1:0,BkgShakeStrength:window.$.isHyper?1.5:null,FlowShakeScale:0,NoiseTypeBkg:"Radial",NoiseTypeFlow:"Radial",CellHatchThresh:1,CellThreshDir:window.$.isHyper&&window.$.isMirage?1:-1,CellLineRender:!0,LineVariance:"Random",BkgRender:window.$.isHyper,CellOutlineWeight:window.$.isHyper&&window.$.isMirage?.0015:window.$.isMirage?8e-4:.001,DimChance:window.$.isHyper?.8:.5,DimRange:[.2,window.$.isHyper?.5:.8],CellOptimize:!0,GlobalOffsetFlow:random(0,360),GlobalOffsetBkg:random(0,360),BaseSize:512,LineThickness:.02,Spacing:random(.025,.05),BkgColor:color(0),BkgGradient:!0,BkgGradientSpeed:500,GradientBand:360*random(.5,2),GradientBandOffset:random(0,60),ColorSweep:color(window.$.isHyper?0:100),ColorSweepAlt:color(window.$.isHyper?100:0),ColorSweepAccent:color(340,90,100),ColorSweepAccentAlt:color(window.$.isHyper?100:0),ColorBkgThinLine:color(200,100,100),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(window.$.isHyper?32:100),ColorCellLines:color(window.$.isHyper?0:100),ColorCellBkg:color(window.$.isHyper?100:0),ColorCellOutline:color(window.$.isHyper?0:100),FlowBatchSize:64,CellZoom:window.$.isHyper&&window.$.isMirage?1:0,CellRamp:window.$.isHyper&&window.$.isMirage?0:2,CellLineThickness:window.$.isMirage?random(2,3):1,CellLineSpacing:window.$.isMirage?random(.004,.006):.002,CellThresh:25e-5*(window.$.isMirage?3:1),CellHatch:!1,BkgLineFillThresh:.03,NoiseScale:5,NoiseStrength:2,FlowScale:window.$.isMirage?random(.25,.5):.25,FlowStrength:window.$.isHyper&&window.$.isMirage?4:8,FlowZ:1e-8,FlowCells:window.$.isHyper||window.$.isMirage?window.$.isHyper?45:~~random(54,64):~~random(30,36),FlowGradient:!0,FlowGradientBand:[random(1,1.5)*(window.$.isMirage?.75:1),random(1.5,2)*(window.$.isMirage?.75:1)],FlowGradientOffset:random(0,60),FlowGradientFn:window.$.isHyper?"lighten":"constant",FlowSpeed:window.$.isHyper?5e-4:.001,FlowWeight:.001,FlowRender:!0,CellRender:!0,BkgLineRamp:0,BkgCellHatchThresh:.001,CellHasGradient:!1,CellGradientFillA:color(0),CellGradientFillB:color(0),CellGradientStrokeA:color(0),CellGradientStrokeB:color(0),SweepAccentRatio:.33,BkgGradientShift:360*random()},6:U(),7:{BkgGradientSpeed:1e3,FixEdge:!0,FlowOrientation:0,CellsOnTop:!0,FadeCellFillFn:4,FadeCellStrokeFn:0,Pad:random([.05,.1,.15]),CellDivideCount:3,AreaWeight:0,AreaCurve:1.75,FlowBatches:24,TwistBkgSize:1,TwistBkgCurve:0,Travel:random(200,2e3),TwistBkg:0,TwistFlow:0,FlowWarp:1,BkgWarp:1,BkgFadeAmt:.5,BkgFadeFn:random([-1,1]),CrayonTheme:window.$.isHyper?"RGB":"Crayon",UseBkgCrayons:!1,UseBkgCrayonsMulti:!1,UseFlowCrayons:!1,UseCellBkgCrayons:!1,UseCellLineCrayons:!1,CellShakeScale:.5,CellShakeStrength:5,FlowOrientation:Math.floor(7*random()),BkgShakeScale:window.$.isMirage&&!window.$.isHyper?1.25:.1,BkgShakeStrength:window.$.isMirage&&!window.$.isHyper?2:.4,FlowShakeScale:0,NoiseTypeBkg:"Radial",NoiseTypeFlow:"Radial",CellHatchThresh:null,CellThreshDir:1,CellLineRender:!0,LineVariance:"Random",BkgRender:!0,CellOutlineWeight:window.$.isHyper||window.$.isMirage?.002:.001,DimChance:.5,DimRange:[.2,.8],CellOptimize:!0,GlobalOffsetFlow:0,GlobalOffsetBkg:0,GlobalOffsetCell:0,BaseSize:256,LineThickness:.01,Spacing:.02,BkgColor:color(0),BkgGradient:!1,GradientBand:random([360,720,1080]),GradientBandOffset:0,ColorSweep:color(160,40,75),ColorSweepAlt:color(P.Paper),ColorSweepAccent:color(180,85,40),ColorSweepAccentAlt:color(P.Paper),ColorBkgThinLine:color(0),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(24),ColorCellLines:color(24),ColorCellBkg:color(0),ColorCellOutline:color(72),FlowBatchSize:window.$.isMirage&&!window.$.isHyper?72:64,CellZoom:0,CellRamp:window.$.isMirage?2.5:1,CellLineThickness:window.$.isMirage?1.5:1,CellLineSpacing:window.$.isMirage?.015:.025,CellThresh:random(.01,.02),CellHatch:!window.$.isMirage,BkgLineFillThresh:.01,NoiseScale:7,NoiseStrength:1,FlowScale:window.$.isMirage&&!window.$.isHyper?.33:.25,FlowStrength:8,FlowZ:window.$.isHyper&&window.$.isMirage?1e-8:8e-8,FlowCells:window.$.isMirage?~~random(50,64):~~random(30,40),FlowGradient:window.$.isHyper,FlowGradientBand:window.$.isHyper?[1,2]:null,FlowGradientOffset:0,FlowGradientFn:"constant",FlowSpeed:.001,FlowWeight:.001,FlowRender:!0,CellRender:!0,BkgLineRamp:.5,BkgCellHatchThresh:1,CellHasGradient:!1,CellGradientFillA:color(0),CellGradientFillB:color(0),CellGradientStrokeA:color(0),CellGradientStrokeB:color(0),SweepAccentRatio:.33,BkgGradientShift:360*random()},8:{FixEdge:!0,FlowOrientation:Math.floor(7*random()),CellsOnTop:!0,FadeCellFillFn:4,FadeCellStrokeFn:0,Pad:random([.05,.1]),AreaWeight:random([1,2]),AreaCurve:1.75,FlowBatches:16,TwistBkgSize:1,TwistBkgCurve:0,Travel:window.$.isHyper?500:250,TwistBkg:0,TwistFlow:0,FlowWarp:1,BkgWarp:1,BkgFadeAmt:window.$.isHyper?1:0,Vignette:window.$.isHyper,BkgFadeFn:window.$.isHyper?random([-1,1]):0,CrayonTheme:"Carnival",UseBkgCrayons:!0,UseBkgCrayonsMulti:!1,UseFlowCrayons:!0,UseCellBkgCrayons:!window.$.isHyper,UseCellLineCrayons:!0,CellShakeScale:.25,CellShakeStrength:window.$.isHyper||!window.$.isHyper&&window.$.isMirage?1:0,BkgShakeScale:0,FlowShakeScale:0,NoiseTypeBkg:"Radial",NoiseTypeFlow:"Radial",CellHatchThresh:null,CellThreshDir:1,CellLineRender:!0,LineVariance:"Random",BkgRender:!0,CellOutlineWeight:.001,DimChance:.5,DimRange:[.2,.8],CellOptimize:!0,GlobalOffsetFlow:0,GlobalOffsetBkg:0,GlobalOffsetCell:0,BaseSize:128,LineThickness:random(5e-4,.001),Spacing:.005,BkgColor:window.$.isHyper?color(0):color(random([P.Cardboard,P.Paper])),BkgGradient:!1,GradientBand:0,GradientBandOffset:0,ColorSweep:color(200,100,100),ColorSweepAlt:color(0),ColorSweepAccent:color(180,80,80),ColorSweepAccentAlt:color(0),ColorBkgThinLine:color(0),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(0),ColorCellLines:window.$.isHyper?color(15):color(340,100,40),ColorCellBkg:color(0),ColorCellOutline:window.$.isHyper?color(P.Cardboard):color(0,100,100),FlowBatchSize:64,CellZoom:1,CellRamp:2,CellLineThickness:1,CellLineSpacing:.005,CellThresh:window.$.isHyper?25e-5:4e-4,CellHatch:!window.$.isMirage,BkgLineFillThresh:.0125,NoiseScale:random(.25,1),NoiseStrength:3,FlowScale:.25,FlowStrength:8,FlowZ:window.$.isHyper?1e-7:8e-8,FlowCells:window.$.isHyper?32:50,FlowGradient:!1,FlowGradientBand:null,FlowGradientOffset:0,FlowGradientFn:"constant",FlowSpeed:8e-4,FlowWeight:.001,FlowRender:!0,CellRender:!0,BkgLineRamp:0,BkgCellHatchThresh:0,CellHasGradient:!window.$.isHyper,CellGradientFillA:color(0,45,90),CellGradientFillB:color(280,90,90),CellGradientStrokeA:color(300,100,100),CellGradientStrokeB:color(340,100,80),SweepAccentRatio:.33},9:{Ghost:!0,HyperGhost:!0,FixEdge:!0,FlowOrientation:0,CellsOnTop:window.$.isHyper,FadeCellFillFn:random([4,5]),FadeCellStrokeFn:random([0,1,2,3]),Pad:random([.05,.1,.15]),CellDivideCount:window.$.isHyper?8:random([1,2,4,8]),CellGridFillDir:0,CellGridStrokeDir:1,FlowRetrace:!window.$.isHyper,AreaWeight:window.$.isHyper?1.5:1,AreaCurve:window.$.isHyper?2:1.75,FlowBatches:window.$.isHyper?64:16,TwistBkgSize:0,TwistBkgCurve:0,Travel:window.$.isHyper?100:25,TwistBkg:0,TwistFlow:0,FlowWarp:1,BkgWarp:1,BkgFadeAmt:0,Vignette:!1,BkgFadeFn:0,CrayonTheme:window.$.isHyper?"Riptide":null,UseBkgCrayons:window.$.isHyper&&window.$.isMirage,UseBkgCrayonsMulti:!1,UseFlowCrayons:window.$.isHyper&&window.$.isMirage,UseCellBkgCrayons:!1,UseCellLineCrayons:!1,CellShakeScale:random(.4,.6),CellShakeStrength:random(.5,1),FlowOrientation:Math.floor(7*random()),BkgShakeScale:0,FlowShakeScale:0,NoiseTypeBkg:"Radial",NoiseTypeFlow:"Radial",CellHatchThresh:null,CellThreshDir:-1,CellLineRender:!0,LineVariance:"Random",BkgRender:!0,DimChance:random(.5,1),DimRange:[random(.1,.2),random(.4,1)],CellOptimize:!0,GlobalOffsetFlow:0,GlobalOffsetBkg:0,GlobalOffsetCell:0,BaseSize:256,LineThickness:window.$.isHyper?.001:random(5e-4,8e-4),Spacing:random(8e-4,.001),BkgColor:color(window.$.isHyper?P.Cardboard:random([P.Paper,P.White])),BkgGradient:!1,GradientBand:0,GradientBandOffset:0,ColorSweep:window.$.isHyper?color(0):color(P.Cardboard),ColorSweepAlt:color(0),ColorSweepAccent:color(0),ColorSweepAccentAlt:color(0),ColorBkgThinLine:color(0),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(0),ColorCellLines:color((340+window.$.Shift)%360,100,40),ColorCellBkg:color(0),ColorCellOutline:color(100),FlowBatchSize:random([32,64]),CellZoom:.5,CellRamp:1.5,CellLineThickness:window.$.isHyper?random(1,1.5):1,CellLineSpacing:.002,CellThresh:random(3e-4,5e-4),CellHatch:!window.$.isHyper,BkgLineFillThresh:.0125,NoiseScale:random([.25,.5,.75]),NoiseStrength:random([2,3,4]),FlowScale:.25,FlowStrength:window.$.isHyper?2:3,FlowZ:window.$.isHyper?1e-7:2e-7,FlowCells:window.$.isHyper?32:64,FlowGradient:!1,FlowGradientBand:null,FlowGradientOffset:0,FlowGradientFn:"constant",FlowTravel:200,FlowSpeed:.001,FlowWeight:window.$.isHyper?.0015:.001,FlowRender:!1,CellRender:!0,BkgLineRamp:0,BkgCellHatchThresh:0,CellHasGradient:!0,CellGradientFillA:window.$.isHyper?window.$.isMirage?color(60,45,90):color(0,45,90):color(0),CellGradientFillB:window.$.isHyper?window.$.isMirage?color(340,90,90):color(280,90,90):color(0),CellGradientStrokeA:window.$.isHyper?window.$.isMirage?color(240,100,100):color(180,100,100):color(0),CellGradientStrokeB:window.$.isHyper?window.$.isMirage?color(320,100,80):color(260,100,80):color(P.Cardboard),SweepAccentRatio:.33,CellShakeScale:random(.25,.5),CellShakeStrength:.5,CellThresh:.001,CellsOnTop:!0,CellHatch:!1,FlowCells:40,CellOutlineWeight:window.$.isHyper&&window.$.isMirage?75e-5:65e-5,FlowZ:1e-7,BkgShakeScale:.01,BkgShakeStrength:.5,LineVariance:"None",FlowRender:!1,AreaWeight:1.5,...window.$.isHyper?{CellHasGradient:!1,ColorCellOutline:color(hue(P.Cardboard),saturation(P.Cardboard),.5*brightness(P.Cardboard)),ColorCellBkg:color(P.Cardboard),BkgColor:color(P.Cardboard),ColorCellLines:color(0),FlowScale:3,FlowStrength:5,BkgShakeStrength:0,CellHasGradient:!window.$.isMirage,CellZoom:2,CellRamp:2,CellLineThickness:1.25,CellLineSpacing:window.$.isMirage?.004:.002,CellDivideCount:window.$.isMirage?4:2,ColorCellOutline:color(0)}:{CellHasGradient:!1,ColorCellOutline:color(window.$.isMirage?P.Cardboard:8),ColorCellBkg:color(window.$.isMirage?8:P.Cardboard),BkgColor:color(P.Cardboard),ColorCellLines:color(window.$.isMirage?P.Cardboard:8),FlowScale:3,FlowStrength:.75,CellDivideCount:2}}}),window.$=(()=>{const e=W[window.$styles[window.$.Style].CrayonTheme]??[];if(window.$.Palette=e.map((e=>P[e])),Q(window.$.Palette),window.$.GhostWeight=window.$styles[window.$.Style].GhostWeight,window.$.GhostInvert=window.$styles[window.$.Style].GhostInvert,window.$.Ghost=window.$styles[window.$.Style].Ghost,window.$.HyperGhost=window.$styles[window.$.Style].HyperGhost,window.$.StreamFactor=window.$styles[window.$.Style].StreamFactor,window.$.StreamThresh=window.$styles[window.$.Style].StreamThresh,window.$.BkgGradientShift=window.$styles[window.$.Style].BkgGradientShift,w
i=new T:void 0,n=this._clip(e);if(null===n||!n.length)return;i.moveTo(n[0],n[1]);let l=n.length;for(;n[0]===n[l-2]&&n[1]===n[l-1]&&l>1;)l-=2;for(let e=2;e<l;e+=2)n[e]===n[e-2]&&n[e+1]===n[e-1]||i.lineTo(n[e],n[e+1]);return i.closePath(),o&&o.value()}*cellPolygons(){const{delaunay:{points:e}}=this;for(let i=0,o=e.length/2;i<o;++i){const e=this.cellPolygon(i);e&&(e.index=i,yield e)}}cellPolygon(e){const i=new M;return this.renderCell(e,i),i.value()}_renderSegment(e,i,o,n,l){let t;const r=this._regioncode(e,i),w=this._regioncode(o,n);0===r&&0===w?(l.moveTo(e,i),l.lineTo(o,n)):(t=this._clipSegment(e,i,o,n,r,w))&&(l.moveTo(t[0],t[1]),l.lineTo(t[2],t[3]))}contains(e,i,o){return(i=+i)==i&&(o=+o)==o&&this.delaunay._step(e,i,o)===e}*neighbors(e){const i=this._clip(e);if(i)for(const o of this.delaunay.neighbors(e)){const e=this._clip(o);if(e)e:for(let n=0,l=i.length;n<l;n+=2)for(let t=0,r=e.length;t<r;t+=2)if(i[n]===e[t]&&i[n+1]===e[t+1]&&i[(n+2)%l]===e[(t+r-2)%r]&&i[(n+3)%l]===e[(t+r-1)%r]){yield o;break e}}}_cell(e){const{circumcenters:i,delaunay:{inedges:o,halfedges:n,triangles:l}}=this,t=o[e];if(-1===t)return null;const r=[];let w=t;do{const o=Math.floor(w/3);if(r.push(i[2*o],i[2*o+1]),w=w%3==2?w-2:w+1,l[w]!==e)break;w=n[w]}while(w!==t&&-1!==w);return r}_clip(e){if(0===e&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const i=this._cell(e);if(null===i)return null;const{vectors:o}=this,n=4*e;return this._simplify(o[n]||o[n+1]?this._clipInfinite(e,i,o[n],o[n+1],o[n+2],o[n+3]):this._clipFinite(e,i))}_clipFinite(e,i){const o=i.length;let n,l,t,r,w=null,s=i[o-2],a=i[o-1],d=this._regioncode(s,a),h=0;for(let c=0;c<o;c+=2)if(n=s,l=a,s=i[c],a=i[c+1],t=d,d=this._regioncode(s,a),0===t&&0===d)r=h,h=0,w?w.push(s,a):w=[s,a];else{let i,o,c,g,$;if(0===t){if(null===(i=this._clipSegment(n,l,s,a,t,d)))continue;[o,c,g,$]=i}else{if(null===(i=this._clipSegment(s,a,n,l,d,t)))continue;[g,$,o,c]=i,r=h,h=this._edgecode(o,c),r&&h&&this._edge(e,r,h,w,w.length),w?w.push(o,c):w=[o,c]}r=h,h=this._edgecode(g,$),r&&h&&this._edge(e,r,h,w,w.length),w?w.push(g,$):w=[g,$]}if(w)r=h,h=this._edgecode(w[0],w[1]),r&&h&&this._edge(e,r,h,w,w.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return w}_clipSegment(e,i,o,n,l,t){const r=l<t;for(r&&([e,i,o,n,l,t]=[o,n,e,i,t,l]);;){if(0===l&&0===t)return r?[o,n,e,i]:[e,i,o,n];if(l&t)return null;let w,s,a=l||t;8&a?(w=e+(o-e)*(this.ymax-i)/(n-i),s=this.ymax):4&a?(w=e+(o-e)*(this.ymin-i)/(n-i),s=this.ymin):2&a?(s=i+(n-i)*(this.xmax-e)/(o-e),w=this.xmax):(s=i+(n-i)*(this.xmin-e)/(o-e),w=this.xmin),l?(e=w,i=s,l=this._regioncode(e,i)):(o=w,n=s,t=this._regioncode(o,n))}}_clipInfinite(e,i,o,n,l,t){let r,w=Array.from(i);if((r=this._project(w[0],w[1],o,n))&&w.unshift(r[0],r[1]),(r=this._project(w[w.length-2],w[w.length-1],l,t))&&w.push(r[0],r[1]),w=this._clipFinite(e,w))for(let i,o=0,n=w.length,l=this._edgecode(w[n-2],w[n-1]);o<n;o+=2)i=l,l=this._edgecode(w[o],w[o+1]),i&&l&&(o=this._edge(e,i,l,w,o),n=w.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(w=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return w}_edge(e,i,o,n,l){for(;i!==o;){let o,t;switch(i){case 5:i=4;continue;case 4:i=6,o=this.xmax,t=this.ymin;break;case 6:i=2;continue;case 2:i=10,o=this.xmax,t=this.ymax;break;case 10:i=8;continue;case 8:i=9,o=this.xmin,t=this.ymax;break;case 9:i=1;continue;case 1:i=5,o=this.xmin,t=this.ymin}n[l]===o&&n[l+1]===t||!this.contains(e,o,t)||(n.splice(l,0,o,t),l+=2)}return l}_project(e,i,o,n){let l,t,r,w=1/0;if(n<0){if(i<=this.ymin)return null;(l=(this.ymin-i)/n)<w&&(r=this.ymin,t=e+(w=l)*o)}else if(n>0){if(i>=this.ymax)return null;(l=(this.ymax-i)/n)<w&&(r=this.ymax,t=e+(w=l)*o)}if(o>0){if(e>=this.xmax)return null;(l=(this.xmax-e)/o)<w&&(t=this.xmax,r=i+(w=l)*n)}else if(o<0){if(e<=this.xmin)return null;(l=(this.xmin-e)/o)<w&&(t=this.xmin,r=i+(w=l)*n)}return[t,r]}_edgecode(e,i){return(e===this.xmin?1:e===this.xmax?2:0)|(i===this.ymin?4:i===this.ymax?8:0)}_regioncode(e,i){return(e<this.xmin?1:e>this.xmax?2:0)|(i<this.ymin?4:i>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let i=0;i<e.length;i+=2){const o=(i+2)%e.length,n=(i+4)%e.length;(e[i]===e[o]&&e[o]===e[n]||e[i+1]===e[o+1]&&e[o+1]===e[n+1])&&(e.splice(o,2),i-=2)}e.length||(e=null)}return e}}const H=2*Math.PI,v=Math.pow;function L(e){return e[0]}function _(e){return e[1]}function A(e,i,o){return[e+Math.sin(e+i)*o,i+Math.cos(e-i)*o]}class R{static from(e,i=L,o=_,n){return new R("length"in e?function(e,i,o,n){const l=e.length,t=new Float64Array(2*l);for(let r=0;r<l;++r){const l=e[r];t[2*r]=i.call(n,l,r,e),t[2*r+1]=o.call(n,l,r,e)}return t}(e,i,o,n):Float64Array.from(function*(e,i,o,n){let l=0;for(const t of e)yield i.call(n,t,l,e),yield o.call(n,t,l,e),++l}(e,i,o,n)))}constructor(e){this._delaunator=new p(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,i=this.points;if(e.hull&&e.hull.length>2&&function(e){const{triangles:i,coords:o}=e;for(let e=0;e<i.length;e+=3){const n=2*i[e],l=2*i[e+1],t=2*i[e+2];if((o[t]-o[n])*(o[l+1]-o[n+1])-(o[l]-o[n])*(o[t+1]-o[n+1])>1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:i.length/2},((e,i)=>i)).sort(((e,o)=>i[2*e]-i[2*o]||i[2*e+1]-i[2*o+1]));const e=this.collinear[0],o=this.collinear[this.collinear.length-1],n=[i[2*e],i[2*e+1],i[2*o],i[2*o+1]],l=1e-8*Math.hypot(n[3]-n[1],n[2]-n[0]);for(let e=0,o=i.length/2;e<o;++e){const o=A(i[2*e],i[2*e+1],l);i[2*e]=o[0],i[2*e+1]=o[1]}this._delaunator=new p(i)}else delete this.collinear;const o=this.halfedges=this._delaunator.halfedges,n=this.hull=this._delaunator.hull,l=this.triangles=this._delaunator.triangles,t=this.inedges.fill(-1),r=this._hullIndex.fill(-1);for(let e=0,i=o.length;e<i;++e){const i=l[e%3==2?e-2:e+1];-1!==o[e]&&-1!==t[i]||(t[i]=e)}for(let e=0,i=n.length;e<i;++e)r[n[e]]=e;n.length<=2&&n.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=n[0],t[n[0]]=1,2===n.length&&(t[n[1]]=0,this.triangles[1]=n[1],this.triangles[2]=n[1]))}voronoi(e){return new G(this,e)}*neighbors(e){const{inedges:i,hull:o,_hullIndex:n,halfedges:l,triangles:t,collinear:r}=this;if(r){const i=r.indexOf(e);return i>0&&(yield r[i-1]),void(i<r.length-1&&(yield r[i+1]))}const w=i[e];if(-1===w)return;let s=w,a=-1;do{if(yield a=t[s],s=s%3==2?s-2:s+1,t[s]!==e)return;if(s=l[s],-1===s){const i=o[(n[e]+1)%o.length];return void(i!==a&&(yield i))}}while(s!==w)}find(e,i,o=0){if((e=+e)!=e||(i=+i)!=i)return-1;const n=o;let l;for(;(l=this._step(o,e,i))>=0&&l!==o&&l!==n;)o=l;return l}_step(e,i,o){const{inedges:n,hull:l,_hullIndex:t,halfedges:r,triangles:w,points:s}=this;if(-1===n[e]||!s.length)return(e+1)%(s.length>>1);let a=e,d=v(i-s[2*e],2)+v(o-s[2*e+1],2);const h=n[e];let c=h;do{let n=w[c];const h=v(i-s[2*n],2)+v(o-s[2*n+1],2);if(h<d&&(d=h,a=n),c=c%3==2?c-2:c+1,w[c]!==e)break;if(c=r[c],-1===c){if(c=l[(t[e]+1)%l.length],c!==n&&v(i-s[2*c],2)+v(o-s[2*c+1],2)<d)return c;break}}while(c!==h);return a}render(e){const i=null==e?e=new T:void 0,{points:o,halfedges:n,triangles:l}=this;for(let i=0,t=n.length;i<t;++i){const t=n[i];if(t<i)continue;const r=2*l[i],w=2*l[t];e.moveTo(o[r],o[r+1]),e.lineTo(o[w],o[w+1])}return this.renderHull(e),i&&i.value()}renderPoints(e,i){void 0!==i||e&&"function"==typeof e.moveTo||(i=e,e=null),i=null==i?2:+i;const o=null==e?e=new T:void 0,{points:n}=this;for(let o=0,l=n.length;o<l;o+=2){const l=n[o],t=n[o+1];e.moveTo(l+i,t),e.arc(l,t,i,0,H)}return o&&o.value()}renderHull(e){const i=null==e?e=new T:void 0,{hull:o,points:n}=this,l=2*o[0],t=o.length;e.moveTo(n[l],n[l+1]);for(let i=1;i<t;++i){const l=2*o[i];e.lineTo(n[l],n[l+1])}return e.closePath(),i&&i.value()}hullPolygon(){const e=new M;return this.renderHull(e),e.value()}renderTriangle(e,i){const o=null==i?i=new T:void 0,{points:n,triangles:l}=this,t=2*l[e*=3],r=2*l[e+1],w=2*l[e+2];return i.moveTo(n[t],n[t+1]),i.lineTo(n[r],n[r+1]),i.lineTo(n[w],n[w+1]),i.closePath(),o&&o.value()}*trianglePolygons(){const{triangles:e}=this;for(let i=0,o=e.length/3;i<o;++i)yield this.trianglePolygon(i)}trianglePolygon(e){const i=new M;return this.renderTriangle(e,i),i.value()}}var b=o(187),O=o.n(b);const z=JSON.parse('{"0":[{"Mode":"Light","Palette":"Bloom"},{"Mode":"Light","Palette":"Bloom"}],"1":[{"Mode":"Light","Palette":"Crayon"},{"Mode":"Dark","Palette":"Sketch"}],"2":[{"Mode":"Dark","Palette":"Marine"},{"Mode":"Dark","Palette":"RGB"}],"3":[{"Mode":"Dark","Palette":"Riptide"},{"Mode":"Dark","Palette":"Riptide"}],"4":[{"Mode":"Light","Palette":"Phoenix"},{"Mode":"Dark","Palette":"Phoenix"}],"5":[{"Mode":"Dark","Palette":"RGB"},{"Mode":"Dark","Palette":"RGB"}],"6":[{"Mode":"Light","Palette":"Crayon"},{"Mode":"Dark","Palette":"Crayon"}],"7":[{"Mode":"Dark","Palette":"Mint"},{"Mode":"Dark","Palette":"RGB"}],"8":[{"Mode":"Light","Palette":"Carnival"},{"Mode":"Dark","Palette":"Carnival"}],"9":[{"Mode":"Light","Palette":"Sketch"},{"Mode":"Light","Palette":"Sketch"}]}'),P=JSON.parse('{"Paper":"#fff5eb","Cardboard":"#eee5d8","White":"#fff","Black":"#000","Teal":"#60cab6","Yellow":"#fabf0f","Yellow2":"#EEC61F","Blue":"#1a3966","Red":"#bf2640","Carnival1":"#f0c54a","Carnival2":"#e590a2","Carnival3":"#4d9cd0","Carnival4":"#dd5b44","Carnival5":"#61b8a3","Carnival6":"#221f20","Riptide1":"#d52c52","Riptide2":"#342720","Riptide3":"#0a202c","Riptide4":"#37709d","Riptide5":"#aea09d","Riptide6":"#233a3d"}'),W=JSON.parse('{"Monochrome":["Paper","White","Black"],"Crayon":["Paper","White","Black","Teal","Yellow","Blue","Red"],"Carnival":["Carnival1","Carnival2","Carnival3","Carnival4","Carnival5","Carnival6"],"Red":["Red","White","Black"],"Riptide":["Riptide1","Riptide2","Riptide3","Riptide4","Riptide5","Riptide6"]}');function U(){const e=window.$.isHyper?[P.Black]:random([[P.Red],[P.Yellow],[P.Blue],[P.Teal,P.Blue],[P.Blue,P.Teal],[P.Teal,P.Black],[P.Red,P.Black]]);return{FixEdge:!0,FlowOrientation:window.$.isHyper&&window.$.isMirage?Math.floor(7*random()):0,CellsOnTop:window.$.isHyper||window.$.isMirage,FadeCellFillFn:4,FadeCellStrokeFn:0,Pad:random([.05,.1,.2]),AreaWeight:0,AreaCurve:1.75,FlowBatches:64,TwistBkgSize:1,TwistBkgCurve:0,CellDivideCount:2,Travel:random(500,2500),TwistBkg:0,TwistFlow:0,FlowWarp:1,BkgWarp:1,BkgFadeAmt:0,BkgFadeFn:0,CrayonTheme:"Crayon",UseBkgCrayons:!1,UseBkgCrayonsMulti:!0,UseFlowCrayons:!1,UseCellBkgCrayons:!0,UseCellLineCrayons:!0,CellShakeScale:window.$.isMirage?.25:0,CellShakeStrength:window.$.isMirage?.5:0,BkgShakeScale:.025,BkgShakeStrength:.8,FlowShakeScale:0,NoiseTypeBkg:"Radial",NoiseTypeFlow:"Radial",CellHatchThresh:null,CellThreshDir:window.$.isMirage?1:-1,CellLineRender:!0,LineVariance:"Random",BkgRender:!0,CellOutlineWeight:.001,DimChance:.5,DimRange:[.2,.8],CellOptimize:!0,GlobalOffsetFlow:0,GlobalOffsetBkg:0,GlobalOffsetCell:0,BaseSize:256,LineThickness:random(5e-4,.05),Spacing:random(.002,.002),BkgColor:color(window.$.isHyper?random([P.Riptide1,P.Riptide4]):random([P.Paper,P.Cardboard])),BkgGradient:!1,GradientBand:0,GradientBandOffset:0,ColorSweep:color(e[0]),ColorSweepAlt:color(e[1%e.length]),ColorSweepAccent:color(e[0]),ColorSweepAccentAlt:color(e[0]),ColorBkgThinLine:color(0),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(0),ColorCellLines:color(340,100,40),ColorCellBkg:color(0),ColorCellOutline:window.$.isHyper?color(0):color(100),FlowBatchSize:20,CellZoom:2,CellRamp:1,CellLineThickness:1,CellLineSpacing:.002,CellThresh:25e-5,CellHatch:random([!0,!1]),BkgLineFillThresh:.005,NoiseScale:7,NoiseStrength:3,FlowScale:.25,FlowStrength:8,FlowZ:1e-7,FlowCells:64,FlowGradient:!1,FlowGradientBand:null,FlowGradientOffset:0,FlowGradientFn:"constant",FlowSpeed:.001,FlowWeight:.001,FlowRender:!0,CellRender:!0,BkgLineRamp:0,BkgCellHatchThresh:0,CellHasGradient:!0,CellGradientFillA:color(180,10,100),CellGradientFillB:color(200,10,100),CellGradientStrokeA:color(180,100,100),CellGradientStrokeB:color(200,100,100),SweepAccentRatio:.33}}let D,N,Z,I,V,E;window.$={},window.$f={},window.$styles={};let q=0,K=0,j=0;const Y=new t;function J(e,i,o,n,l){const t=dist(e,i,0,0),r=constrain(t/o,0,1);return t*n*Math.pow(r,l)}D=~~(1e9*Y.random_dec());const Q=e=>{for(let i=e.length-1;i>0;i--){const o=Math.floor(random()*(i+1)),n=e[i];e[i]=e[o],e[o]=n}},X=(e,i=10)=>{const o=color(e?window.$.Palette[e%window.$.Palette.length]:random(window.$.Palette));return"RGB"===window.$.CrayonTheme?color(360*random(),100,100):color(hue(o),saturation(o),brightness(o)+random(-i,i))};function ee(e){let i=0,o=0;const n=e.length;for(let l=0;l<n;l++)i+=e[l][0],o+=e[l][1];return[i/n,o/n]}function ie(e){let i=0,o=e.length-1;for(let n=0;n<e.length;n++)i+=(e[o][0]+e[n][0])*(e[o][1]-e[n][1]),o=n;return Math.abs(i/2)}function oe(e){const i=e.length;let o=0,n=0;for(let l=0,t=i-1;l<i;t=l++){const i=dist(e[l][0],e[l][1],e[t][0],e[t][1]);i>o&&(o=i,n=atan2(e[t][1]-e[l][1],e[t][0]-e[l][0]))}return n}const ne=(e,i,o,n=0,l=0)=>{noStroke(),fill(color((hue(i)+l)%360,saturation(i),brightness(i)));const t=window.$.FlowGradientFn??random(["lighten","darken","constant"]),r=e.length,w=window.$.BaseSize,s=width/w*w,a=height/w*w;for(let i=0;i<r;i++){const[w,d]=e[i];if(n){const e=i/r;fill(color((360*e*n+l)%360,100,"lighten"===t?100*(1-e):"darken"===t?100*e:100))}circle(w*s,d*a,o*s)}},le=()=>{randomSeed(D),noiseSeed(D)},te=()=>~~(1*window.$.BaseSize),re=()=>{I=Array(te()).fill().map((()=>Array(te()).fill(0)))};function we(e,i){const o=e[0],n=1-o,l=e[1],t=1-l,r=o*l,w=n*t;switch("fill"===i?window.$.FadeCellFillFn:window.$.FadeCellStrokeFn){case 0:return o;case 1:return l;case 2:return n;case 3:return t;case 4:return r;case 5:return w}return r}window.setup=()=>{le(),N=function(o=Math.random){const l=function(e){const i=new Uint8Array(512);for(let e=0;e<256;e++)i[e]=e;for(let o=0;o<255;o++){const n=o+~~(e()*(256-o)),l=i[o];i[o]=i[n],i[n]=l}for(let e=256;e<512;e++)i[e]=i[e-256];return i}(o),t=new Float64Array(l).map((e=>n[e%12*3])),r=new Float64Array(l).map((e=>n[e%12*3+1])),w=new Float64Array(l).map((e=>n[e%12*3+2]));return function(o,n,s){let a,d,h,c;const g=.3333333333333333*(o+n+s),$=i(o+g),C=i(n+g),y=i(s+g),p=($+C+y)*e,u=o-($-p),f=n-(C-p),S=s-(y-p);let k,F,m,B,x,T;u>=f?f>=S?(k=1,F=0,m=0,B=1,x=1,T=0):u>=S?(k=1,F=0,m=0,B=1,x=0,T=1):(k=0,F=0,m=1,B=1,x=0,T=1):f<S?(k=0,F=0,m=1,B=0,x=1,T=1):u<S?(k=0,F=1,m=0,B=0,x=1,T=1):(k=0,F=1,m=0,B=1,x=1,T=0);const M=u-k+e,G=f-F+e,H=S-m+e,v=u-B+2*e,L=f-x+2*e,_=S-T+2*e,A=u-1+.5,R=f-1+.5,b=S-1+.5,O=255&$,z=255&C,P=255&y;let W=.6-u*u-f*f-S*S;if(W<0)a=0;else{const e=O+l[z+l[P]];W*=W,a=W*W*(t[e]*u+r[e]*f+w[e]*S)}let U=.6-M*M-G*G-H*H;if(U<0)d=0;else{const e=O+k+l[z+F+l[P+m]];U*=U,d=U*U*(t[e]*M+r[e]*G+w[e]*H)}let D=.6-v*v-L*L-_*_;if(D<0)h=0;else{const e=O+B+l[z+x+l[P+T]];D*=D,h=D*D*(t[e]*v+r[e]*L+w[e]*_)}let N=.6-A*A-R*R-b*b;if(N<0)c=0;else{const e=O+1+l[z+1+l[P+1]];N*=N,c=N*N*(t[e]*A+r[e]*R+w[e]*b)}return 32*(a+d+h+c)}}(random);const[o,l]=pe(1,windowWidth,windowHeight);createCanvas(o,l),pixelDensity(2),re(),window.$f=(()=>{const e=new t;window.$={},window.$.Seed=D,window.$.Style=e.random_int(0,9),window.$.isHyper=e.random_bool(.4),window.$.isMirage=e.random_bool(.3),window.$.Shift=random(-15,15),window.$.ShiftLargest=random([60,165,260,340]);const i=z[window.$.Style][Number(window.$.isHyper)];return 0===window.$.Style&&!window.$.isHyper&&window.$.isMirage&&(i.Mode="Dark"),2===window.$.Style&&!window.$.isHyper&&window.$.isMirage&&(i.Palette="Dragon"),9===window.$.Style&&window.$.isMirage&&!window.$.isHyper&&(i.Mode="Dark"),window.$.isHyper&&window.$.isMirage?i.Type="HyperMirage":window.$.isHyper?i.Type="Hyper":window.$.isMirage?i.Type="Mirage":i.Type="Elemental",i})(),window.$styles=(colorMode(HSB,360,100,100,100),{0:{FlowOrientation:0,FadeCellFillFn:4,FadeCellStrokeFn:0,Pad:random([.05,.1]),AreaWeight:0,AreaCurve:1.75,FlowBatches:64,TwistBkgSize:1,TwistBkgCurve:0,Travel:250,TwistBkg:0,TwistFlow:0,FlowWarp:random([.5,1,2]),BkgWarp:random([.5,1,2]),BkgFadeAmt:0,Vignette:window.$.isMirage,BkgFadeFn:0,CrayonTheme:null,UseBkgCrayons:!1,UseBkgCrayonsMulti:!1,UseFlowCrayons:!1,UseCellBkgCrayons:!1,UseCellLineCrayons:!1,CellShakeScale:0,BkgShakeScale:0,FlowShakeScale:0,NoiseTypeBkg:window.$.isMirage?"Radial":random(["Linear","Radial"]),NoiseTypeFlow:"Radial",CellHatchThresh:null,CellThreshDir:1,CellLineRender:!0,LineVariance:"Random",BkgRender:!0,CellOutlineWeight:5e-4,DimChance:random(.5,1),DimRange:[random(.1,.2),random(.4,1)],CellOptimize:!0,GlobalOffsetFlow:0,GlobalOffsetBkg:0,GlobalOffsetCell:0,BaseSize:window.$.isHyper?500:random(256,320),LineThickness:window.$.isHyper?4e-4:.001,Spacing:window.$.isHyper||window.$.isMirage?.001:random(.0025,.005),BkgColor:window.$.isMirage?color(190+random(0,10),random(50,90),random(87,95)):color(window.$.isHyper?P.Cardboard:P.Paper),BkgGradient:window.$.isHyper&&window.$.isMirage,GradientBand:window.$.isMirage&&window.$.isHyper?random([180,360,540,720]):0,GradientBandOffset:window.$.isMirage&&window.$.isHyper?360:null,ColorSweep:window.$.isMirage&&!window.$.isHyper?color(0):color((200+window.$.Shift)%360,100,100),ColorSweepAlt:color(0),ColorSweepAccent:color((180+window.$.Shift)%360,80,80),ColorSweepAccentAlt:color((180+window.$.Shift)%360,80,80),ColorBkgThinLine:color(16),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(16),ColorCellLines:color((340+window.$.Shift)%360,100,40),ColorCellBkg:color(0),ColorCellOutline:color((0+window.$.Shift)%360,100,100),FlowBatchSize:64,CellZoom:random(1,3),CellRamp:random(1,2),CellLineThickness:1,CellLineSpacing:.002,CellThresh:window.$.isHyper?1e-4:25e-5,CellHatch:random([!1,!0]),BkgLineFillThresh:.0125,NoiseScale:random([.25,.5,.75]),NoiseStrength:random([2,3,4]),FlowScale:.25,FlowStrength:6,FlowZ:2e-7,FlowCells:64,FlowGradient:!1,FlowGradientBand:null,FlowGradientOffset:0,FlowGradientFn:"constant",FlowSpeed:4e-4,FlowWeight:8e-4,FlowRender:!0,CellRender:!0,BkgLineRamp:0,BkgCellHatchThresh:0,CellHasGradient:!0,CellGradientFillA:color((0+window.$.Shift)%360,45,90),CellGradientFillB:color((280+window.$.Shift)%360,90,90),CellGradientStrokeA:color((300+window.$.Shift)%360,100,100),CellGradientStrokeB:color((340+window.$.Shift)%360,100,80),SweepAccentRatio:.33,BkgGradientShift:0},1:{FixEdge:!0,FlowOrientation:Math.floor(7*random()),CellsOnTop:!0,FadeCellFillFn:4,FadeCellStrokeFn:0,CellDivideCount:2,Pad:random([.05,.1,.2]),AreaWeight:window.$.isHyper?window.$.isHyper&&window.$.isMirage:0,AreaCurve:1.75,FlowBatches:16,TwistBkgSize:1,TwistBkgCurve:0,Travel:1e3,TwistBkg:0,TwistFlow:0,FlowWarp:random([.5,1,2]),BkgWarp:random([.5,1,2]),BkgFadeAmt:0,Vignette:!0,BkgFadeFn:1,CrayonTheme:window.$.isHyper?"Monochrome":"Crayon",UseBkgCrayons:!0,UseBkgCrayonsMulti:window.$.isMirage,UseFlowCrayons:!(window.$.isHyper&&window.$.isMirage),UseCellBkgCrayons:window.$.isMirage&&!window.$.isHyper,UseCellLineCrayons:!0,CellShakeScale:.1,BkgShakeScale:random(8,12),BkgShakeStrength:window.$.isHyper?random([0,10,50]):null,FlowShakeScale:0,NoiseTypeBkg:random(["Linear","Radial"]),NoiseTypeFlow:"Radial",CellHatchThresh:0,CellThreshDir:1,CellLineRender:!0,LineVariance:"Random",BkgRender:!(window.$.isHyper&&window.$.isMirage),CellOutlineWeight:(window.$.isHyper,.001),DimChance:random(.5,1),DimRange:[random(.1,.2),random(.4,1)],CellOptimize:!0,GlobalOffsetFlow:0,GlobalOffsetBkg:0,GlobalOffsetCell:0,BaseSize:~~random(500,1500),LineThickness:random(.001,.002)*random([10,15,20]),Spacing:.005,BkgColor:color(window.$.isHyper?window.$.isMirage?color(0):color(20,4,90):window.$.isMirage?random([P.Yellow,P.Red,P.Teal]):random([P.Cardboard,P.Paper])),BkgGradient:!1,GradientBand:0,GradientBandOffset:0,ColorSweep:color(window.$.isHyper&&window.$.isMirage?32:P.Blue),ColorSweepAlt:color(color(window.$.isHyper&&window.$.isMirage?64:0)),ColorSweepAccent:color(window.$.isHyper&&window.$.isMirage?50:P.Blue),ColorSweepAccentAlt:color(0),ColorBkgThinLine:color(0),ColorBkgThinLineColorThresh:1,ColorBkgLineFill:color(0),ColorCellLines:color((340+window.$.Shift)%360,100,40),ColorCellBkg:color(window.$.isHyper||window.$.isMirage?0:P.Cardboard),ColorCellOutline:window.$.isHyper?window.$.isMirage?color(100):color(P.Cardboard):color(P.Blue),FlowBatchSize:window.$.isHyper?32:64,CellZoom:random(1,3),CellRamp:random(1,2),CellLineThickness:1.5,CellLineSpacing:.00
/*! For license information please see bundle.js.LICENSE.txt */ (()=>{"use strict";var e={187:e=>{function i(e,i,n){n=n||2;var t,r,w,s,h,c,$,C=i&&i.length,y=C?i[0]*n:e.length,p=o(e,0,y,n,!0),u=[];if(!p||p.next===p.prev)return u;if(C&&(p=function(e,i,n,l){var t,r,w,s=[];for(t=0,r=i.length;t<r;t++)(w=o(e,i[t]*l,t<r-1?i[t+1]*l:e.length,l,!1))===w.next&&(w.steiner=!0),s.push(g(w));for(s.sort(a),t=0;t<s.length;t++)n=d(s[t],n);return n}(e,i,p,n)),e.length>80*n){t=w=e[0],r=s=e[1];for(var f=n;f<y;f+=n)(h=e[f])<t&&(t=h),(c=e[f+1])<r&&(r=c),h>w&&(w=h),c>s&&(s=c);$=0!==($=Math.max(w-t,s-r))?32767/$:0}return l(p,u,n,t,r,$,0),u}function o(e,i,o,n,l){var t,r;if(l===T(e,i,o,n)>0)for(t=i;t<o;t+=n)r=m(t,e[t],e[t+1],r);else for(t=o-n;t>=i;t-=n)r=m(t,e[t],e[t+1],r);return r&&p(r,r.next)&&(B(r),r=r.next),r}function n(e,i){if(!e)return e;i||(i=e);var o,n=e;do{if(o=!1,n.steiner||!p(n,n.next)&&0!==y(n.prev,n,n.next))n=n.next;else{if(B(n),(n=i=n.prev)===n.next)break;o=!0}}while(o||n!==i);return i}function l(e,i,o,a,d,h,g){if(e){!g&&h&&function(e,i,o,n){var l=e;do{0===l.z&&(l.z=c(l.x,l.y,i,o,n)),l.prevZ=l.prev,l.nextZ=l.next,l=l.next}while(l!==e);l.prevZ.nextZ=null,l.prevZ=null,function(e){var i,o,n,l,t,r,w,s,a=1;do{for(o=e,e=null,t=null,r=0;o;){for(r++,n=o,w=0,i=0;i<a&&(w++,n=n.nextZ);i++);for(s=a;w>0||s>0&&n;)0!==w&&(0===s||!n||o.z<=n.z)?(l=o,o=o.nextZ,w--):(l=n,n=n.nextZ,s--),t?t.nextZ=l:e=l,l.prevZ=t,t=l;o=n}t.nextZ=null,a*=2}while(r>1)}(l)}(e,a,d,h);for(var $,C,y=e;e.prev!==e.next;)if($=e.prev,C=e.next,h?r(e,a,d,h):t(e))i.push($.i/o|0),i.push(e.i/o|0),i.push(C.i/o|0),B(e),e=C.next,y=C.next;else if((e=C)===y){g?1===g?l(e=w(n(e),i,o),i,o,a,d,h,2):2===g&&s(e,i,o,a,d,h):l(n(e),i,o,a,d,h,1);break}}}function t(e){var i=e.prev,o=e,n=e.next;if(y(i,o,n)>=0)return!1;for(var l=i.x,t=o.x,r=n.x,w=i.y,s=o.y,a=n.y,d=l<t?l<r?l:r:t<r?t:r,h=w<s?w<a?w:a:s<a?s:a,c=l>t?l>r?l:r:t>r?t:r,g=w>s?w>a?w:a:s>a?s:a,C=n.next;C!==i;){if(C.x>=d&&C.x<=c&&C.y>=h&&C.y<=g&&$(l,w,t,s,r,a,C.x,C.y)&&y(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function r(e,i,o,n){var l=e.prev,t=e,r=e.next;if(y(l,t,r)>=0)return!1;for(var w=l.x,s=t.x,a=r.x,d=l.y,h=t.y,g=r.y,C=w<s?w<a?w:a:s<a?s:a,p=d<h?d<g?d:g:h<g?h:g,u=w>s?w>a?w:a:s>a?s:a,f=d>h?d>g?d:g:h>g?h:g,S=c(C,p,i,o,n),k=c(u,f,i,o,n),F=e.prevZ,m=e.nextZ;F&&F.z>=S&&m&&m.z<=k;){if(F.x>=C&&F.x<=u&&F.y>=p&&F.y<=f&&F!==l&&F!==r&&$(w,d,s,h,a,g,F.x,F.y)&&y(F.prev,F,F.next)>=0)return!1;if(F=F.prevZ,m.x>=C&&m.x<=u&&m.y>=p&&m.y<=f&&m!==l&&m!==r&&$(w,d,s,h,a,g,m.x,m.y)&&y(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;F&&F.z>=S;){if(F.x>=C&&F.x<=u&&F.y>=p&&F.y<=f&&F!==l&&F!==r&&$(w,d,s,h,a,g,F.x,F.y)&&y(F.prev,F,F.next)>=0)return!1;F=F.prevZ}for(;m&&m.z<=k;){if(m.x>=C&&m.x<=u&&m.y>=p&&m.y<=f&&m!==l&&m!==r&&$(w,d,s,h,a,g,m.x,m.y)&&y(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function w(e,i,o){var l=e;do{var t=l.prev,r=l.next.next;!p(t,r)&&u(t,l,l.next,r)&&k(t,r)&&k(r,t)&&(i.push(t.i/o|0),i.push(l.i/o|0),i.push(r.i/o|0),B(l),B(l.next),l=e=r),l=l.next}while(l!==e);return n(l)}function s(e,i,o,t,r,w){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&C(s,a)){var d=F(s,a);return s=n(s,s.next),d=n(d,d.next),l(s,i,o,t,r,w,0),void l(d,i,o,t,r,w,0)}a=a.next}s=s.next}while(s!==e)}function a(e,i){return e.x-i.x}function d(e,i){var o=function(e,i){var o,n=i,l=e.x,t=e.y,r=-1/0;do{if(t<=n.y&&t>=n.next.y&&n.next.y!==n.y){var w=n.x+(t-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(w<=l&&w>r&&(r=w,o=n.x<n.next.x?n:n.next,w===l))return o}n=n.next}while(n!==i);if(!o)return null;var s,a=o,d=o.x,c=o.y,g=1/0;n=o;do{l>=n.x&&n.x>=d&&l!==n.x&&$(t<c?l:r,t,d,c,t<c?r:l,t,n.x,n.y)&&(s=Math.abs(t-n.y)/(l-n.x),k(n,e)&&(s<g||s===g&&(n.x>o.x||n.x===o.x&&h(o,n)))&&(o=n,g=s)),n=n.next}while(n!==a);return o}(e,i);if(!o)return i;var l=F(o,e);return n(l,l.next),n(o,o.next)}function h(e,i){return y(e.prev,e,i.prev)<0&&y(i.next,e,e.next)<0}function c(e,i,o,n,l){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))|(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-n)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function g(e){var i=e,o=e;do{(i.x<o.x||i.x===o.x&&i.y<o.y)&&(o=i),i=i.next}while(i!==e);return o}function $(e,i,o,n,l,t,r,w){return(l-r)*(i-w)>=(e-r)*(t-w)&&(e-r)*(n-w)>=(o-r)*(i-w)&&(o-r)*(t-w)>=(l-r)*(n-w)}function C(e,i){return e.next.i!==i.i&&e.prev.i!==i.i&&!function(e,i){var o=e;do{if(o.i!==e.i&&o.next.i!==e.i&&o.i!==i.i&&o.next.i!==i.i&&u(o,o.next,e,i))return!0;o=o.next}while(o!==e);return!1}(e,i)&&(k(e,i)&&k(i,e)&&function(e,i){var o=e,n=!1,l=(e.x+i.x)/2,t=(e.y+i.y)/2;do{o.y>t!=o.next.y>t&&o.next.y!==o.y&&l<(o.next.x-o.x)*(t-o.y)/(o.next.y-o.y)+o.x&&(n=!n),o=o.next}while(o!==e);return n}(e,i)&&(y(e.prev,e,i.prev)||y(e,i.prev,i))||p(e,i)&&y(e.prev,e,e.next)>0&&y(i.prev,i,i.next)>0)}function y(e,i,o){return(i.y-e.y)*(o.x-i.x)-(i.x-e.x)*(o.y-i.y)}function p(e,i){return e.x===i.x&&e.y===i.y}function u(e,i,o,n){var l=S(y(e,i,o)),t=S(y(e,i,n)),r=S(y(o,n,e)),w=S(y(o,n,i));return l!==t&&r!==w||!(0!==l||!f(e,o,i))||!(0!==t||!f(e,n,i))||!(0!==r||!f(o,e,n))||!(0!==w||!f(o,i,n))}function f(e,i,o){return i.x<=Math.max(e.x,o.x)&&i.x>=Math.min(e.x,o.x)&&i.y<=Math.max(e.y,o.y)&&i.y>=Math.min(e.y,o.y)}function S(e){return e>0?1:e<0?-1:0}function k(e,i){return y(e.prev,e,e.next)<0?y(e,i,e.next)>=0&&y(e,e.prev,i)>=0:y(e,i,e.prev)<0||y(e,e.next,i)<0}function F(e,i){var o=new x(e.i,e.x,e.y),n=new x(i.i,i.x,i.y),l=e.next,t=i.prev;return e.next=i,i.prev=e,o.next=l,l.prev=o,n.next=o,o.prev=n,t.next=n,n.prev=t,n}function m(e,i,o,n){var l=new x(e,i,o);return n?(l.next=n.next,l.prev=n,n.next.prev=l,n.next=l):(l.prev=l,l.next=l),l}function B(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function x(e,i,o){this.i=e,this.x=i,this.y=o,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(e,i,o,n){for(var l=0,t=i,r=o-n;t<o;t+=n)l+=(e[r]-e[t])*(e[t+1]+e[r+1]),r=t;return l}e.exports=i,e.exports.default=i,i.deviation=function(e,i,o,n){var l=i&&i.length,t=l?i[0]*o:e.length,r=Math.abs(T(e,0,t,o));if(l)for(var w=0,s=i.length;w<s;w++){var a=i[w]*o,d=w<s-1?i[w+1]*o:e.length;r-=Math.abs(T(e,a,d,o))}var h=0;for(w=0;w<n.length;w+=3){var c=n[w]*o,g=n[w+1]*o,$=n[w+2]*o;h+=Math.abs((e[c]-e[$])*(e[g+1]-e[c+1])-(e[c]-e[g])*(e[$+1]-e[c+1]))}return 0===r&&0===h?0:Math.abs((h-r)/r)},i.flatten=function(e){for(var i=e[0][0].length,o={vertices:[],holes:[],dimensions:i},n=0,l=0;l<e.length;l++){for(var t=0;t<e[l].length;t++)for(var r=0;r<i;r++)o.vertices.push(e[l][t][r]);l>0&&(n+=e[l-1].length,o.holes.push(n))}return o}}},i={};function o(n){var l=i[n];if(void 0!==l)return l.exports;var t=i[n]={exports:{}};return e[n](t,t.exports,o),t.exports}o.n=e=>{var i=e&&e.__esModule?()=>e.default:()=>e;return o.d(i,{a:i}),i},o.d=(e,i)=>{for(var n in i)o.o(i,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),(()=>{Math.sqrt(3),Math.sqrt(3);const e=1/6,i=(Math.sqrt(5),Math.sqrt(5),e=>0|Math.floor(e)),n=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);class l{constructor(e,i,o,n,l){this.bounds={x:e,y:i,width:o,height:n},this.halfWidth=o/2,this.halfHeight=n/2,this.points=[],this.capacity=l,this.divided=!1}insert(e){return!!this.contains(e)&&(this.points.length<this.capacity?(this.points.push(e),!0):(this.divided||this.subdivide(),this.northeast.insert(e)||this.northwest.insert(e)||this.southeast.insert(e)||this.southwest.insert(e)))}subdivide(){const e=this.bounds.x,i=this.bounds.y;this.northeast=new l(e+this.halfWidth,i,this.halfWidth,this.halfHeight,this.capacity),this.northwest=new l(e,i,this.halfWidth,this.halfHeight,this.capacity),this.southeast=new l(e+this.halfWidth,i+this.halfHeight,this.halfWidth,this.halfHeight,this.capacity),this.southwest=new l(e,i+this.halfHeight,this.halfWidth,this.halfHeight,this.capacity),this.divided=!0}contains(e){const i=this.bounds.x,o=this.bounds.y,n=this.bounds.width,l=this.bounds.height;return e.x>=i&&e.x<i+n&&e.y>=o&&e.y<o+l}query(e,i=[]){if(!this.intersects(e))return i;for(let o of this.points)o.x>=e.x&&o.x<e.x+e.width&&o.y>=e.y&&o.y<e.y+e.height&&i.push(o);return this.divided&&(this.northeast.query(e,i),this.northwest.query(e,i),this.southeast.query(e,i),this.southwest.query(e,i)),i}intersects(e){const i=this.bounds.x,o=this.bounds.y,n=this.bounds.width,l=this.bounds.height;return!(e.x+e.width<i||e.x>i+n||e.y+e.height<o||e.y>o+l)}remove(e){if(!this.contains(e))return!1;const i=this.points.findIndex((i=>i.x===e.x&&i.y===e.y));return-1!==i?(this.points.splice(i,1),!0):!!this.divided&&(this.northeast.remove(e)||this.northwest.remove(e)||this.southeast.remove(e)||this.southwest.remove(e))}visit(e){const i=o=>{o.divided&&(i(o.northeast),i(o.northwest),i(o.southeast),i(o.southwest)),e(o)};i(this)}clear(){if(this.points=[],this.divided)for(const e of[this.northwest,this.northeast,this.southwest,this.southeast])e.clear();this.divided=!1}}class t{constructor(){this.useA=!1;let e=function(e){let i=parseInt(e.substr(0,8),16),o=parseInt(e.substr(8,8),16),n=parseInt(e.substr(16,8),16),l=parseInt(e.substr(24,8),16);return function(){i|=0,o|=0,n|=0,l|=0;let e=(i+o|0)+l|0;return l=l+1|0,i=o^o>>>9,o=n+(n<<3)|0,n=n<<21|n>>>11,n=n+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}random_num(e,i){return e+(i-e)*this.random_dec()}random_int(e,i){return Math.floor(this.random_num(e,i+1))}random_bool(e){return this.random_dec()<e}random_choice(e){return e[this.random_int(0,e.length-1)]}}const r=134217729;function w(e,i,o,n,l){let t,r,w,s,a=i[0],d=n[0],h=0,c=0;d>a==d>-a?(t=a,a=i[++h]):(t=d,d=n[++c]);let g=0;if(h<e&&c<o)for(d>a==d>-a?(r=a+t,w=t-(r-a),a=i[++h]):(r=d+t,w=t-(r-d),d=n[++c]),t=r,0!==w&&(l[g++]=w);h<e&&c<o;)d>a==d>-a?(r=t+a,s=r-t,w=t-(r-s)+(a-s),a=i[++h]):(r=t+d,s=r-t,w=t-(r-s)+(d-s),d=n[++c]),t=r,0!==w&&(l[g++]=w);for(;h<e;)r=t+a,s=r-t,w=t-(r-s)+(a-s),a=i[++h],t=r,0!==w&&(l[g++]=w);for(;c<o;)r=t+d,s=r-t,w=t-(r-s)+(d-s),d=n[++c],t=r,0!==w&&(l[g++]=w);return 0===t&&0!==g||(l[g++]=t),g}function s(e){return new Float64Array(e)}const a=s(4),d=s(8),h=s(12),c=s(16),g=s(4);function $(e,i,o,n,l,t){const s=(i-t)*(o-l),$=(e-l)*(n-t),C=s-$;if(0===s||0===$||s>0!=$>0)return C;const y=Math.abs(s+$);return Math.abs(C)>=33306690738754716e-32*y?C:-function(e,i,o,n,l,t,s){let $,C,y,p,u,f,S,k,F,m,B,x,T,M,G,H,v,L;const _=e-l,A=o-l,R=i-t,b=n-t;M=_*b,f=r*_,S=f-(f-_),k=_-S,f=r*b,F=f-(f-b),m=b-F,G=k*m-(M-S*F-k*F-S*m),H=R*A,f=r*R,S=f-(f-R),k=R-S,f=r*A,F=f-(f-A),m=A-F,v=k*m-(H-S*F-k*F-S*m),B=G-v,u=G-B,a[0]=G-(B+u)+(u-v),x=M+B,u=x-M,T=M-(x-u)+(B-u),B=T-H,u=T-B,a[1]=T-(B+u)+(u-H),L=x+B,u=L-x,a[2]=x-(L-u)+(B-u),a[3]=L;let O=function(e,i){let o=i[0];for(let e=1;e<4;e++)o+=i[e];return o}(0,a),z=22204460492503146e-32*s;if(O>=z||-O>=z)return O;if(u=e-_,$=e-(_+u)+(u-l),u=o-A,y=o-(A+u)+(u-l),u=i-R,C=i-(R+u)+(u-t),u=n-b,p=n-(b+u)+(u-t),0===$&&0===C&&0===y&&0===p)return O;if(z=11093356479670487e-47*s+33306690738754706e-32*Math.abs(O),O+=_*p+b*$-(R*y+A*C),O>=z||-O>=z)return O;M=$*b,f=r*$,S=f-(f-$),k=$-S,f=r*b,F=f-(f-b),m=b-F,G=k*m-(M-S*F-k*F-S*m),H=C*A,f=r*C,S=f-(f-C),k=C-S,f=r*A,F=f-(f-A),m=A-F,v=k*m-(H-S*F-k*F-S*m),B=G-v,u=G-B,g[0]=G-(B+u)+(u-v),x=M+B,u=x-M,T=M-(x-u)+(B-u),B=T-H,u=T-B,g[1]=T-(B+u)+(u-H),L=x+B,u=L-x,g[2]=x-(L-u)+(B-u),g[3]=L;const P=w(4,a,4,g,d);M=_*p,f=r*_,S=f-(f-_),k=_-S,f=r*p,F=f-(f-p),m=p-F,G=k*m-(M-S*F-k*F-S*m),H=R*y,f=r*R,S=f-(f-R),k=R-S,f=r*y,F=f-(f-y),m=y-F,v=k*m-(H-S*F-k*F-S*m),B=G-v,u=G-B,g[0]=G-(B+u)+(u-v),x=M+B,u=x-M,T=M-(x-u)+(B-u),B=T-H,u=T-B,g[1]=T-(B+u)+(u-H),L=x+B,u=L-x,g[2]=x-(L-u)+(B-u),g[3]=L;const W=w(P,d,4,g,h);M=$*p,f=r*$,S=f-(f-$),k=$-S,f=r*p,F=f-(f-p),m=p-F,G=k*m-(M-S*F-k*F-S*m),H=C*y,f=r*C,S=f-(f-C),k=C-S,f=r*y,F=f-(f-y),m=y-F,v=k*m-(H-S*F-k*F-S*m),B=G-v,u=G-B,g[0]=G-(B+u)+(u-v),x=M+B,u=x-M,T=M-(x-u)+(B-u),B=T-H,u=T-B,g[1]=T-(B+u)+(u-H),L=x+B,u=L-x,g[2]=x-(L-u)+(B-u),g[3]=L;const U=w(W,h,4,g,c);return c[U-1]}(e,i,o,n,l,t,y)}s(4),s(4),s(4),s(4),s(4),s(4),s(4),s(4),s(4),s(8),s(8),s(8),s(4),s(8),s(8),s(8),s(12),s(192),s(192),s(4),s(4),s(4),s(4),s(4),s(4),s(4),s(4),s(8),s(8),s(8),s(8),s(8),s(8),s(8),s(8),s(8),s(4),s(4),s(4),s(8),s(16),s(16),s(16),s(32),s(32),s(48),s(64),s(1152),s(1152),s(4),s(4),s(4),s(4),s(4),s(4),s(4),s(4),s(4),s(4),s(24),s(24),s(24),s(24),s(24),s(24),s(24),s(24),s(24),s(24),s(1152),s(1152),s(1152),s(1152),s(1152),s(2304),s(2304),s(3456),s(5760),s(8),s(8),s(8),s(16),s(24),s(48),s(48),s(96),s(192),s(384),s(384),s(384),s(768),s(96),s(96),s(96),s(1152);const C=Math.pow(2,-52),y=new Uint32Array(512);class p{static from(e,i=m,o=B){const n=e.length,l=new Float64Array(2*n);for(let t=0;t<n;t++){const n=e[t];l[2*t]=i(n),l[2*t+1]=o(n)}return new p(l)}constructor(e){const i=e.length>>1;if(i>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const o=Math.max(2*i-5,0);this._triangles=new Uint32Array(3*o),this._halfedges=new Int32Array(3*o),this._hashSize=Math.ceil(Math.sqrt(i)),this._hullPrev=new Uint32Array(i),this._hullNext=new Uint32Array(i),this._hullTri=new Uint32Array(i),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(i),this._dists=new Float64Array(i),this.update()}update(){const{coords:e,_hullPrev:i,_hullNext:o,_hullTri:n,_hullHash:l}=this,t=e.length>>1;let r=1/0,w=1/0,s=-1/0,a=-1/0;for(let i=0;i<t;i++){const o=e[2*i],n=e[2*i+1];o<r&&(r=o),n<w&&(w=n),o>s&&(s=o),n>a&&(a=n),this._ids[i]=i}const d=(r+s)/2,h=(w+a)/2;let c,g,y,p=1/0;for(let i=0;i<t;i++){const o=u(d,h,e[2*i],e[2*i+1]);o<p&&(c=i,p=o)}const f=e[2*c],F=e[2*c+1];p=1/0;for(let i=0;i<t;i++){if(i===c)continue;const o=u(f,F,e[2*i],e[2*i+1]);o<p&&o>0&&(g=i,p=o)}let m=e[2*g],B=e[2*g+1],x=1/0;for(let i=0;i<t;i++){if(i===c||i===g)continue;const o=S(f,F,m,B,e[2*i],e[2*i+1]);o<x&&(y=i,x=o)}let T=e[2*y],M=e[2*y+1];if(x===1/0){for(let i=0;i<t;i++)this._dists[i]=e[2*i]-e[0]||e[2*i+1]-e[1];k(this._ids,this._dists,0,t-1);const i=new Uint32Array(t);let o=0;for(let e=0,n=-1/0;e<t;e++){const l=this._ids[e];this._dists[l]>n&&(i[o++]=l,n=this._dists[l])}return this.hull=i.subarray(0,o),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if($(f,F,m,B,T,M)<0){const e=g,i=m,o=B;g=y,m=T,B=M,y=e,T=i,M=o}const G=function(e,i,o,n,l,t){const r=o-e,w=n-i,s=l-e,a=t-i,d=r*r+w*w,h=s*s+a*a,c=.5/(r*a-w*s);return{x:e+(a*d-w*h)*c,y:i+(r*h-s*d)*c}}(f,F,m,B,T,M);this._cx=G.x,this._cy=G.y;for(let i=0;i<t;i++)this._dists[i]=u(e[2*i],e[2*i+1],G.x,G.y);k(this._ids,this._dists,0,t-1),this._hullStart=c;let H=3;o[c]=i[y]=g,o[g]=i[c]=y,o[y]=i[g]=c,n[c]=0,n[g]=1,n[y]=2,l.fill(-1),l[this._hashKey(f,F)]=c,l[this._hashKey(m,B)]=g,l[this._hashKey(T,M)]=y,this.trianglesLen=0,this._addTriangle(c,g,y,-1,-1,-1);for(let t,r,w=0;w<this._ids.length;w++){const s=this._ids[w],a=e[2*s],d=e[2*s+1];if(w>0&&Math.abs(a-t)<=C&&Math.abs(d-r)<=C)continue;if(t=a,r=d,s===c||s===g||s===y)continue;let h=0;for(let e=0,i=this._hashKey(a,d);e<this._hashSize&&(h=l[(i+e)%this._hashSize],-1===h||h===o[h]);e++);h=i[h];let p,u=h;for(;p=o[u],$(a,d,e[2*u],e[2*u+1],e[2*p],e[2*p+1])>=0;)if(u=p,u===h){u=-1;break}if(-1===u)continue;let f=this._addTriangle(u,s,o[u],-1,-1,n[u]);n[s]=this._legalize(f+2),n[u]=f,H++;let S=o[u];for(;p=o[S],$(a,d,e[2*S],e[2*S+1],e[2*p],e[2*p+1])<0;)f=this._addTriangle(S,s,p,n[s],-1,n[S]),n[s]=this._legalize(f+2),o[S]=S,H--,S=p;if(u===h)for(;p=i[u],$(a,d,e[2*p],e[2*p+1],e[2*u],e[2*u+1])<0;)f=this._addTriangle(p,s,u,-1,n[u],n[p]),this._legalize(f+2),n[p]=f,o[u]=u,H--,u=p;this._hullStart=i[s]=u,o[u]=i[S]=s,o[s]=S,l[this._hashKey(a,d)]=s,l[this._hashKey(e[2*u],e[2*u+1])]=u}this.hull=new Uint32Array(H);for(let e=0,i=this._hullStart;e<H;e++)this.hull[e]=i,i=o[i];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,i){return Math.floor(function(e,i){const o=e/(Math.abs(e)+Math.abs(i));return(i>0?3-o:1+o)/4}(e-this._cx,i-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:i,_halfedges:o,coords:n}=this;let l=0,t=0;for(;;){const r=o[e],w=e-e%3;if(t=w+(e+2)%3,-1===r){if(0===l)break;e=y[--l];continue}const s=r-r%3,a=w+(e+1)%3,d=s+(r+2)%3,h=i[t],c=i[e],g=i[a],$=i[d];if(f(n[2*h],n[2*h+1],n[2*c],n[2*c+1],n[2*g],n[2*g+1],n[2*$],n[2*$+1])){i[e]=$,i[r]=h;const n=o[d];if(-1===n){let i=this._hullStart;do{if(this._hullTri[i]===d){this._hullTri[i]=e;break}i=this._hullPrev[i]}while(i!==this._hullStart)}this._link(e,n),this._link(r,o[t]),this._link(t,d);const w=s+(r+1)%3;l<y.length&&(y[l++]=w)}else{if(0===l)break;e=y[--l]}}return t}_link(e,i){this._halfedges[e]=i,-1!==i&&(this._halfedges[i]=e)}_addTriangle(e,i,o,n,l,t){const r=this.trianglesLen;return this._triangles[r]=e,this._triangles[r+1]=i,this._triangles[r+2]=o,this._link(r,n),this._link(r+1,l),this._link(r+2,t),this.trianglesLen+=3,r}}function u(e,i,o,n){const l=e-o,t=i-n;return l*l+t*t}function f(e,i,o,n,l,t,r,w){const s=e-r,a=i-w,d=o-r,h=n-w,c=l-r,g=t-w,$=d*d+h*h,C=c*c+g*g;return s*(h*C-$*g)-a*(d*C-$*c)+(s*s+a*a)*(d*g-h*c)<0}function S(e,i,o,n,l,t){const r=o-e,w=n-i,s=l-e,a=t-i,d=r*r+w*w,h=s*s+a*a,c=.5/(r*a-w*s),g=(a*d-w*h)*c,$=(r*h-s*d)*c;return g*g+$*$}function k(e,i,o,n){if(n-o<=20)for(let l=o+1;l<=n;l++){const n=e[l],t=i[n];let r=l-1;for(;r>=o&&i[e[r]]>t;)e[r+1]=e[r--];e[r+1]=n}else{let l=o+1,t=n;F(e,o+n>>1,l),i[e[o]]>i[e[n]]&&F(e,o,n),i[e[l]]>i[e[n]]&&F(e,l,n),i[e[o]]>i[e[l]]&&F(e,o,l);const r=e[l],w=i[r];for(;;){do{l++}while(i[e[l]]<w);do{t--}while(i[e[t]]>w);if(t<l)break;F(e,l,t)}e[o+1]=e[t],e[t]=r,n-l+1>=t-o?(k(e,i,l,n),k(e,i,o,t-1)):(k(e,i,o,t-1),k(e,i,l,n))}}function F(e,i,o){const n=e[i];e[i]=e[o],e[o]=n}function m(e){return e[0]}function B(e){return e[1]}const x=1e-6;class T{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+i}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,i){this._+=`L${this._x1=+e},${this._y1=+i}`}arc(e,i,o){const n=(e=+e)+(o=+o),l=i=+i;if(o<0)throw new Error("negative radius");null===this._x1?this._+=`M${n},${l}`:(Math.abs(this._x1-n)>x||Math.abs(this._y1-l)>x)&&(this._+="L"+n+","+l),o&&(this._+=`A${o},${o},0,1,1,${e-o},${i}A${o},${o},0,1,1,${this._x1=n},${this._y1=l}`)}rect(e,i,o,n){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+i}h${+o}v${+n}h${-o}Z`}value(){return this._||null}}class M{constructor(){this._=[]}moveTo(e,i){this._.push([e,i])}closePath(){this._.push(this._[0].slice())}lineTo(e,i){this._.push([e,i])}value(){return this._.length?this._:null}}class G{constructor(e,[i,o,n,l]=[0,0,960,500]){if(!((n=+n)>=(i=+i)&&(l=+l)>=(o=+o)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=n,this.xmin=i,this.ymax=l,this.ymin=o,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:i,triangles:o},vectors:n}=this;let l,t;const r=this.circumcenters=this._circumcenters.subarray(0,o.length/3*2);for(let n,w,s=0,a=0,d=o.length;s<d;s+=3,a+=2){const d=2*o[s],h=2*o[s+1],c=2*o[s+2],g=e[d],$=e[d+1],C=e[h],y=e[h+1],p=e[c],u=e[c+1],f=C-g,S=y-$,k=p-g,F=u-$,m=2*(f*F-S*k);if(Math.abs(m)<1e-9){if(void 0===l){l=t=0;for(const o of i)l+=e[2*o],t+=e[2*o+1];l/=i.length,t/=i.length}const o=1e9*Math.sign((l-g)*F-(t-$)*k);n=(g+p)/2-o*F,w=($+u)/2+o*k}else{const e=1/m,i=f*f+S*S,o=k*k+F*F;n=g+(F*i-S*o)*e,w=$+(f*o-k*i)*e}r[a]=n,r[a+1]=w}let w,s,a,d=i[i.length-1],h=4*d,c=e[2*d],g=e[2*d+1];n.fill(0);for(let o=0;o<i.length;++o)d=i[o],w=h,s=c,a=g,h=4*d,c=e[2*d],g=e[2*d+1],n[w+2]=n[h]=a-g,n[w+3]=n[h+1]=c-s}render(e){const i=null==e?e=new T:void 0,{delaunay:{halfedges:o,inedges:n,hull:l},circumcenters:t,vectors:r}=this;if(l.length<=1)return null;for(let i=0,n=o.length;i<n;++i){const n=o[i];if(n<i)continue;const l=2*Math.floor(i/3),r=2*Math.floor(n/3),w=t[l],s=t[l+1],a=t[r],d=t[r+1];this._renderSegment(w,s,a,d,e)}let w,s=l[l.length-1];for(let i=0;i<l.length;++i){w=s,s=l[i];const o=2*Math.floor(n[s]/3),a=t[o],d=t[o+1],h=4*w,c=this._project(a,d,r[h+2],r[h+3]);c&&this._renderSegment(a,d,c[0],c[1],e)}return i&&i.value()}renderBounds(e){const i=null==e?e=new T:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),i&&i.value()}renderCell(e,i){const o=null==i?
Inspired by my nostalgic love of rich worlds constructed in early video games using simple shapes with limited palettes, and the mesmerizing music visualization plugins that emerged in an era when sharing creativity online was a joyous pastime, this artwork reflects the playful media I have enjoyed over the years and aims to contribute more joy to the world. **Interactions** **`click`** - allow microphone & activate audio **`drag & drop`** - add audio files to playlist **`spacebar`** - toggle playlist / microphone monitoring **`left/right arrows`** - next / previous track **`double click`** - toggle fullscreen **URL Configuration** **`quality=1`** - adjust pixelation (0.25 to 4,) **`maxDb=6`** - set max sample decibel (>0)\* **`minDb=120`** - set min sample decibel (>30)\* _\*Decibles will be interpreted as negative values_ `URL?quality=2&maxDb=12&minDb=96` **`static=true`** - render single frame (quality 4) **`time=1`** - advances time in seconds (1 to N) `URL?static=true&time=60`
//Memory Loss by Andrew Mitchell class Random{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),n=parseInt(e.substr(16,8),16),c=parseInt(e.substr(24,8),16);return function(){n|=0;let e=((t|=0)+(r|=0)|0)+(c|=0)|0;return c=c+1|0,t=r^r>>>9,r=n+(n<<3)|0,n=(n=n<<21|n>>>11)+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let t=0;t<1e6;t+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}random_num(e,t){return e+(t-e)*this.random_dec()}random_int(e,t){return Math.floor(this.random_num(e,t+1))}random_bool(e){return this.random_dec()<e}random_choice(e){return e[this.random_int(0,e.length-1)]}}class Mediator{constructor(){}call(e,t,r,n,c,o=0,s=1){n.push(),n.translate(t,r),this.applyRotation(radians(o),n),this.resize(s,n),n.translate(-t,-r),e(c),n.pop()}applyRotation(e,t){t.rotate(e)}resize(e,t){t.scale(e,e)}}let colorPalettes=[["112b73","133081","0f2562","1e87c3","1c7ab0","1f89c7","52a588","5bae91","4a967c","484068","4c446f","443c62","abcfad","7d91ac","36867f"],["c4bf95","c8c49d","ccc8a4","5a780d","526e0c","56740b","799341","7e9a42","a4885c","a68c64","adb279","acaf83","c8c148","bc8f2d"],["eb6521","ed763b","e06324","c74618","bf4418","cf400c","a56a32","a46932","d7c314","decb1b","111d6f","a6bcc1","860f21","2b3706"],["e3d6c7","eee6dd","e0d3c2","eadfd1","c0022d","b6022c","ca0231","721543","5a1136","7da29d","85a8a3","1d4260","1b3e5a","eb85c7","854c8c"],["aa805c","ae8765","ae8d6f","542840","5a2b45","482337","b10726","a60724","417708","52831e","72a277","002ad2","776b9a","c9d191"],["12151d","101219","0e1016","ceb31b","cbb11a","c7ad1a","7f0b25","750a21","be7113","b46c13","397748","cb4b46","408175","d7d98b"],["f8f9fa","e9ecef","dee2e6","c4cdd4","3c4953","303436","ccd7e0","dfe1e2",,"1f2a33","ced4da","d6dce1","d0dae2","e4e6e7","adb5bd","6c757d","495057","343a40","212529"],["d7d9c5","d5d7c1","d9dbc7","d9dbc7","b32b44","b62b44","b92d46","c58481","c78885","c68480"],["1e6fe8","2674e8","246fe0","1764d9","2a5314","264a12","785019","6e4a17","6350b6","6856b8","851a54","77184c","a48a15","9e8410","9f3a04","953704"],["9c4a6e","f8f1f4","9d4b6f","ebd5df","debaca","e4c8d4","ddbbca","b1597f","cb90a9","d09ab1"],["e8d2a9","ead3a9","ead5ae","e7cfa2","e8d1a6","e8d3ab","b6201e","b3211e","3f799f","40779c","a49228","a08e27","5e6d33","596831"],["dbc7a6","ddcaac","e1cdad","0d1228","0a0e1f","101632","d70200","e00400","c30704","48694c","446448","405e44","d6b32b","d7b52d","122948","102641"],["06142c","071631","06142d","051229","e2d2ac","e3d4b1","e3d5b5","a6b15d","a4af5a","568047","547e45","e8ae77","a77d4d","b1443d","276687"]],random=new Random,mediator=new Mediator,backgroundColor,r1,r2,r3,r4,r5,r6,r7,pgBeziers,finalCanvas,temporaryCanvas,incrementDegree,start,end,curveDirectionLeft,curveDirectionRight,curveFunctionRight,curveFunctionLeft,curveDegreeLeft,curveDegreeRight,curveRadiusRight,curveRadiusLeft,smallerDimension,textColor,circleX,w20,circleFunction,d,i,section,colorPalette,circleRadius,nWidthMax,nWidthMin,black="#0E0E10",black2="#403f42",white="#fdfff5";function shuffle2(e){for(let t=0;t<3;t++)for(let r=e.length-1;r>0;r--){let n=random.random_int(0,e.length-1),c=e[r],o=e[n];e[r]=o,e[n]=c}return e}function setup(){noiseSeed(random.random_int(0,1e4)),incrementDegree=.1,createCanvas(500,500),pgBeziers=createGraphics(500,500),temporaryCanvas=createGraphics(500,500),finalCanvas=createGraphics(500,500),pixelDensity(6),pgBeziers.pixelDensity(6),temporaryCanvas.pixelDensity(6),finalCanvas.pixelDensity(6),strokeJoin(CURVE),colorPalettes=shuffle2(colorPalettes),smallerDimension=windowWidth<windowHeight?windowWidth:windowHeight,backgroundColor="#"+(colorPalette=random.random_choice(colorPalettes))[0];let e=colorPalette[0];pgBeziers.background(backgroundColor),textColor="#"+colorPalette[colorPalette.length-1],colorPalette=shuffle2(colorPalette);for(let t=0;t<colorPalette.length;t++)colorPalette[t]="#"+colorPalette[t];nWidthMin=0,nWidthMax=500,circleFunction=Math.cos,curveFunctionRight=Math.sin,curveFunctionLeft=Math.sin,curveDirectionLeft=random.random_choice([-1,1]),curveDirectionRight=random.random_choice([-1,1]),circleX=0,w20=25,w40=12.5,w80=6.25,ww20=525,h20=height/20,h30=height/30,d=100,i=-8*w20,section=1,curveDegreeRight=PI,curveDegreeLeft=PI,_strokeWeight=2,pgBeziers.noFill(),r1=random.random_bool(.8)?random.random_int(12,25):random.random_int(12,30),r2=(r2=random.random_bool(.98)?random.random_int(-5,-5)+r1:random.random_int(12,25))<10?r1:r2,r3=1.5,r4=1.4,r5=1.3,r6=1.2,r7=1.1,getX=function(e,t){return e/r1},getY=function(e,t){return t/r2};let r={};r.ColorPalette=e,console.log(r)}function draw(){switch(section){case 1:a(),i>height&&section++,i+=1.5*_strokeWeight;break;case 2:a(),i>2*height&&section++,i+=2*_strokeWeight;break;case 3:a(),i>4*height&&(section=4,push(),fill(textColor),stroke("#000000"),500===width?textSize(12):textSize(24),text("Loading...",width/2-28,height/2),pop()),i+=2*_strokeWeight;break;case 4:temporaryCanvas.image(pgBeziers,0,0,width,height),temporaryCanvas.filter(BLUR,10),temporaryCanvas.filter(POSTERIZE,5),section++;break;case 5:finalCanvas.tint(255,128),finalCanvas.image(temporaryCanvas,0,0,width,height),finalCanvas.tint(255,128),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(ERODE),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(ERODE),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(DILATE),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(DILATE),clear(),tint(255,255),image(finalCanvas,0,0,width,height),document.getElementsByTagName("canvas")[0].style.width=smallerDimension+"px",document.getElementsByTagName("canvas")[0].style.height=smallerDimension+"px",document.getElementById("defaultCanvas0").style.filter="brightness(1.2) contrast(1.2)",noLoop()}document.getElementsByTagName("canvas")[0].style.width=smallerDimension+"px",document.getElementsByTagName("canvas")[0].style.height=smallerDimension+"px",document.getElementById("defaultCanvas0").style.filter="brightness(1.2) contrast(1.2)"}function a(){circleRadius=random.random_int(width,2*width),curveRadiusRight=random.random_int(0,100),curveRadiusLeft=random.random_int(0,100),start=nWidthMin+(circleX=circleRadius*circleFunction(d))+curveDirectionLeft*curveRadiusLeft*curveFunctionLeft(curveDegreeLeft),end=nWidthMax+circleX+curveDirectionRight*curveRadiusRight*curveFunctionRight(curveDegreeRight),d+=incrementDegree,curveDegreeRight+=incrementDegree,curveDegreeLeft+=incrementDegree;let e=-w20,t=start,r=end,n=width+w20,c=i,o=-w20,s=-w20,$=i;for(let l=0;l<=400;l++){let _=l/400,f=pgBeziers.bezierPoint(e,t,r,n,_),m=pgBeziers.bezierPoint(c,o,s,$,_);f>-w20&&m>-w20&&f<ww20&&m<ww20&&(splat(f,m,r3),splat(f,m-1,r4),splat(f,m-2,r5),splat(f,m-3,r6),splat(f,m-4,r7))}image(pgBeziers,0,0,width,height)}function splat(e,t,r){pgBeziers.push();let n=noise(getX(e,t),getY(e,t)),c=10*n*random.random_int(-1,1);random.random_int(-1,1),pgBeziers.translate(e,t),pgBeziers.rotate(radians(720*n)),pgBeziers.translate(-e,-t);let o=n;o=o<.2?.5*r:o<.4?2*r:o<.6?r:1.5*r,pgBeziers.strokeWeight(o);let s=color(colorPalette[Math.floor(n*colorPalette.length)]);s.setAlpha(255*n),pgBeziers.stroke(s),pgBeziers.bezier(e,t,e,t,e,t+c,e+10,t),pgBeziers.pop()}let value=1;function mouseClicked(){section>4&&(0===value?(clear(),image(finalCanvas,0,0,width,height),value=1):(clear(),image(temporaryCanvas,0,0,width,height),value=0))}function fitToWidth(){document.getElementsByTagName("canvas")[0].style.width=smallerDimension+"px",document.getElementsByTagName("canvas")[0].style.height=smallerDimension+"px"}
//Memory Loss by Andrew Mitchell class Random{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),n=parseInt(e.substr(16,8),16),c=parseInt(e.substr(24,8),16);return function(){n|=0;let e=((t|=0)+(r|=0)|0)+(c|=0)|0;return c=c+1|0,t=r^r>>>9,r=n+(n<<3)|0,n=(n=n<<21|n>>>11)+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let t=0;t<1e6;t+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}random_num(e,t){return e+(t-e)*this.random_dec()}random_int(e,t){return Math.floor(this.random_num(e,t+1))}random_bool(e){return this.random_dec()<e}random_choice(e){return e[this.random_int(0,e.length-1)]}}class Mediator{constructor(){}call(e,t,r,n,c,o=0,s=1){n.push(),n.translate(t,r),this.applyRotation(radians(o),n),this.resize(s,n),n.translate(-t,-r),e(c),n.pop()}applyRotation(e,t){t.rotate(e)}resize(e,t){t.scale(e,e)}}let colorPalettes=[["112b73","133081","0f2562","1e87c3","1c7ab0","1f89c7","52a588","5bae91","4a967c","484068","4c446f","443c62","abcfad","7d91ac","36867f"],["c4bf95","c8c49d","ccc8a4","5a780d","526e0c","56740b","799341","7e9a42","a4885c","a68c64","adb279","acaf83","c8c148","bc8f2d"],["eb6521","ed763b","e06324","c74618","bf4418","cf400c","a56a32","a46932","d7c314","decb1b","111d6f","a6bcc1","860f21","2b3706"],["e3d6c7","eee6dd","e0d3c2","eadfd1","c0022d","b6022c","ca0231","721543","5a1136","7da29d","85a8a3","1d4260","1b3e5a","eb85c7","854c8c"],["aa805c","ae8765","ae8d6f","542840","5a2b45","482337","b10726","a60724","417708","52831e","72a277","002ad2","776b9a","c9d191"],["12151d","101219","0e1016","ceb31b","cbb11a","c7ad1a","7f0b25","750a21","be7113","b46c13","397748","cb4b46","408175","d7d98b"],["f8f9fa","e9ecef","dee2e6","c4cdd4","ccd7e0","dfe1e2","ced4da","d6dce1","d0dae2","e4e6e7","adb5bd","6c757d","495057","343a40","212529"],["d7d9c5","d5d7c1","d9dbc7","d9dbc7","b32b44","b62b44","b92d46","c58481","c78885","c68480"],["1e6fe8","2674e8","246fe0","1764d9","2a5314","264a12","785019","6e4a17","6350b6","6856b8","851a54","77184c","a48a15","9e8410","9f3a04","953704"],["9c4a6e","f8f1f4","9d4b6f","ebd5df","debaca","e4c8d4","ddbbca","b1597f","cb90a9","d09ab1"],["e8d2a9","ead3a9","ead5ae","e7cfa2","e8d1a6","e8d3ab","b6201e","b3211e","3f799f","40779c","a49228","a08e27","5e6d33","596831"],["dbc7a6","ddcaac","e1cdad","0d1228","0a0e1f","101632","d70200","e00400","c30704","48694c","446448","405e44","d6b32b","d7b52d","122948","102641"],["06142c","071631","06142d","051229","e2d2ac","e3d4b1","e3d5b5","a6b15d","a4af5a","568047","547e45","e8ae77","a77d4d","b1443d","276687"]],random=new Random,mediator=new Mediator,backgroundColor,r1,r2,r3,r4,r5,r6,r7,pgBeziers,finalCanvas,temporaryCanvas,incrementDegree,start,end,curveDirectionLeft,curveDirectionRight,curveFunctionRight,curveFunctionLeft,curveDegreeLeft,curveDegreeRight,curveRadiusRight,curveRadiusLeft,smallerDimension,textColor,circleX,w20,circleFunction,d,i,section,colorPalette,circleRadius,nWidthMax,nWidthMin,black="#0E0E10",black2="#403f42",white="#fdfff5";function shuffle2(e){for(let t=0;t<3;t++)for(let r=e.length-1;r>0;r--){let n=random.random_int(0,e.length-1),c=e[r],o=e[n];e[r]=o,e[n]=c}return e}function setup(){noiseSeed(random.random_int(0,1e4)),incrementDegree=.1,createCanvas(500,500),pgBeziers=createGraphics(500,500),temporaryCanvas=createGraphics(500,500),finalCanvas=createGraphics(500,500),pixelDensity(6),pgBeziers.pixelDensity(6),temporaryCanvas.pixelDensity(6),finalCanvas.pixelDensity(6),strokeJoin(CURVE),colorPalettes=shuffle2(colorPalettes),smallerDimension=windowWidth<windowHeight?windowWidth:windowHeight,backgroundColor="#"+(colorPalette=random.random_choice(colorPalettes))[0];let e=colorPalette[0];pgBeziers.background(backgroundColor),textColor="#"+colorPalette[colorPalette.length-1],colorPalette=shuffle2(colorPalette);for(let t=0;t<colorPalette.length;t++)colorPalette[t]="#"+colorPalette[t];nWidthMin=0,nWidthMax=500,circleFunction=Math.cos,curveFunctionRight=Math.sin,curveFunctionLeft=Math.sin,curveDirectionLeft=random.random_choice([-1,1]),curveDirectionRight=random.random_choice([-1,1]),circleX=0,w20=25,w40=12.5,w80=6.25,ww20=525,h20=height/20,h30=height/30,d=100,i=-8*w20,section=1,curveDegreeRight=PI,curveDegreeLeft=PI,_strokeWeight=2,pgBeziers.noFill(),r1=random.random_bool(.8)?random.random_int(12,25):random.random_int(12,30),r2=(r2=random.random_bool(.98)?random.random_int(-5,-5)+r1:random.random_int(12,25))<10?r1:r2,r3=1.5,r4=1.4,r5=1.3,r6=1.2,r7=1.1,getX=function(e,t){return e/r1},getY=function(e,t){return t/r2};let r={};r.ColorPalette=e,console.log(r)}function draw(){switch(section){case 1:a(),i>height&&section++,i+=1.5*_strokeWeight;break;case 2:a(),i>2*height&&section++,i+=2*_strokeWeight;break;case 3:a(),i>4*height&&(section=4,push(),fill(textColor),stroke("#000000"),500===width?textSize(12):textSize(24),text("Loading...",width/2-28,height/2),pop()),i+=2*_strokeWeight;break;case 4:temporaryCanvas.image(pgBeziers,0,0,width,height),temporaryCanvas.filter(BLUR,10),temporaryCanvas.filter(POSTERIZE,5),section++;break;case 5:finalCanvas.tint(255,128),finalCanvas.image(temporaryCanvas,0,0,width,height),finalCanvas.tint(255,128),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(ERODE),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(ERODE),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(DILATE),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(DILATE),clear(),tint(255,255),image(finalCanvas,0,0,width,height),document.getElementsByTagName("canvas")[0].style.width=smallerDimension+"px",document.getElementsByTagName("canvas")[0].style.height=smallerDimension+"px",document.getElementById("defaultCanvas0").style.filter="brightness(1.2) contrast(1.2)",noLoop()}document.getElementsByTagName("canvas")[0].style.width=smallerDimension+"px",document.getElementsByTagName("canvas")[0].style.height=smallerDimension+"px",document.getElementById("defaultCanvas0").style.filter="brightness(1.2) contrast(1.2)"}function a(){circleRadius=random.random_int(width,2*width),curveRadiusRight=random.random_int(0,100),curveRadiusLeft=random.random_int(0,100),start=nWidthMin+(circleX=circleRadius*circleFunction(d))+curveDirectionLeft*curveRadiusLeft*curveFunctionLeft(curveDegreeLeft),end=nWidthMax+circleX+curveDirectionRight*curveRadiusRight*curveFunctionRight(curveDegreeRight),d+=incrementDegree,curveDegreeRight+=incrementDegree,curveDegreeLeft+=incrementDegree;let e=-w20,t=start,r=end,n=width+w20,c=i,o=-w20,s=-w20,$=i;for(let l=0;l<=400;l++){let _=l/400,f=pgBeziers.bezierPoint(e,t,r,n,_),m=pgBeziers.bezierPoint(c,o,s,$,_);f>-w20&&m>-w20&&f<ww20&&m<ww20&&(splat(f,m,r3),splat(f,m-1,r4),splat(f,m-2,r5),splat(f,m-3,r6),splat(f,m-4,r7))}image(pgBeziers,0,0,width,height)}function splat(e,t,r){pgBeziers.push();let n=noise(getX(e,t),getY(e,t)),c=10*n*random.random_int(-1,1);random.random_int(-1,1),pgBeziers.translate(e,t),pgBeziers.rotate(radians(720*n)),pgBeziers.translate(-e,-t);let o=n;o=o<.2?.5*r:o<.4?2*r:o<.6?r:1.5*r,pgBeziers.strokeWeight(o);let s=color(colorPalette[Math.floor(n*colorPalette.length)]);s.setAlpha(255*n),pgBeziers.stroke(s),pgBeziers.bezier(e,t,e,t,e,t+c,e+10,t),pgBeziers.pop()}let value=1;function mouseClicked(){section>4&&(0===value?(clear(),image(finalCanvas,0,0,width,height),value=1):(clear(),image(temporaryCanvas,0,0,width,height),value=0))}function fitToWidth(){document.getElementsByTagName("canvas")[0].style.width=smallerDimension+"px",document.getElementsByTagName("canvas")[0].style.height=smallerDimension+"px"}
If winds were fibers, what would they weave? I live on a hillside near the coast. Seasonal winds sculpt the trees into tortured but elegant shapes. Some are stripped bare but still reach for the sky. Others bend their trunks to protect their foliage like a shield. This project began with an idea to simulate smoke and the winding paths it follows. The smoke coalesced into strands of fiber and colorful yarn. Then it swirled into strange and organic forms. Some look like those wind-sculpted trees. Others are blankets unraveling, or storybook creatures felted from wool. If you look close, they are all fuzzy and soft and begging to be touched. As this project developed I researched fiber arts, an artistic tradition with a rich history. I spoke with artists and friends who knit, weave, felt wool, and raise Alpacas and sheep. Windwoven pieces don't try to simulate actual weaving, but the project is grounded in the fiber arts world. Many palettes are drawn from yarn and wool roving colors and from shades of Alpaca fur. The color blending mimics the dynamic colors that can be achieved when carding dyed wool. Of course, most of the outputs could only be made with code, pushing fiber-like artwork into new realms.
H=tokenData.hash S=Uint32Array.from([9,7,n1=5,t=3]);R=(a1=1)=>a1*(t=S[3],S[3]=S[2],S[2]=S[1],S[1]=n1=S[0],t^=t<<11,S[0]^=(t^t>>>8)^(n1>>>19),S[0]/2**32);seed=H;[...seed+'SaRaHNaCl'].map(c=>R(S[3]^=c.charCodeAt()*23205));'tx piter' rN2=(f,l)=>{return n7(R(1),0,1,f,l)};n7=(d1,d2,d3,d4,d5)=>{return(d1-d2)*(d5-d4)/(d3-d2)+d4}; bG=[205,169,119];c3=~~(rN2(0,12));cC=0;if(c3==8){cC=1;bG=[6,8,20]};if(c3==4||c3==6||c3==10){cC=1};g1=rN2(0,1)>.05?1:0; g3=rN2(0,1)>.3?0.984:rN2(0,1)>.9?0.87:0.99;g8=0;if(g3==.99){v2=30,v8=17,g8=1}else if(g3==.984){v2=50,v8=30}else if(g3==.87){v2=70,v8=30};g4=rN2(0,1)>.5?1:0;g5=rN2(0,1)>.4?1:rN2(0,1)>.1?0:2;g6=rN2(0,1)>.2?1:rN2(0,1)>.5?0:2;g7=rN2(0,1)>.02?1:0;g9=0;if(g5==2){if(rN2(0,1)>.2){g9=1}}; setup=()=>{console.log(H);pixelDensity(2);mF=Math.floor;mC=Math.cos;mS=Math.sin;mQ=Math.sqrt;cP=curvePoint;n=noise;o=map;cG=createGraphics;rN=(f,l)=>o(R(),0,1,f,l);w=1000;h=1500;oH=windowHeight;oW=~~(oH*.66666667);wH=windowHeight;wW=windowWidth;if(wW<oW){oW=wW;oH=oW*1.5};createCanvas(oW,oH);canvas.getContext('2d',{colorSpace:'display-p3'});nxS=oH/h;nS1=~~(rN(1000,9000));noiseSeed(nS1);noStroke(); cA0=[[66,91,46],[76,156,203],[54,127,191],[26,138,226],[189,224,240],[112,144,3],[128,153,92],[130,161,65],[89,123,33],[13,72,109]];cA1=[[177,165,48],[11,55,194],[43,126,191],[112,160,101],[178,41,19],[222,130,101],[232,201,191],[222,223,193],[23,111,96],[13,37,58]];cA2=[[217,210,218],[53,67,106],[17,27,71],[212,125,120],[46,68,61],[90,123,161],[209,150,146],[90,109,95],[121,87,62],[48,54,60]];cA3=[[207,90,40],[156,191,196],[74,102,105],[105,141,155],[67,84,52],[230,203,154],[123,124,8],[191,136,72],[58,83,83],[36,42,27]];cA4=[[239,201,182],[248,116,90],[0,116,95],[139,116,79],[230,193,99],[243,187,159],[126,179,101],[166,173,82],[180,171,124],[97,48,56]];cA5=[[154,162,172],[11,48,110],[15,96,177],[16,112,186],[13,76,154],[232,235,238],[114,131,151],[56,69,97],[177,186,210],[16,27,55]];cA6=[[224,219,213],[253,224,73],[255,134,80],[104,173,119],[11,135,96],[19,123,196],[94,208,211],[213,89,146],[19,50,119],[6,8,20]];cA7=[[49,138,55],[20,54,131],[200,62,95],[204,101,140],[239,128,4],[250,150,60],[231,168,155],[201,44,112],[194,40,53],[2,18,109]];cA8=[[231,229,221],[222,31,0],[102,119,183],[72,97,45],[103,97,43],[33,51,37],[208,98,120],[19,50,119],[211,148,15],[172,110,26],[8,8,73]];cA9=[[218,199,186],[213,168,24],[107,135,173],[207,54,0],[235,172,118],[54,81,140],[188,156,135],[54,64,84],[37,82,127],[52,35,24]];cA10=[[211,204,190],[125,82,38],[167,120,31],[39,102,115],[42,150,173],[221,201,135],[217,181,16],[223,191,72],[0,89,98],[51,42,22]];cA11=[[26,123,126],[225,204,95],[233,209,179],[150,144,169],[20,89,166],[103,158,174],[101,139,110],[7,149,171],[100,116,190],[77,60,66]];cA=[];if(c3==0){cA=cA0};if(c3==1){cA=cA1};if(c3==2){cA=cA2};if(c3==3){cA=cA3};if(c3==4){cA=cA4};if(c3==5){cA=cA5};if(c3==6){cA=cA6};if(c3==7){cA=cA7};if(c3==8){cA=cA8};if(c3==9){cA=cA9};if(c3==10){cA=cA10};if(c3==11){cA=cA11};ttC=cA.length;b1=cA[2];b2=cA[4];b3=cA[6];iG1=cG(w,h);iG1.pixelDensity(1);iG2=cG(w,h);iG2.pixelDensity(1);iG3=cG(w,h,WEBGL);iG3.pixelDensity(1);iG3.setAttributes('antialias',false);iG3.setAttributes('alpha',true);iG4=cG(w,h);iG4.pixelDensity(1);iG5=cG(w,h);iG5.pixelDensity(1);iG6=cG(w,h);iG6.pixelDensity(1);bS=4000;test7=0;test8=bS;bA=[];l5=cG(oW,oH);l5.noStroke();l5B=cG(oW,oH)} fR=0;draw=()=>{background(bG); if(fR==0){fill(b1);rect(30,30,10,10)}; if(fR==1){sS();fill(b2);rect(50,30,10,10)}; if(fR==2){tB1();fill(b3);rect(70,30,10,10)}; if(fR==3){mL()};if(fR>3){dL();image(l5B,0,0)};if(test8>bA.length&&fR>3){noLoop();console.log("Viridaria by Sarah Ridgley 2023");console.log("https://sarahridgley.com");console.log("https://twitter.com/Sarah_Ridgley");console.log("press [p] to pause/unpause");console.log("press [spacebar] to save");l5.remove();l5B.remove();bA.length=0};fR+=1} dL=()=>{const le6=bA.length;if(test8<le6-4){for(var k2=test7;k2<test8;k2++){var xx=bA[k2][0]*nxS;var yy=bA[k2][1]*nxS;var rr=1.3*nxS;var A=bA[k2][3];var B=bA[k2][4];var C=bA[k2][5];l5.fill(A-75,B-75,C-75,27);l5.rect(xx+.5,yy+.5,rr);l5.fill(A,B,C,rN(50,200));l5.rect(xx,yy,rr)}};l5B.image(l5,0,0);l5.clear();test7+=bS;test8+=bS} sS=()=>{var pN=0;var cS=[];var t9=.9;var t10=.5;var fS=80;var eE=180;iG3.ambientLight(255);iG3.lightFalloff(4,0,0);iG3.pointLight(250,250,250,-1000,0,1000);var fD=65;if(rN(0,1)>.8){fS=130;fD=45};if(g7==0){t9=.5};if(g6==2){eE=135;fS=100;t9=.8;fD=55};if(g5==2&&rN(0,1)>.8){fS=100;fD=45};var b4=1;if(rN(0,1)>.9){b4=0}; while(cS.length<eE){if(cS.length==fS){if(g6==0||g9==1){t9=.4;t10=0}else{t9=.58};if(g7==0){t9=.5}}dI=~~(rN(fD,250));if(cS.length>fS){dI=~~(rN(100,550))};nC={dia:dI,r:dI/2,x:rN(-w/2+dI*t10,w/2),y:rN(-h/2,h/2-dI*t10)};var oG=false;for(j=0;j<cS.length;j++){oT=cS[j];var d=(dist(nC.x,nC.y,oT.x,oT.y)).toFixed();d=Number(d);if(d<nC.r*t9+oT.r*t9){oG=true}};if(!oG){nC.x=~~nC.x;nC.y=~~nC.y;if(g7==0&&cS.length==0){var tX=-425;if(g5==0||g5==2){tX=150};nC.x=415;if(g5==2){nC.x=~~(rN(-400,400))};nC.y=~~(rN(-50,tX));nC.dia=~~(rN(700,800));nC.r=~~(nC.dia/2)};cS.push(nC);iG3.push();iG3.strokeWeight(1);rD=rN(1,3);if(rN(0,1)>.5?rD:rD*=-1);rD.toFixed(2);rD=Number(rD);if(cS.length>fS){if(g6==2&&nC.x>w/2-100){nC.x-=nC.dia};iG3.translate(nC.x,nC.y);iG3.rotateZ(rD);if(rN(0,1)>.1){iG3.translate(0,0,-100);var tF=cA[~~(rN(0,ttC))];if(cC==1){tF=cA[~~(rN(1,ttC))]};iG3.stroke(tF);iG3.noFill();iG3.ellipsoid(nC.dia*1.3,nC.dia*rN(.5,.9),150,8,8)}}else{if(cS.length>1&&g5==1&&nC.y<=-580){if(nC.y<=-620){nC.r=0;nC.dia=0}else if(nC.dia>200){nC.y+=45}else{nC.y+=25}};iG3.translate(nC.x,nC.y);if(b4==1&&cS.length>1){iG3.rotateZ(rN(-.2,.2))};tF=cA[~~(rN(0,ttC-1))];tP=~~(rN(3,5));if(g7==0&&cS.length==1){tP=3};var tP1=((6.283/tP)*.5).toFixed(5);tP1=Number(tP1);iG3.ambientMaterial(tF);iG3.noStroke();iG3.translate(0,0,220);iG3.push();thisR=nC.r.toFixed(2);thisR=Number(thisR);iG3.strokeWeight(1);if(g7==0&&cS.length==1){tA=0;iG3.stroke(tF[0]-7,tF[1]-7,tF[2]-7);for(k=0;k<3;k++){iG3.push();var w1=thisR*.27;var h1=thisR*.8;iG3.rotate(radians(tA));iG3.box(w1,h1,5,4,4);iG3.noStroke();tA+=rN(115,125);iG3.pop()};iG3.translate(0,0,5);iG3.noStroke();iG3.box(thisR*.4,thisR*.4,2)}else{for(k=0;k<tP;k++){rN(0,1)>.6?iG3.stroke(tF[0]-5,tF[1]-5,tF[2]-5):iG3.stroke(tF[0]+25,tF[1]+25,tF[2]+25);var x=(thisR*rN(.2,.3)).toFixed(2);x=Number(x);var y=thisR*.8;y=Number(y);iG3.box(x,y,15,4,4);var tP2=(tP1+rN(.03,.04)).toFixed(0);tP2=Number(tP2);iG3.rotateZ(tP2)}};iG3.pop();vT=rN(0,1).toFixed(2);vT=1;if(nC.dia<100){iG3.push();iG3.translate(rN(nC.dia*.65,nC.dia*.85).toFixed(2),rN(-20,0),0);for(k=0;k<tP;k++){rN(0,1)>.6?iG3.stroke(tF[0]-5,tF[1]-5,tF[2]-5):iG3.stroke(tF[0]+25,tF[1]+25,tF[2]+25);iG3.box((nC.r*rN(.19,.25)).toFixed(2),(nC.r*.8).toFixed(2),15,4,4);var tP2=tP1+rN(.03,.04);tP2.toFixed(2);iG3.rotateZ(tP2)};iG3.pop()}; if(nC.dia<100){iG3.push();iG3.translate(rN(0,20),rN(nC.dia*.65,nC.dia*.85).toFixed(2),0);for(k=0;k<tP;k++){rN(0,1)>.6?iG3.stroke(tF[0]-5,tF[1]-5,tF[2]-5):iG3.stroke(tF[0]+25,tF[1]+25,tF[2]+25);iG3.box((nC.r*rN(.19,.25)).toFixed(2),(nC.r*.8).toFixed(2),15,4,4);var tP2=tP1+rN(.03,.04);tP2.toFixed(2);iG3.rotateZ(tP2)};iG3.pop()}};iG3.pop()};pN++;if(pN>10000){;break;}};cS.length=0;cA.length=0;cL()} cI=()=>{lB=[];if(g5==2){iG4.image(iG3,0,0)}else if(g5==0){iG1.scale(-1,1);iG1.image(iG3,-w,0);iG4.image(iG3,-w/2,0);iG4.image(iG1,w/2,0)}else if(g5==1){iG1.scale(-1,1);iG1.image(iG3,-w,0);iG5.image(iG3,-w/2,0);iG5.image(iG1,w/2,0);iG6.scale(1,-1);iG6.image(iG5,0,-h);iG4.image(iG6,0,-h/2);iG4.image(iG5,0,h/2)};iG1.remove();iG3.remove();iG5.remove();iG6.remove();iG4.loadPixels();pxC=[];for(var i=0;i<1500000*4;i++){pxC.push(rN(0,2))};for(var J=4;J<1496;J++){for(var E=4;E<996;E+=4){var cT=.52;if(g1==0){cT=.31};var iX=(E+(J)*(w))*4;var A=iG4.pixels[iX];var B=iG4.pixels[iX+1];var C=iG4.pixels[iX+2];var T=iG4.pixels[iX+3];var bP=0;var t3=0;var t4=0;var v6=pxC[iX];g2=rN(0,1);if(g2>g3){bP=1;t3=rN(5,100);t4=rN(10,v8);if(g8<1&&rN(0,1)>.8){t4=~~(rN(30,v2))}};if(g1==0){v6=n(E,iX)};if(v6<cT){lB.push([E,J,A,B,C,bP,t3,t4])}}}pxC.length=0;iG4.remove()} tB1=()=>{const lBl=lB.length;var dV=8;if(g1==0){dV=4};var sZ=Math.ceil(lBl/dV);var sM1=0;var sM2=1;for(i4=0;i4<dV;i4++){st1=sZ*sM1;st2=sZ*sM2;if(st2>lBl){st2=lBl};for(var i3=st1;i3<st2-1;i3++){tB(i3,lB[i3][0],lB[i3][1])};sM1+=1;sM2+=1}} tB=(x,tX,tY)=>{var nND=1000;var nN=0;for(var i1=x;i1<st2;i1++){var nX=lB[i1][0];var nY=lB[i1][1];if(nX>tX-20&&nX<tX+20&&nY>tY-20&&nY<tY+20){const tD=~~(dist(tX,tY,nX,nY));if(i1!=x&&tD<nND){nND=tD;nN=i1}}};var hold=lB[x+1];lB[x+1]=lB[nN];lB[nN]=hold} mL=()=>{const ll7=lB.length-4;var tOff=0;var xO3=rN(.03,.04);var xO4=rN(.009,.01);for(var w2=0;w2<ll7;w2++){var x1=lB[w2][0];var y1=lB[w2][1];var x2=lB[w2+1][0];var y2=lB[w2+1][1];var x3=lB[w2+2][0];var y3=lB[w2+2][1];var x4=lB[w2+3][0];var y4=lB[w2+3][1];var A=lB[w2+1][2];var B=lB[w2+1][3];var C=lB[w2+1][4];var bP=lB[w2+1][5];var t3=lB[w2+1][6];var t4=lB[w2+1][7];var a=x3-x2;var b=y3-y2;var steps=~~(mQ(a*a+b*b)*.5);var d6=(dist(x2,y2,x3,y3)).toFixed(4);d6=Number(d6);if(d6>4.6){steps=0};for(var k3=0;k3<=steps;k3++){var t=k3/steps;var xF=~~cP(x1,x2,x3,x4,t);var yF=~~cP(y1,y2,y3,y4,t);if(A==0&&B==0&&C==0){sS5=~~(1)*o(n(tOff),0,1,0,0)}else{var sS5=~~(1)*o(n(tOff),0,1,2,8)};bB(xF,yF,sS5,sS5*3.5,A,B,C);if(bP>0){for(var i5=0;i5<t4;i5++){var ttt=rN(.5,2);var t5=rN(0,1)>=.5?-1:1;if(g4==0){if(steps>0&&sS5>0){bB(xF+t3+i5*2,yF+(t3+i5*2)*t5,ttt,ttt*2.5,A,B,C)}}else if(g4==1){if(steps>0&&sS5>0){bB(xF,yF+(t3+i5*2)*t5,ttt,ttt*2.5,A,B,C)}}}};tOff+=rN(xO3,xO4)}};lB.length=0} bB=(bX,bY,rA,px1,A,B,C)=>{var pN2=0;var pX=[];var lX=bX-rA;if(lX<10){px1=0};var rX=bX+rA;if(rX>989){px1=0};var tpY=bY-rA;if(tpY<10){px1=0};var btY=bY+rA;if(btY>1489){px1=0};var pxs=px1*2;while(pX.length<pxs){nP={dia:.1,x:rN(lX,rX),y:rN(tpY,btY)};var oS=false;var d=dist(nP.x,nP.y,bX+(n(bX,bY)*.5),bY+(n(bX,bY)*.5));if(d>rA){oS=true;}else{bA.push([nP.x,nP.y,1,A,B,C])};if(!oS){pX.push(nP)}pN2++;if(pN2>500){break}};pX.length=0} pA=0;keyPressed=()=>{if(keyCode==32){console.log("Saving...");save("Viridaria"+'.png')}if(keyCode==80){if(pA==0){noLoop();pA=1}else if(pA==1){loop();pA=0}}} cL=()=>{iG3.noStroke();iG2.image(iG3,0,0);var w1=3;var col=~~(w/w1);var row=~~(h/w1);for(let i=0;i<col;i++){for(let j=0;j<row;j++){var x1=i*w1;var y1=j*w1;if(rN(0,1)>.6){rN(0,1)>.5?t7=~~rN(0,5):t7=~~(-5,0);var c3=iG2.get(x1+t7,y1+t7);iG3.fill(c3);iG3.push();iG3.translate(-w/2,-h/2,230);iG3.rect((i*w1),(j*w1),(w1-1),(w1-1));iG3.pop()}}}iG2.remove();cI()}
*And through the looking-glass, where maidens roam, the blossoms speak, to lead the lost ones home: 'To seek the end around the bend — rewind your mind and leave the way you know behind.'* *Viridaria* playfully revisits the adventure of Alice in the Garden of Live Flowers from *Through the Looking Glass* by Lewis Carroll. Alice learns that following the path through this garden only leads her back to where she has started. To break free, she finds that she must reverse logic and force herself to walk in the opposite direction of her destination. In this series, the not-quite-perfect mirrored images challenge our perception of reality, inviting us to take a closer look, to welcome the surprises. Like Alice, we might discover that, to find our way, we must first step back and look from a different perspective.
(()=>{"use strict";let e=(e,n,r)=>Math.min(Math.max(e,n),r),n=(n,r,t,a,s,i=!1)=>{let o=(n-r)/(t-r)*(s-a)+a;return i?e(o,a,s):o};function r(e,n,r){let t=n/2,a=Math.round(e/t*r);return Math.min(r,Math.max(0,a))}function t(e,t,a,s){if(!e)return 0;let i=e.context.sampleRate,o=e.frequencyBinCount,m=r(a,i,o),u=r(s,i,o),c=u-m,d=0;for(;m<u;m++)d+=t[m];let p=e.minDecibels,l=e.maxDecibels,V=0!==c&&isFinite(d)?d/c:p;return n(V,p,l,0,1,!0)}String.prototype.INC=function(e,n){return this.replaceAll(`#include<${e}>\n`,n)},Number.prototype.F=function(){return this.toFixed(10)};let a,s=new class{constructor(){this.useA=!1;let e=function(e){let n=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),t=parseInt(e.substr(16,8),16),a=parseInt(e.substr(24,8),16);return function(){n|=0,r|=0,t|=0,a|=0;let e=(n+r|0)+a|0;return a=a+1|0,n=r^r>>>9,r=t+(t<<3)|0,t=t<<21|t>>>11,t=t+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}dec(e=1){return this.useA=!this.useA,(this.useA?this.prngA():this.prngB())*e}num(e,n){return e+(n-e)*this.dec()}int(e,n){return Math.floor(this.num(e,n+1))}lim(e=1){return this.map(this.dec(),0,1,-e,e)}choice(e){return e[this.int(0,e.length-1)]}map(e,n,r,t,a){return(e-n)/(r-n)*(a-t)+t}hash(){let e="0x";for(let n=0;n<64;n++)e+=Math.floor(16*this.dec()).toString(16);return e}min(e){return Math.min(...e)}max(e){return Math.max(...e)}pn(e,n){let r=this.num(e,n);return this.dec()<.5?r:-r}},i=s.dec()<.35?0:s.dec()<.275?2:1,o={samples:new Array(8).fill(0),colors:Array.from(new Array(15),((r,t)=>e(t%3?(t-1)%3?s.num(.2,.7):s.num(.125,.625):s.num(.175,.715),n(t,0,14,.125,.3),1))),randoms:Array.from(new Array(3),(e=>s.dec())),A:{wave:s.int(0,2),form:s.int(0,3)},B:{wave:i,form:1===i?s.dec()<.45?0:s.int(1,3):s.int(0,3)}},m=window,u=document,c=u.body,d=new URLSearchParams(m.location.search),p=/\bHeadlessChrome/.test(navigator.userAgent),l=d.get("static"),V=-(parseInt(d.get("minDb"))||120),F=-(parseInt(d.get("maxDb"))||6),x=1e3*parseInt(d.get("time"))||0,S=parseFloat(d.get("quality")),h=-1!=navigator.userAgent.indexOf("Chrome"),M=-1!=navigator.userAgent.indexOf("Firefox")&&!h,f=S?e(parseFloat(S),.25,4):l?4:p?2:1,R="#version 300 es\n#define U uniform\n#define F float\n#define I int\nprecision highp I;\nprecision highp F;\n#define V2 vec2\n#define V3 vec3\n#define V4 vec4\n#define MX mix\n#define PW pow\n#define MA max\n#define MN min\n#define MD mod\n#define FL floor\n#define DT dot\n#define LN length\n#define TX texture\n#define S2D sampler2D\n#define NOR normalize\n#define CLM clamp\n#define DST distance\n#define CL01(T) CLM((T),0.,1.)\n#define SS01(T) smoothstep(0.,1.,T)\n#define SSCL01(T) CL01(SS01(T))\nF MPV(F n,F a,F b,F x,F y){return ((n-a)/(b-a))*(y-x)+x;}F MPS(F n,F x,F y){return MPV(n,-1.,1.,x,y);}F MPR(F n,F v){return ((n)/(1.))*(v-(-v))+(-v);}\n",y=new class{v=R+"in V3 aPs;in V2 aTc;out V2 vTc;void main(){gl_Position=V4(aPs,1.);vTc=aTc;}";d=R+"U F uTm;U V2 uRs;U F uSm[7];U S2D uWv;U V3 uCl[5];U F uRn[3];in V2 vTc;out V4 o0;struct SDF {F d;V2 m;V4 w;V2 p;I s;};V4 prm(V4 x){return MD(((x*34.)+1.)*x,289.);}V4 tis(V4 r){return 1.79284291400159-.85373472095314*r;}F sns(V3 v){const V2 C=V2(1./6.,1./3.);const V4 D=V4(0.,.5,1.,2.);V3 i=FL(v+DT(v,C.yyy));V3 x0=v-i+DT(i,C.xxx);V3 g=step(x0.yzx,x0.xyz);V3 l=1.-g;V3 i1=MN(g.xyz,l.zxy);V3 i2=MA(g.xyz,l.zxy);V3 x1=x0-i1+1.*C.xxx;V3 x2=x0-i2+2.*C.xxx;V3 x3=x0-1.+3.*C.xxx;i=MD(i,289.);V4 p=prm(prm(prm(i.z+V4(0.,i1.z,i2.z,1.))+i.y+V4(0.,i1.y,i2.y,1.))+i.x+V4(0.,i1.x,i2.x,1.));F n_=1./7.;V3 ns=n_*D.wyz-D.xzx;V4 j=p-49.*FL(p*ns.z*ns.z);V4 x_=FL(j*ns.z);V4 y_=FL(j-7.*x_);V4 x=x_*ns.x+ns.yyyy;V4 y=y_*ns.x+ns.yyyy;V4 h=1.-abs(x)-abs(y);V4 b0=V4(x.xy,y.xy);V4 b1=V4(x.zw,y.zw);V4 s0=FL(b0)*2.+1.;V4 s1=FL(b1)*2.+1.;V4 sh=-step(h,V4(0.));V4 a0=b0.xzyw+s0.xzyw*sh.xxyy;V4 a1=b1.xzyw+s1.xzyw*sh.zzww;V3 p0=V3(a0.xy,h.x);V3 p1=V3(a0.zw,h.y);V3 p2=V3(a1.xy,h.z);V3 p3=V3(a1.zw,h.w);V4 norm=tis(V4(DT(p0,p0),DT(p1,p1),DT(p2,p2),DT(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;V4 m=MA(.6-V4(DT(x0,x0),DT(x1,x1),DT(x2,x2),DT(x3,x3)),0.);m=m*m;return 42.*DT(m*m,V4(DT(p0,x0),DT(p1,x1),DT(p2,x2),DT(p3,x3)));}F fP(V3 p,V4 n){return DT(p,n.xyz)+n.w;}F fS(V3 p,F s){return LN(p)-s;}F fB(V3 p,V3 b){V3 q=abs(p)-b;return LN(MA(q,0.))+MN(MA(q.x,MA(q.y,q.z)),0.);}mat3 rtm(V3 v,F a){v=NOR(v);F s=sin(a);F c=cos(a);F oc=1.-c;return mat3(oc*v.x*v.x+c,oc*v.x*v.y-v.z*s,oc*v.z*v.x+v.y*s,oc*v.x*v.y+v.z*s,oc*v.y*v.y+c,oc*v.y*v.z-v.x*s,oc*v.z*v.x-v.y*s,oc*v.y*v.z+v.x*s,oc*v.z*v.z+c);}V3 oRt(V3 p,V3 v,F a){mat3 m=rtm(v,a);p*=m;return p;}V2 pM2(inout V2 p,V2 s){V2 c=FL((p+s*.5)/s);p=MD(p+s*.5,s)-s*.5;return c;}V2 pMM2(inout V2 p,V2 s){V2 halfsize=s*.5;V2 c=FL((p+halfsize)/s);p=MD(p+halfsize,s)-halfsize;p*=MD(c,V2(2.))*2.-V2(1.);return c;}F pUS(F a,F b,F r,F n){F s=r/n;F u=b-r;return MN(MN(a,b),.5*(u+a+abs((MD(u-a+s,2.*s))-s)));}SDF oUS(SDF a,SDF b,F r,F n,F k){F h=CLM(.5+.5*(b.d-a.d)/k,0.,1.);F d=pUS(a.d,b.d,r,n);V2 m=MX(b.m,a.m,h);V2 p=MX(b.p,a.p,h);return SDF(d,m,V4(0.),p,0);}SDF oIS(SDF a,SDF b,F k){F h=CLM(.5-.5*(b.d-a.d)/k,0.,1.);F d=MX(b.d,a.d,h)+k*h*(1.-h);V2 m=MX(b.m,a.m,h);V2 p=MX(b.p,a.p,h);return SDF(d,m,V4(0.),p,0);}V2 Ma=V2(0.,0.);V2 Mb=V2(0.,1.);V2 Mc=V2(1.,0.);V2 Md=V2(1.,1.);\n#include<A>\n#include<B>\nSDF map(V3 pos){SDF R=A(pos);R=oUS(R,B(pos),.2+.2*uRn[0],1.5+2.5*uRn[1],.5+.2*uRn[2]);V4 m=V4(PW(DST(Ma,R.m),8.),PW(DST(Mb,R.m),8.),PW(DST(Mc,R.m),8.),PW(DST(Md,R.m),8.));F t=m.x+m.y+m.z+m.w;R.w=CL01(m/t);return R;}SDF INT(V3 ro,V3 rd){F t=0.;I s=0;SDF R=SDF(1e10,V2(-1.),V4(0.),V2(0.),0);for (s=0;s<150;s++){R=map(ro+rd*t);R.s=s;if(R.d<.0001){t+=.0001;break;}else if(R.d>1e10){R.m=V2(-1.);R.d=-1.;break;}t+=R.d*.1;}R.d=t;return R;}V3 NRM(V3 p){V2 e=V2(1.,-1.)*.5773*.1;return NOR(e.xyy*map(p+e.xyy).d+e.yyx*map(p+e.yyx).d+e.yxy*map(p+e.yxy).d+e.xxx*map(p+e.xxx).d);}V3 render(V3 ro,V3 rd){V3 C;SDF R=INT(ro,rd);V3 N=V3(0.,1.,0.);V3 L=NOR(V3(1.,.95,.25));if(R.m.x>=0.&&R.m.y>=0.){V3 pos=ro+rd*R.d;N=NRM(pos);C+=.725*MX(uCl[0],uCl[4],R.p[0])*R.w.w;C+=uCl[1]*R.w.x;C+=uCl[2]*R.w.y;C+=uCl[3]*R.w.z;F aoc=1.-(float(R.s)/150.);C=MX(C,C+CL01(PW(aoc,2.)),.2);C=MX(C,C*CL01(PW(aoc,.05)),.2);F NoL=MA(DT(N,L),0.);C*=CLM(PW(NoL,1.2),.5,1.)+.175;C=MX(C,C*1.1,SSCL01(PW(N.y,4.)));C=MX(C,C*1.2,SSCL01(PW(N.y,8.)));C=MX(C,C*.6,SSCL01(PW(MA(N.x,N.z),2.)));C=MX(C,C*.5+(1.-C)*.25+.25*uCl[4],SSCL01(R.p[1]*PW(1.-N.y,.8)));C=CL01(C);}else{C=V3(1.,0.,0.);}return C;}void main(){V2 uv=gl_FragCoord.xy/uRs.xy;V3 cF=NOR(V3(-1.));V3 cR=NOR(cross(cF,V3(0.,-1.,0.)));V3 cU=NOR(cross(cF,cR));F a=uRs.x/uRs.y;F rm=step(1.,a);F o=13.;F vpW=MX(o,o*a,rm);F vpH=MX(vpW/a,o,rm);uv.x=(uv.x*vpW)-vpW*.5;uv.y=(uv.y*vpH)-vpH*.5;V3 rd=cF;V3 ro=-uv.x*cR+uv.y*cU+vpH*.5;o0=V4(render(ro,rd),1.);}";p=R+"U V2 uRs;U S2D uT0;U F uSm[7];U V3 uCl[5];U F uPX;in V2 vTc;out V4 o0;V3 GMA(V3 c,F g){return PW(c,V3(1./g));}V3 RNG(V3 c,F l,F h){return MN(MA(c-V3(l),V3(0.))/(V3(h)-V3(l)),V3(1.));}V3 LVL(V3 c,F l,F g,F h){return GMA(RNG(c,l,h),g);}V3 CON(V3 c,F v){return .5+(1.+v)*(c-.5);}V3 EXP(V3 c,F v){return (1.+v)*c;}F LUM(V3 c){return DT(c,V3(.2126,.7152,.0722));}V3 SAT(V3 c,F v){return MX(V3(LUM(c)),c,1.+v);}V3 SRP(S2D t,V2 uv,F a,F o){V3 c=TX(t,vTc).rgb;V3 b=c;b+=TX(t,uv+V2(0.,.001*o)).rgb;b+=TX(t,uv+V2(.001*o,0.)).rgb;b+=TX(t,uv-V2(0.,.001*o)).rgb;b+=TX(t,uv-V2(.001*o,0.)).rgb;b+=TX(t,uv+V2(.001*o)).rgb/2.;b+=TX(t,uv-V2(.001*o)).rgb/2.;b+=TX(t,uv+V2(.001*o,-.001*o)).rgb/2.;b+=TX(t,uv+V2(-.001*o,.001*o)).rgb/2.;b/=7.;F s=(c-b).r*a;return c+s;}void main(){F kk=SS01(uSm[0]);F dm=SS01(uSm[1]);F sg=SS01(uSm[2]);F wd=SS01(uSm[3]);F sp=SS01(uSm[4]);F cp=SS01(uSm[5]);F me=SS01(uSm[6]);V2 uv=gl_FragCoord.xy/uRs;V3 C=SRP(uT0,vTc,.4,uPX);C=CLM(C,.05,.95);C=MX(C,C*2.,SSCL01(PW(sp,12.)));F q=16.-MPV(PW(MA(sg,wd),16.),0.,1.,0.,16.*.3);C*=q;C=round(C);C/=q;C=EXP(C,.225);C=CON(C,.325);C=SAT(C,.225);C=LVL(C,.05,.825,.925);uv*=1.-uv.yx;F V=uv.x*uv.y*100.;V=PW(V,.275)+.125+MPR(sg,.125);C*=V;F l=LUM(C);if(l>.1){C=EXP(C,.1+MPR(PW(sp,2.),.1));C=CON(C,.1+MPR(PW(cp,2.),.1));C=RNG(C,0.+.05-MPR(MA(sg,wd),-.05),1.+.1+MPR(PW(me,4.),.125));}else{C=MX(C,uCl[4]*.3,.5);}C=CLM(C,.05,.95);o0=V4(C,1.);}";constructor(e,r){let t=(e,n)=>{let r=`vec${n}(`;for(let t=0;t<n;t++)r+=e().F(),t<n-1&&(r+=",");return r+=")",r},a=e=>t(e,3),s=e=>t(e,4),i=n=>e.choice(["sin","cos"]),o=["c.x","c.y","abs(c.x)","abs(c.y)","c.x+c.y","DST(c.x,c.y)","LN(c)"],m=n=>`MD(${e.choice(o)},${n})`,u=n=>`MD(${e.choice(o.slice(0,5))},${n})`,c=n=>`MD(${e.choice(o.slice(2,7))},${n})`,d=(n,r)=>e.choice([`fS(${n},LN(${r})*.5)`,`fB(${n},${r})`]),p=n=>e.choice(["+=","-="]),l=e.num(1,1.5),V=e.num(-.05,.05),F=r=>0===r?e.dec()<.5?"X":"Z":1===r?"LN(V2(X,Z))":2===r?`sns(V3(V2(X,Z)*${n(l,1,2,.3,.5).F()},${e.dec(10).F()}+T*.2))`:`(.5*(sin(X*${e.num(1,3).F()})+cos(Z*${e.num(1,3).F()})))`,x=`F mmx=${e.dec()<.5?e.num(.3,.5).F():e.num(.5,.7).F()};F mx=mmx+MPR(SSCL01(MA(kk,dm)),(mmx>.5 ? 1.-mmx : mmx));mx=MX(mmx,mx,abs(sin(${u("denom.w")})));F d=MX(a,b,mx);denom=${s((()=>e.num(2,9)))};V2 m1=Mb;V2 m2=Mc;if( ${e.dec().F()}<0.){m1=MX(m1,m1+V2(1.,0.),CL01(${c("denom.x")}));m1=MX(m1,m1-V2(0.,1.),CL01(${c("denom.y")}));m2=MX(m2,m2+V2(0.,1.),CL01(${c("denom.z")}));m2=MX(m2,m2-V2(1.,0.),CL01(${c("denom.w")}));}else{m1+=abs(${i()}(${c("denom.x")}))*V2(1.,0.);m1-=abs(${i()}(${c("denom.y")}))*V2(0.,1.);m2+=abs(${i()}(${c("denom.z")}))*V2(0.,1.);m2-=abs(${i()}(${c("denom.w")}))*V2(1.,0.);}V2 m=MX(m1,m2,SSCL01(mx));denom=${s((()=>e.num(2,5)))};F p=SS01(sp);p=MX(p*.2,p,SSCL01(${m("denom.x")}));p=MX(p*.2,p,SSCL01(${m("denom.y")}));p=MX(p*.2,p,SSCL01(${m("denom.z")}));p=MX(p*.2,p,SSCL01(${m("denom.w")}));p=CL01(p);`;["A","B"].forEach(((n,t)=>{let o=r[n],S=`SDF ${n}(in V3 pos){SDF R=SDF(1e10,V2(-1.),V4(0.),V2(0.),0);pos=oRt(pos,V3(0.,1.,0.),6.2831853072*${V.F()});F X=pos.x;F Z=pos.z;F kk=SS01(uSm[0]);F dm=SS01(uSm[1]);F sg=SS01(uSm[2]);F wd=SS01(uSm[3]);F sp=SS01(uSm[4]);F cp=SS01(uSm[5]);F me=SS01(uSm[6]);F T=1.+uTm*.0003+MPR(me,.325);`;if(0===t)S+=`F W=MPR(SS01(TX(uWv,V2(${F(o.form)}*.02,0.)).a),1.35)+(.1+${e.num(0,.1).F()})*sin(${1===o.wave?"2.":"4."}*(T*${o.wave>1?".3":"1."})-${F(o.wave)}*(2.-MPR(SSCL01(me),${e.num(.1,.2).F()}*${l.F()}))*${l.F()}*${e.num(.8,1.6).F()});R=SDF(fP(pos,V4(0.,1.,0.,W+.2)),Ma,V4(0.),V2(SS01(.5+.5*MX(W,me,.6))),0);`;else if(1===t){let n=e.dec()<.5,r=`{F C=${o.form<2?e.num(.8,1).F():e.num(.725,.775).F()};V2 c=pM2(P.xz,V2(C+${e.num(-.2,.2).F()},C+${e.num(-.2,.2).F()})+MPR(sg,.0125));F bounds=fB(P,V3(.5,5.0,.5));P=oRt(P,NOR(${a((()=>e.dec()))}),${e.num(-.2,.2).F()}*6.2831853072);P.x-=amplitude.x*${i()}(period.x*(${u("denom.x")}+t));P.y-=amplitude.y*${i()}(period.y*(${u("denom.y")}+t));P.z-=amplitude.z*${i()}(period.z*(${u("denom.z")}+t));denom=${s((()=>e.num(4,12)))};V3 off=V3(0.,+.1+MPR(MA(dm,kk),.1)*${i()}(period.w*(${u("denom.w")}+t)),0.);V3 sA=${a((()=>e.num(.4,.7)))};sA+=.1+MPR(dm,.1)+MPS(sin(${e.dec(10).F()}+t*period.x),0.,.1)*amplitude.x;V3 pA=P-V3(0.,MPR(MA(kk,cp),.1)*abs(sin(${c("denom.x")})),0.);F a=${d("pA-off","sA")};a=MA(bounds,a);off*=${e.num(.95,1.05).F()};V3 sB=${a((()=>e.num(.4,.7)))};sB-=.1+MPR(sp,.1)+MPS(sin(${e.dec(10).F()}+t*period.y),0.,.1)*amplitude.y;V3 pB=P-V3(0.,MPR(MA(wd,sg),.1)*abs(sin(${c("denom.y")})),0.);F b=${d("pB-off","sB")};b=MA(bounds,b);${x}d-=.08+MPR(cp,.08);r=SDF(d,m,V4(0.),V2(p),0);}`,t=`{V2 xz=V2(abs(pos.x),abs(pos.z));xz.xy=xz.${e.dec()<.5?"xy":"yx"};xz ${p()} t*${e.num(0,2).F()};P.xz=P.${((n=!0)=>n?e.choice(["x","z"]):e.choice(["xz","zx"]))(0)};V2 c=pM2(P.xz,V2(${n?e.num(3,9).F():e.num(1,2).F()},${e.num(.3,.7).F()})+MPR(sg,.0125));${n} ? pMM2(P.xz,V2(${e.num(.6,1.2).F()}+${i()}(t*${e.pn(.6,1.2).F()})*.5,1.)) : c;P=oRt(P,NOR(${a((()=>e.dec()))}),Z*${e.num(.2,.8).F()}+t*${e.pn(3,4).F()});V3 size=${a((()=>e.num(.3,.8)))};size.y=${e.num(.35,.45).F()}+${i()}(${e.dec().F()}+${[e.choice(["xz.x","xz.y"]),"LN(xz)","MN(xz.x,xz.y)","MA(xz.x,xz.y)"][o.form]}*${e.num(.8,1.6).F()}*MPS(sin(period.w+t*.025),.6,1.2))*${e.num(.3,.5).F()};size.x ${p()} amplitude.x*MPS(sin(${e.dec().F()}+t*period.x),0.,.2)+.1+MPR(dm,.1);size.y ${p()} amplitude.y*MPS(sin(${e.dec().F()}+t*period.y),0.,.2)+.1+MPR(kk,.1);size.z ${p()} amplitude.z*MPS(sin(${e.dec().F()}+t*period.z),0.,.2)+.1+MPR(sg,.1);F pY=${i()}((P.z*${e.num(.5,.5).F()}))*.2+MPR(MA(dm,kk),.1);F a=fB(P-V3(0.,pY,0.),size)-MPV((dm+kk)*.5,0.,1.,0.,.4)*sin(${m("denom.y")});F b=a-MPS(wd,0.,.175);${x}r=SDF(d,m,V4(0.),V2(p),0);}`,l=`{t=T*${e.num(.4,.6).F()};r=SDF(1e10,V2(-1.),V4(0.),V2(0.),0);X=abs(pos.x);Z=abs(pos.z);X ${p()} t*${e.num(1.25,2.5).F()};Z ${p()} t*${e.num(1.25,2.5).F()};F posY=.1+MPR(MA(dm,kk),.1);F radius=${e.num(.2,.5).F()}+${i()}(X*${e.num(.4,1.6).F()}+1.+MPR(dm,1.))*${e.num(.1,.3).F()}+${i()}(Z*${e.num(.4,1.6).F()}+1.+MPR(kk,1.))*${e.num(.1,.3).F()};F height=.5+${i()}(LN(V2(X,Z))*.5)*${e.num(.2,.5).F()};F offset=${i()}(LN(V2(X,Z))*${e.num(.4,1.2).F()})*${e.num(.3,.6).F()};radius+=.2+MPR(MA(dm,kk),.2);offset+=.1+MPR(MA(sp,cp),.1);V2 c=pM2(P.xz,V2(${e.num(3,9).F()}+MPR(sg,.075)));P.x+=t*.6*${e.dec()<.5?"1.":"-1."}*${e.num(.8,1.2).F()};P.z+=t*.6*${e.dec()<.5?"1.":"-1."}*${e.num(.8,1.2).F()};c=pM2(P.xz,V2(${e.num(.5,1).F()}+MPR(wd,0.01)));posY+=.1+MPR(cp,.1)*abs(sin(${c("denom.x")}));radius ${p()} .125+MPR(dm,.125)*abs(sin(${c("denom.y")}));offset ${p()} .125+MPR(sg,.125)*abs(sin(${c("denom.z")}));height ${p()} .125+MPR(wd,.125)*abs(sin(${c("denom.w")}));V3 h=V3(${e.num(.3,.6).F()},height*2.,${e.num(.4,.6).F()});F a=${d("P+V3(0.,posY,0.)","h")};F b=${d("P+V3(offset,0.,offset)","V3(radius,radius*1.5,radius)")};${x}d-=.08+MPR(cp,.08);m=MX(m,Md,.3);r=oIS(SDF(a,m,V4(0.),V2(p),0),SDF(b,m,V4(0.),V2(p),0),MPS(sg,0.,.2));}`;S+=`V3 P=pos;F t=1.+.2*uTm*.0003+MPR(me,.325)*.6;SDF r=SDF(1e10,V2(-1.),V4(0.),V2(0.),0);V4 amplitude=${s((()=>e.num(.15,.5)))};V4 period=${s((()=>e.num(3,6)))};V4 denom=${s((()=>e.num(4,12)))};`,0===o.wave?o.form<2?S+=`${r}R=r;`:S+=`${r}SDF a=r;${r}SDF b=r;R=oIS(a,b,MPS(sg,0.,.25));`:S+=`${1===o.wave?t:l}R=r;`}S+="return R;}",this.d=this.d.INC(n,S)}))}}(s,o),v=u.createElement("style");v.innerHTML="*{overflow:hidden;margin:0;background:#000;visibility:hidden;}body{display:flex;justify-content:center;align-items:center}canvas{visibility:visible}}",c.appendChild(v);let $=u.createElement("canvas");c.appendChild($);let C=$.getContext("webgl2",{preserveDrawingBuffer:!0});"drawingBufferColorSpace"in C&&(C.drawingBufferColorSpace="display-p3");let g=C.FRAMEBUFFER,P=C.ARRAY_BUFFER,b=C.ELEMENT_ARRAY_BUFFER,T=C.TEXTURE_2D,A=C.STATIC_DRAW,D=C.UNSIGNED_BYTE,w=C.RGBA,z=C.TEXTURE_MIN_FILTER,L=C.TEXTURE_MAG_FILTER,X=C.TEXTURE_WRAP_S,E=C.TEXTURE_WRAP_T,N=C.CLAMP_TO_EDGE,U=C.NEAREST,k=C.LINEAR,B=C.MIRRORED_REPEAT,W=C.COLOR_ATTACHMENT0,_=e=>C.createBuffer(),I=e=>C.bindVertexArray(e),O=(e,n)=>C.bindBuffer(e,n),q=(e,n,r)=>C.bufferData(e,n,r),G=e=>C.bindFramebuffer(g,e),H=e=>C.bindTexture(T,e),Z=(e,n)=>C.texParameteri(T,e,n),Y=(e,n,r,t,a,s,i)=>C.texImage2D(T,0,e,n,r,t,a,s,i),j=e=>C.activeTexture(C.TEXTURE0),J=(e,n)=>C.uniform1i(e,n),K=(e,n)=>C.uniform1f(e,n),Q=(e,n)=>C.uniform1fv(e,n),ee=(e,n)=>C.uniform2fv(e,n),ne=(e,n)=>C.uniform3fv(e,n),re=e=>C.viewport(0,0,be[0],be[1]),te=e=>C.drawElements(C.TRIANGLES,6,C.UNSIGNED_SHORT,0),ae=e=>C.finish();class se{constructor(e,n,r,t,a,s){C??=e,this.v=n,this.frag=r,this.createProgram(),this.useProgram(),t.forEach((e=>{this[e]=C.getAttribLocation(this.program,e)})),a.forEach((e=>{this[e]=C.getUniformLocation(this.program,e)})),this.vertexArray=C.createVertexArray(),I(this.vertexArray),this.vertexBuffer=_(),O(P,this.vertexBuffer),q(P,new Float32Array([-1,1,0,-1,-1,0,1,-1,0,1,1,0]),A),-1!==this.aPs&&(C.enableVertexAttribArray(this.aPs),C.vertexAttribPointer(this.aPs,3,C.FLOAT,!1,0,0)),s&&(O(P,s),C.enableVertexAttribArray(this.aTc),C.vertexAttribPointer(this.aTc,2,C.FLOAT,!1,0,0)),this.indexBuffer=_(),O(b,this.indexBuffer),q(b,new Uint16Array([0,1,2,0,2,3]),A),I(null),O(P,null),O(b,null)}useProgram(){C.useProgram(this.program)}getUniform(e){return C.getUniform(this.program,e)}createProgram(){return this.vertexShader=this.createShader(C.VERTEX_SHADER,this.v),this.fragmentShader=this.createShader(C.FRAGMENT_SHADER,this.frag),this.program=C.createProgram(),C.attachShader(this.program,this.vertexShader),C.attachShader(this.program,this.fragmentShader),C.linkProgram(this.program),this.program}createShader(e,n){let r=C.createShader(e);return C.shaderSource(r,n),C.compileShader(r),r}}let ie,oe,me,ue,ce,de,pe,le,Ve,Fe=4096,xe=!1,Se=!1,he=[40,180,450,1500,3e3,5e3,1e4],Me=u.createElement("audio"),fe=C.createTexture(),Re=new Uint8Array(Array.from(new Array(1024),(e=>127)));H(fe),Y(w,256,1,0,w,D,Re),Z(z,k),Z(L,k),Z(X,B),Z(E,B);let ye=[],ve=!0,$e=0,Ce=(e=!1)=>{ye.length>0&&(ge(),e&&(Me.src=ye[$e].url,Me.load()),Me.play(),ve=!1)},ge=e=>{Me.paused||Me.pause()},Pe=e=>{$e+=1,$e>=ye.length&&($e=0),Ce(!0)};m.onkeydown=e=>{let n=e.keyCode;ye.length>0&&(37===n&&($e-=1,$e<0&&($e=ye.length-1),Ce(!0)),39===n&&Pe(),32===n&&(ye.length<=0||(Me.paused?Ce():ge(),ve=Me.paused)))},m.ondragover=e=>e.preventDefault(),m.ondrop=e=>{if(e.preventDefault(),e.stopPropagation(),!ie)return void alert("Click Required");let n=0===ye.length,r=e.dataTransfer.files;if(r.length>0)for(let e=0;e<r.length;e++){let n=r[e];["wav","mpeg","aac","ogg","flac"].some((e=>n.type.includes(e)))&&(ye.some((e=>e.name===n.name))||ye.push({name:n.name,url:URL.createObjectURL(n)}))}ye.length>0&&Me.paused&&n&&Ce(!0)};let be=[m.innerWidth,m.innerHeight],Te=e=>{be=[m.innerWidth,m.innerHeight],$.width=be[0],$.height=be[1],$.style.width=be[0]+"px",$.style.height=be[1]+"px",$.style.imageRendering="pixelated",a=Math.max(1,Math.round(Math.min(be[0],be[1])/(448*f)*4)/4),C.texImage2D(T,0,w,be[0]/a,be[1]/a,0,w,D,null),xe=!0},Ae=C.createTexture();H(Ae),Y(w,be[0]/a,be[1]/a,0,w,D,null),Z(z,U),Z(L,U),Z(X,N),Z(E,N),m.onresize=Te,Te();let De=e=>{Se=u.webkitIsFullScreen||u.mozFullScreen||u.fullscreenElement||!1,$.style.cursor=Se?"none":"auto"};m.addEventListener("fullscreenchange",De,!1),m.addEventListener("webkitfullscreenchange",De,!1),m.addEventListener("mozfullscreenchange",De,!1),m.onclick=async e=>{if(!l&&!ie){ie=new(window.AudioContext||window.webkitAudioContext),de=ie.createAnalyser(),de.fftSize=Fe,de.minDecibels=V,de.maxDecibels=F,pe=new Float32Array(Fe),le=new Float32Array(Fe),Ve=new Float32Array(Fe),navigator.mediaSession.setActionHandler("pause",(()=>{}));let e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:M,sampleRate:48e3,sampleSize:16,latency:0,volume:1},video:!1});oe=ie.createMediaStreamSource(e),me=ie.createGain(),oe.connect(me),me.connect(de),ue=ie.createMediaElementSource(Me),ce=ie.createGain(),ue.connect(ce),ce.connect(de),ce.connect(ie.destination)}},m.ondblclick=e=>{var n=c;e instanceof HTMLElement&&(n=e),n.requestFullScreen=n.requestFullScreen||n.webkitRequestFullScreen||n.mozRequestFullScreen||function(){return!1},u.cancelFullScreen=u.cancelFullScreen||u.webkitCancelFullScreen||u.mozCancelFullScreen||function(){return!1},Se?u.cancelFullScreen():n.requestFullScreen()};let we=((...e)=>{let n=C.createFramebuffer();G(n);let r=[W];return e.forEach(((e,n,t)=>{C.framebufferTexture2D(g,r[n],T,e,0)})),n})(Ae),ze=new se(C,y.v,y.d,["aPs","aTc"],["uRs","uTm","uSm","uWv","uCl","uRn"]),Le=_();O(P,Le),q(P,new Float32Array([0,1,0,0,1,0,1,1]),A);let Xe,Ee,Ne,Ue,ke,Be,We=new se(C,y.v,y.p,["aPs","aTc"],["uRs","uT0","uSm","uCl","uPX"],Le),_e=0,Ie=e=>{ke=Date.now(),Be&&Ee||(Be=ke,Ee=ke),l?(Ne=0,Ue=0,_e=0):(Ne=ke-Be,Ue=ke-Ee),ie&&(me&&ce&&(me.gain.value=Me.paused?1:0,ce.gain.value=Me.paused?0:1),ye.length>0&&Me.paused&&!ve&&Pe()),(Ne>Xe||l)&&(Be=ke-Ne%Xe,_e+=30*(o.samples[7]??0),l&&!xe||(Oe(),qe(),Ge(),xe=!1)),requestAnimationFrame(Ie)},Oe=r=>{if(!ie)return;de.getFloatFrequencyData(pe),de.getFloatTimeDomainData(Ve);let a=[];for(let e=0;e<le.length;e++){let r=(s=le[e],i=Ve[e],.005,m=Ne,void 0,void 0,void 0,u=s,c=i,(1-(d=1-Math.exp(-.005*m)))*u+d*c);le[e]=r,r=parseInt(n(r,-1,1,0,255)),a.push(r)}var s,i,m,u,c,d;let p=[];for(let e=0;e<a.length;e+=16){let n=0;for(let r=0;r<16;r++)n+=a[e+r];n/=16,p.push([n,n,n,n])}let l=new Uint8Array(p.flat());H(fe),Y(w,256,1,0,w,D,l);let V=0;for(let r=0;r<6;r++){let a=t(de,pe,he[r+0],he[r+1]);a=n(e(a,.15,1),.15,1,0,1),a=Math.pow(a,n(r,0,5,1,.3)),F=a,a=(F/=.5)<1?.5*F*F:-.5*(--F*(F-2)-1),o.samples[r]=a,V+=a}var F;o.samples[6]=V/6,o.samples[7]=Math.pow(n(V,0,5,0,1),1.4)},qe=e=>{re(),C.clear(C.COLOR_BUFFER_BIT|C.DEPTH_BUFFER_BIT),ze.useProgram(C),I(ze.vertexArray),G(we),K(ze.uTm,Ue+_e+x),ee(ze.uRs,[be[0]/a,be[1]/a]),Q(ze.uSm,o.samples),ne(ze.uCl,o.colors),Q(ze.uRn,o.randoms),J(ze.uWv,0),j(),H(fe),C.drawBuffers([W]),te(),ae()},Ge=e=>{re(),We.useProgram(C),G(null),I(We.vertexArray),ee(We.uRs,be),J(We.uT0,0),Q(We.uSm,o.samples),ne(We.uCl,o.colors),K(We.uPX,a),j(),C.bindTexture(T,Ae),te(),ae()};Xe=1e3/(p?30:60),requestAnimationFrame(Ie)})();
Inspired by my nostalgic love of rich worlds constructed in early video games using simple shapes with limited palettes, and the mesmerizing music visualization plugins that emerged in an era when sharing creativity online was a joyous pastime, this artwork reflects the playful media I have enjoyed over the years and aims to contribute more joy to the world.. **Interactions** **`click`** - allow microphone & activate audio **`drag & drop`** - add audio files to playlist **`spacebar`** - toggle playlist / microphone monitoring **`left/right arrows`** - next / previous track **`double click`** - toggle fullscreen **URL Configuration** **`quality=1`** - adjust pixelation (0.25 to 4,) **`maxDb=6`** - set max sample decibel (>0)\* **`minDb=120`** - set min sample decibel (>30)\* _\*Decibles will be interpreted as negative values_ `URL?quality=2&maxDb=12&minDb=96` **`static=true`** - render single frame (quality 4) **`time=1`** - advances time in seconds (1 to N) `URL?static=true&time=60`
let rngt,rngs,S=Uint32Array.from([0,1,rngs=rngt=2,3].map(i=>parseInt(tokenData.hash.substr(i*8+5,8),16)));R=(a=1)=>a*(rngt=S[3],S[3]=S[2],S[2]=S[1],S[1]=rngs=S[0],rngt^=rngt<<11,S[0]^=(rngt^rngt>>>8)^(rngs>>>19),S[0]/2**32);RT=(a=1)=>a*(R()-R());RV=(v)=>v[R(v.length)|0];C=(a)=>R()<a?1:0;acv=(n,c)=>{for(let i=0;i<n;i++){cv.push(c)}};mn=(...a)=>Math.min(...a);mx=(...a)=>Math.max(...a); let cols=[[44,14,85],[0,0,25],[6,55,52],[25,57,53],[50,53,54],[106,36,41],[220,42,47],[244,32,49]],ww,wh,w,h,p,pd,ar=3/4,gs,gr,rc=C(.5),bw=C(.1),cai=rc?C(.66):(2+R(6)|0),cbi=rc?bw?((cai+1)%2):(2+R(6)|0):(R(2)|0),cci=(C(.9)||bw)?cai:rc?(R(2)|0):(2+R(6)|0),cola=cols[cai],colb=cols[cbi],colc=cols[cci],gds=20,gdh=1+R(2)*0,pxn=.1+R(.2)+R()*R(.15),pyn0=.1+R(.2)+R()*R(.3),hv=(1-2*pxn)>(1/ar-2*pyn0),pSA=Math.PI*(C(.02)?(C(.5)?0:1):(((C(.5)?-1:1)-R(.7))/4+(C(.5)?1:0))+(hv?.5:0)),qdrt=((4+pSA/(Math.PI/2))|0)%4,Nx=5+(R()*R(200))|0,dxn=(1-2*pxn)/Nx,dyn=dxn,Ny=Math.round((1/ar-2*pyn0)/dyn),pyn=(1/ar-Ny*dyn)/2,pdn=C(.1)?0:(.05+R()*R(.35)),wp=2*pxn-.05,hp=2*pyn-.05,hs=Math.abs(Math.sin(pSA)),ws=Math.abs(Math.cos(pSA)),pSS=1000*mn(wp/ws,hp/hs)*(1-.9*R()),pRM=C(.75)?3:R(2)|0,pRMB=R()*R(.75),pOXY=C(.3),pSD1=C(.75)?0:((R(2)|0)+1),pSD2=C(.5),pBZ=C(.8)?0:(R(.3)),pCS=10+R(40)*R(),pSP=R(10),pSO=R(),pBD=C(.75)?0:(1+R(3)|0),pBD2=R(4)|0,pBB=R(),pSH=.05+R(.1),pMA=C(.5),pNS=(mn(Nx,Ny)*.25+RT(mn(Nx,Ny)*(Nx<50?.25:.1))+R()*R()*R(.5))|0,pTR=.05+R(),bhmMX=.005+R(.3)*R()*R(),lniw=mx((Nx*.15+R()*R(Nx*.45))|0,1),lni=(Nx/2+RT(Nx/3)-lniw/2)|0,lnjw=mx((Ny*.15+R()*R(Ny*.45))|0,1),lnj=(Ny/2+RT(Ny/3)-lnjw/2)|0,bvo=[],filled=[];for(let i=0;i<Nx*Ny;i++)filled[i]=0;if(lni<=0)lni=1;if(lni>=Nx-1)lni=Nx-2;if(lnj<=0)lnj=1;if(lnj>=Ny-1)lni=Ny-2;let pLY=1,pLX=0;if((C(.05))){pLX=1;pLY=1;}else if((C(.5))){pLX=1;pLY=0;}let dLX=(pLX)?1:0,dLY=(pLY)?1:0;if(dLX&&dLY){if(C(.5)){dLX=1;dLY=0}else{dLY=1;dLX=0}} findGrid=()=>{for(let i=0;i<Nx;i++){for(let j=0;j<Ny;j++){let ind=j*Nx+i;if(pLX&&i>=lni&&i<(lni+lniw))filled[ind]=1;if(pLY&&j>=lnj&&j<(lnj+lnjw))filled[ind]=1;}}Ntr=Nx*Ny*10;for(let tr=0;tr<Ntr;tr++){let ptr=tr/Ntr,nshort=1+(pNS*(1-ptr**pTR))|0,nlong=nshort+R(nshort*pSP)|0,nx=nshort,ny=nlong;if(C(pSO)){nx=nlong;ny=nshort;}let i=R(Nx-nx)|0,j=R(Ny-ny)|0;if(pSD1==1&&C(.95)){if(pSD2=1)i=(ptr*Nx)|0;else if(pSD2==2)i=((1-ptr)*Nx)|0}if(pSD1==2&&C(.95)){if(pSD2=1)j=(ptr*Ny)|0;else if(pSD2==2)i=((1-ptr)*Ny)|0}i=constrain(i,0,Nx-nx),j=constrain(j,0,Ny-ny);let flag=1;for(let it=i;it<i+nx;it++)for(let jt=j;jt<j+ny;jt++)if(filled[jt*Nx+it])flag=0;if(flag==0||nx>Nx||ny>Ny)continue;let bh=.1+R(.9),im=(i+nx/2)/Nx,jm=(j+ny/2)/Ny,ijm=.5;if(pBD==1)bh=1-R()*R(pBB);if(pBD==2)ijm=im;if(pBD==3)ijm=jm;if(pBD==2||pBD==3){if(pBD2==0)bh=ijm;if(pBD2==1)bh=1-ijm;if(pBD2==2)bh=sq(sin(PI*ijm));if(pBD2==3)bh=1-sq(sin(PI*ijm));}if(pBD>=2)bh+=RT(.1);if(bh<.005)bh=.005;bhm=C(pBZ)?-.5:(.005+R(bhmMX));if(pRM==0&&hv&&C(1-sin(PI*im)))bh=bhm;if(pRM==1&&hv&&C(sin(PI*im)))bh=bhm;if(pRM==0&&!hv&&C(1-sin(PI*jm)))bh=bhm;if(pRM==1&&!hv&&C(sin(PI*jm)))bh=bhm;if(pRM=3&&C(pRMB))bh=bhm;if(bh>1)bh=1;if(flag){for(let it=i;it<i+nx;it++)for(let jt=j;jt<j+ny;jt++)filled[jt*Nx+it]=1;bvo.push([i,j,nx,ny,bh,cola])}}} setup=()=>{findGrid();wh=windowHeight,ww=windowWidth;wh>=ww/ar?(w=ww,h=ww/ar):(w=wh*ar,h=wh);p=w/1000;createCanvas(ww,wh);gs=createGraphics(ww,wh); gr=createGraphics(ww,wh);pd=pixelDensity();let pdw=pd,pdh=pd;if(pd*wh<2000)pdh=Math.ceil(2000/wh);if(pd*ww<2000)pdw=Math.ceil(2000/ww);pd=mx(pdw,pdh);pixelDensity(pd);colorMode(HSL);noStroke();gs.pixelDensity(pd);gs.colorMode(HSL);gs.noStroke();gr.pixelDensity(pd);gr.colorMode(HSL);gr.noStroke();noLoop();} draw=()=>{let px=pxn*w,py=pyn*w,dx=dxn*w,dy=dyn*w,bpd=pdn*dx,xmin=ww,xmax=0,ymin=wh,ymax=0,bv=[];for(let b=0;b<bvo.length;b++){let bvoh=bvo[b],i=bvoh[0],j=bvoh[1],nx=bvoh[2],ny=bvoh[3],bh=bvoh[4],col=bvoh[5],bx=nx*dx-2*bpd,by=ny*dy-2*bpd,x=px+i*dx+bpd,y=py+j*dy+bpd,sx=bh*pSS*p*cos(pSA),sy=-bh*pSS*p*sin(pSA);bv.push([i,j,nx,ny,bh,col,bx,by,x,y,sx,sy]);if(bh==0)continue;xmin=mn(xmin,(qdrt==0||qdrt==3)?x:(x+sx));xmax=mx(xmax,(qdrt==0||qdrt==3)?(x+bx+sx):(x+bx));ymin=mn(ymin,(qdrt==2||qdrt==3)?y:(y+sy));ymax=mx(ymax,(qdrt==2||qdrt==3)?(y+by+sy):(y+by));}if(dLX&&abs(pSH*pSS*p*cos(pSA))>(lniw*dx-2*bpd)/3)pSH=(lniw*dx-2*bpd)/3/pSS/p/abs(cos(pSA));if(dLY&&abs(pSH*pSS*p*sin(pSA))>(lnjw*dx-2*bpd)/3)pSH=(lnjw*dx-2*bpd)/3/pSS/p/abs(sin(pSA));let xavg=(xmin+xmax)/2,yavg=(ymin+ymax)/2,tx=(ww-w)/2+(w/2-xavg),ty=(wh-h)/2+(h/2-yavg),offx=RT((w-(xmax-xmin))/2)*.9*pOXY,offy=RT((h-(ymax-ymin))/2)*.9*pOXY,sxd=pSH*pSS*p*cos(pSA),syd=-pSH*pSS*p*sin(pSA);cgrd(0,0,colb,0,1);rect(0,0,ww,wh);gs.fill(0);gs.rect(-ww,-wh,3*ww,3*wh);gs.erase();if(dLX)gs.rect(tx+px+lni*dx+bpd+sxd,0,lniw*dx-2*bpd,wh);if(dLY)gs.rect(0,ty+py+lnj*dy+bpd+syd,ww,lnjw*dy-2*bpd);for(let ib=0;ib<bv.length;ib++){let i=bv[ib][0],j=bv[ib][1];bv[ib][8]+=tx;bv[ib][9]+=ty;if(dLX&&pMA){if(i>lni)bv[ib][9]+=offy;else bv[ib][9]+=-offy;} if(dLY&&pMA){if(j>lnj)bv[ib][8]+=offx;else bv[ib][8]+=-offx;}}for(let ib=0;ib<bv.length;ib++){let b=bv[ib];let bh=b[4],bx=b[6],by=b[7],x=b[8],y=b[9];if(bh<0)gs.rect(x+sxd,y+syd,bx,by);}gs.noErase();for(let ib=0;ib<bv.length;ib++){let b=bv[ib];let bh=b[4],bx=b[6],by=b[7],x=b[8],y=b[9],sx=b[10],sy=b[11],xp=[x,x,x+bx,x+bx],yp=[y,y+by,y+by,y];if(bh>0){gs.beginShape();for(let i=0;i<3;i+=2)gs.vertex(xp[(i+qdrt)%4],yp[(i+qdrt)%4]);for(let i=0;i<3;i++)gs.vertex(sxd+sx+xp[(i+qdrt+2)%4],syd+sy+yp[(i+qdrt+2)%4]);gs.endShape();}}push();tint(100,.85);image(gs,0,0);pop();gs.clear();cgrd(0,0,cola,gr,1);gr.rect(0,0,ww,wh);cgrd(0,0,colc,gr,1);if(dLX)gr.rect(tx+px+lni*dx+bpd+lniw*dx-2*bpd,0,ww,wh);if(dLY)gr.rect(0,ty+py+lnj*dy+bpd+lnjw*dy-2*bpd,ww,wh);gs.fill(0);for(let ib=0;ib<bv.length;ib++){let b=bv[ib];let bh=b[4],bx=b[6],by=b[7],x=b[8],y=b[9],sx=b[10],sy=b[11],xp=[x,x,x+bx,x+bx],yp=[y,y+by,y+by,y];if(bh>0){gs.beginShape();for(let i=0;i<3;i+=2)gs.vertex(xp[(i+qdrt)%4],yp[(i+qdrt)%4]);for(let i=0;i<3;i++)gs.vertex(sx+xp[(i+qdrt+2)%4],sy+yp[(i+qdrt+2)%4]);gs.endShape()}}gr.push();gr.tint(100,.85);gr.image(gs,0,0);gr.pop();gr.erase();if(dLX)gr.rect(tx+px+lni*dx+bpd,0,lniw*dx-2*bpd,wh);if(dLY)gr.rect(0,ty+py+lnj*dy+bpd,ww,lnjw*dy-2*bpd);gr.noErase();gr.erase();for(let ib=0;ib<bv.length;ib++){let b=bv[ib],bh=b[4],bx=b[6],by=b[7],x=b[8],y=b[9];if(bh<0)gr.rect(x,y,bx,by);}gr.noErase();image(gr,0,0);gr.remove();for(let ib=0;ib<bv.length;ib++){let b=bv[ib];let i=b[0],j=b[1],bh=b[4],col=b[5],bx=b[6],by=b[7],x=b[8],y=b[9];gr1=createGraphics(bx,by);gr1.colorMode(HSL);gr1.noStroke();gr1.pixelDensity(pd);if((j>lnj&&dLY)||(i>lni&&dLX))col=colc;if(bh<=0)continue;cgrd(x,y,[col[0],col[1],col[2]+10*bh],gr1,-1);gr1.rect(0,0,bx,by);gr2=createGraphics(bx,by);gr2.colorMode(HSL);gr2.noStroke();gr2.pixelDensity(pd);gr2.fill(0);for(let ob=0;ob<bv.length;ob++){bo=bv[ob];let io=bo[0],jo=bo[1],bho=bo[4],bxo=bo[6],byo=bo[7],xo=bo[8]-x,yo=bo[9]-y;if(qdrt<=1 && jo<j)continue;if(qdrt>1&&jo>j)continue;if((qdrt==0||qdrt==3)&&io>i)continue;if((qdrt==1||qdrt==2)&&io<i)continue;let xp=[xo,xo,xo+bxo,xo+bxo],yp=[yo,yo+byo,yo+byo,yo],sxo=(bho-bh)*pSS*p*cos(pSA),syo=-(bho-bh)*pSS*p*sin(pSA);if(bho-bh>0){gr2.beginShape();for(let i=0;i<3;i+=2)gr2.vertex(xp[(i+qdrt)%4],yp[(i+qdrt)%4]);for(let i=0;i<3;i++)gr2.vertex(sxo+xp[(i+qdrt+2)%4],syo+yp[(i+qdrt+2)%4]);gr2.endShape();}}gr1.tint(100,.85);gr1.image(gr2,0,0);image(gr1,x,y);gr1.remove();}loadPixels();for(let p=0;p<pixels.length;p+=4){dp=RT(6);pixels[p]=pixels[p]+dp;pixels[p+1]=pixels[p+1]+dp;pixels[p+2]=pixels[p+2]+dp;}updatePixels();} cgrd=(x,y,c,gcg,d)=>{let gd;if(gcg==0)gd=drawingContext.createLinearGradient(ww/2-gdh*h*cos(pSA)+d*x,wh/2+gdh*h*sin(pSA)+d*y,ww/2+gdh*h*cos(pSA)+d*x,wh/2-gdh*h*sin(pSA)+d*y);else gd=gcg.drawingContext.createLinearGradient(ww/2-gdh*h*cos(pSA)+d*x,wh/2+gdh*h*sin(pSA)+d*y,ww/2+gdh*h*cos(pSA)+d*x,wh/2-gdh*h*sin(pSA)+d*y);gd.addColorStop(0.0,color(c[0],c[1],c[2]+gds));gd.addColorStop(0.5,color(c[0],c[1],c[2]));gd.addColorStop(1.0,color(c[0],c[1],c[2]-gds));if(gcg==0)drawingContext.fillStyle=gd;else gcg.drawingContext.fillStyle=gd;}
The exploitation of natural resources presents an inherent imbalance. While profits stack up, the true costs distribute. _StackSlash_ utilizes a 2D rigid-body physics engine for composition. Rectangular bodies are placed within a scene and the forces of gravity and collision guide them into a stable resting state. The rendering of the system occurs in two parts: While interacting, the bodies are rendered in a 2D canvas to allow fluid manipulation. Once the system arrives in a stable configuration, a heavier WebGL rendering step creates and applies surface textures to the bodies. The system is fully responsive and can extend to any viewport size upon interaction. The composition is initially presented in its default 3:4 deterministic state.
turn vec2(cr*(st.x)+sr*(st.y)+.5,cr*(st.y)-sr*(st.x)+.5);}\nfloat rand(vec2 st){return fract(sin(dot(st,vec2(12.9898,78.233)))*43758.5453);}\nvec2 gO(vec3 bdP){\nvec2 pos=bdP.xy/uVp.xy;\npos.y=(1.-pos.y)/uVp.z;\nreturn pos;\n}\nfloat rect(vec2 st,vec3 bdP,vec2 bdS){\nfloat x=(1.-bdS.x/max(uVp.z,1.)/(1./uB))/2.; \nfloat y=(1.-bdS.y/max(uVp.z,1.)/(1./uB))/2.;\nst=rUV(st-gO(bdP),PI-bdP.z);\nvec2 bl=smoothstep(vec2(x-F,y-F),vec2(x+F,y+F),st);\nvec2 tr=smoothstep(vec2(x-F,y-F),vec2(x+F,y+F),1.-st);\nreturn bl.x*bl.y*tr.x*tr.y;\n}\nvec2 tU(vec2 st,vec3 bdP,vec2 bdS,int i){\nreturn rUV((st-gO(bdP))*(1./uB)*max(uVp.z, 1.),PI*.5-bdP.z)*vec2(1.,1./uBr)*vec2(1./uTl,1.)+vec2(.5*max(1.-uTl,0.)+(1./uTl)*floor(float(i/8)),0.); \n}\nfloat tM(int i,int offset){return step(float(i+offset&7),0.);}\nvoid main(){\nvec2 uv=vUv;\nuv.y/=uVp.z;\nvec4 b=vec4(31./255.,30./255.,28./255.,1.);\nvec4 w=vec4(249./255.,241./255.,234./255.,1.);\nvec4 c=mix(w,b,uI);\nfor (int i=0;i<COUNT;i++){\nvec3 bdP=uBdP[i];\nvec2 bdS=uBdS[i];\nfloat r=rect(uv,bdP,bdS);\nc = max(c-r,0.);\nc+=r*tM(i,0)*texture(uTx[0],tU(uv,bdP,bdS,i));\nc+=r*tM(i,1)*texture(uTx[1],tU(uv,bdP,bdS,i));\nc+=r*tM(i,2)*texture(uTx[2],tU(uv,bdP,bdS,i));\nc+=r*tM(i,3)*texture(uTx[3],tU(uv,bdP,bdS,i));\nc+=r*tM(i,4)*texture(uTx[4],tU(uv,bdP,bdS,i));\nc+=r*tM(i,5)*texture(uTx[5],tU(uv,bdP,bdS,i));\nc+=r*tM(i,6)*texture(uTx[6],tU(uv,bdP,bdS,i));\nc+=r*tM(i,7)*texture(uTx[7],tU(uv,bdP,bdS,i));\n}\nc=clamp(c,b,w)+.18*max(c-w,0.);\nc+=(rand(uv*10.)*2.-1.)*.025;\nfc=c;\n}\n`,u),_=tt(h,et,"#version 300 es\nprecision highp float;\n#define PI 3.1415926535\nin vec2 vUv;\nuniform vec2 uS;\nuniform vec3 uVp,uSu;\nuniform vec4 uCl;\nuniform float uT,uZ,uA,uM,uC,uTn,uTl,uI;\nout vec4 fc;\nmat2 r2d(float t){return mat2(cos(t),sin(t),-sin(t),cos(t));}\n// Noise, Copyright (C) 2011 Ian McEwan, Ashima Arts, MIT License\nfloat rand(vec2 st){return fract(sin(dot(st,vec2(12.9898,78.233)))*43758.5453);}\nvec3 mod289(vec3 x){return x-floor(x*(1./289.))*289.;}vec2 mod289(vec2 x){return x-floor(x*(1./289.))*289.;}vec3 permute(vec3 x){return mod289(((x*34.)+1.)*x);}float noise(vec2 v){const vec4 C=vec4(.211324865405187,.366025403784439,-.577350269189626,.024390243902439);vec2 i=floor(v+dot(v,C.yy));vec2 x0=v-i+dot(i,C.xx);vec2 i1;i1=(x0.x>x0.y)?vec2(1.,0.):vec2(0.,1.);vec4 x12=x0.xyxy+C.xxzz;x12.xy-=i1;i=mod289(i);vec3 p=permute(permute(i.y+vec3(0.,i1.y,1.))+i.x+vec3(0.,i1.x,1.));vec3 m=max(.5-vec3(dot(x0,x0),dot(x12.xy,x12.xy),dot(x12.zw,x12.zw)),0.);m=m*m;m=m*m;vec3 x=2.*fract(p*C.www)-1.;vec3 h=abs(x)-.5;vec3 ox=floor(x+.5);vec3 a0=x-ox;m*=1.79284291400159-.85373472095314*(a0*a0+h*h);vec3 g;g.x=a0.x*x0.x+h.x*x0.y;g.yz=a0.yz*x12.xz+h.yz*x12.yw;return 130.*dot(m,g);}\n#define O 6\nfloat fbm(vec2 uv){\nfloat v=0.,a=.16+.04*uA;\nmat2 rot=mat2(cos(.5),sin(.5),-sin(.5),cos(.5));\nfor(int i=0;i<O;++i){\nv+=a*noise(uv+(uS*2.-1.));\nuv=rot*uv*-2.;a*=.46+.04*uM;\n}\nreturn v;\n}\nfloat frm(vec2 p,float s){return fbm(p+fbm(p+fbm(p+fbm(p+fbm(p+fbm(p+fbm(p+fbm(p+fbm(p+fbm(p*s))))))))));}\nvoid main(){\nvec2 uv=vUv;\nuv.x+=10.*sin(uT*.00001);\nuv.x*=uTl;\nuv*=r2d(PI*-.5);\nvec3 c=vec3(uTn);\nfloat rib=sin((uv.x+uSu.z)*uSu.x+uv.y*uSu.y)*.5+.5;\nuv+=vec2(rib,uv.y+.33*uv.x)*.2;\nc.rgb+=pow(rib,1.5)*.18;\nfloat zoom=.5+.5*uZ;\nc+=(1.3+.2*uC+1.5*uI)*frm(uv,zoom);\nc*=1.-.6*uI;\nc+=2.*vec3(.6,.3+.5*pow(uCl.g,3.)*uCl.a,.15+.5*pow(uCl.b,3.)*uCl.a)*frm(uv*.17,zoom*.88);\nc+=2.*vec3(.6+.4*pow(uCl.r,3.)*uCl.a,.4,.2)*frm(uv*.66,zoom*1.93);\nc+=(rand(uv*10.)*2.-1.)*.025;\nfc=vec4(c,1.);\n}\n",u);let I=!1,T=!1,M=!1,U=!1,R=!1,L=!1,D=!1;const k=Ct[7][1]===wt;let F,O,V,z,X,N,Y,G,W,$=0,J=0,Q=0,nt=[[0,0],[0,0],[0,0]];const at=[];for(let t=0;8>t;t++)at.push([...w(.05)?[0,0,0]:w(.05)?[1,1,1]:[B(.2,1),B(.2,1),B(.2,1)],(ot=Ct[4][1],ot===ft?B(0,.25):ot===yt?B(.25,.5):ot===mt?B(.6,.75):ot===ht?B(.85,.95):B(.05,1))]);var ot;const st=(t=>{for(var e,r,n=t.length,a=[...t];n;)e=~~(A()*n--),r=a[n],a[n]=a[e],a[e]=r;return a})(x).slice(0,2),it=t=>{const e=[x[0],0,0];return t===ct?(e[0]=x[1],e[2]=.28):t===pt?e[0]=x[2]:t===xt?e[0]=x[3]:t===ut?e[0]=x[4]:t===vt?e[0]=x[0]+(x[~~(A()*x.length)]-x[0]):t===dt&&(e[0]=st[w()?0:1]),e},lt=at.map((([t,e,r,n])=>[["uS","v2",[B(1,2),B(1,2)]],["uZ","f",A()],["uA","f",A()],["uM","f",A()],["uC","f",A()],["uTn","f",n],["uCl","v4",[t,e,r,Ct[4][1]===bt?1:0]],["uSu","v3",it(Ct[3][1])],["uTl","f",P.config[2]],["uI","f",k?1:0]])),Bt=[],_t=t=>{j.ud(S,t[0]||1e3/120),P.frame(t,L),J++},It=()=>{U=!1},Tt=t=>t.__size,Mt=t=>[t.pos.x*G[0],t.pos.y*G[1],t.a],Ut=()=>{zt(!0),U=!0,c((()=>{(t=>{const e=Y[2]*P.config[1]*P.config[2],r=.2*e;_.resize(e,r,e/2,r/2);let n=0;const a=()=>{n++,n===Bt.length&&c(t)};lt.forEach(((t,e)=>{_.frame([W,$],t),Bt[e]=new Image,Bt[e].onload=a,Bt[e].src=h.toDataURL()}))})((()=>{C.frame([W,$],[["uB","f",P.config[1]],["uBr","f",.2],["uBdS","v2[]",Float32Array.from(P.bodies().flatMap(Tt))],["uBdP","v3[]",Float32Array.from(P.bodies().flatMap(Mt))],["uTx","t[]",Bt,"REPEAT","LINEAR"],["uTl","f",P.config[2]],["uI","f",k?1:0]]),E.clear(),zt(!1)}))}))},Rt=()=>{F=t.innerWidth,V=t.innerHeight,(M||F!==O||V!==z)&&(O=F,z=V,X=F/V,!M&&(X>=l?F=~~(V*l):V=~~(F/l),X=l),N=s(t.devicePixelRatio,2),Y=[F,V,F*N,V*N,X,N],f(p,{width:`${F}px`,height:`${V}px`}),P.resize(Y),G=[Y[2]/P.size()[0],Y[3]/P.size()[1]],E.resize(Y[2],Y[3],Y[0],Y[1]),C.resize(Y[2],Y[3],Y[0],Y[1]),It())},Lt=()=>{const t=performance.now();W=s(t-Q,1e3/30),Q=t,$+=W,U||(_t([W,$,J]),R=P.resting(),R&&!L?!D&&(Ut(),D=!0):(E.frame(Y[2],Y[3],G,P.bodies(),k),D=!1)),c(Lt)},Dt=({clientX:t,clientY:e},r,n)=>{nt[0]=[t/Y[0],e/Y[1]],r&&(nt[1]=nt[0],L=!0,M||(M=!0,Rt()),It()),nt[2]=[nt[0][0]-nt[1][0],nt[0][1]-nt[1][1]],n&&(((t,e=[0,0])=>{o((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1]))})(nt[2]),L=!1)},kt=t=>Dt(t,!0),Ft=t=>Dt(t),Ot=t=>Dt(t,!1,!0);i(t,"resize",Rt),i(t,"keydown",(t=>{" "===t.key.toLowerCase()&&((t=>{t.preventDefault()})(t),U=!U)})),i(t,"keyup",(t=>{const e=t.key.toLowerCase();"r"===e&&Ut(),"s"===e&&(async(t,e)=>{(async(t,e)=>{const r=document,n=window.URL.createObjectURL(t),a=r.body.appendChild(r.createElement("a"));a.href=n,a.download=e,a.click(),r.body.removeChild(a),window.URL.revokeObjectURL(n)})((t=>{let e=window.atob(t.split(",")[1]),r=new ArrayBuffer(e.length),n=new Uint8Array(r);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return new Blob([new DataView(r)],{type:t.split(",")[0].split(":")[1].split(";")[0]})})(t),e)})(y.toDataURL("image/png"),`stackslash-${Date.now()}-${Et}.png`),"`"===e&&Vt(!I)})),i(p,"mousedown",kt),i(e,"mousemove",Ft),i(e,"mouseup",Ot),i(p,"touchstart",(t=>{t.clientX=t.touches[0].clientX,t.clientY=t.touches[0].clientY,kt(t)})),i(e,"touchmove",(t=>{t.clientX=t.touches[0].clientX,t.clientY=t.touches[0].clientY,Ft(t)})),i(e,"touchend",(t=>{t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY,Ot(t)})),f(r,{touchAction:"none",margin:0,display:"flex",alignItems:"center",background:d}),f(p,{position:"relative",margin:"0 auto"}),f(m,{pointerEvents:"none",position:"absolute",inset:0}),f(y,{background:k?d:v}),f(h,{pointerEvents:"none",position:"absolute",right:0,bottom:0}),f(b,{position:"absolute",inset:0,background:"rgba(31, 30, 28, 0.2)"}),f(g,{position:"absolute",inset:"50%",width:"20px",height:"80px",margin:"-40px 0 0 -10px",background:v,animation:"3s linear infinite spin"}),a(e.head,n("style")).innerHTML="@keyframes spin{from{transform:none}to{transform:rotate(360deg)}}";const Vt=t=>{I=t,f(h,{display:I?"block":"none"})},zt=t=>{T=t,f(b,{display:T?"block":"none"})};Vt(!1),Rt(),(()=>{for(let t=0;t<1800;t++)_t([0,0,J]);Ut()})(),c(Lt)})()})();
.t=0},_bdAG:(t,e)=>{var r=void 0===e.scl?.001:e.scl;if((0!==e.x||0!==e.y)&&0!==r)for(var n,a=0;a<t.length;a++)(n=t[a]).iSt||(n.f.y+=n.m*e.y*r,n.f.x+=n.m*e.x*r)},_bdU:(t,e,r,n)=>{for(var a,o=0;o<t.length;o++)(a=t[o]).iSt||M.ud(a,e,r,n)}},W={cr:t=>{var e={};return e.el=t||document.body,e.abs={x:0,y:0},e.pos={x:0,y:0},e.md={x:0,y:0},e.mu={x:0,y:0},e.offset={x:0,y:0},e.scl={x:1,y:1},e.button=-1,e.pixelRatio=parseInt(e.el.getAttribute("data-pixel-ratio"),10)||1,e.sourceEvents={mousemove:null,mousedown:null,mouseup:null},e.mousemove=t=>{var r=W._gRlM(t,e.el,e.pixelRatio);t.changedTouches&&(e.button=0,t.preventDefault()),e.abs.x=r.x,e.abs.y=r.y,e.pos.x=e.abs.x*e.scl.x+e.offset.x,e.pos.y=e.abs.y*e.scl.y+e.offset.y,e.sourceEvents.mousemove=t},e.mousedown=t=>{var r=W._gRlM(t,e.el,e.pixelRatio);t.changedTouches?(e.button=0,t.preventDefault()):e.button=t.button,e.abs.x=r.x,e.abs.y=r.y,e.pos.x=e.abs.x*e.scl.x+e.offset.x,e.pos.y=e.abs.y*e.scl.y+e.offset.y,e.md.x=e.pos.x,e.md.y=e.pos.y,e.sourceEvents.mousedown=t},e.mouseup=t=>{var r=W._gRlM(t,e.el,e.pixelRatio);t.changedTouches&&t.preventDefault(),e.button=-1,e.abs.x=r.x,e.abs.y=r.y,e.pos.x=e.abs.x*e.scl.x+e.offset.x,e.pos.y=e.abs.y*e.scl.y+e.offset.y,e.mu.x=e.pos.x,e.mu.y=e.pos.y,e.sourceEvents.mouseup=t},W.sEl(e,e.el),e},sEl:(t,e)=>{t.el=e,e.addEventListener("mousedown",t.mousedown),document.addEventListener("mousemove",t.mousemove),document.addEventListener("mouseup",t.mouseup),e.addEventListener("touchstart",t.mousedown),document.addEventListener("touchmove",t.mousemove),document.addEventListener("touchend",t.mouseup)},clSrcE:t=>{t.sourceEvents.mousemove=null,t.sourceEvents.mousedown=null,t.sourceEvents.mouseup=null},sO:(t,e)=>{t.offset.x=e.x,t.offset.y=e.y,t.pos.x=t.abs.x*t.scl.x+t.offset.x,t.pos.y=t.abs.y*t.scl.y+t.offset.y},sScl:(t,e)=>{t.scl.x=e.x,t.scl.y=e.y,t.pos.x=t.abs.x*t.scl.x+t.offset.x,t.pos.y=t.abs.y*t.scl.y+t.offset.y},_gRlM:(t,e,r)=>{var n,a,o=e.getBoundingClientRect(),s=document.documentElement||document.body.prNode||document.body,i=void 0===window.pageXOffset?s.scrollLeft:window.pageXOffset,l=void 0===window.pageYOffset?s.scrollTop:window.pageYOffset,c=t.changedTouches;return c?(n=c[0].pageX-o.left-i,a=c[0].pageY-o.top-l):(n=t.pageX-o.left-i,a=t.pageY-o.top-l),{x:n/(e.clientWidth/(e.width||e.clientWidth)*r),y:a/(e.clientHeight/(e.height||e.clientHeight)*r)}}},$={cr:(t,e)=>{var r=(t?t.mouse:null)||(e?e.mouse:null);r||(r=t&&t.render&&t.render.canvas?W.cr(t.render.canvas):e&&e.el?W.cr(e.el):W.cr());var n={type:"mouseConstraint",mouse:r,el:null,body:null,constraint:N.cr({l:"Mouse Constraint",ptA:r.pos,ptB:{x:0,y:0},length:.01,st:.1,aSt:1}),cF:{category:1,mask:4294967295,group:0}},a=C.xt(n,e);return((t,e,r)=>{for(var n,a=e.split(" "),o=0;o<a.length;o++)n=a[o],t.events=t.events||{},t.events[n]=t.events[n]||[],t.events[n].push(r)})(t,"beforeUpdate",(()=>{var e=X.allBd(t.world);$.ud(a,e),$._tE(a)})),a},ud:(t,e)=>{var r=t.mouse,n=t.constraint,a=t.body;if(0!==r.button)n.bdB=t.body=null,n.ptB=null,a&&z(t,"enddrag",{mouse:r,body:a});else if(n.bdB)n.ptA=r.pos;else for(var o=0;o<e.length;o++)if(a=e[o],T.cont(a.b,r.pos)&&Y.cCol(a.cF,t.cF))for(var s,i=1<a.pt.length?1:0;i<a.pt.length;i++)if(s=a.pt[i],I.cont(s.vt,r.pos)){n.ptA=r.pos,n.bdB=t.body=a,n.ptB={x:r.pos.x-a.pos.x,y:r.pos.y-a.pos.y},n.aB=a.a,z(t,"startdrag",{mouse:r,body:a});break}},_tE:t=>{var e=t.mouse,r=e.sourceEvents;r.mousemove&&z(t,"mousemove",{mouse:e}),r.mousedown&&z(t,"mousedown",{mouse:e}),r.mouseup&&z(t,"mouseup",{mouse:e}),W.clSrcE(e)}};const H=(t,e,r,n,a)=>{t.width=e,t.height=r,f(t,{width:`${n}px`,height:`${a}px`})},q=(t,e)=>{t.save(),e(),t.restore()},K=(t,e,r=[1,1])=>{t.moveTo(e[0].x*r[0],e[0].y*r[1]);for(let n=1,a=e.length;n<a;n++)t.lineTo(e[n].x*r[0],e[n].y*r[1])},Z=t=>t.clearRect(0,0,t.canvas.width,t.canvas.height);const J=(t,e,r)=>{const n=t.createShader(e);return t.shaderSource(n,r),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)?n:void t.deleteShader(n)},Q=(t,e,r=0,n=t.CLAMP_TO_EDGE,a=t.NEAREST)=>{const o=t.createTexture();return t.activeTexture(t.TEXTURE0+r),t.bindTexture(t.TEXTURE_2D,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,a),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),o};var tt=(t,e,r,n)=>{const a=t.getContext("webgl2",n);a.drawingBufferColorSpace="display-p3",a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!0);const o=((t,e,r)=>{const n=t.createProgram();return t.attachShader(n,e),t.attachShader(n,r),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)?n:void t.deleteProgram(n)})(a,J(a,a.VERTEX_SHADER,e),J(a,a.FRAGMENT_SHADER,r)),s=a.getAttribLocation(o,"aPos"),i=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,i),a.bufferData(a.ARRAY_BUFFER,new Float32Array([-1,-1,-1,3,3,-1]),a.STATIC_DRAW);const l=a.createVertexArray();a.bindVertexArray(l),a.enableVertexAttribArray(s),a.bindBuffer(a.ARRAY_BUFFER,i),a.vertexAttribPointer(s,2,a.FLOAT,!1,0,0),a.bindVertexArray(null);const c=[];let p,x=()=>{},u=()=>{};const v=()=>a.clear(a.COLOR_BUFFER_BIT);return{resize:(...e)=>x=((e,r,n,a)=>(x(),H(t,e,r,n||e,a||r),p=[e,r,e/r],v(),()=>{}))(...e),frame:(...t)=>u=((t,e)=>{u(),a.viewport(0,0,p[0],p[1]),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),a.useProgram(o),a.bindVertexArray(l);let r=0;return[["uVp","v3",p],["uT","f",t[1]],...e.map((t=>("t"===t[1]&&(c[t[0]]=[Q(a,t[2],r,a[t[3]],a[t[4]]),r++]),"t[]"===t[1]&&(c[t[0]]=[[],[]],t[2].forEach((e=>{c[t[0]][0].push(Q(a,e,r,a[t[3]],a[t[4]])),c[t[0]][1].push(r++)}))),t)))].forEach((([t,e,r])=>((t,[e,r,n,a])=>{"b"===e?t.uniform1i(n,!0===r?1:0):"i"===e?t.uniform1i(n,r):"i[]"===e?t.uniform1iv(n,r):"f"===e?t.uniform1f(n,r):"f[]"===e?t.uniform1fv(n,r):"v2"===e?t.uniform2f(n,...r):"v2[]"===e?t.uniform2fv(n,r):"v3"===e?t.uniform3f(n,...r):"v3[]"===e?t.uniform3fv(n,r):"v4"===e?t.uniform4f(n,...r):"v4[]"===e?t.uniform4fv(n,r):"t"===e?t.uniform1i(n,a):"t[]"===e&&t.uniform1iv(n,a)})(a,[e,"t"===e||"t[]"===e?c[t][0]:r,a.getUniformLocation(o,t),"t"===e||"t[]"===e?c[t][1]:-1]))),a.drawArrays(a.TRIANGLES,0,3),()=>{}})(...t),clear:v}};const et="#version 300 es\nin vec2 aPos;\nout vec2 vUv;\nvoid main(){gl_Position=vec4(aPos*2.-1.,0.,1.);vUv=aPos;}\n",rt={FEW:"Few",SOME:"Some",MANY:"Many",LOADED:"Loaded",GREEDY:"Greedy"},nt="Full",at="Uniform",ot="Split",st="Full",it="Uniform",lt="Split",ct="Crystal",pt="Ribbed",xt="Knurly",ut="Lenticular",vt="Mixed",dt="Split",ft="Dark",yt="Amber",mt="Bright",ht="Crystal",bt="Colour",gt="None",At="Left",St="Right",wt="Dark",Bt=[["Count",[[rt.FEW,40],[rt.SOME,40],[rt.MANY,10],[rt.LOADED,7],[rt.GREEDY,3]]],["Lengths",[["Mixed",50],[nt,30],[at,10],[ot,10]]],["Breadths",[[st,80],[it,5],["Mixed",5],[lt,10]]],["Surfaces",[["Squared",40],[ct,20],[pt,5],[xt,5],[ut,5],[vt,15],[dt,10]]],["Tint",[["Mixed",20],[ft,10],[yt,5],[mt,20],[ht,5],[bt,40]]],["Side",[["None",90],[At,5],[St,5]]],["Gravity",[["Down",70],[gt,25],["Up",5]]],["Base",[["Light",60],[wt,40]]]];var Pt=(t,e,r)=>{const n=(t=>{const e=Object.values(rt).indexOf(t),r=0<e?((t,e,r)=>Math.max(s(t,4),2))(e*e):1;return[c[e],p[e],r]})(r[0][1]),[a,o]=n,l=()=>X.allBd(t.world).filter((t=>!t.iSt));let x,u,v,d,f,y,m,h,b=[i,i],g=[],S=[],P=[],C=[],_=!1,I=0,T=()=>{};let U=()=>{};return{config:n,resize:(...n)=>T=(n=>{T(),_=!1,I=0;const l=!!S.length;x=n[4],v=1<=x,d=i*(v?x:1),f=d/2,y=i/(v?1:x),m=y/2,h=.1*s(d,y);const c=x>u?1:-1;u=x,b=[d,y];const p=(t=0,e=0,r,n)=>R(t,e,r,n,{iSt:!0,fr:0});g=[p(-f+h,m,d,4*y),p(d+f-h,m,d,4*y),p(f,-m+h,2*d,y),p(f,y+m-h,2*d,y)],X.add(t.world,g);const U=B(.75,.9),L=B(.75,.9),D=t=>{var e=Math.PI;const n=s(...b)*o,a=l?C[t][1]:(u=r[1][1])===nt?1:u===at?U:u===ot?w()?.4:1:B(.33,1),i=l?C[t][0]:.2*(t=>t===st?1:t===it?L:t===lt?w()?B(.75,.8):B(.95,1):B(.75,1))(r[2][1]),p=l?[S[t][0]*d,S[t][1]*y]:[B(0,d),B(0,y)],x=R(...p,n*i,n*a,{r:.2,fr:.2,a:l?P[t]:A()*e*2});var u;return x.__index=t,x.__size=[i,a],l&&M.af(x,x.pos,E.cr(0,-(0<c?.02:.005)*x.m*B(.5,1))),x},k=[];for(let t=0;t<a;t++)k.push(D(t));X.add(t.world,k);const F=W.cr(e),O=$.cr(t,{mouse:F,constraint:{st:.05,da:.9}});return W.sScl(F,E.cr(d/n[0],y/n[1])),X.add(t.world,O),()=>{S=k.map((t=>[t.pos.x/d,t.pos.y/y])),P=k.map((t=>t.a)),C=k.map((t=>t.__size)),X.rm(t.world,[...g,...k,O])}})(...n),frame:(...t)=>U=((t,e)=>{U();const r=l();_=!0,I=e?0:I+t[0],I<=1e3&&(_=!1);for(let e=0,n=r.length;e<n;e++){const n=r[e];if(n.s>.5){_=!1,I=0;break}t[2]<450&&M.af(n,n.pos,E.cr(.03*d*B(-1,1),.03*d*B(-1,1)))}return()=>{}})(...t),size:()=>[...b],bodies:l,resting:()=>_}};const Et="undefined"==typeof tokenData?(()=>{let t="0x";for(let e=64;0<e;--e)t+="0123456789abcdef"[~~(16*Math.random())];return t})():"string"==typeof tokenData?tokenData:tokenData.hash;(t=>{const e=~~((t.length-2)/2),r=[];for(let n=0;n<e;n++){const e=2+2*n;r.push(parseInt(t.slice(e,e+2),16))}const n=S(r,1690382925),a=S(r,72970470);g.setUint32(0,n),g.setUint32(4,a)})(Et);const Ct=Bt.map((t=>{const e=t[1].map((t=>t[1]));return[t[0],t[1][P(e)][0]]}));console.log(`${Et}\n`,...Ct.map((t=>`\n${t[0]}: ${t[1]}`))),(()=>{const t=window,e=document,r=e.body,n=(t="canvas")=>e.createElement(t),a=(t,e)=>t.appendChild(e),i=(t,e,r)=>t.addEventListener(e,r),c=e=>t.requestAnimationFrame(e),p=a(r,n("main")),y=a(p,n()),m=a(p,n()),h=a(r,n()),b=a(r,n("div")),g=a(b,n("div")),S=j.cr({gravity:((t,e,r)=>{const n=r===rt.GREEDY?.2:r===rt.LOADED?.33:1;return{x:n*(t===At?-1:t===St?1:0),y:n*(e===gt?0:"Up"===e?-1:1)}})(Ct[5][1],Ct[6][1],Ct[0][1])}),P=Pt(S,p,Ct),E=(t=>{const e=t.getContext("2d");let r=()=>{},n=()=>{};return{resize:(...e)=>r=((e,n,a,o)=>(r(),H(t,e,n,a,o),()=>{}))(...e),frame:(...t)=>n=((t,r,a,o,s)=>{n(),Z(e),q(e,(()=>{e.fillStyle=s?d:v,e.globalAlpha=.7,e.fillRect(0,0,t,r)}));for(let t=0,r=o.length;t<r;t++){const r=o[t];q(e,(()=>{r.iSt||(e.beginPath(),K(e,[...r.vt,r.vt[0]],a),e.closePath(),e.fillStyle=s?v:d,e.fill())}))}return()=>{}})(...t),clear:()=>Z(e)}})(m),C=tt(y,et,`#version 300 es\nprecision highp float;\n#define COUNT ${P.config[0]}\n#define PI 3.1415926535\n#define F .0005\nin vec2 vUv;\nuniform vec2 uBdS[COUNT];\nuniform vec3 uVp,uBdP[COUNT];\nuniform float uT,uB,uBr,uTl,uI;\nuniform sampler2D uTx[8];\nout vec4 fc;\nvec2 rUV(vec2 st,float t){float sr=sin(t),cr=cos(t);re
.pnt.x=s.x*n.dpt,n.pnt.y=s.y*n.dpt;var x=k._fs(t,e,s,1),u=0;if(I.cont(t.vt,x[0])&&(i[u++]=x[0]),I.cont(t.vt,x[1])&&(i[u++]=x[1]),2>u){var v=k._fs(e,t,s,-1);I.cont(e.vt,v[0])&&(i[u++]=v[0]),2>u&&I.cont(e.vt,v[1])&&(i[u++]=v[1])}return 0==u&&(i[u++]=x[0]),i.length=u,n},k._oA=(e,r,n,a)=>{var o,s,i,l,c,p,x=r.length,u=n.length,v=r[0].x,d=r[0].y,f=n[0].x,y=n[0].y,m=a.length,h=t,b=0;for(c=0;c<m;c++){var g=a[c],A=g.x,S=g.y,w=v*A+d*S,B=f*A+y*S,P=w,E=B;for(p=1;p<x;p+=1)(l=r[p].x*A+r[p].y*S)>P?P=l:l<w&&(w=l);for(p=1;p<u;p+=1)(l=n[p].x*A+n[p].y*S)>E?E=l:l<B&&(B=l);if((o=(s=P-B)<(i=E-w)?s:i)<h&&(h=o,b=c,0>=o))break}e.axis=a[b],e.ovlp=h},k._pTA=(t,e,r)=>{for(var n,a=e[0].x*r.x+e[0].y*r.y,o=a,s=1;s<e.length;s+=1)(n=e[s].x*r.x+e[s].y*r.y)>o?o=n:n<a&&(a=n);t.min=a,t.max=o},k._fs=(e,r,n,a)=>{var o,s,i,l,c,p=r.vt,x=p.length,u=e.pos.x,v=e.pos.y,d=n.x*a,f=n.y*a,y=t;for(c=0;c<x;c+=1)(l=d*(u-(s=p[c]).x)+f*(v-s.y))<y&&(y=l,o=s);return y=d*(u-(i=p[(x+o.index-1)%x]).x)+f*(v-i.y),d*(u-(s=p[(o.index+1)%x]).x)+f*(v-s.y)<y?(F[0]=o,F[1]=s,F):(F[0]=o,F[1]=i,F)};var z=(t,e,r)=>{var n,a,o,s,i=t.events;if(i&&0<C.ky(i).length){r||(r={}),n=e.split(" ");for(var l=0;l<n.length;l++)if(o=i[a=n[l]]){(s=C.cl(r,!1)).name=a,s.source=t;for(var c=0;c<o.length;c++)o[c].apply(t,[s])}}},X={cr:t=>C.xt({id:C.nxI(),type:"composite",pr:null,iMd:!1,bodies:[],cn:[],cm:[],l:"Composite",cache:{allBd:null,allCn:null,allCm:null}},t),stM:(t,e,r,n)=>{if(t.iMd=e,e&&t.cache&&(t.cache.allBd=null,t.cache.allCn=null,t.cache.allCm=null),r&&t.pr&&X.stM(t.pr,e,r,n),n)for(var a,o=0;o<t.cm.length;o++)a=t.cm[o],X.stM(a,e,r,n)},add:(t,e)=>{var r=[].concat(e);z(t,"beforeAdd",{object:e});for(var n,a=0;a<r.length;a++)switch(n=r[a],n.type){case"body":if(n.pr!==n)break;X.addB(t,n);break;case"constraint":X.addCn(t,n);break;case"composite":X.addC(t,n);break;case"mouseConstraint":X.addCn(t,n.constraint)}return z(t,"afterAdd",{object:e}),t},rm:(t,e,r)=>{var n=[].concat(e);z(t,"beforeRemove",{object:e});for(var a,o=0;o<n.length;o++)switch(a=n[o],a.type){case"body":X.rmB(t,a,r);break;case"constraint":X.rmCn(t,a,r);break;case"composite":X.rmC(t,a,r);break;case"mouseConstraint":X.rmCn(t,a.constraint)}return z(t,"afterRemove",{object:e}),t},addC:(t,e)=>(t.cm.push(e),e.pr=t,X.stM(t,!0,!0,!1),t),rmC:(t,e,r)=>{var n=C.io(t.cm,e);if(-1!==n&&X.rmCa(t,n),r)for(var a=0;a<t.cm.length;a++)X.rmC(t.cm[a],e,!0);return t},rmCa:(t,e)=>(t.cm.splice(e,1),X.stM(t,!0,!0,!1),t),addB:(t,e)=>(t.bodies.push(e),X.stM(t,!0,!0,!1),t),rmB:(t,e,r)=>{var n=C.io(t.bodies,e);if(-1!==n&&X.rmBa(t,n),r)for(var a=0;a<t.cm.length;a++)X.rmB(t.cm[a],e,!0);return t},rmBa:(t,e)=>(t.bodies.splice(e,1),X.stM(t,!0,!0,!1),t),addCn:(t,e)=>(t.cn.push(e),X.stM(t,!0,!0,!1),t),rmCn:(t,e,r)=>{var n=C.io(t.cn,e);if(-1!==n&&X.rmCna(t,n),r)for(var a=0;a<t.cm.length;a++)X.rmCn(t.cm[a],e,!0);return t},rmCna:(t,e)=>(t.cn.splice(e,1),X.stM(t,!0,!0,!1),t),allBd:t=>{if(t.cache&&t.cache.allBd)return t.cache.allBd;for(var e=[].concat(t.bodies),r=0;r<t.cm.length;r++)e=e.concat(X.allBd(t.cm[r]));return t.cache&&(t.cache.allBd=e),e},allCn:t=>{if(t.cache&&t.cache.allCn)return t.cache.allCn;for(var e=[].concat(t.cn),r=0;r<t.cm.length;r++)e=e.concat(X.allCn(t.cm[r]));return t.cache&&(t.cache.allCn=e),e}},N={_w:.4,_td:1,_ml:1e-6,cr:t=>{var e=t;e.bdA&&!e.ptA&&(e.ptA={x:0,y:0}),e.bdB&&!e.ptB&&(e.ptB={x:0,y:0});var r=e.bdA?E.add(e.bdA.pos,e.ptA):e.ptA,n=e.bdB?E.add(e.bdB.pos,e.ptB):e.ptB,a=E.mag(E.sub(r,n));return e.length=void 0===e.length?a:e.length,e.id=e.id||C.nxI(),e.l=e.l||"Constraint",e.type="constraint",e.st=e.st||(0<e.length?1:.7),e.da=e.da||0,e.aSt=e.aSt||0,e.aA=e.bdA?e.bdA.a:e.aA,e.aB=e.bdB?e.bdB.a:e.aB,e},prsa:t=>{for(var e=0;e<t.length;e+=1){var r=t[e],n=r.cI;r.iSt||0===n.x&&0===n.y&&0===n.a||(r.pos.x+=n.x,r.pos.y+=n.y,r.a+=n.a)}},slvA:(t,e)=>{for(var r=0;r<t.length;r+=1){var n=t[r],a=!n.bdA||n.bdA&&n.bdA.iSt,o=!n.bdB||n.bdB&&n.bdB.iSt;(a||o)&&N.slv(t[r],e)}for(r=0;r<t.length;r+=1)a=!(n=t[r]).bdA||n.bdA&&n.bdA.iSt,o=!n.bdB||n.bdB&&n.bdB.iSt,a||o||N.slv(t[r],e)},slv:(t,e)=>{var r=t.bdA,n=t.bdB,a=t.ptA,o=t.ptB;if(r||n){r&&!r.iSt&&(E.rot(a,r.a-t.aA,a),t.aA=r.a),n&&!n.iSt&&(E.rot(o,n.a-t.aB,o),t.aB=n.a);var s=a,i=o;if(r&&(s=E.add(r.pos,a)),n&&(i=E.add(n.pos,o)),s&&i){var l=E.sub(s,i),c=E.mag(l);c<N._ml&&(c=N._ml);var p,x,u,v,d,f=(c-t.length)/c,y=1>t.st?t.st*e:t.st,m=E.mult(l,f*y),h=(r?r.iM:0)+(n?n.iM:0),b=h+((r?r.iIa:0)+(n?n.iIa:0));if(t.da){var g=E.cr();u=E.div(l,c),d=E.sub(n&&E.sub(n.pos,n.pP)||g,r&&E.sub(r.pos,r.pP)||g),v=E.dot(u,d)}r&&!r.iSt&&(x=r.iM/h,r.cI.x-=m.x*x,r.cI.y-=m.y*x,r.pos.x-=m.x*x,r.pos.y-=m.y*x,t.da&&(r.pP.x-=t.da*u.x*v*x,r.pP.y-=t.da*u.y*v*x),p=E.cross(a,m)/b*N._td*r.iIa*(1-t.aSt),r.cI.a-=p,r.a-=p),n&&!n.iSt&&(x=n.iM/h,n.cI.x+=m.x*x,n.cI.y+=m.y*x,n.pos.x+=m.x*x,n.pos.y+=m.y*x,t.da&&(n.pP.x+=t.da*u.x*v*x,n.pP.y+=t.da*u.y*v*x),p=E.cross(o,m)/b*N._td*n.iIa*(1-t.aSt),n.cI.a+=p,n.a+=p)}}},psa:t=>{for(var e=0;e<t.length;e++){var r=t[e],n=r.cI;if(!(r.iSt||0===n.x&&0===n.y&&0===n.a)){for(var a,o=0;o<r.pt.length;o++)a=r.pt[o],I.tran(a.vt,n),0<o&&(a.pos.x+=n.x,a.pos.y+=n.y),0!==n.a&&(I.rot(a.vt,n.a,r.pos),_(a.ax,n.a),0<o&&E.rotA(a.pos,n.a,r.pos,a.pos)),T.ud(a.b,a.vt,r.v);n.a*=N._w,n.x*=N._w,n.y*=N._w}}},ptAW:t=>({x:(t.bdA?t.bdA.pos.x:0)+(t.ptA?t.ptA.x:0),y:(t.bdA?t.bdA.pos.y:0)+(t.ptA?t.ptA.y:0)}),ptBW:t=>({x:(t.bdB?t.bdB.pos.x:0)+(t.ptB?t.ptB.x:0),y:(t.bdB?t.bdB.pos.y:0)+(t.ptB?t.ptB.y:0)})},Y={cr:t=>C.xt({bodies:[],pairs:null},t),sBd:(t,e)=>{t.bodies=e.slice(0)},clr:t=>{t.bodies=[]},cols:t=>{var e,r,n=[],a=t.pairs,o=t.bodies,s=o.length,i=Y.cCol,l=k.cld;for(o.sort(Y._cBX),e=0;e<s;e++){var c=o[e],p=c.b,x=c.b.max.x,u=c.b.max.y,v=c.b.min.y,d=c.iSt,f=c.pt.length,y=1===f;for(r=e+1;r<s;r++){var m=o[r];if((P=m.b).min.x>x)break;if(!(u<P.min.y||v>P.max.y)&&(!d||!m.iSt)&&i(c.cF,m.cF)){var h=m.pt.length;if(y&&1===h)(w=l(c,m,a))&&n.push(w);else for(var b=1<h?1:0,g=1<f?1:0;g<f;g++)for(var A=c.pt[g],S=(p=A.b,b);S<h;S++){var w,B=m.pt[S],P=B.b;p.min.x>P.max.x||p.max.x<P.min.x||p.max.y<P.min.y||p.min.y>P.max.y||(w=l(A,B,a))&&n.push(w)}}}}return n},cCol:(t,e)=>t.group===e.group&&0!==t.group?0<t.group:0!=(t.mask&e.category)&&0!=(e.mask&t.category),_cBX:(t,e)=>t.b.min.x-e.b.min.x},G={_rT:4,_rTt:6,_posD:.9,_posW:.8,_frNmlM:5,prsp:t=>{var e,r,n,a=t.length;for(e=0;e<a;e++)(r=t[e]).iA&&(n=r.aCn.length,r.col.prA.tC+=n,r.col.prB.tC+=n)},slvp:(t,e)=>{var r,n,a,o,s,i,l,c,p=G._posD,x=t.length;for(r=0;r<x;r++)(n=t[r]).iA&&!n.iSn&&(o=(a=n.col).prA,s=a.prB,i=a.nml,n.sep=i.x*(s.pI.x+a.pnt.x-o.pI.x)+i.y*(s.pI.y+a.pnt.y-o.pI.y));for(r=0;r<x;r++)(n=t[r]).iA&&!n.iSn&&(o=(a=n.col).prA,s=a.prB,i=a.nml,c=(n.sep-n.sp)*e,(o.iSt||s.iSt)&&(c*=2),o.iSt||(l=p/o.tC,o.pI.x+=i.x*c*l,o.pI.y+=i.y*c*l),s.iSt||(l=p/s.tC,s.pI.x-=i.x*c*l,s.pI.y-=i.y*c*l))},pSp:t=>{for(var e=G._posW,r=t.length,n=I.tran,a=T.ud,o=0;o<r;o++){var s=t[o],i=s.pI,l=i.x,c=i.y,p=s.v;if(s.tC=0,0!==l||0!==c){for(var x,u=0;u<s.pt.length;u++)n((x=s.pt[u]).vt,i),a(x.b,x.vt,p),x.pos.x+=l,x.pos.y+=c;s.pP.x+=l,s.pP.y+=c,0>l*p.x+c*p.y?(i.x=0,i.y=0):(i.x*=e,i.y*=e)}}},prSv:t=>{var e,r,n=t.length;for(e=0;e<n;e++){var a=t[e];if(a.iA&&!a.iSn){var o=a.aCn,s=o.length,i=a.col,l=i.prA,c=i.prB,p=i.nml,x=i.tg;for(r=0;r<s;r++){var u=o[r],v=u.vertex,d=u.nmlI,f=u.tgI;if(0!==d||0!==f){var y=p.x*d+x.x*f,m=p.y*d+x.y*f;l.iSt||(l.pP.x+=y*l.iM,l.pP.y+=m*l.iM,l.aP+=l.iIa*((v.x-l.pos.x)*m-(v.y-l.pos.y)*y)),c.iSt||(c.pP.x-=y*c.iM,c.pP.y-=m*c.iM,c.aP-=c.iIa*((v.x-c.pos.x)*m-(v.y-c.pos.y)*y))}}}}},slvv:(e,r)=>{var n,a,o,i,l=r*r,c=G._rT*l,p=G._frNmlM,x=G._rTt*l,u=e.length;for(o=0;o<u;o++){var v=e[o];if(v.iA&&!v.iSn){var d=v.col,f=d.prA,y=d.prB,m=f.v,h=y.v,b=d.nml.x,g=d.nml.y,A=d.tg.x,S=d.tg.y,w=v.aCn,B=w.length,P=1/B,E=f.iM+y.iM,C=v.fr*v.fS*p*l;for(m.x=f.pos.x-f.pP.x,m.y=f.pos.y-f.pP.y,h.x=y.pos.x-y.pP.x,h.y=y.pos.y-y.pP.y,f.aV=f.a-f.aP,y.aV=y.a-y.aP,i=0;i<B;i++){var _=w[i],I=_.vertex,T=I.x-f.pos.x,M=I.y-f.pos.y,U=I.x-y.pos.x,R=I.y-y.pos.y,L=m.x-M*f.aV,D=m.y+T*f.aV,k=L-(h.x-R*y.aV),F=D-(h.y+U*y.aV),O=b*k+g*F,V=A*k+S*F,z=v.sep+O,X=s(z,1),N=(X=0>z?0:X)*C;V>N||-V>N?(a=0<V?V:-V,(n=v.fr*(0<V?1:-1)*l)<-a?n=-a:n>a&&(n=a)):(n=V,a=t);var Y=T*g-M*b,j=U*g-R*b,W=P/(E+f.iIa*Y*Y+y.iIa*j*j),$=(1+v.r)*O*W;if(n*=W,O*O>c&&0>O)_.nmlI=0;else{var H=_.nmlI;_.nmlI+=$,_.nmlI=s(_.nmlI,0),$=_.nmlI-H}if(V*V>x)_.tgI=0;else{var q=_.tgI;_.tgI+=n,_.tgI<-a&&(_.tgI=-a),_.tgI>a&&(_.tgI=a),n=_.tgI-q}var K=b*$+A*n,Z=g*$+S*n;f.iSt||(f.pP.x+=K*f.iM,f.pP.y+=Z*f.iM,f.aP+=(T*Z-M*K)*f.iIa),y.iSt||(y.pP.x-=K*y.iM,y.pP.y-=Z*y.iM,y.aP-=(U*Z-R*K)*y.iIa)}}}}},j={cr:t=>{t=t||{};var e=C.xt({posIt:6,vIt:4,cnIt:2,events:[],gravity:{x:0,y:1,scale:.001},timing:{tm:0,tS:1,lD:0,lE:0}},t);return e.world=t.world||X.cr({l:"World"}),e.pairs=t.pairs||(t=>C.xt({table:{},list:[],colStart:[],colActive:[],colEnd:[]},t))(),e.detector=t.detector||Y.cr(),e},ud:(t,e,r)=>{var n=C.now();e=e||1e3/60,r=r||1;var a,o=t.world,s=t.detector,i=t.pairs,l=t.timing,c=l.tm;l.tm+=e*l.tS,l.lD=e*l.tS;var p={tm:l.tm};z(t,"beforeUpdate",p);var x=X.allBd(o),u=X.allCn(o);for(o.iMd&&Y.sBd(s,x),o.iMd&&X.stM(o,!1,!1,!0),j._bdAG(x,t.gravity),j._bdU(x,e,l.tS,r,o.b),N.prsa(x),a=0;a<t.cnIt;a++)N.slvA(u,l.tS);for(N.psa(x),s.pairs=t.pairs,((t,e,r)=>{var n,a,o,s,i=t.list,l=i.length,c=t.table,p=e.length,x=t.colStart,u=t.colEnd,v=t.colActive;for(x.length=0,u.length=0,v.length=0,s=0;s<l;s++)i[s].cfmA=!1;for(s=0;s<p;s++)(o=(n=e[s]).pair)?(o.iA?v.push(o):x.push(o),D.ud(o,n,r),o.cfmA=!0):(c[(o=D.cr(n,r)).id]=o,x.push(o),i.push(o));var d=[];for(l=i.length,s=0;s<l;s++)(o=i[s]).cfmA||(D.sAc(o,!1,r),u.push(o));for(s=0;s<d.length;s++)o=i[a=d[s]-s],i.splice(a,1),delete c[o.id]})(i,Y.cols(s),c),0<i.colStart.length&&z(t,"colStart",{pairs:i.colStart}),G.prsp(i.list),a=0;a<t.posIt;a++)G.slvp(i.list,l.tS);for(G.pSp(x),N.prsa(x),a=0;a<t.cnIt;a++)N.slvA(u,l.tS);for(N.psa(x),G.prSv(i.list),a=0;a<t.vIt;a++)G.slvv(i.list,l.tS);return 0<i.colActive.length&&z(t,"colActive",{pairs:i.colActive}),0<i.colEnd.length&&z(t,"colEnd",{pairs:i.colEnd}),j._bdClfs(x),z(t,"afterUpdate",p),t.timing.lE=C.now()-n,t},merge:(t,e)=>{if(C.xt(t,e),e.world){t.world=e.world,j.clr(t);for(var r=X.allBd(t.world),n=0;n<r.length;n++)r[n].id=C.nxI()}},clr:t=>{var e;(e=t.pairs).table={},e.list.length=0,e.colStart.length=0,e.colActive.length=0,e.colEnd.length=0,Y.clr(t.detector)},_bdClfs:t=>{for(var e,r=0;r<t.length;r++)(e=t[r]).f.x=0,e.f.y=0,e
(()=>{"use strict";var t=Number.MAX_VALUE,e=Math.abs,r=Math.sin,n=Math.cos,a=Math.pow,o=Math.sqrt,s=Math.min;const i=2048,l=3/4,c=[8,16,32,64,128],p=[.58,.42,.3,.21,.15],x=[12.5,13,32,80,125],u={antialias:!1,dpt:!1,stencil:!1,preserveDrawingBuffer:!0},v="#f9f1ea",d="#1f1e1c",f=(t,e)=>{const r=Object.keys(e);for(let n=0;n<r.length;n++)t.style[r[n]]=e[r[n]]},y=a(2,-32),m=32557,h=19605,b=new Uint16Array(4),g=new DataView(b.buffer),A=()=>{const t=b[0],e=b[1],r=b[2],n=b[3],a=0|33103+m*t,o=0|63335+m*e+(h*t+(a>>>16)),s=0|31614+m*r+h*e+(62509*t+(o>>>16));b[0]=a,b[1]=o,b[2]=s,b[3]=5125+m*n+(h*r+62509*e)+(22609*t+(s>>>16));const i=(n<<21)+((n>>2^r)<<5)+((r>>2^e)>>11);return y*((i>>>(n>>11)|i<<(31&-(n>>11)))>>>0)},S=(t,e=0)=>{const r=16,n=65535,a=255;for(var o,s=1540483477,i=t.length,l=e^i,c=0;4<=i;)o=((o=t[c]&a|(t[++c]&a)<<8|(t[++c]&a)<<16|(t[++c]&a)<<24)&n)*s+(((o>>>r)*s&n)<<r),l=(l&n)*s+(((l>>>r)*s&n)<<r)^(o=((o^=o>>>24)&n)*s+(((o>>>r)*s&n)<<r)),i-=4,++c;switch(i){case 3:l^=(t[c+2]&a)<<r;case 2:l^=(t[c+1]&a)<<8;case 1:l=((l^=t[c]&a)&n)*s+(((l>>>r)*s&n)<<r)}return l=((l^=l>>>13)&n)*s+(((l>>>16)*s&n)<<16),(l^=l>>>15)>>>0},w=(t=.5)=>A()<t,B=(t,e)=>(void 0===e&&(e=t,t=0),A()*(e-t)+t),P=t=>{var e,r=0;for(e=0;e<t.length;e++)r+=t[e];var n=A()*r;for(e=0;e<t.length;e++){if(n<t[e])return e;n-=t[e]}return 0};var E={cr:(t,e)=>({x:t||0,y:e||0}),cl:t=>({x:t.x,y:t.y}),mag:t=>o(t.x*t.x+t.y*t.y),mag2:t=>t.x*t.x+t.y*t.y,rot:(t,e,a)=>{var o=n(e),s=r(e);a||(a={});var i=t.x*o-t.y*s;return a.y=t.x*s+t.y*o,a.x=i,a},rotA:(t,e,a,o)=>{var s=n(e),i=r(e);o||(o={});var l=a.x+((t.x-a.x)*s-(t.y-a.y)*i);return o.y=a.y+((t.x-a.x)*i+(t.y-a.y)*s),o.x=l,o},nmlz:t=>{var e=E.mag(t);return 0===e?{x:0,y:0}:{x:t.x/e,y:t.y/e}},dot:(t,e)=>t.x*e.x+t.y*e.y,cross:(t,e)=>t.x*e.y-t.y*e.x,cross3:(t,e,r)=>(e.x-t.x)*(r.y-t.y)-(e.y-t.y)*(r.x-t.x),add:(t,e,r)=>(r||(r={}),r.x=t.x+e.x,r.y=t.y+e.y,r),sub:(t,e,r)=>(r||(r={}),r.x=t.x-e.x,r.y=t.y-e.y,r),mult:(t,e)=>({x:t.x*e,y:t.y*e}),div:(t,e)=>({x:t.x/e,y:t.y/e}),perp:(t,e)=>({x:(e=!0===e?-1:1)*-t.y,y:e*t.x}),neg:t=>({x:-t.x,y:-t.y}),a:(t,e)=>Math.atan2(e.y-t.y,e.x-t.x)};E._temp=[E.cr(),E.cr(),E.cr(),E.cr(),E.cr(),E.cr()];var C={_nxi:0,_sd:0};C._nwst=+new Date,C.xt=function(t,e){var r,n;"boolean"==typeof e?(r=2,n=e):(r=1,n=!0);for(var a,o=r;o<arguments.length;o++)if(a=arguments[o])for(var s in a)n&&a[s]&&a[s].constructor===Object?t[s]&&t[s].constructor!==Object?t[s]=a[s]:(t[s]=t[s]||{},C.xt(t[s],n,a[s])):t[s]=a[s];return t},C.cl=(t,e)=>C.xt({},e,t),C.ky=t=>{if(Object.keys)return Object.keys(t);var e=[];for(var r in t)e.push(r);return e},C.values=t=>{var e=[];if(Object.keys){for(var r=Object.keys(t),n=0;n<r.length;n++)e.push(t[r[n]]);return e}for(var a in t)e.push(t[a]);return e},C.gt=(t,e,r,n)=>{e=e.split(".").slice(r,n);for(var a=0;a<e.length;a+=1)t=t[e[a]];return t},C.st=(t,e,r,n,a)=>{var o=e.split(".").slice(n,a);return C.gt(t,e,0,-1)[o[o.length-1]]=r,r},C.now=()=>{if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return Date.now?Date.now():new Date-C._nwst},C.nxI=()=>C._nxi++,C.io=(t,e)=>{if(t.indexOf)return t.indexOf(e);for(var r=0;r<t.length;r++)if(t[r]===e)return r;return-1};var _=(t,e)=>{if(0!==e)for(var a=n(e),o=r(e),s=0;s<t.length;s++){var i,l=t[s];i=l.x*a-l.y*o,l.y=l.x*o+l.y*a,l.x=i}},I={cr:(t,e)=>{for(var r=[],n=0;n<t.length;n++){var a=t[n],o={x:a.x,y:a.y,index:n,body:e,isInternal:!1};r.push(o)}return r},frPth:(t,e)=>{var r=[];return t.replace(/L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/gi,((t,e,n)=>{r.push({x:parseFloat(e),y:parseFloat(n)})})),I.cr(r,e)},centre:t=>{for(var e,r,n,a=I.aa(t,!0),o={x:0,y:0},s=0;s<t.length;s++)n=(s+1)%t.length,e=E.cross(t[s],t[n]),r=E.mult(E.add(t[s],t[n]),e),o=E.add(o,r);return E.div(o,6*a)},mean:t=>{for(var e={x:0,y:0},r=0;r<t.length;r++)e.x+=t[r].x,e.y+=t[r].y;return E.div(e,t.length)},aa:(t,r)=>{for(var n=0,a=t.length-1,o=0;o<t.length;o++)n+=(t[a].x-t[o].x)*(t[a].y+t[o].y),a=o;return r?n/2:e(n)/2},ia:(t,r)=>{for(var n,a,o=0,s=0,i=t,l=0;l<i.length;l++)a=(l+1)%i.length,o+=(n=e(E.cross(i[a],i[l])))*(E.dot(i[a],i[a])+E.dot(i[a],i[l])+E.dot(i[l],i[l])),s+=n;return r/6*(o/s)},tran:(t,e,r)=>{r=void 0===r?1:r;var n,a=t.length,o=e.x*r,s=e.y*r;for(n=0;n<a;n++)t[n].x+=o,t[n].y+=s;return t},rot:(t,e,a)=>{if(0!==e){var o,s,i,l,c=n(e),p=r(e),x=a.x,u=a.y,v=t.length;for(l=0;l<v;l++)s=(o=t[l]).x-x,i=o.y-u,o.x=x+(s*c-i*p),o.y=u+(s*p+i*c);return t}},cont:(t,e)=>{for(var r,n=e.x,a=e.y,o=t.length,s=t[o-1],i=0;i<o;i++){if(r=t[i],0<(n-s.x)*(r.y-s.y)+(a-s.y)*(s.x-r.x))return!1;s=r}return!0},scl:(t,e,r,n)=>{if(1===e&&1===r)return t;n=n||I.centre(t);for(var a,o,s=0;s<t.length;s++)a=t[s],o=E.sub(a,n),t[s].x=n.x+o.x*e,t[s].y=n.y+o.y*r;return t},cwSrt:t=>{var e=I.mean(t);return t.sort(((t,r)=>E.a(e,t)-E.a(e,r))),t},iCvx:t=>{var e,r,n,a,o=0,s=t.length;if(3>s)return null;for(e=0;e<s;e++)if(n=(e+2)%s,a=(t[r=(e+1)%s].x-t[e].x)*(t[n].y-t[r].y),0>(a-=(t[r].y-t[e].y)*(t[n].x-t[r].x))?o|=1:0<a&&(o|=2),3===o)return!1;return 0!=o||null},hull:t=>{var e,r,n=[],a=[];for((t=t.slice(0)).sort(((t,e)=>{var r=t.x-e.x;return 0==r?t.y-e.y:r})),r=0;r<t.length;r+=1){for(e=t[r];2<=a.length&&0>=E.cross3(a[a.length-2],a[a.length-1],e);)a.pop();a.push(e)}for(r=t.length-1;0<=r;r-=1){for(e=t[r];2<=n.length&&0>=E.cross3(n[n.length-2],n[n.length-1],e);)n.pop();n.push(e)}return n.pop(),a.pop(),n.concat(a)}},T={cr:t=>{var e={min:{x:0,y:0},max:{x:0,y:0}};return t&&T.ud(e,t),e},ud:(t,e,r)=>{t.min.x=1/0,t.max.x=-1/0,t.min.y=1/0,t.max.y=-1/0;for(var n,a=0;a<e.length;a++)(n=e[a]).x>t.max.x&&(t.max.x=n.x),n.x<t.min.x&&(t.min.x=n.x),n.y>t.max.y&&(t.max.y=n.y),n.y<t.min.y&&(t.min.y=n.y);r&&(0<r.x?t.max.x+=r.x:t.min.x+=r.x,0<r.y?t.max.y+=r.y:t.min.y+=r.y)},cont:(t,e)=>e.x>=t.min.x&&e.x<=t.max.x&&e.y>=t.min.y&&e.y<=t.max.y,overlaps:(t,e)=>t.min.x<=e.max.x&&t.max.x>=e.min.x&&t.max.y>=e.min.y&&t.min.y<=e.max.y,tran:(t,e)=>{t.min.x+=e.x,t.max.x+=e.x,t.min.y+=e.y,t.max.y+=e.y},shift:(t,e)=>{var r=t.max.x-t.min.x,n=t.max.y-t.min.y;t.min.x=e.x,t.max.x=e.x+r,t.min.y=e.y,t.max.y=e.y+n}},M={_iaScale:4,_nextCollidingGroupId:1,_nextNonCollidingGroupId:-1,_nextCategory:1,cr:t=>{var e={id:C.nxI(),type:"body",l:"Body",pt:[],a:0,vt:I.frPth("L 0 0 L 40 0 L 40 40 L 0 40"),pos:{x:0,y:0},f:{x:0,y:0},t:0,pI:{x:0,y:0},cI:{x:0,y:0,a:0},tC:0,s:0,aS:0,v:{x:0,y:0},aV:0,iSn:!1,iSt:!1,mt:0,d:.001,r:0,fr:.1,fS:.5,fA:.01,cF:{category:1,mask:4294967295,group:0},sp:.05,tS:1,events:null,b:null,cR:0,pP:null,aP:0,pr:null,ax:null,aa:0,m:0,ia:0,_og:null},r=C.xt(e,t);return U(r,t),r}},U=(t,e)=>{e=e||{},M.set(t,{b:t.b||T.cr(t.vt),pP:t.pP||E.cl(t.pos),aP:t.aP||t.a,vt:t.vt,pt:t.pt||[t],iSt:t.iSt,pr:t.pr||t}),I.rot(t.vt,t.a,t.pos),_(t.ax,t.a),T.ud(t.b,t.vt,t.v),M.set(t,{ax:e.ax||t.ax,aa:e.aa||t.aa,m:e.m||t.m,ia:e.ia||t.ia})};M.set=(t,e,r)=>{for(var n in"string"==typeof e&&(n=e,(e={})[n]=r),e)Object.prototype.hasOwnProperty.call(e,n)&&(r=e[n],"m"===n?M.setm(t,r):"ia"===n?M.setia(t,r):"vt"===n?M.setVt(t,r):"pos"===n?M.setpos(t,r):"pt"===n?M.setpt(t,r):t[n]=r)},M.setm=(t,e)=>{var r=t.ia/(t.m/6);t.ia=r*(e/6),t.iIa=1/t.ia,t.m=e,t.iM=1/t.m,t.d=t.m/t.aa},M.setia=(t,e)=>{t.ia=e,t.iIa=1/t.ia},M.setVt=(t,e)=>{t.vt=e[0].body===t?e:I.cr(e,t),t.ax=(t=>{for(var e={},r=0;r<t.length;r++){var n=(r+1)%t.length,a=E.nmlz({x:t[n].y-t[r].y,y:t[r].x-t[n].x}),o=0===a.y?1/0:a.x/a.y;e[o=o.toFixed(3).toString()]=a}return C.values(e)})(t.vt),t.aa=I.aa(t.vt),M.setm(t,t.d*t.aa);var r=I.centre(t.vt);I.tran(t.vt,r,-1),M.setia(t,M._iaScale*I.ia(t.vt,t.m)),I.tran(t.vt,t.pos),T.ud(t.b,t.vt,t.v)},M.setpt=(t,e)=>{var r;for(e=e.slice(0),t.pt.length=0,t.pt.push(t),t.pr=t,r=0;r<e.length;r++){var n=e[r];n!==t&&(n.pr=t,t.pt.push(n))}if(1!==t.pt.length){var a=M._ttP(t);t.aa=a.aa,t.pr=t,t.pos.x=a.centre.x,t.pos.y=a.centre.y,t.pP.x=a.centre.x,t.pP.y=a.centre.y,M.setm(t,a.m),M.setia(t,a.ia),M.setpos(t,a.centre)}},M.setpos=(t,e)=>{var r=E.sub(e,t.pos);t.pP.x+=r.x,t.pP.y+=r.y;for(var n,a=0;a<t.pt.length;a++)(n=t.pt[a]).pos.x+=r.x,n.pos.y+=r.y,I.tran(n.vt,r),T.ud(n.b,n.vt,t.v)},M.ud=(t,r,n,o)=>{var s=a(r*n*t.tS,2),i=1-t.fA*n*t.tS,l=t.pos.x-t.pP.x,c=t.pos.y-t.pP.y;t.v.x=l*i*o+t.f.x/t.m*s,t.v.y=c*i*o+t.f.y/t.m*s,t.pP.x=t.pos.x,t.pP.y=t.pos.y,t.pos.x+=t.v.x,t.pos.y+=t.v.y,t.aV=(t.a-t.aP)*i*o+t.t/t.ia*s,t.aP=t.a,t.a+=t.aV,t.s=E.mag(t.v),t.aS=e(t.aV);for(var p,x=0;x<t.pt.length;x++)p=t.pt[x],I.tran(p.vt,t.v),0<x&&(p.pos.x+=t.v.x,p.pos.y+=t.v.y),0!==t.aV&&(I.rot(p.vt,t.aV,t.pos),_(p.ax,t.aV),0<x&&E.rotA(p.pos,t.aV,t.pos,p.pos)),T.ud(p.b,p.vt,t.v)},M.af=(t,e,r)=>{t.f.x+=r.x,t.f.y+=r.y;var n=e.x-t.pos.x,a=e.y-t.pos.y;t.t+=n*r.y-a*r.x},M._ttP=t=>{for(var e={m:0,aa:0,ia:0,centre:{x:0,y:0}},r=1===t.pt.length?0:1;r<t.pt.length;r++){var n=t.pt[r],a=n.m===1/0?1:n.m;e.m+=a,e.aa+=n.aa,e.ia+=n.ia,e.centre=E.add(e.centre,E.mult(n.pos,a))}return e.centre=E.div(e.centre,e.m),e};var R=(t,e,r,n,a)=>{a=a||{};var o={l:"rect",pos:{x:t,y:e},vt:I.frPth("L 0 0 L "+r+" 0 L "+r+" "+n+" L 0 "+n)};return M.cr(C.xt({},o,a))},L=t=>({vertex:t,nmlI:0,tgI:0}),D={cr:(t,e)=>{var r=t.bdA,n=t.bdB,a={id:D.id(r,n),bdA:r,bdB:n,col:t,contacts:[],aCn:[],sep:0,iA:!0,cfmA:!0,iSn:r.iSn||n.iSn,tCr:e,tUp:e,iM:0,fr:0,fS:0,r:0,sp:0};return D.ud(a,t,e),a},ud:(t,e,r)=>{var n=t.contacts,a=e.spt,o=t.aCn,s=e.prA,i=e.prB,l=s.vt.length;t.iA=!0,t.tUp=r,t.col=e,t.sep=e.dpt,t.iM=s.iM+i.iM,t.fr=s.fr<i.fr?s.fr:i.fr,t.fS=s.fS>i.fS?s.fS:i.fS,t.r=s.r>i.r?s.r:i.r,t.sp=s.sp>i.sp?s.sp:i.sp,e.pair=t,o.length=0;for(var c=0;c<a.length;c++){var p=a[c],x=p.body===s?p.index:l+p.index,u=n[x];u?o.push(u):o.push(n[x]=L(p))}},sAc:(t,e,r)=>{e?(t.iA=!0,t.tUp=r):(t.iA=!1,t.aCn.length=0)},id:(t,e)=>t.id<e.id?"A"+t.id+"B"+e.id:"A"+e.id+"B"+t.id},k={},F=[],O={ovlp:0,axis:null},V={ovlp:0,axis:null};k.cr=(t,e)=>({pair:null,cold:!1,bdA:t,bdB:e,prA:t.pr,prB:e.pr,dpt:0,nml:{x:0,y:0},tg:{x:0,y:0},pnt:{x:0,y:0},spt:[]}),k.cld=(t,e,r)=>{if(k._oA(O,t.vt,e.vt,t.ax),0>=O.ovlp)return null;if(k._oA(V,e.vt,t.vt,e.ax),0>=V.ovlp)return null;var n,a=r&&r.table[D.id(t,e)];a?n=a.col:((n=k.cr(t,e)).cold=!0,n.bdA=t.id<e.id?t:e,n.bdB=t.id<e.id?e:t,n.prA=n.bdA.pr,n.prB=n.bdB.pr),t=n.bdA,e=n.bdB;var o=O.ovlp<V.ovlp?O:V,s=n.nml,i=n.spt,l=o.axis,c=l.x,p=l.y;0>c*(e.pos.x-t.pos.x)+p*(e.pos.y-t.pos.y)?(s.x=c,s.y=p):(s.x=-c,s.y=-p),n.tg.x=-s.y,n.tg.y=s.x,n.dpt=o.ovlp,n
let rngt,rngs,S=Uint32Array.from([0,1,rngs=rngt=2,3].map(i=>parseInt(tokenData.hash.substr(i*8+5,8),16)));R=(a=1)=>a*(rngt=S[3],S[3]=S[2],S[2]=S[1],S[1]=rngs=S[0],rngt^=rngt<<11,S[0]^=(rngt^rngt>>>8)^(rngs>>>19),S[0]/2**32);RT=(a=1)=>a*(R()-R());RV=(v)=>v[R(v.length)|0];C=(a)=>R()<a?1:0;acv=(n,c)=>{for(let i=0;i<n;i++){cv.push(c)}};mn=(...a)=>Math.min(...a);mx=(...a)=>Math.max(...a); let cols=[[44,14,85],[0,0,25],[6,55,52],[25,57,53],[50,53,54],[106,36,41],[220,42,47],[244,32,49]],ww,wh,w,h,p,pd,ar=3/4,gs,gr,rc=C(.5),bw=C(.1),cai=rc?C(.66):(2+R(6)|0),cbi=rc?bw?((cai+1)%2):(2+R(6)|0):(R(2)|0),cci=(C(.9)||bw)?cai:rc?(R(2)|0):(2+R(6)|0),cola=cols[cai],colb=cols[cbi],colc=cols[cci],gds=20,gdh=1+R(2)*0,pxn=.1+R(.2)+R()*R(.15),pyn0=.1+R(.2)+R()*R(.3),hv=(1-2*pxn)>(1/ar-2*pyn0),pSA=Math.PI*(C(.02)?(C(.5)?0:1):(((C(.5)?-1:1)-R(.7))/4+(C(.5)?1:0))+(hv?.5:0)),qdrt=((4+pSA/(Math.PI/2))|0)%4,Nx=5+(R()*R(200))|0,dxn=(1-2*pxn)/Nx,dyn=dxn,Ny=Math.round((1/ar-2*pyn0)/dyn),pyn=(1/ar-Ny*dyn)/2,pdn=C(.1)?0:(.05+R()*R(.35)),wp=2*pxn-.05,hp=2*pyn-.05,hs=Math.abs(Math.sin(pSA)),ws=Math.abs(Math.cos(pSA)),pSS=1000*mn(wp/ws,hp/hs)*(1-.9*R()),pRM=C(.75)?3:R(2)|0,pRMB=R()*R(.75),pOXY=C(.3),pSD1=C(.75)?0:((R(2)|0)+1),pSD2=C(.5),pBZ=C(.8)?0:(R(.3)),pCS=10+R(40)*R(),pSP=R(10),pSO=R(),pBD=C(.75)?0:(1+R(3)|0),pBD2=R(4)|0,pBB=R(),pSH=.05+R(.1),pMA=C(.5),pNS=(mn(Nx,Ny)*.25+RT(mn(Nx,Ny)*(Nx<50?.25:.1))+R()*R()*R(.5))|0,pTR=.005+R(),bhmMX=.005+R(.3)*R()*R(),lniw=mx((Nx*.15+R()*R(Nx*.45))|0,1),lni=(Nx/2+RT(Nx/3)-lniw/2)|0,lnjw=mx((Ny*.15+R()*R(Ny*.45))|0,1),lnj=(Ny/2+RT(Ny/3)-lnjw/2)|0,bvo=[],filled=[];for(let i=0;i<Nx*Ny;i++)filled[i]=0;if(lni<=0)lni=1;if(lni>=Nx-1)lni=Nx-2;if(lnj<=0)lnj=1;if(lnj>=Ny-1)lni=Ny-2;let pLY=1,pLX=0;if((C(.05))){pLX=1;pLY=1;}else if((C(.5))){pLX=1;pLY=0;}let dLX=(pLX)?1:0,dLY=(pLY)?1:0;if(dLX&&dLY){if(C(.5)){dLX=1;dLY=0}else{dLY=1;dLX=0}} findGrid=()=>{for(let i=0;i<Nx;i++){for(let j=0;j<Ny;j++){let ind=j*Nx+i;if(pLX&&i>=lni&&i<(lni+lniw))filled[ind]=1;if(pLY&&j>=lnj&&j<(lnj+lnjw))filled[ind]=1;}}Ntr=Nx*Ny*10;for(let tr=0;tr<Ntr;tr++){let ptr=tr/Ntr,nshort=1+(pNS*(1-ptr**pTR))|0,nlong=nshort+R(nshort*pSP)|0,nx=nshort,ny=nlong;if(C(pSO)){nx=nlong;ny=nshort;}let i=R(Nx-nx)|0,j=R(Ny-ny)|0;if(pSD1==1&&C(.95)){if(pSD2=1)i=(ptr*Nx)|0;else if(pSD2==2)i=((1-ptr)*Nx)|0}if(pSD1==2&&C(.95)){if(pSD2=1)j=(ptr*Ny)|0;else if(pSD2==2)i=((1-ptr)*Ny)|0}i=constrain(i,0,Nx-nx),j=constrain(j,0,Ny-ny);let flag=1;for(let it=i;it<i+nx;it++)for(let jt=j;jt<j+ny;jt++)if(filled[jt*Nx+it])flag=0;if(flag==0||nx>Nx||ny>Ny)continue;let bh=.1+R(.9),im=(i+nx/2)/Nx,jm=(j+ny/2)/Ny,ijm=.5;if(pBD==1)bh=1-R()*R(pBB);if(pBD==2)ijm=im;if(pBD==3)ijm=jm;if(pBD==2||pBD==3){if(pBD2==0)bh=ijm;if(pBD2==1)bh=1-ijm;if(pBD2==2)bh=sq(sin(PI*ijm));if(pBD2==3)bh=1-sq(sin(PI*ijm));}if(pBD>=2)bh+=RT(.1);if(bh<.005)bh=.005;bhm=C(pBZ)?-.5:(.005+R(bhmMX));if(pRM==0&&hv&&C(1-sin(PI*im)))bh=bhm;if(pRM==1&&hv&&C(sin(PI*im)))bh=bhm;if(pRM==0&&!hv&&C(1-sin(PI*jm)))bh=bhm;if(pRM==1&&!hv&&C(sin(PI*jm)))bh=bhm;if(pRM=3&&C(pRMB))bh=bhm;if(bh>1)bh=1;if(flag){for(let it=i;it<i+nx;it++)for(let jt=j;jt<j+ny;jt++)filled[jt*Nx+it]=1;bvo.push([i,j,nx,ny,bh,cola])}}} setup=()=>{findGrid();wh=windowHeight,ww=windowWidth;wh>=ww/ar?(w=ww,h=ww/ar):(w=wh*ar,h=wh);p=w/1000;createCanvas(ww,wh);gs=createGraphics(ww,wh); gr=createGraphics(ww,wh);pd=pixelDensity();let pdw=pd,pdh=pd;if(pd*wh<2000)pdh=Math.ceil(2000/wh);if(pd*ww<2000)pdw=Math.ceil(2000/ww);pd=mx(pdw,pdh);pixelDensity(pd);colorMode(HSL);noStroke();gs.pixelDensity(pd);gs.colorMode(HSL);gs.noStroke();gr.pixelDensity(pd);gr.colorMode(HSL);gr.noStroke();noLoop();} draw=()=>{let px=pxn*w,py=pyn*w,dx=dxn*w,dy=dyn*w,bpd=pdn*dx,xmin=ww,xmax=0,ymin=wh,ymax=0,bv=[];for(let b=0;b<bvo.length;b++){let bvoh=bvo[b],i=bvoh[0],j=bvoh[1],nx=bvoh[2],ny=bvoh[3],bh=bvoh[4],col=bvoh[5],bx=nx*dx-2*bpd,by=ny*dy-2*bpd,x=px+i*dx+bpd,y=py+j*dy+bpd,sx=bh*pSS*p*cos(pSA),sy=-bh*pSS*p*sin(pSA);bv.push([i,j,nx,ny,bh,col,bx,by,x,y,sx,sy]);if(bh==0)continue;xmin=mn(xmin,(qdrt==0||qdrt==3)?x:(x+sx));xmax=mx(xmax,(qdrt==0||qdrt==3)?(x+bx+sx):(x+bx));ymin=mn(ymin,(qdrt==2||qdrt==3)?y:(y+sy));ymax=mx(ymax,(qdrt==2||qdrt==3)?(y+by+sy):(y+by));}if(dLX&&abs(pSH*pSS*p*cos(pSA))>(lniw*dx-2*bpd)/3)pSH=(lniw*dx-2*bpd)/3/pSS/p/abs(cos(pSA));if(dLY&&abs(pSH*pSS*p*sin(pSA))>(lnjw*dx-2*bpd)/3)pSH=(lnjw*dx-2*bpd)/3/pSS/p/abs(sin(pSA));let xavg=(xmin+xmax)/2,yavg=(ymin+ymax)/2,tx=(ww-w)/2+(w/2-xavg),ty=(wh-h)/2+(h/2-yavg),offx=RT((w-(xmax-xmin))/2)*.9*pOXY,offy=RT((h-(ymax-ymin))/2)*.9*pOXY,sxd=pSH*pSS*p*cos(pSA),syd=-pSH*pSS*p*sin(pSA);cgrd(0,0,colb,0,1);rect(0,0,ww,wh);gs.fill(0);gs.rect(-ww,-wh,3*ww,3*wh);gs.erase();if(dLX)gs.rect(tx+px+lni*dx+bpd+sxd,0,lniw*dx-2*bpd,wh);if(dLY)gs.rect(0,ty+py+lnj*dy+bpd+syd,ww,lnjw*dy-2*bpd);for(let ib=0;ib<bv.length;ib++){let i=bv[ib][0],j=bv[ib][1];bv[ib][8]+=tx;bv[ib][9]+=ty;if(dLX&&pMA){if(i>lni)bv[ib][9]+=offy;else bv[ib][9]+=-offy;} if(dLY&&pMA){if(j>lnj)bv[ib][8]+=offx;else bv[ib][8]+=-offx;}}for(let ib=0;ib<bv.length;ib++){let b=bv[ib];let bh=b[4],bx=b[6],by=b[7],x=b[8],y=b[9];if(bh<0)gs.rect(x+sxd,y+syd,bx,by);}gs.noErase();for(let ib=0;ib<bv.length;ib++){let b=bv[ib];let bh=b[4],bx=b[6],by=b[7],x=b[8],y=b[9],sx=b[10],sy=b[11],xp=[x,x,x+bx,x+bx],yp=[y,y+by,y+by,y];if(bh>0){gs.beginShape();for(let i=0;i<3;i+=2)gs.vertex(xp[(i+qdrt)%4],yp[(i+qdrt)%4]);for(let i=0;i<3;i++)gs.vertex(sxd+sx+xp[(i+qdrt+2)%4],syd+sy+yp[(i+qdrt+2)%4]);gs.endShape();}}push();tint(100,.85);image(gs,0,0);pop();gs.clear();cgrd(0,0,cola,gr,1);gr.rect(0,0,ww,wh);cgrd(0,0,colc,gr,1);if(dLX)gr.rect(tx+px+lni*dx+bpd+lniw*dx-2*bpd,0,ww,wh);if(dLY)gr.rect(0,ty+py+lnj*dy+bpd+lnjw*dy-2*bpd,ww,wh);gs.fill(0);for(let ib=0;ib<bv.length;ib++){let b=bv[ib];let bh=b[4],bx=b[6],by=b[7],x=b[8],y=b[9],sx=b[10],sy=b[11],xp=[x,x,x+bx,x+bx],yp=[y,y+by,y+by,y];if(bh>0){gs.beginShape();for(let i=0;i<3;i+=2)gs.vertex(xp[(i+qdrt)%4],yp[(i+qdrt)%4]);for(let i=0;i<3;i++)gs.vertex(sx+xp[(i+qdrt+2)%4],sy+yp[(i+qdrt+2)%4]);gs.endShape()}}gr.push();gr.tint(100,.85);gr.image(gs,0,0);gr.pop();gr.erase();if(dLX)gr.rect(tx+px+lni*dx+bpd,0,lniw*dx-2*bpd,wh);if(dLY)gr.rect(0,ty+py+lnj*dy+bpd,ww,lnjw*dy-2*bpd);gr.noErase();gr.erase();for(let ib=0;ib<bv.length;ib++){let b=bv[ib],bh=b[4],bx=b[6],by=b[7],x=b[8],y=b[9];if(bh<0)gr.rect(x,y,bx,by);}gr.noErase();image(gr,0,0);gr.remove();for(let ib=0;ib<bv.length;ib++){let b=bv[ib];let i=b[0],j=b[1],bh=b[4],col=b[5],bx=b[6],by=b[7],x=b[8],y=b[9];gr1=createGraphics(bx,by);gr1.colorMode(HSL);gr1.noStroke();gr1.pixelDensity(pd);if((j>lnj&&dLY)||(i>lni&&dLX))col=colc;if(bh<=0)continue;cgrd(x,y,[col[0],col[1],col[2]+10*bh],gr1,-1);gr1.rect(0,0,bx,by);gr2=createGraphics(bx,by);gr2.colorMode(HSL);gr2.noStroke();gr2.pixelDensity(pd);gr2.fill(0);for(let ob=0;ob<bv.length;ob++){bo=bv[ob];let io=bo[0],jo=bo[1],bho=bo[4],bxo=bo[6],byo=bo[7],xo=bo[8]-x,yo=bo[9]-y;if(qdrt<=1 && jo<j)continue;if(qdrt>1&&jo>j)continue;if((qdrt==0||qdrt==3)&&io>i)continue;if((qdrt==1||qdrt==2)&&io<i)continue;let xp=[xo,xo,xo+bxo,xo+bxo],yp=[yo,yo+byo,yo+byo,yo],sxo=(bho-bh)*pSS*p*cos(pSA),syo=-(bho-bh)*pSS*p*sin(pSA);if(bho-bh>0){gr2.beginShape();for(let i=0;i<3;i+=2)gr2.vertex(xp[(i+qdrt)%4],yp[(i+qdrt)%4]);for(let i=0;i<3;i++)gr2.vertex(sxo+xp[(i+qdrt+2)%4],syo+yp[(i+qdrt+2)%4]);gr2.endShape();}}gr1.tint(100,.85);gr1.image(gr2,0,0);image(gr1,x,y);gr1.remove();}loadPixels();for(let p=0;p<pixels.length;p+=4){dp=RT(6);pixels[p]=pixels[p]+dp;pixels[p+1]=pixels[p+1]+dp;pixels[p+2]=pixels[p+2]+dp;}updatePixels();} cgrd=(x,y,c,gcg,d)=>{let gd;if(gcg==0)gd=drawingContext.createLinearGradient(ww/2-gdh*h*cos(pSA)+d*x,wh/2+gdh*h*sin(pSA)+d*y,ww/2+gdh*h*cos(pSA)+d*x,wh/2-gdh*h*sin(pSA)+d*y);else gd=gcg.drawingContext.createLinearGradient(ww/2-gdh*h*cos(pSA)+d*x,wh/2+gdh*h*sin(pSA)+d*y,ww/2+gdh*h*cos(pSA)+d*x,wh/2-gdh*h*sin(pSA)+d*y);gd.addColorStop(0.0,color(c[0],c[1],c[2]+gds));gd.addColorStop(0.5,color(c[0],c[1],c[2]));gd.addColorStop(1.0,color(c[0],c[1],c[2]-gds));if(gcg==0)drawingContext.fillStyle=gd;else gcg.drawingContext.fillStyle=gd;}
A structure, once whole, has split. Shadows reach from one side to the other in a futile attempt to bridge the gap. The impossible distance from here to there is too far to judge. The light indicates a moment in time, as if the sides could still be moving. But are they drifting apart or will they come back together?
Ephemeral Tides is an exploration of the mesmerizing dance between chaos and control where unpredictability meets order. Each iteration of Ephemeral Tides brings forth a unique and fleeting moment, inviting viewers to embrace the beauty of impermanence and the subtle harmony that arises from the convergence of seemingly opposing forces. Experience the ebb and flow of Ephemeral Tides. Press the "S" key to save the image, or "P" to export a high-resolution print.
"The Collector's Room" represents my inaugural foray into the realm of long-form generative art. This series synthesizes my well-established Infinity Room NFT and cryptoart series with my burgeoning passion for crafting textures, 3D geometries, and colors through code. Each NFT, or room, in this series, functions as an homage to the current moment generative digital art is enjoying within the contemporary art sphere. Furthermore, this project pays tribute to the discerning digital art collectors who passionately support and preserve digital culture, paralleling the enthusiasm of the artists who create it. In a unique twist, each room offers the option of being adorned with one of three distinct generative art series, exclusively available within "The Collector's Room." Consequently, this creates a meta-generative art project, encapsulating a myriad of generative art series within a larger, overarching generative endeavor. I am honored to bring this series to life, thanks to the support from Proof Collective and the Moonbirds community. (Press the 'S' key to save a PNG of any output from this series while viewing the live code).
let hash=tokenData.hash;class Random{constructor(){this.useA=!1;let e=function(e){let n=parseInt(e.substring(0,8),16),o=parseInt(e.substring(8,16),16),a=parseInt(e.substring(16,24),16),t=parseInt(e.substring(24,32),16);return function(){let e=((n|=0)+(o|=0)|0)+(t|=0)|0;return t=t+1|0,n=o^o>>>9,o=(a|=0)+(a<<3)|0,a=(a=a<<21|a>>>11)+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substring(2,34)),this.prngB=new e(tokenData.hash.substring(34,66));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}}let R=new Random;const body=document.querySelector("body"),canvas=document.querySelector("body > .webgl"),scene=new THREE.Scene;document.documentElement.style.margin="0px",document.documentElement.style.padding="0px",document.documentElement.style.overflow="hidden",document.documentElement.style.height="100vh",document.documentElement.style.width="100vw",document.body.style.margin="0px",document.body.style.padding="0px",document.body.style.overflow="hidden",document.body.style.height="100vh",document.body.style.width="100vw";const mainElement=document.createElement("div");mainElement.id="main",mainElement.style.display="flex",mainElement.style.alignItems="center",mainElement.style.justifyContent="center",mainElement.style.height="100%",mainElement.style.width="100%",mainElement.style.boxSizing="border-box",mainElement.style.padding="10px",mainElement.style.position="absolute",mainElement.style.top="0",mainElement.style.left="0",document.body.appendChild(mainElement);const containerElement=document.createElement("div");containerElement.id="container",containerElement.style.backgroundColor="transparent",mainElement.appendChild(containerElement);const aspectRatio=1;let sizes={width:1*window.innerHeight,height:window.innerHeight};const updateSizes=()=>{const e=window.innerHeight,n=window.innerWidth;sizes.height=e,sizes.width=1*e,sizes.width>n&&(sizes.width=n,sizes.height=n/1)},camera=new THREE.PerspectiveCamera(25,sizes.width/sizes.height,.1,1e3);scene.add(camera);const renderer=new THREE.WebGLRenderer({antialias:!0});renderer.shadowMap.enabled=!0,renderer.shadowMap.type=THREE.PCFSoftShadowMap;const setRendererSize=(e,n)=>{e.setSize(n.width,n.height),e.setPixelRatio(Math.min(window.devicePixelRatio,2))};updateSizes(),setRendererSize(renderer,sizes),Object.assign(container.style,{width:sizes.width+"px",height:sizes.height+"px",backgroundColor:"transparent"}),container.appendChild(renderer.domElement);const vertexShader="\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n",fragmentShader="\n uniform float aspectRatio;\n uniform vec3 marginColor;\n uniform float marginSize;\n\n varying vec2 vUv;\n\n void main() {\n vec2 uv = vUv * vec2(aspectRatio, 1.0);\n vec2 margin = vec2(marginSize);\n\n if (uv.x < margin.x || uv.y < margin.y || uv.x > 1.0 - margin.x || uv.y > 1.0 - margin.y) {\n gl_FragColor = vec4(marginColor, 1.0);\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n }\n",shaderMaterial=new THREE.ShaderMaterial({vertexShader:vertexShader,fragmentShader:fragmentShader,uniforms:{aspectRatio:{value:sizes.width/sizes.height},marginColor:{value:new THREE.Color(15527381)},marginSize:{value:.15}},transparent:!0}),geometry=new THREE.PlaneGeometry(2,2),marginPlane=new THREE.Mesh(geometry,shaderMaterial);marginPlane.position.set(0,0,-3.4),scene.add(marginPlane),window.addEventListener("resize",()=>{updateSizes(),camera.aspect=sizes.width/sizes.height,camera.updateProjectionMatrix(),setRendererSize(renderer,sizes),Object.assign(container.style,{width:sizes.width+"px",height:sizes.height+"px"}),shaderMaterial.uniforms.aspectRatio.value=sizes.width/sizes.height}),scene.add(new THREE.AmbientLight(16777215,.6));const addDirectionalLight=(e,n)=>{const o=new THREE.DirectionalLight;o.position.set(...e),o.castShadow=!0,o.intensity=n,o.shadow.mapSize.width=2160,o.shadow.mapSize.height=2700,o.shadow.camera=Object.assign(new THREE.OrthographicCamera(-50,50,50,-50,.1,1e3)),scene.add(o)};addDirectionalLight([-.5,53.3,1],1),addDirectionalLight([-.5,65.6,57],.4);const getRandomColor=e=>e[Math.floor(R.random_dec()*e.length)],randomColor2=getRandomColor([15452134,10344159,13364693,16775324,16697448,16776181,12189688,9281279]),randomColor3=getRandomColor([13940112,14237503,15105183,15096608,1381399,1453381,9875939,7214374,16212562,1577505,10568243,12759445,8551282,13737081,12816345,12893554]),randomColor4=getRandomColor([10048031,4341567,3942945,10066326]),width=window.innerWidth,height=window.innerHeight,createShaderMaterial=(e,n,o)=>new THREE.ShaderMaterial({uniforms:o,vertexShader:e,fragmentShader:n}),wallMaterial=createShaderMaterial("varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n","\nprecision mediump float;\nvarying vec2 vUv;\nuniform vec3 color;\nuniform float seed; // Add seed uniform\n\n// Improved seeded random function\nfloat random(vec2 st) {\n vec3 magic = vec3(1.0, 113.0, 301.0);\n return fract(sin(dot(st + seed, magic.xy)) * magic.z);\n}\n\nvoid main() {\n vec2 uv = vUv;\n \n // Scale the input coordinates to get consistent noise\n float n = random(uv * 1000.0); // Adjust the value (e.g., 50.0) for consistent noise\n \n vec3 finalColor = mix(color, vec3(1.0 - color.r, 1.0 - color.g, 1.0 - color.b), n);\n gl_FragColor = vec4(finalColor, 1.0);\n}",{color:{value:new THREE.Color(randomColor2)},seed:{value:R.random_dec()}}),frameMaterial=createShaderMaterial("varying vec2 vUv;\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n vUv = uv;\n}\n","\nvarying vec2 uUv;\nprecision mediump float;\nuniform vec3 uColor;\nvoid main() {\n gl_FragColor = vec4(uColor, 0.8);\n}",{uColor:{value:new THREE.Color(randomColor2)},transparent:!0}),artMaterial=new THREE.ShaderMaterial({uniforms:{seed:{value:R.random_dec()},squareSeed:{value:R.random_dec()},pixelRatio:{value:window.devicePixelRatio||1}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"\n precision mediump float;\n uniform float seed;\n uniform float squareSeed;\n varying vec2 vUv;\n uniform float pixelRatio;\n\n // Improved seeded random function\n float random(vec2 st) {\n vec3 magic = vec3(1.0, 113.0, 301.0);\n return fract(sin(dot(st + seed, magic.xy)) * magic.z);\n }\n\n // Seeded random function for color\n float randomColor(vec2 st) {\n vec3 magic = vec3(1.0, 113.0, 301.0);\n return fract(sin(dot(st + seed + squareSeed, magic.xy)) * magic.z);\n }\n\n vec3 filterGreen(vec3 color) {\n float greenThreshold = 0.2;\n float saturationThreshold = 0.3;\n float brightness = (color.r + color.g + color.b) / 3.0;\n float saturation = max(max(color.r, color.g), color.b) - min(min(color.r, color.g), color.b);\n if (color.g > greenThreshold && brightness > greenThreshold && saturation > saturationThreshold) {\n color.g = greenThreshold;\n }\n return color;\n }\n\n vec3 getColor(float value) {\n vec3 color1 = filterGreen(vec3(randomColor(vec2(squareSeed, 3.0)), randomColor(vec2(squareSeed, 4.0)), randomColor(vec2(squareSeed, 5.0))));\n vec3 color2 = filterGreen(vec3(randomColor(vec2(squareSeed, 6.0)), randomColor(vec2(squareSeed, 7.0)), randomColor(vec2(squareSeed, 8.0))));\n vec3 color3 = filterGreen(vec3(randomColor(vec2(squareSeed, 9.0)), randomColor(vec2(squareSeed, 10.0)), randomColor(vec2(squareSeed, 11.0))));\n vec3 color4 = filterGreen(vec3(randomColor(vec2(squareSeed, 12.0)), randomColor(vec2(squareSeed, 13.0)), randomColor(vec2(squareSeed, 14.0))));\n vec3 color = vec3(0.0);\n if (value < 0.25) {\n color = mix(color1, color2, value * 4.0);\n } else if (value < 0.5) {\n color = mix(color2, color3, (value - 0.25) * 4.0);\n } else if (value < 0.75) {\n color = mix(color3, color4, (value - 0.5) * 4.0);\n } else {\n color = mix(color4, color1, (value - 0.75) * 4.0);\n }\n return color;\n}\n\n void main() {\n float squareSize = mix(4.0, 65.0, squareSeed * 0.5) * pixelRatio; // Multiply by pixelRatio\n vec2 uv = vUv * squareSize;\n vec2 grid = fract(uv) - 0.57;\n float line = min(abs(grid.x), abs(grid.y));\n float noiseValue = random(floor(uv)) * 0.9 + 0.5;\n vec3 color = getColor(noiseValue);\n line = smoothstep(0.05, 0.02, line);\n vec3 gridColor = vec3(random(vec2(seed, 0.0)), random(vec2(seed, 1.0)), random(vec2(seed, 2.0)));\n vec4 finalColor = vec4(mix(color, filterGreen(gridColor), line), 1.0);\n float marginSize = 0.025;\n vec4 marginColor = vec4(0.96, 0.97, 0.85, 1.0);\n if (vUv.x < marginSize || vUv.x > 1.0 - marginSize || vUv.y < marginSize || vUv.y > 1.0 - marginSize) {\n finalColor = marginColor;\n }\n gl_FragColor = finalColor;\n }"}),artMaterial2=new THREE.ShaderMaterial({uniforms:{seed:{value:R.random_dec()},shapeSize:{value:200}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"\n precision mediump float;\n uniform float seed;\n uniform float shapeSize;\n varying vec2 vUv;\n \n // Improved seeded random function\n float random(vec2 st) {\n vec3 magic = vec3(1.0, 113.0, 301.0);\n return fract(sin(dot(st + seed, magic.xy)) * magic.z);\n }\n \n vec3 getColor(float value) {\n value *= 4.0;\n int index = int(floor(value));\n float t = fract(value);\n vec3 colorA = vec3(random(vec2(seed, float(index * 3 + 3))), random(vec2(seed, float(index * 3 + 4))), random(vec2(seed, float(index * 3 + 5))));\n vec3 colorB = vec3(random(vec2(seed, float((index + 1) * 3 + 3))), random(vec2(seed, float((index + 1) * 3 + 4))), random(vec2(seed, float((index + 1) * 3 + 5))));\n return mix(colorA, colorB, t);\n }\n \n void main() {\n vec2 uv = vUv * shapeSize;\n vec2 grid = fract(uv) - 0.5;\n float randomValue = random(floor(uv * 1.5));\n float shape = max(grid.x - grid.y, grid.y - grid.x) * float(randomValue < 0.111) + length(grid) * float(randomValue >= 0.111 && randomValue < 0.333) + max(abs(grid.x), abs(grid.y)) * float(randomValue >= 0.333);\n shape = smoothstep(0.2, 0.001, shape);\n vec3 color = getColor(randomValue);\n vec3 gridColor = vec3(random(vec2(seed, 1.0)), random(vec2(seed, 1.0)), random(vec2(seed, 2.0)));\n vec4 finalColor = vec4(mix(color, gridColor, shape), 1.0);\n float marginSize = 0.025;\n vec4 marginColor = vec4(0.96, 0.97, 0.85, 1.0);\n if (vUv.x < marginSize || vUv.x > 1.0 - marginSize || vUv.y < marginSize || vUv.y > 1.0 - marginSize) {\n finalColor = marginColor;\n }\n gl_FragColor = finalColor;\n }\n "}),artMaterial3=new THREE.ShaderMaterial({uniforms:{time:{value:0},resolution:{value:new THREE.Vector2(window.innerWidth,window.innerHeight)},seed:{value:R.random_dec()}},vertexShader:"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",fragmentShader:"\n uniform float time;\n uniform vec2 resolution;\n uniform float seed;\n varying vec2 vUv;\n vec3 permute(vec3 x) {\n return mod(((x * 34.0) + 100.0) * x, 289.0);\n }\n float snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod(i, 289.0);\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 0.5)) + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n }\n float stroke(vec2 st) {\n float noiseValue = mix(0.0, 1.0, snoise(seed * 8.0 + st * 0.4));\n float scale = mix(1.5, 3.5, snoise(seed * 2.0 + st * 0.1));\n float rotation = mix(0.5, 3.14, snoise(seed * 4.0 + st * 0.2));\n int octaves = int(mix(4.0, 7.0, snoise(seed * 6.0 + st * 0.3)));\n for (int i = 0; i < octaves; i++) {\n noiseValue += snoise(seed + st * scale);\n st = vec2(st.x * cos(rotation) - st.y * sin(rotation), st.x * sin(rotation) + st.y * cos(rotation));\n scale *= 1.5;\n rotation += 1.3;\n }\n float sizeVariation = snoise(seed * 3.0 + st * 0.3);\n float minSize = mix(0.1, 0.3, snoise(seed * 5.0 + st * 0.4));\n float maxSize = mix(0.4, 0.8, snoise(seed * 6.0 + st * 0.5));\n float adjustedSize = mix(minSize, maxSize, sizeVariation);\n return smoothstep(adjustedSize - 0.1, adjustedSize, abs(noiseValue));\n }\n void main() {\n vec2 st = vUv;\n float scribble = stroke(st);\n float marginSize = 0.025;\n vec4 marginColor = vec4(0.96, 0.97, 0.85, 1.0);\n vec4 finalColor = vec4(vec3(scribble), 1.0);\n if (vUv.x < marginSize || vUv.x > 1.0 - marginSize || vUv.y < marginSize || vUv.y > 1.0 - marginSize) {\n finalColor = marginColor;\n }\n gl_FragColor = finalColor;\n }"}),group=new THREE.Group;function createBox(e,n,o,a,t,r,i){const l=new THREE.BoxGeometry(1,1,1,10,10),s=new THREE.Mesh(l,i);return s.position.set(e,n,o),s.scale.set(a,t,r),s}const box1=createBox(0,10.88,-2,1.44,18.878,1,wallMaterial),box2=createBox(37.2,9.65,-2,72.959,21.34,1,wallMaterial),box3=createBox(-37.2,9.65,-2,72.959,21.34,1,wallMaterial),planeGeometry=new THREE.PlaneGeometry(5,5,32),planeMaterial=new THREE.MeshStandardMaterial({color:randomColor3}),plane=new THREE.Mesh(planeGeometry,planeMaterial);plane.position.set(0,-1,7.5),plane.scale.set(30,4,1),plane.rotation.x=-.5*Math.PI,plane.receiveShadow=!0;const box4=createBox(-.751,.22,.5,-.06,2.45,.05,frameMaterial),box5=createBox(.751,.22,.5,-.06,2.45,.05,frameMaterial),box6=createBox(0,1.475,.5,1.562,.06,.05,frameMaterial),box7=createBox(38.3,-.97,.5,75,.06,.05,frameMaterial),box8=createBox(-38.3,-.97,.5,75,.06,.05,frameMaterial),frameGroup=new THREE.Group;frameGroup.add(box4,box5,box6,box7,box8);const artGeometry=new THREE.BoxGeometry(1,1,1,10,10),art=new THREE.Mesh(artGeometry,artMaterial);art.position.set(-2.35,1.2,-2),art.scale.set(2.7,3.2,1);const artClone=art.clone();artClone.position.set(2.35,1.2,-2),artClone.scale.set(2.7,3.2,1);const artClone2=art.clone();function getMaterialCombination(e){const n=new Random(e);function o(){const e=[0,1,2];return e[Math.floor(n.random_dec()*e.length)]}function a(e){for(let o=e.length-1;o>0;o--){const a=Math.floor(n.random_dec()*(o+1));[e[o],e[a]]=[e[a],e[o]]}}return function(){const e=[0,1,2],t=n.random_dec();if(t<=.8)return a(e),e;if(t<=.95){const t=o(),r=e.filter(e=>e!==t)[Math.floor(2*n.random_dec())],i=[t,t,r];return a(i),i}{const e=o();return[e,e,e]}}()}artClone2.position.set(0,2.7,-2),artClone2.scale.set(1.6,2.1,1);const[materialIndexForArt,materialIndexForArtClone,materialIndexForArtClone2]=getMaterialCombination(tokenData.hash),materials=[artMaterial,artMaterial2,artMaterial3];function calculateFeatures(e){const[n,o,a]=getMaterialCombination(e.hash);let t;return{"Artwork Type":t=n===o&&o===a?"Triptych":n===o&&n!==a||n===a&&n!==o||o===a&&o!==n?"Diptych":"Varied"}}art.material=materials[materialIndexForArt],artClone.material=materials[materialIndexForArtClone],artClone2.material=materials[materialIndexForArtClone2];const features=calculateFeatures(tokenData.hash);console.log("Features:",features);const tableGroup=new THREE.Group,minLength=.5,maxLength=3,randomLength=.5+2.5*R.random_dec(),tabletopGeometry=new THREE.BoxGeometry(randomLength,.1,1),tabletopMaterial=new THREE.MeshStandardMaterial({color:randomColor4,metalness:.5,roughness:.5}),tabletop=new THREE.Mesh(tabletopGeometry,tabletopMaterial);tabletop.castShadow=!0,tabletop.receiveShadow=!0;const legHeight=.3,legGeometry=new THREE.BoxGeometry(.1,.3,.1),legMaterial=new THREE.MeshStandardMaterial({color:randomColor4,metalness:.5,roughness:.5}),leg1=new THREE.Mesh(legGeometry,legMaterial),leg2=new THREE.Mesh(legGeometry,legMaterial),leg3=new THREE.Mesh(legGeometry,legMaterial),leg4=new THREE.Mesh(legGeometry,legMaterial);leg1.castShadow=!0,leg1.receiveShadow=!0,leg2.castShadow=!0,leg2.receiveShadow=!0,leg3.castShadow=!0,leg3.receiveShadow=!0,leg4.castShadow=!0,leg4.receiveShadow=!0;const legOffsetRatio=(randomLength-.1)/2;leg1.position.set(-legOffsetRatio,-.3/1.55,-.3),leg2.position.set(legOffsetRatio,-.3/1.55,-.3),leg3.position.set(-legOffsetRatio,-.3/1.55,.3),leg4.position.set(legOffsetRatio,-.3/1.55,.3),tableGroup.add(tabletop),tableGroup.add(leg1),tableGroup.add(leg2),tableGroup.add(leg3),tableGroup.add(leg4),group.add(box1),group.add(box2),group.add(box3),group.add(plane),group.add(frameGroup),group.add(art),group.add(artClone),group.add(artClone2);let nTable=-20,numTableClones=40;const cloneTableGroup=(e,n,o)=>{let a=new THREE.Group;e.traverse(e=>{e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0)});for(let t=0;t<o;t++){let o=new THREE.Group;e.children.forEach(function(e){let n=e.clone();o.add(n)}),o.position.z=n*t,a.add(o)}return a},clonedTableGroup=cloneTableGroup(tableGroup,nTable,numTableClones);scene.add(clonedTableGroup);let randomZPosition=10*R.random_dec()+6,randomXPosition=R.random_dec()-.5;clonedTableGroup.position.set(randomXPosition,-.67,randomZPosition);let n=-20,numClones=40;const cloneGroup=(e,n,o)=>{let a=new THREE.Group;for(let t=0;t<o;t++)e.children.forEach(function(e){let o=e.clone();o.position.z=n*t,a.add(o)});return a},clonedGroup=cloneGroup(group,n,numClones);scene.add(clonedGroup);const loop=()=>{renderer.render(scene,camera),window.requestAnimationFrame(loop)};function saveSnapshot(){renderer.render(scene,camera);const e=renderer.domElement.toDataURL("image/png"),n=document.createElement("canvas");n.width=container.clientWidth,n.height=container.clientHeight;const o=n.getContext("2d"),a=getComputedStyle(container).getPropertyValue("background-color"),t=new Image;t.src=e,t.onload=function(){const e=renderer.domElement.getBoundingClientRect(),r=container.getBoundingClientRect(),i=e.left-r.left,l=e.top-r.top;o.fillStyle=a,o.fillRect(0,0,n.width,n.height),o.drawImage(t,i,l);const s=n.toDataURL("image/png"),d=document.createElement("a");d.href=s,d.download="TheCollectorsRoom.png",d.click()}}loop(),document.addEventListener("keydown",e=>{"s"!==e.key&&"S"!==e.key||saveSnapshot()});
cathedral study is a series of experimental, generative, living paintings. Continually evolving pixelated landscapes evoke ruins, fantastical cityscapes, and cathedrals. Best viewed running in real-time on a large screen. Press ‘f’ to cycle through full-screen options.
!function(){"use strict";function e(e,t,r,a,c,o){e.beginPath(),e.moveTo(t+a,r);for(let i=0;i<c;i++)e.lineTo(s(2*f*i/c)*a*V+t,n(2*f*i/c)*a*o+r);e.fill()}function t(e,t,r){let a=document.createElement("canvas");a.width=e,a.height=t;let c=a.getContext("2d");return c.scale(e,t),H(c,r),c.fillRect(0,0,1,1),[a,c]}function r(e){return e.toFixed(5)}function a(e,t,r){return e*(1-r)+t*r}var c=Math.max,o=Math.ceil,i=Math.sqrt,l=Math.pow,d=Math.floor,n=Math.sin,s=Math.cos,f=Math.PI;let v=new URLSearchParams(window.location.search).get("hash")||tokenData.hash;console.log(v);let u,b,h=new class{constructor(e){this.useA=!1,this.sfc32=e=>{let t=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),a=parseInt(e.substr(16,8),16),c=parseInt(e.substr(24,8),16);return()=>{t|=0,r|=0,a|=0,c|=0;let e=0|(0|t+r)+c;return c=0|c+1,t=r^r>>>9,r=0|a+(a<<3),a=a<<21|a>>>11,a=0|a+e,(e>>>0)/4294967296}},this.prngA=this.sfc32(e.substr(2,32)),this.prngB=this.sfc32(e.substr(34,32));for(let e=0;1e6>e;e+=2)this.prngA(),this.prngB()}rd(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}rn(e,t){return e+(t-e)*this.rd()}ri(e,t){return d(this.rn(e,t+1))}rc(e){return e[this.ri(0,e.length-1)]}rcw(e){let t=[];for(let r=0;r<e.length;r++)for(let a=0;a<=e[r][0];a++)t.push([e[r][1],e[r][2]]);return t=t.map((e=>({v:e,s:this.rd()}))).sort(((e,t)=>e.s-t.s)).map((({v:e})=>e)),[t[0][0],t[0][1]]}}(v),g=d(h.rn(0,1e6)),m=(e,t)=>d(e*t)/t,p=h.ri(50,400),E=m(.04*h.rd()+.008,1e3),A=m(500*h.rd()+20,1),D=.5>h.rd()?0:m(l(h.rd(),3),100),x=h.rc([.333333,.666667,.5]),w=h.rc([.333333,.666667,.5]);[u,b]=h.rcw([[1,0,"All I have is a vague feeling."],[1,1,"It seems to revolve around this."],[1,2,"If I could only figure out this bit right here."],[1,3,"So much confusing detail."]]);let F,y=1,C=.8>h.rd(),B=h.rc([1,-1])*h.rd()*h.rd()*f*2,T=.8*h.rd()+.6,I=.8*h.rd()+.6,$=.2>h.rd(),_=h.rd(),R=m(1.5*h.rd()+2,10),S=.8>h.rd();0==u?(F=m(h.rd()*h.rd()*50,1),y=.3*h.rd()+.2):1==u?(F=h.ri(4,100),y=.5>h.rd()?y:.8*h.rd()+.2):2==u?(F=h.ri(100,300),y=.1*h.rd()+.05):3==u&&(F=h.ri(100,300),y=.3*h.rd()+.05),.66667<_&&(R+=1);const U=["#264653","#2A9D8F","#E76F51","#8d99ae","#ef233c","#b95173","#d03e3a","#e17f36","#2d5277","#e40445","#134c51","#047a7d","#a11f5d","#e07270","#eb942e","#4d879b","#21527c","#0d4756","#9aa6c2","#51413d","#ada1cc","#699fcb","#087c7c","#3f302e","#6f0039","#f0b4b3","#f3acca","#c67cde","#f6895e","#005e23","#1d3663","#e29578","#7f24af","#FED3D6","#D69DAB","#C58B99","#E8ACB8","#866F74","#D5D7DF","#624A4E","#2E3E2E","#56684E","#243520","#4B7C86","#326762","#4C6D2A","#453326","#AF5C7E","#4F2546","#332424","#6A3E3A","#891860","#402433","#553D37","#785D6F","#B6B2BE","#D70B58","#594D5E","#2b2d42","#003566","#5C4C50","#457b9d","#d90429","#9D001A","#EAA4B5","#928E92","#498885","#91465B","#ada397","#776d6b","#a2a9a3","#717278","#edf2f4"];let P,N,k=[],L=h.ri(8,15);for(let e=0;e<L;e++)k.push(h.rc(U));P=[];for(let e=0;e<L;e++)P.push(k[e]);[P,N]=h.rcw([[50,P,"Something indescribable."],[6,["#ada397","#776d6b","#a2a9a3","#717278"],"I'm like 99% sure it started with the letter X..."],[5,["#f3acca","#0d4756","#2A9D8F","#699fcb","#f3acca","#d03e3a","#21527c"],"Something about it was fresh and pure."],[5,["#b95173","#51413d","#134c51","#eb942e","#134c51","#d03e3a","#9aa6c2"],"There were tigers."],[5,["#f3acca","#E76F51","#8d99ae","#9aa6c2","#699fcb","#2d5277","#0d4756","#e07270","#d03e3a","#ada1cc"],"Whoa I have smelt that before like 300 years ago..."],[5,["#f3acca","#f0b4b3","#8d99ae","#e07270"],"Are you sure we haven't met??? Like completely sure?"],[5,["#9aa6c2","#8d99ae","#087c7c","#e07270","#51413d","#e40445","#134c51","#264653","#e40445"],"I do remember I was happy."],[5,["#f0b4b3","#d03e3a","#E76F51","#047a7d"],"I think I was sitting by a fireplace."],[10,["#e07270","#f0b4b3","#f3acca","#ada1cc","#51413d","#699fcb","#699fcb","#087c7c","#2A9D8F","#0d4756"],"I was a carefree child, staring out the window. But what window and where?"],[5,["#d03e3a","#e17f36","#51413d","#4d879b","#E76F51","#0d4756"],"Have I ever been to Arizona?"],[10,["#d03e3a","#8d99ae","#4d879b","#eb942e","#ef233c","#087c7c","#087c7c","#f0b4b3","#9aa6c2","#f3acca"],"It smelled like Iowa."],[5,["#a11f5d","#c67cde","#E76F51","#e17f36","#4d879b","#087c7c","#e17f36","#e40445"],"A blurred, dreamlike vision."],[5,["#b95173","#c67cde","#E76F51","#087c7c","#134c51","#a11f5d","#7f24af","#eb6ea3","#2e0055"],"It was definitely in the 90s."],[10,["#699fcb","#1d3663","#1d3663","#134c51","#e29578","#6f0039","#4d879b","#ada1cc","#005e23"],"Big city vibes."],[5,["#2d5277","#134c51","#8d99ae","#4d879b","#e40445","#d03e3a","#e29578","#4d879b"],"I visited a house as a child, and all I remember is the feeling."],[10,["#5C4C50","#EAA4B5","#928E92","#498885","#91465B"],"I'm sure I have been there in a book... but what book? And where is there?"],[10,["#453326","#AF5C7E","#4F2546","#D5D7DF","#332424","#6A3E3A","#891860","#402433","#E3E7EF","#402433","#AF5C7E","#553D37","#CDC4CD","#785D6F","#B6B2BE","#4F2546","#D70B58","#594D5E","#264653","#134c51"],"It had to do with romance."],[10,["#FED3D6","#D69DAB","#C58B99","#264653","#E8ACB8","#191D13","#866F74","#6f0039","#624A4E","#2E3E2E","#56684E","#243520","#4B7C86","#326762","#4C6D2A"],"I'm sure I was in a garden... somewhere."],[5,["#326762","#594D5E","#EAA4B5","#2A9D8F","#2b2d42","#ada397","#e29578","#498885","#b95173","#2E3E2E","#2b2d42","#9D001A","#6f0039","#a2a9a3","#134c51"],"A moment of suspended time."],[5,["#6f0039","#56684E","#E76F51","#21527c","#402433","#D69DAB","#edf2f4","#0d4756"],"It was veryyyy humid."],[5,["#4d879b","#191D13","#edf2f4","#51413d","#C58B99","#D69DAB","#51413d","#D69DAB","#003566","#498885","#edf2f4","#326762","#087c7c"],"A wisp of forgotten emotion."],[5,["#21527c","#5C4C50","#134c51","#EAA4B5","#005e23","#D5D7DF","#0d4756","#0d4756","#b95173","#d03e3a","#AF5C7E","#134c51","#e40445","#AF5C7E"],"Something about a swimming pool... in a park...???"],[5,["#928E92","#51413d","#9D001A","#624A4E","#e29578","#264653","#AF5C7E","#087c7c"],"A delicate, lost fragrance."],[5,["#8d99ae","#3f302e","#624A4E","#e17f36","#264653","#91465B","#f6895e","#51413d","#e29578","#ada1cc","#8d99ae","#3f302e","#ada1cc","#332424"],"Pure nostalgia."],[10,["#2d5277","#e29578","#4F2546","#FED3D6","#243520","#498885","#CDC4CD","#717278","#E8ACB8","#402433"],"A shiver down my spine."],[10,["#56684E","#087c7c","#e29578","#f3acca","#91465B","#e40445","#8d99ae","#047a7d","#264653","#624A4E","#699fcb","#5C4C50","#5C4C50"],"Haven't I walked down that path before?"],[5,["#4F2546","#498885","#56684E","#594D5E","#d03e3a","#e29578","#FED3D6","#f3acca"],"There was laughter in the other room."],[10,["#264653","#785D6F","#f3acca","#776d6b","#717278","#d03e3a","#E76F51","#e07270","#E76F51","#866F74","#91465B","#047a7d","#087c7c","#699fcb"],"An inexplicable and mysterious warmth."]]),console.log(P);let M=h.rc(["#264653","#134c51","#a2a9a3","#ada397"]);P.push("#3a3a3a"),P.push("#cbbfb0"),P.push(M);class X{constructor(e,t,r,a,c,o,i){let l="precision highp float;",d=document.createElement("canvas");d.width=e,d.height=t;let n=d.getContext("webgl"),s=n.createShader(n.VERTEX_SHADER);n.shaderSource(s,l+o),n.compileShader(s);let f=n.createShader(n.FRAGMENT_SHADER);n.shaderSource(f,l+"float H=0."+r+`;float H2=H;float N21(vec2 p){vec3 p3=fract(vec3(p.xyx)*H2);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}vec4 br(vec2 uv,sampler2D ug,float s){vec2 r=vec2(s);vec4 c=texture2D(ug,uv);const float inc=6.283185/${c}.0;for(float d=0.0; d<6.283185;d+=inc){vec2 ccss=vec2(cos(d),sin(d))*r;for(float i=(1.0/${a}.0)*4.0;i<=1.0;i+=(1.0/${a}.0)){vec2 p=uv+ccss*i;c+=texture2D(ug,p);}}return c/(${a}.0*(${c}.0-5.0));}vec4 drbr(vec2 uv,sampler2D ug,float s,float t,bool cbo){vec4 c=texture2D(ug,uv);vec2 ccss=vec2(cos(t),sin(t))*vec2(s);for(float i=0.0;i<=1.0;i+=(1.0/${a}.0)){c+=texture2D(ug,uv+ccss*(cbo?(i-0.5):i));}return c/${a}.0;}float SN(vec2 uv,float x,float y){uv=uv*vec2(x,y);vec2 lv=fract(uv),id=floor(uv);lv=lv*lv*(3.-2.*lv);float bl=N21(id),br=N21(id+vec2(1,0)),b=mix(bl,br,lv.x),tl=N21(id+vec2(0,1)),tr=N21(id+vec2(1,1)),t=mix(tl,tr,lv.x);return mix(b,t,lv.y);}float FN(vec2 uv,float x,float y){float c=SN(uv,pow(2.0,x),pow(2.0,y)),div=1.0;for(float i=0.0;i<12.0;i++){float s=(1.0/pow(2.0,i));c+=SN(uv,pow(2.0,x+i),pow(2.0,y+i))*s;div+=s;}c/=div;return c;}vec4 bm(vec4 b,vec4 l,float o){return (b*l*o+b*(1.0-o));}float bm(float b,float l,float o){return (b*l*o+b*(1.0-o));}float bs(float b,float l){return 1.0-((1.0-b)*(1.0-l));}vec4 bs(vec4 b,vec4 l){return vec4(bs(b.r,l.r),bs(b.g,l.g),bs(b.b,l.b),min(b.a+l.a,1.0));}float bo(float b,float l){return b<0.5?(2.0*b*l):(1.0-2.0*(1.0-b)*(1.0-l));}vec4 bo(vec4 b,vec4 l){return vec4(bo(b.r,l.r),bo(b.g,l.g),bo(b.b,l.b),min(b.a+l.a,1.0));}vec3 lv(vec3 c,float i,float g,float a){return pow(min(max(c-vec3(i),vec3(0.0))/(vec3(a)-vec3(i)),vec3(1.0)),vec3(1.0/g));}vec4 lv(vec4 c,float i,float g,float a){return vec4(lv(vec3(c.r,c.g,c.b),i,g,a),c.a);}float lv(float c,float i,float g,float a){return lv(vec3(c),i,g,a).r;}float th(float c,float t){return(c<t?0.0:1.0);}vec4 alphaBlend(vec4 down,vec4 up){return down*(1.0-up.a)+up*up.a;}vec4 sa(vec4 a,float b){const vec3 e=vec3(0.2125,0.7154,0.0721);vec3 i=vec3(dot(a.rgb,e));return vec4(mix(i,a.rgb,b),a.a);}mat2 rt(float a){return mat2(cos(a),-sin(a),sin(a),cos(a));}float b(vec4 a){return (a.r+a.g+a.b)/3.0;}vec2 rtpv(float a,vec2 uv,vec2 p){uv=uv-p;uv=rt(a)*uv;uv=uv+p;return uv;}`+i),n.compileShader(f);let v=n.createProgram();n.attachShader(v,s),n.attachShader(v,f),n.linkProgram(v);let u=n.getAttribLocation(v,"a_p"),b=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,b),n.useProgram(v),n.enableVertexAttribArray(u),n.bindBuffer(n.ARRAY_BUFFER,b),n.vertexAttribPointer(u,2,n.FLOAT,!1,0,0),n.viewport(0,0,n.canvas.width,n.canvas.height),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),this.c=d,this.gl=n,this.p=v}setUniformColor(e,t){this.gl.uniform4f(this.gl.getUniformLocation(this.p,e),t.r,t.g,t.b,t.a)}setUniform1f(e,t){this.gl.uniform1f(this.gl.getUniformLocation(this.p,e),t)}setUniformSampler2D(e,t,r){let a=this.gl,c=a.createTexture();a.activeTexture(a.TEXTURE0+t),a.bindTexture(a.TEXTURE_2D,c),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,r);let o=a.getUniformLocation(this.p,e);a.uniform1i(o,t)}render(){this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1,-1,-1,1,1]),this.gl.STATIC_DRAW),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}}const H=(e,t)=>{e.fillStyle=t},G=e=>`rgb(${e},${e},${e})`;let O=e=>e.getImageData(0,0,Z,ee);const W=.5*(i(3)-1),Y=(3-i(3))/6,z=e=>0|d(e),q=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]);let V=.8,j=window,J=document;const K=J.body.appendChild(J.createElement("canvas")),Q=K.getContext("2d");let Z,ee,te,re,ae=j.innerWidth,ce=j.innerHeight;ce>ae/V?(Z=ae,ee=Z/V):(ee=ce,Z=ee*V),Z=o(Z),ee=o(ee),te=j.devicePixelRatio;let oe=!1;/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(oe=!0),1<te&&!oe?(Z*=te,ee*=te,K.style.width=Z/te+"px",K.style.height=ee/te+"px"):(K.style.width=`${Z}px`,K.style.height=`${ee}px`),K.width=Z,K.height=ee,Q.lineJoin="round",Q.lineCap="round",Q.scale(Z,ee);let ie=J.body;ie.style.display="flex",ie.style.alignItems="center",ie.style.justifyContent="center",ie.style.backgroundColor="#302e2f",ie.style.overflow="hidden";const le=(e=>{const t=(e=>{const t=new Uint8Array(512);for(let e=0;256>e;e++)t[e]=e;for(let r=0;255>r;r++){const a=r+~~(e.rd()*(256-r)),c=t[r];t[r]=t[a],t[a]=c}for(let e=256;e<512;e++)t[e]=t[e-256];return t})(e),r=new Float64Array(t).map((e=>q[e%12*2])),a=new Float64Array(t).map((e=>q[e%12*2+1]));return(e,c)=>{let o=0,i=0,l=0;const d=(e+c)*W,n=z(e+d),s=z(c+d),f=(n+s)*Y,v=e-(n-f),u=c-(s-f);let b,h;v>u?(b=1,h=0):(b=0,h=1);const g=v-b+Y,m=u-h+Y,p=v-1+2*Y,E=u-1+2*Y,A=255&n,D=255&s;let x=.5-v*v-u*u;if(0<=x){const e=A+t[D];x*=x,o=x*x*(r[e]*v+a[e]*u)}let w=.5-g*g-m*m;if(0<=w){const e=A+b+t[D+h];w*=w,i=w*w*(r[e]*g+a[e]*m)}let F=.5-p*p-E*E;if(0<=F){const e=A+1+t[D+1];F*=F,l=F*F*(r[e]*p+a[e]*E)}return.5*(70*(o+i+l)+1)}})(h);if(H(Q,M),Q.fillRect(0,0,1,1),S){for(let t=0;1e3>t;t++)H(Q,h.rc(P)),e(Q,h.rd()*V,h.rd(),.08,20,V);re=new X(Z,ee,g,30,30,"attribute vec3 a_p;void main(){gl_Position=vec4(a_p,1.0);}",`uniform sampler2D cxt;void main(){vec2 uv=(gl_FragCoord.xy/vec2(${r(Z)},${r(ee)}));uv.y=1.0-uv.y;gl_FragColor=br(uv,cxt,0.1);}`),re.setUniformSampler2D("cxt",1,O(Q)),re.render(),Q.drawImage(re.c,0,0,1,1)}for(let e=0;e<p;e++){let e,t,r;e=(1-l(h.rd(),2))*(I-.1)+.1,t=h.rd()*T+(1-T)/2,r=h.rd()*e/2+(1-e)/2;let c=1-r;Q.beginPath();let o=9874512*h.rd(),i=9874512*h.rd(),d=t+.1*(le(o,i)-.5)*e*D+.01*(le(o,i)-.5)*e*D+.04*(le(o,i)-.5)*e*D+.02*(le(o,i)-.5)*e*D,n=r;Q.moveTo(d*V,n);for(let l,s=1e-4;1>s;s+=1e-4){l=t+.1*(le(o,i+2*s*e)-.5)*e*D+.01*(le(o,i+10*s*e)-.5)*e*D+.04*(le(o,i+20*s*e)-.5)*e*D+.02*(le(o,i+40*s*e)-.5)*e*D,l*=V;let f=a(r,c,s);Q.lineTo(l,f),d=l,n=f}Q.lineWidth=l(h.rd(),2)*E+.002,Q.strokeStyle=h.rc(P),Q.stroke()}let[de,ne]=t(Z,ee,G(127.5));ne.lineWidth=3e-4;let se=.15;for(let e=0;1e3>e;e++){ne.beginPath();let e=h.rd(),t=h.rd();ne.moveTo(e,t);for(let r=0;100>r;r++){let r=e+.1*(h.rd()-.5),a=t+.1*(h.rd()-.5);ne.quadraticCurveTo(r,a,e,t),e=r,t=a}ne.strokeStyle=G(255*(h.rd()*se*h.rc([1,-1])+.5)),ne.stroke()}se=.2;let[fe,ve]=t(Z,ee,G(127.5));for(let t=0;5e4>t;t++)H(ve,G(255*(h.rd()*se*h.rc([1,-1])+.5))),e(ve,h.rd(),h.rd(),h.rd()*h.rd()*.0015,20,.8),ve.fill();for(let t=0;100>t;t++){H(ve,G(255*h.rd()));let t=h.rd(),r=h.rd(),a=98456512*h.rd(),c=98456512*h.rd();for(let o=0;1>o;o+=.01)e(ve,t+.02*(2*le(.2*o+a,0)-1),r+.02*(2*le(.2*o+c,0)-1),5e-4,20,.8);ve.fill()}let ue="";if(1==u){let e=1.5*c(x,w,1-x,1-w);for(let t=0;t<F;t++){let a=w,c=e*y*(F-t)/F;ue+=`p=vec2(${r(x*V)},${r(a)});if(distance(uv,p)<${r(c)}){uv=rtpv(${r($?h.rc([0,f/2,f,3*f/2]):C?B:h.rc([1,-1])*h.rd()*f*2)},uv,p);}`}}else if(0==u||3==u)for(let e=0;e<F;e++){let e=h.rd(),t=h.rd(),a=y*h.rd();ue+=`p=vec2(${r(e*V)},${r(t)});if(distance(uv,p)<${r(a)}){uv=rtpv(${r($?h.rc([0,f/2,f,3*f/2]):C?B:h.rc([1,-1])*h.rd()*f*2)},uv,p);}`}else if(2==u)for(let e=0;e<F;e++){let t=h.rd()*f*2,a=1.5*e*l(h.rd(),1.5)/F,c=s(t)*a+x,o=n(t)*a+w,i=e*y/F;ue+=`p=vec2(${r(c*V)},${r(o)});if(distance(uv,p)<${r(i)}){uv=rtpv(${r($?h.rc([0,f/2,f,3*f/2]):C?B:h.rc([1,-1])*h.rd()*f*2)},uv,p);}`}re=new X(Z,ee,g,100,50,"attribute vec3 a_p;void main(){gl_Position=vec4(a_p,1.0);}",`uniform sampler2D cxt;vec2 p;void main(){vec2 uv=(gl_FragCoord.xy/vec2(${r(Z)},${r(ee)}));uv.y=1.0-uv.y;uv.x*=${r(V)};`+ue+`float ss=SN(uv,1.0,${r(A)});vec4 c=drbr(uv,cxt,ss>0.5?0.05:0.0,0.0,true);if(ss>0.5){c=bo(c,c);}gl_FragColor=c;}`),re.setUniformSampler2D("cxt",1,O(Q)),re.render(),Q.drawImage(re.c,0,0,1,1),x=h.rc([.333333,.666667,.5]),w=h.rc([.333333,.666667,.5]),re=new X(Z,ee,g,100,50,"attribute vec3 a_p;void main(){gl_Position=vec4(a_p,1.0);}",`\nuniform sampler2D cxt,t,tex;void main(){vec2 og=(gl_FragCoord.xy/vec2(${r(Z)},${r(ee)}));og.y=1.0-og.y;vec2 uv=og;uv.x*=${r(V)};float dx=uv.x-${r(x*V)},dy=uv.y-${r(w)};float a=atan(dy,dx);float dis=pow(distance(uv,vec2(${r(x*V)},${r(w)})),${r(R)});uv=og;vec4 c;if(${r(_)}<0.33333){c=drbr(uv,cxt,${r(1)}*dis,a,true);}else if(${r(_)}<0.66667){c=drbr(uv,cxt,${r(1)}*dis,a+1.5708,true);}else{c=br(uv,cxt,${r(.3)}*dis);}c=bo(c,c);vec2 st=uv+FN(uv,4.0,4.0)*0.05;vec4 n=mix(vec4(vec3(1.0),1.0),vec4(vec3(0.95),1.0),(SN(st,1500.0,1.0)+SN(st,1.0,2000.0)));n=bm(c,n,1.0);n=bo(n,mix(texture2D(t,uv),vec4(vec3(0.5),1.0),SN(uv,8.0,10.0)*0.5+0.25));vec4 texx=texture2D(tex,uv);n=bo(n,texx);n=lv(n,0.05,1.1,0.95);gl_FragColor=n;}`),re.setUniformSampler2D("t",0,O(ne)),re.setUniformSampler2D("tex",3,O(ve)),re.setUniformSampler2D("cxt",1,O(Q)),re.render(),Q.drawImage(re.c,0,0,1,1)}();
This feels familiar But I can't figure out why Have I been here before Or was it a dream I remember this feeling I have felt this before Have I stepped in a time machine Gone warp speed back to....... when And just like that, the feeling is gone The memory was sweet, I want it back But I never did figure out what it was. (This is a generative algorithm written completely with code in Javascript and GLSL.)
function vecscl(e,l){let r=[];for(let a=0;a<e.length;a++)r[a]=e[a]*l;return r}function clamp(e){return Math.max(0,Math.min(1,e))}function dot2(e,l){return e[0]*l[0]+e[1]*l[1]}function unit(e){return vecscl(e,1/norm3(e))}function norm3(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])}let C,D,body,gl,Shader,simp,colp,pap,vs,fs,Lx,Ly,Nx,Ny;GET.hash&&(tokenData.hash=GET.hash),R=new Random,document.body.style.backgroundColor="#030303",console.log("cathedral study by Eric De Giuli"),C=({body:body}=D=document).createElement("canvas"),body.appendChild(C),gl=C.getContext("webgl2"),"drawingBufferColorSpace"in gl&&(gl.drawingBufferColorSpace="display-p3"),Shader=(e,l)=>{const r=gl.createShader(e);return gl.shaderSource(r,l),gl.compileShader(r),gl.getShaderParameter(r,gl.COMPILE_STATUS)||(console.error(`Error compiling ${e===gl.VERTEX_SHADER?"vertex":"fragment"} shader "${l}":`),console.log(gl.getShaderInfoLog(r))),r};let pal,pj,inv,hgt=rnd(),Nm=hgt<.15?60:hgt<.4?120:hgt<.8?240:hgt<.93?360:512;GET.N&&(Nm=GET.N),innerWidth>innerHeight?(Ny=Nm,Nx=Math.floor(Nm*innerWidth/innerHeight)):(Nx=Nm,Ny=Math.floor(Nm*innerHeight/innerWidth));let palp=[16,3,10,7,4,0,10,13,10,13,1,1,1,2,7,12];palp=vecscl(palp,1/110);let cumpal=[];cumpal[0]=0;for(let e=1;e<palp.length;e++)cumpal[e]=cumpal[e-1]+palp[e-1];let st=1;pj=1;let palr=rnd();for(;st<palp.length&&cumpal[st]<palr;)st++;st--;let mm,nn,ri,zh,zh2,zh3,zr,a,ct,dc,archdepth,night,rlight,wf0,rain,st0,scalefac,infrac,Pcir,lgfac,famp,kkx,kky,hx,lo,sparkle,speckle,skeleton,bubbly,wobble,narch,y0,stt,rr0,nt,refl,dt,phase,clarity,gfac,kgx,kgy,melt,wild,eye,sphsh,a1,a2,xe0,ye0,ze0,kz,kx,ky,om,ox,oy,col,c1,s1,c2,s2,xe,ye,ze,pj2=0;switch(inv=0,st){case 0:pj=6,pj2=7;break;case 1:pj=11,pj2=7;break;case 2:pj=1,pj2=5;break;case 3:pj=1,pj2=0;break;case 4:pj=3,pj2=9;break;case 5:pj=6,pj2=0;break;case 6:pj=5,pj2=7;break;case 7:pj=11,pj2=5;break;case 8:pj=11,pj2=4;break;case 9:pj=11,pj2=0;break;case 10:pj=0,pj2=0,inv=1;break;case 11:pj=3,pj2=3,inv=1;break;case 12:pj=2,pj2=0;break;case 13:pj=2,pj2=10;break;case 14:pj=10,pj2=8;break;case 15:pj=10,pj2=4}pal=new Uint8Array(80);for(let e=0;e<11;e++)for(let l=0;l<2;l++){let r=0==l?pj:pj2,a=Math.min(e,pals[r].length-1);pal[3*e+30*l]=pals[r][a][0],pal[3*e+30*l+1]=pals[r][a][1],pal[3*e+30*l+2]=pals[r][a][2],inv&&(pal[3*e+30*l]=(pal[3*e+30*l]+180)%360)}let rndth=-PI/4+PI/2*rnd();c1=Math.cos(rndth),s1=Math.sin(rndth),c2=-.7,s2=.7,ze0=-(.8+1.5*rnd()),xe0=.05*(2*rnd()-1),ye0=-1/4,kz=1,rnd()<.1&&(kz=2),kx=1,rnd()<.1&&(kx=2),ky=1,rnd()<.1&&(ky=2);let azz=Math.floor(Math.exp(rnd()*Math.log(.95/.1)));azz>=4&&azz<=6&&(azz=1),hx=360*rnd(),sparkle=0,rnd()<.5&&(sparkle=1),lo=0,rnd()<.4&&(lo=1),speckle=0,famp=3*rnd(),rnd()<.4&&(famp=0),kkx=6*rnd(),kky=6*rnd(),rr0=.6,stt=0,lo=1,eye=0,skeleton=0,bubbly=1+Math.floor(4*rnd()),rnd<.1&&(bubbly=0),refl=1,rnd()<.3&&(refl=0),refl&&(rr0*=.9),inv=0,rnd()<.2&&(inv=1),rnd()<.7&&(wobble=1),azz<7&&(wobble=0),phase=0,rnd()<.6&&(phase=-PI/3+PI/6*rnd()),dt=.1+1.2*rnd(),clarity=0,rnd()<.5&&(clarity=.7*rnd()),kgx=5+7*rnd(),kgy=5+7*rnd(),gfac=.5+rnd(),Nrad0*=gfac,melt=0,rnd()<.4&&azz>5&&(melt=1),wild=1,rnd()<.2&&(wild=0),a1=rnd(),a2=rnd();let miny=1,maxy=-1,v2=[];ze=ze0,xe=xe0,ye=ye0,stt=1,rnd()<.7&&(stt=2),st0=stt,sparkle=0;let gothic=rnd()<.3?1:0;refl=0,rnd()<.8&&(refl=1),rain=0,(rnd()<.3||gothic)&&(rain=rnd()),lo&&(Nrad0*=.7);let Nc=5*gothic+6+Math.floor(10*rnd()),Nb=Math.floor(Nc/2+3*Nc*rnd());dc=.008;let colht=8-4*gothic;ct=1.5*dc;let locrnd=rnd()<.3?0:rnd();a=[];for(let e=0;e<Nc;e++){let l=[];l.x=[],l.y=[],l.z=[],l.vx=[],l.vy=[],l.vz=[],l.x[0]=.07+.85*(e/Nc+.1*locrnd*rnd()),l.z[0]=.2*rnd(),l.y[0]=0,l.vx[0]=0,l.vy[0]=1,l.vz[0]=0;for(let e=1;e<colht+1;e++)l.x[e]=l.x[0],l.y[e]=l.y[0]+dc*e,l.z[e]=l.z[0],l.vx[e]=0,l.vy[e]=1,l.vz[e]=0;l.arch=0,l.maxy=l.y[colht-1]+dc,l.maxx=l.x[colht-1],l.maxz=l.z[0],l.open=1,a.push(l)}narch=0;let nopen=Nc;for(;narch<Nb&&nopen>2;){let e=Math.floor(rnd()*a.length),l=Math.floor(rnd()*a.length);if(e!=l&&1==a[e].open&&1==a[l].open){a[e].open=0,a[l].open=0,nopen-=2;let r=a[e].maxy,t=a[l].maxy;r>t&&([e,l]=[l,e]),r=a[e].maxy,t=a[l].maxy;let c=a[e].maxx,o=a[l].maxx,n=a[e].maxz,g=a[l].maxz,i=[];i.x=[],i.y=[],i.z=[];let d=1+Math.floor((t-r)/dc+1e-4);a[e].arch;i.vx=[],i.vy=[],i.vz=[];for(let l=0;l<d;l++)i.x[l]=a[e].maxx,i.y[l]=a[e].maxy+(t-r)*l/d,i.z[l]=n,i.vx[l]=0,i.vy[l]=1,i.vz[l]=0;let p=Math.abs(o-c)/2,x=Math.max(6,1.2*PI*(p-dc)/dc),s=PI/(x-1),f=0;c<o&&(f=PI,s*=-1),y0=d>0?i.y[d-1]:a[e].maxy;for(let e=0;e<x;e++){gothic?(i.x[d+e]=(a1*c+(1-a1)*o)/2+1.1*(a1*c-(1-a1)*o)/2+1.1*(e+.5)/x*((1-a1)*o-a1*c),i.y[d+e]=y0+3*p*Math.max(0,(.5-Math.abs(e/x-.5))*(.5-Math.abs(e/x-.5)))):(i.x[d+e]=(c+o)/2+p*Math.cos(f+s*(e+1)),i.y[d+e]=y0+Math.max(0,p*Math.sin(f+s*(e+1)))),i.z[d+e]=n+(g-n)*(e+1)/x;let l=unit([Math.cos(f+s*(e+1))-Math.cos(f+s*e),Math.sin(f+s*(e+1))-Math.sin(f+s*e),0]);i.vx[d+e]=l[0],i.vy[d+e]=l[1],i.vz[d+e]=l[2]}i.maxx=(c+o)/2,i.maxy=t+p+ct/2,i.maxz=(n+g)/2,i.arch=Math.sign(o-c),i.open=1,nopen++,a.push(i),narch++}}let Nfinal=a.length,sortr=rnd();sortr>.1&&a.sort((function(e,l){return sortr<.8?parseFloat(l.maxz)-parseFloat(e.maxz):parseFloat(l.maxy)-parseFloat(e.maxy)})),maxy=0;for(let e=0;e<Nfinal;e++)maxy=Math.max(maxy,a[e].maxy);scalefac=.7/(maxy-0),ox=.5-xe0,oy=.5-ye0,oy=.93,rlight=[4*rnd()-2,4*rnd()-2,4*rnd()-2],night=0,rnd()<.3&&(night=1),(6==st||7==st||15==st)&&(night=0),wf0=.7*Math.exp(.3*rnd()),ze=ze0+.2,xe=.5+.2*rnd()-.1,ye=0,Pcir=.05+.04*Math.exp(rnd()),lgfac=rnd();let kp,km,kl,rand,aa=[],ax=[],ay=[],az=[],vx=[],vy=[],vz=[];for(let e=0;e<Nfinal;e++)for(ax.push(...a[e].x),ay.push(...a[e].y),az.push(...a[e].z),vx.push(...a[e].vx),vy.push(...a[e].vy),vz.push(...a[e].vz);ax.length>LL;){let e=[];e.x=ax.slice(0,LL),e.y=ay.slice(0,LL),e.z=az.slice(0,LL),e.vx=vx.slice(0,LL),e.vy=vy.slice(0,LL),e.vz=vz.slice(0,LL),aa.push(e),ax=ax.slice(LL),ay=ay.slice(LL),az=az.slice(LL),vx=vx.slice(LL),vy=vy.slice(LL),vz=vz.slice(LL)}Nfinal=aa.length,ax=[],ay=[],az=[],vx=[],vy=[],vz=[],rand=[];for(let e=0;e<Nrand;e++)rand[e]=rnd();let kl0=.001;switch(kp=new Float32Array(N),km=new Float32Array(N),kl=new Float32Array(N),kl[0]=c1,kl[1]=s1,kl[2]=xe,kl[3]=ye,kl[4]=ze,kl[6]=Nrad0,kl[7]=clarity,kl[8]=wf0,kl[9]=rr0,kl[10]=lgfac,kl[11]=wild,kl[12]=rlight[0],kl[13]=rlight[1],kl[14]=rlight[2],kl[15]=inv,kl[16]=night,kl[17]=lo,kl[18]=phase,kl[19]=rain,kl[20]=famp,kl[21]=kkx,kl[22]=kky,kl[23]=scalefac,kl[24]=ox,kl[25]=oy,st){case 0:kp=[.66,.95,.94,.037,.89,.26,.9,.94,.65,.76,.54,.11,.5,.66,.96,.74,.91,.33,.15,.85];break;case 1:kp=[.97,.01,.89,.08,.78,.98,.16,.8,.53,.91,.4,.54,.84,.44,.14,.75,.45,.33,.47,.95];break;case 2:kp=[.72,.85,.51,.08,.98,.29,.91,.19,.69,.24,.99,.32,.84,.03,.97,.14,.09,.04,.08,.26];break;case 3:kp=[.14,.95,.24,.09,.05,.18,.96,.04,.47,.18,.13,.38,.21,.85,.66,.05,.15,.23,.25,.48];break;case 4:kp=[.58,.02,.03,.84,.43,.4,.95,.76,.15,.55,.04,.49,.49,.55,.52,.07,.22,.16,.31,.37];break;case 5:kp=[.21,.1,.21,.13,.07,.42,.26,.77,.28,.67,.79,.1,.28,.2,.04,.21,.35,.125,.75,.87];break;case 6:kp=[.4,.28,.88,.36,.92,.96,.79,.24,.99,.73,.68,.03,.09,.52,.11,.29,.95,.01,.01,.62];break;case 7:kp=[.1,.27,.31,.05,.4,.24,.67,0,.02,.92,.75,.11,.4,.55,.97,.45,.12,.15,.54,.56];break;case 8:kp=[.17,.81,.64,.19,.52,.27,.59,.11,.65,.87,.36,.17,.66,.1,.95,.08,.5,.43,.92,.13];break;case 9:kp=[.59,.56,.03,.14,.58,.05,.8,0,.09,.75,.8,.55,.07,.27,.46,.08,.35,.01,.17,.63];break;case 10:kp=[.021,.68,.2,.04,.46,.4,.3,.76,.19,.2,.78,.5,.1,.58,.61,.13,.25,.39,.63,.38];break;case 11:kp=[.11,.18,.02,.15,.49,.9,.73,.77,.69,.93,.95,.76,.78,.32,.13,.7,.07,.04,.3,.76];break;case 12:kp=[.15,.27,.17,.11,.61,.44,.65,.21,.82,.79,.4,.33,.43,.22,.02,.07,.5,.13,.95,.34];break;case 13:kp=[.89,.46,.48,.3,.38,.18,.13,.68,.2,.87,.92,.56,.06,.25,.32,.1,.05,.11,.31,.55];break;case 14:kp=[.9,.025,.064,.439,.208,.154,.261,.085,.268,.917,.78,.709,.087,.068,.684,.057,.48,.282,.174,.819];break;case 15:kp=[.81,.79,.38,.8,.19,.22,.39,.047,.82,.98,.9,.28,.12,.24,.12,.69,.62,.2,.99,.71]}kp[4]=Math.exp(rnd()-1)-Math.exp(-1),kp[5]=Math.exp(rnd()-1)-Math.exp(-1);for(let e=0;e<N;e++)km[e]=rnd();function setrand(){rand[37]=km[0],rand[38]=kp[4],rand[39]=km[2],rand[40]=km[3],rand[41]=km[4],rand[42]=km[5],rand[43]=km[6],rand[44]=km[7]}km[0]<.15&&10!=st&&3!=st&&1!=st&&(kp[15]=.69,kp[16]=1.34),setrand();let nx=2+Math.floor(8*rnd()),ny=2+Math.floor(8*rnd()),rr=rnd(),n4=Math.floor(Math.exp(4*rnd()));const tex0=new Uint8Array(Nx*Ny*4);let th,loc_a,loc_L,loc_ac,loc_img,loc_img00,loc_res,loc_t,loc_rand,loc_pal,loc_kp,loc_km,loc_kl,loc_kv,loc_kw,loc_imgc,loc_imgc2,loc_resc,loc_Lc,loc_tc,loc_randc,loc_aavg,loc_bavg,loc_dxy,loc_dxyc,loc_rc,loc_rcc,loc_ax,loc_ay,loc_az,loc_v,loc_klc,loc_kpc,loc_palc,loc_img00c,loc_resp,loc_imgp,loc_randp,loc_kpp,loc_ap,loc_Lp;for(let e=0;e<Nx;e++)for(let l=0;l<Ny;l++){let r=e+Nx*l,a=.1+(.4+.5*a2)*rr;tex0[4*r]=Math.floor(255*rnd()*a),tex0[4*r+1]=Math.floor(255*rnd()*(1-a)),tex0[4*r+2]=Math.floor(255*rnd()*(1-a)),tex0[4*r+3]=255}function thrower(e){if(!gl.getProgramParameter(e,gl.LINK_STATUS))throw console.log(`Link failed:\n${gl.getProgramInfoLog(e)}`),console.log(`VS LOG:\n${gl.getShaderInfoLog(vs)}`),console.log(`FS LOG:\n${gl.getShaderInfoLog(fs)}`),"AARG DED"}function gul(e,l){return gl.getUniformLocation(e,l)}dzc=0,dzp=dzc,simp=gl.createProgram(),vs=Shader(gl.VERTEX_SHADER,src_vert),fs=Shader(gl.FRAGMENT_SHADER,src_simp),gl.attachShader(simp,vs),gl.attachShader(simp,fs),gl.linkProgram(simp),gl.useProgram(simp),thrower(simp),loc_res=gul(simp,"res"),loc_L=gul(simp,"L"),loc_t=gul(simp,"t"),loc_img=gul(simp,"img"),loc_img00=gul(simp,"img00"),loc_kp=gul(simp,"kp"),loc_rand=gul(simp,"rand"),loc_dxy=gul(simp,"dxy"),loc_rc=gul(simp,"rc"),gl.uniform1i(loc_img,0),gl.uniform1i(loc_img00,1),loc_a=gl.getAttribLocation(simp,"a"),gl.activeTexture(gl.TEXTURE0),gl.vertexAttribPointer(loc_a,2,gl.FLOAT,!1,0,0),gl.enableVertexAttribArray(loc_a),pap=gl.createProgram(),vs=Shader(gl.VERTEX_SHADER,src_vert),fs=Shader(gl.FRAGMENT_SHADER,src_pap),gl.attachShader(pap,vs),gl.attachShader(pap,fs),gl.linkProgram(pap),gl.useProgram(pap),thrower(pap),loc_Lp=gul(pap,"L"),loc_imgp=gul(pap,"img"),loc_randp=gul(pap,"rand"),loc_kl=gul(pap,"kl"),loc_ax=gul(pap,"ax"),loc_ay=gul(pap,"ay"),loc_az=gul(pap,"az"),loc_v=gul(pap,"v"),gl.uniform1i(loc_imgp,0),gl.bindBuffer(gl.ARRAY_BUFFER,gl.createBuffer()),gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([-1,1,1,1,1,-1,-1,1,1,-1,-1,-1]),gl.STATIC_DRAW),loc_ap=gl.getAttribLocation(pap,"a"),gl.activeTexture(gl.TEXTURE0),gl.vertexAttribPointer(loc_ap,2,gl.FLOAT,!1,0,0),gl.enableVertexAttribArray(loc_ap),colp=gl.createProgram(),vs=Shader(gl.VERTEX_SHADER,src_vert),fs=Shader(gl.FRAGMENT_SHADER,src_colp),gl.attachShader(colp,vs),gl.attachShader(colp,fs),gl.linkProgram(colp),gl.useProgram(colp),thrower(colp),loc_imgc=gul(colp,"img"),loc_imgc2=gul(colp,"img2"),loc_img00c=gul(colp,"img00"),loc_palc=gul(colp,"pal"),loc_resc=gul(colp,"res"),loc_Lc=gul(colp,"L"),loc_tc=gul(colp,"t"),loc_randc=gul(colp,"rand"),loc_dxyc=gul(colp,"dxy"),loc_rcc=gul(colp,"rc"),loc_klc=gul(colp,"kl"),gl.bindBuffer(gl.ARRAY_BUFFER,gl.createBuffer()),gl.bufferData(gl.ARRAY_BUFFER,new Float32Array([-1,1,1,1,1,-1,-1,1,1,-1,-1,-1]),gl.STATIC_DRAW),gl.uniform1i(loc_imgc,0),gl.uniform1i(loc_imgc2,1),gl.uniform1i(loc_palc,2),gl.uniform1i(loc_img00c,3),loc_ac=gl.getAttribLocation(colp,"a"),gl.activeTexture(gl.TEXTURE0),gl.vertexAttribPointer(loc_ac,2,gl.FLOAT,!1,0,0),gl.enableVertexAttribArray(loc_ac);let M=1,f1=0;var isMobile=window.matchMedia("(hover: none)").matches;function resize_render(){let e=innerWidth,l=innerHeight,r=devicePixelRatio;C.width=M*e*r|0,C.height=M*l*r|0,head||0==f1?(Lx=2*Math.floor(.97*C.width/2),Ly=2*Math.floor(C.height/2-.015*C.width)):(C.requestFullscreen(),Lx=C.width,Ly=C.height),C.style.width=e+"px",C.style.height=l+"px",gl.viewport((C.width-Lx)/2,(C.height-Ly)/2,Lx,Ly),render()}function texset(e=gl.CLAMP_TO_EDGE,l=gl.NEAREST){gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,e),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,e),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,l),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,l)}let tex00,tex02,texA,texB,texC,fbA,fbB,fb00,fb02;tex00=gl.createTexture(),gl.bindTexture(gl.TEXTURE_2D,tex00),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,Nx,Ny,0,gl.RGBA,gl.UNSIGNED_BYTE,null),texset(),fb00=gl.createFramebuffer(),gl.bindFramebuffer(gl.FRAMEBUFFER,fb00),gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,tex00,0),tex02=gl.createTexture(),gl.bindTexture(gl.TEXTURE_2D,tex02),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,Nx,Ny,0,gl.RGBA,gl.UNSIGNED_BYTE,null),texset(),fb02=gl.createFramebuffer(),gl.bindFramebuffer(gl.FRAMEBUFFER,fb02),gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,tex02,0),texA=gl.createTexture(),gl.bindTexture(gl.TEXTURE_2D,texA),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,Nx,Ny,0,gl.RGBA,gl.UNSIGNED_BYTE,tex0.subarray(0,Nx*Ny*4)),texset(),fbA=gl.createFramebuffer(),gl.bindFramebuffer(gl.FRAMEBUFFER,fbA),gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,texA,0),texB=gl.createTexture(),gl.bindTexture(gl.TEXTURE_2D,texB),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,Nx,Ny,0,gl.RGBA,gl.UNSIGNED_BYTE,null),texset(),fbB=gl.createFramebuffer(),gl.bindFramebuffer(gl.FRAMEBUFFER,fbB),gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,texB,0),texC=gl.createTexture(),gl.bindTexture(gl.TEXTURE_2D,texC),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGB,10,2,0,gl.RGB,gl.UNSIGNED_BYTE,pal),texset(gl.REPEAT,gl.LINEAR),gl.useProgram(simp),gl.uniform1fv(loc_rand,rand),gl.uniform1fv(loc_kp,kp),gl.useProgram(pap),gl.uniform1fv(loc_randp,rand),gl.uniform1fv(loc_kl,kl),gl.useProgram(colp),gl.uniform1fv(loc_randc,rand),gl.uniform1fv(loc_klc,kl);let time,prevt=performance.now(),dtime=20,dtt=1,running=!0,periodic=0,anim=0,flip=0,count=0,dxycount=0,TT=120*(5-2*night),om0=.01,A=.002,time0=prevt,ai=0,AA=[],tik=0;function render(){if(running){if(time=performance.now(),time-prevt>dtime){tik%E==0&&(ai==Nfinal&&(ai=0),AA=[],AA=aa[ai],ai++,ax=AA.x,ay=AA.y,az=AA.z,vx=AA.vx,vy=AA.vy,vz=AA.vz,count++,tik=0),gl.viewport(0,0,Nx,Ny),gl.useProgram(pap),gl.uniform2f(loc_Lp,Lx,Ly),gl.uniform1fv(loc_randp,rand),gl.uniform1fv(loc_ax,ax),gl.uniform1fv(loc_ay,ay),gl.uniform1fv(loc_az,az),gl.uniform3fv(loc_v,[vx[0],vy[0],vz[0]]),kl[4]=ze*(1+.5*Math.cos(time/1e3)),kl[5]=LL,kl[26]=rnd(),kl[27]=kp[18],kl[27]=(time-prevt)/1e3*10,kl[28]=kp[19],kl[28]=tik/(E+1)*(1-tik/(E+1))*2,kl[29]=count/TT,gl.uniform1fv(loc_kl,kl);for(let e=0;e<2;e++)flip=!flip,gl.bindFramebuffer(gl.FRAMEBUFFER,flip?fb02:fb00),gl.activeTexture(gl.TEXTURE0),gl.bindTexture(gl.TEXTURE_2D,flip?tex00:tex02),gl.drawArrays(gl.TRIANGLES,0,6);if(gl.viewport(0,0,Nx,Ny),gl.useProgram(simp),tik++,count%TT==0){count=0;for(let e=0;e<Nrand;e++)rand[e]=.7*rnd()+.3*rand[e];setrand(),gl.uniform1fv(loc_rand,rand)}if(0==dxycount){dx=dxc-dxp,dy=dyc-dyp,dz=dzc-dzp,zc*=1+2*dz,xc-=(.5+(2*dx-.5)*(1+2*dz))*zc,yc-=(.5+(2*dy-.5)*(1+2*dz))*zc,kp[0]+=dx/3,kp[1]+=dy/3;let e=count/TT*2;e<1?(kp[18]=6*e*(1-e)*Math.exp(-e),kp[19]=0):(e-=1,kp[18]=0,kp[19]=6*e*(1-e)*Math.exp(-e)),kp[4]=dtt*(1-count/TT)*(1-count/TT),kp[15]*=Math.exp(dx/3),kp[16]*=Math.exp(dy/3)}gl.uniform1fv(loc_kp,kp),0==dx&&0==dy&&0==dz||dxycount++,gl.uniform3fv(loc_dxy,[dx,dy,dz]),gl.uniform3fv(loc_rc,[xc,yc,zc]),gl.uniform1f(loc_t,time),gl.uniform2f(loc_L,Lx,Ly),gl.uniform2f(loc_res,Nx,Ny);for(let e=0;e<2;e++)flip=!flip,gl.bindFramebuffer(gl.FRAMEBUFFER,flip?fbB:fbA),gl.activeTexture(gl.TEXTURE0),gl.bindTexture(gl.TEXTURE_2D,flip?texA:texB),gl.activeTexture(gl.TEXTURE1),gl.bindTexture(gl.TEXTURE_2D,tex00),gl.drawArrays(gl.TRIANGLES,0,6);gl.viewport((C.width-Lx)/2,(C.height-Ly)/2,Lx,Ly),gl.useProgram(colp),gl.uniform1f(loc_tc,time),gl.uniform2f(loc_Lc,Lx,Ly),gl.uniform2f(loc_resc,Nx,Ny),gl.uniform3fv(loc_dxyc,[dx,dy,dz]),gl.uniform3fv(loc_rcc,[xc,yc,zc]),dxycount>=1&&(dxycount=0,dx=0,dy=0,dz=0,dxp=dxc,dyp=dyc,dzp=dzc),gl.bindFramebuffer(gl.FRAMEBUFFER,null),gl.activeTexture(gl.TEXTURE0),gl.bindTexture(gl.TEXTURE_2D,flip?texB:texA),gl.activeTexture(gl.TEXTURE1),gl.bindTexture(gl.TEXTURE_2D,flip?texA:texB),gl.activeTexture(gl.TEXTURE2),gl.bindTexture(gl.TEXTURE_2D,texC),gl.activeTexture(gl.TEXTURE3),gl.bindTexture(gl.TEXTURE_2D,tex00),0==dz&&gl.drawArrays(gl.TRIANGLES,0,6)}prevt=time-(time-prevt)%dtime}if(1==savescr&&(savescr=2,render()),2==savescr){savescr=0;var e=document.createElement("canvas");e.width=Lx,e.height=Ly;var l=e.getContext("2d");l.setTransform(1,0,0,-1,0,gl.height),l.drawImage(C,-(C.width-Lx)/2,-(C.height-Ly)/2),e.toBlob((e=>{saveBlob(e,`cathedral_study-${tokenData.tokenId}.png`)}))}requestAnimationFrame(render)}const saveBlob=function(){const e=document.createElement("a");return document.body.appendChild(e),e.style.display="none",function(l,r){const a=window.URL.createObjectURL(l);e.href=a,e.download=r,e.click()}}();let tid=0,savescr=0;onkeyup=e=>(" "==e.key&&(running=!running),window!==window.parent?(65==e.keyCode&&(dxc-=.01),68==e.keyCode&&(dxc+=.01),87==e.keyCode&&(dyc+=.01),83==e.keyCode&&(dyc-=.01)):(37==e.keyCode&&(dxc-=.01),39==e.keyCode&&(dxc+=.01),38==e.keyCode&&(dyc+=.01),40==e.keyCode&&(dyc-=.01)),88==e.keyCode&&(dzc-=.03),90==e.keyCode&&(dzc=Math.min(0,dzc+.03)),70==e.keyCode&&(f1=(f1+1)%2,resize_render()),80==e.keyCode&&(savescr=1),!1);const delta=6;let startx,starty,startdist,mousedown=0;gl.canvas.addEventListener("dblclick",(function(e){running=!running})),resize_render();
"use strict";let R,N=30,Nrand=100,dx=0,dy=0,dz=0,dxc=0,dyc=0,dzc=0,dxp=0,dyp=0,dzp=0,xc=0,yc=0,zc=1,TWO_PI=6.28318530718,Nrad0=5,E=4,LL=10;const head=/\bHeadlessChrome\//.test(navigator.userAgent);let PI=3.1415926;for(var GET={},query=window.location.search.substring(1).split("&"),i=0,max=query.length;i<max;i++)if(""!==query[i]){var param=query[i].split("=");GET[decodeURIComponent(param[0])]=decodeURIComponent(param[1]||"")}let pals=[];pals.push([[359,31,56],[353,19,97],[6,20,96],[22,21,92],[20,16,98],[28,21,99],[6,20,96],[347,13,96]]),pals.push([[208,49,38],[205,41,59],[192,29,45],[190,14,64],[220,9,78],[12,4,45],[167,16,81],[180,7,100]]),pals.push([[222,86,22],[208,88,29],[203,61,57],[215,49,74],[211,68,93],[236,100,24],[195,85,45]]),pals.push([[4,100,34],[1,96,84],[26,92,94],[34,58,89],[48,100,99],[21,100,84],[8,100,17]]),pals.push([[43,35,28],[46,39,42],[41,27,90],[39,46,49],[39,83,90],[46,6,96],[46,15,97]]),pals.push([[209,92,15],[197,98,24],[195,79,37],[190,42,64],[189,62,90]]),pals.push([[331,21,31],[265,23,40],[335,26,76],[163,32,22],[210,24,29],[180,31,97],[49,30,63],[180,23,90],[170,13,48]]),pals.push([[26,71,17],[26,78,23],[42,68,60],[40,46,60],[42,76,74],[37,62,74]]),pals.push([[102,41,55],[123,37,63],[94,27,65],[121,30,69],[91,26,67],[125,37,63]]),pals.push([[115,52,17],[98,51,40],[78,58,54],[91,67,84],[6,54,38]]),pals.push([[349,83,69],[250,44,66],[191,44,66],[27,82,72],[45,85,70],[0,100,79]]),pals.push([[221,20,21],[199,26,38],[190,10,81],[220,0,100],[190,0,100],[205,30,43],[183,20,100],[215,43,36],[185,0,100],[200,0,100]]);let header="#version 300 es\nprecision highp float;\nprecision highp int;";var src_vert=header+"\nin vec2 a;\nout vec2 u;\nvoid main() {\n gl_Position = vec4(a,0.,1.);\n u = a/2. +vec2(.5,.5);\n}",src_pap=header+"\nconst int N = 30;\nconst int LL = 10;\nconst float Nf =20.;\nconst int Nrand =100;\nconst float Nrandf =100.;\nconst float PI =3.1415926;\n\nin vec2 u;\nout vec4 cout;\n\nuniform vec2 L;\nuniform highp sampler2D img;\nuniform float rand[Nrand];\n\nuniform float kl[N];\nuniform float ax[LL];\nuniform float ay[LL];\nuniform float az[LL];\nuniform vec3 v;\n\nfloat s1,c1,xe,ye,ze,Nrad,clarity,wf0,rr00,lgfac,wild,inv,night,lo,phase,rain,famp,kkx,kky,scalefac,ox,oy,rv;\nint nn; vec3 rlight;\n\nvec2 proj( in vec3 v, in vec3 ve, in vec2 tt) {\n float c = ve.z/(ve.z+v.z);\n return vec2((v.x-ve.x + tt[0]*v.z)*c, (v.y-ve.y + tt[1]*v.z)*c);\n}\nfloat dot3( in vec3 v, in vec3 w) { return v[0]*w[0] + v[1]*w[1] + v[2]*w[2]; }\nvec3 rot3d( in vec3 v, in vec3 k, in float theta) { // rotation of vector v about axis k, angle t with Rodrigues formula:\n return v*cos(theta)+cross(k,v)*sin(theta)+k*dot3(k,v)*(1.-cos(theta));\n}\nfloat norm3( in vec3 v) { return sqrt(dot3(v,v)); }\nvec3 flow( in vec3 r, in vec3 p) {\n return r + vec3(sin(2.*PI*rand[0]+3.*p[0]*r.x),sin(2.*PI*rand[1]+2.*p[1]*r.y),0.)*p[2]/200.;\n}\n\nvec2 ccircle(in vec2 uv, in float x, in float y, in float D, in float t1, in float t2) {\n float dx = x-uv.x; float dy = y-uv.y;\n float d = (dx*dx+dy*dy)/(D*D/4.);\nreturn .07*exp(-d*D*D)*float(dy>0.&&dx*dx<.001)*rain+exp(-(2.+6.*kl[0])*d)*vec2(1.,0.);\n}\n\nvoid main(void) {\n c1 = kl[0];\n s1 = kl[1];\n xe = kl[2];\n ye = kl[3];\n ze = kl[4];\n nn = int(kl[5]);\n Nrad = kl[6];\n clarity = kl[7];\n wf0 = kl[8];\n rr00 = kl[9];\n lgfac = kl[10];\n wild = kl[11];\n rlight = vec3(kl[12],kl[13],kl[14]);\n inv = kl[15];\n night = kl[16];\n lo = kl[17];\n phase = kl[18];\n rain = kl[19];\n famp = kl[20];\n kkx = kl[21];\n kky = kl[22];\n scalefac = kl[23];\n ox = kl[24];\n oy = kl[25];\n rv= kl[26];\nfloat mel1 = kl[27];\nfloat mel2 = kl[28];\nfloat count = kl[29];\n\nvec2 uv = u;\nvec2 uc = u;\n\nvec4 cc = texture(img,uc);\n\nif (L.x<L.y) {\n uv.y = 0.5 + (L.y/L.x)*(uv.y-0.5);\n uc.y = 0.5 + (L.y/L.x)*(uc.y-0.5);\n} else {\n uv.x = 0.5 + (L.x/L.y)*(uv.x-0.5);\n uc.x = 0.5 + (L.x/L.y)*(uc.x-0.5);\n}\n\ncout = cc;\n//cout.xy*=1. - .02*rain-.02*night;\n\nfloat dtt = 1.0;\n\nvec3 ve = vec3(xe,ye,ze);\nvec3 param = vec3(kkx,kky,famp);\nvec2 tt = vec2(c1,s1);\nfloat st=0.;\nfloat cnt=0.;\nint thmax = int(Nrad);\nfor( int j=0; j<nn; j++ ) {\n vec3 p = vec3(ax[j],ay[j],az[j]);\n float wf = wf0*(10.+min(240.,2./(0.005+ay[j])));\n for ( int th=0; th<thmax; th++) {\n cnt++;\n vec3 v1 = rot3d(vec3(1.,0.,0.),vec3(v[0],v[1],v[2]),(rv+2.*mel1+cnt/Nrad)*2.*PI);\n float ri = clarity + (1.-clarity)*(0.2+0.8*rand[int(mod(cnt,Nrandf))]);\n float ri0 = ri;\n float ri2 = fract(237.*ri);\n float ri3 = fract(191.*ri);\n float ri4 = fract(257.*ri);\n float fac = 1.;\n vec3 pr = flow(p+v1*1./200.*fac*ri*wf,param);\n //vec3 pr = p + .4*v1/200.*fac*wf*ri;\n vec2 p1 = proj(pr,ve,tt);\n float rr = 3.*wf0*(2.-clarity)*rr00*3.; //*ri;\n float aaa = 3.2/Nrad;\n aaa *= 2./(2.-clarity);\n //rr*=1.-count;\n float rref = rr;\n float aref = aaa;\n //aaa *= 1.-4.*az[j];\naaa*=2.;\n vec3 dr = rlight + vec3(xe,ye,ze) - pr;\n float xx = dot3(v1,dr)/length(dr);\n float axx = abs(xx); //axx=min(1.,max(0.,axx));\n dr-= .1*vec3(rand[11],rand[12],rand[13]);//.02*ff.yzx;\n float xx2 = dot3(v1,dr)/length(dr);\n\n vec2 hsb = vec2(axx,xx2);\n if (xx<0.) {\n hsb*=0.;\n aaa=1.;\n }\n float vv = min(.27,3.*(hsb.x+hsb.y));\n vv *= 1. + 0.25/rr/rr;\n float dt = 0.01*(1.+3.*ri4);\n fac = exp(ri3*2.);\n rr *= .45*fac;\n aaa*= 1.1/fac;\n vv*= 1.-.2*night;\n vv*= 1.-abs(sin(ri));\n vec2 v2 = proj(v1,ve,tt);\n float t1 = phase + 0.1 + .8*atan(v2.y,v2.x);\n if (xx<0.) { t1 += PI; }\n float t2 = t1 + dt;\n t1 -= dt;\n vv*=2.;\n vec4 cc_rgb = vec4(hsb.xy*vv,1.,min(1.,aaa));\n// vec4 cc_line = vec4(0.9,0.2,1.,.2*aaa);\n // if (rain>0. && xx>0. && st>0.) {rr*=exp(2.*ri4);}\n vec2 cd = ccircle(uc,ox+scalefac*p1.x,1.-oy+scalefac*p1.y,rr/200.,t1,t2);\n cout = mix(cout, cc_rgb, mel1*cc_rgb.w*cd[0]);\n pr = flow(vec3(p.x,-p.y,p.z)+v1/200.*fac*ri*wf,param);\n p1 = proj(pr,ve,tt);\n cd = ccircle(uc,ox+scalefac*p1.x,1.-oy+scalefac*p1.y,rr/200.,t1,t2);\n cout = mix(cout, cc_rgb, mel1*cc_rgb.w*cd[0]);\n }\n}\n}",src_simp=header+"\nconst int N = 30;\nconst int LL = 10;\nconst float Nf =20.;\nconst int Nrand =100;\nconst float Nrandf =100.;\nconst float dn =0.1;\nconst int Nx =512;\nconst float Nxf =512.;\nconst float PI =3.1415926;\nconst int numOctaves = 8;//9;\n//const float TT = 120.;\n\nin vec2 u;\nout vec4 cout;\n\nuniform vec2 res;\nuniform vec2 L;\nuniform float t; // frame number\nuniform highp sampler2D img;\nuniform highp sampler2D img00;\nuniform float kp[N];\nuniform float rand[Nrand];\nuniform vec3 dxy;\nuniform vec3 rc;\n\nvec2 hash2( in vec2 x ) {\n int ii = int(mod(x.x+res.x*x.y,Nrandf)); //counter into array of random #s\n int i2 = int(mod(x.y-res.y*x.x,Nrandf)); //counter into array of random #s\n return vec2(rand[ii],rand[i2]);\n}\nfloat ddot ( in vec2 x, in vec2 y ) { return x.x+y.x + x.y*y.y; }\nvec3 noise( in vec2 p ) {\n vec2 i = floor( p );\n vec2 f = fract( p );\n\n vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);\n vec2 du = 30.0*f*f*(f*(f-2.0)+1.0);\n\n vec2 ga = hash2( i + vec2(0.0,0.0) );\n vec2 gb = hash2( i + vec2(1.0,0.0) );\n vec2 gc = hash2( i + vec2(0.0,1.0) );\n vec2 gd = hash2( i + vec2(1.0,1.0) );\n\n float va = ddot( ga, f - vec2(0.0,0.0) );\n float vb = ddot( gb, f - vec2(1.0,0.0) );\n float vc = ddot( gc, f - vec2(0.0,1.0) );\n float vd = ddot( gd, f - vec2(1.0,1.0) );\n return vec3( va + u.x*(vb-va) + u.y*(vc-va) + u.x*u.y*(va-vb-vc+vd), // value\n ga + u.x*(gb-ga) + u.y*(gc-ga) + u.x*u.y*(ga-gb-gc+gd) + // derivatives\n du * (u.yx*(va-vb-vc+vd) + vec2(vb,vc) - va));\n}\n\nvec3 fbm( in vec2 x, in float H )\n{\n float G = exp(-2.*H);\n float f = 1.0;\n float a = 1.0;\n vec3 t = vec3(0.);\n for( int i=0; i<numOctaves; i++ )\n {\n t += a*noise(f*x);\n f *= 2.0;\n a *= G;\n }\n return t;\n}\n\nvec4 laplacian(in sampler2D img, in vec2 uv, in float dx) {\n vec2 dt = 1./res;\n vec4 rg = texture(img, uv + vec2(0, 0)*dt) * -1.;\n rg += texture(img, uv + vec2(-1, -1)*dt)*(0.05+dx);\n rg += texture(img, uv + vec2(-0, -1)*dt)* (0.2-dx);\n rg += texture(img, uv + vec2(1, -1)*dt)* (0.05+dx);\n rg += texture(img, uv + vec2(-1, 0)*dt) * (0.2-dx);\n rg += texture(img, uv + vec2(1, 0)*dt) * (0.2-dx);\n rg += texture(img, uv + vec2(-1, 1)*dt) * (0.05+dx);\n rg += texture(img, uv + vec2(0, 1)*dt) * (0.2-dx);\n rg += texture(img, uv + vec2(1, 1)*dt) * (0.05+dx);\n\n return rg;\n}\nvec2 proj( in vec3 v, in vec3 ve, in vec2 tt) {\n float c = ve.z/(ve.z+v.z);\n return vec2((v.x-ve.x + tt[0]*v.z)*c, (v.y-ve.y + tt[1]*v.z)*c);\n}\nfloat dot3( in vec3 v, in vec3 w) { return v[0]*w[0] + v[1]*w[1] + v[2]*w[2]; }\nvec3 rot3d( in vec3 v, in vec3 k, in float theta) { // rotation of vector v about axis k, angle t with Rodrigues formula:\n return v*cos(theta)+cross(k,v)*sin(theta)+k*dot3(k,v)*(1.-cos(theta));\n}\nfloat norm3( in vec3 v) { return sqrt(dot3(v,v)); }\nvec3 flow( in vec3 r, in vec3 p) {\n return r + vec3(sin(2.*PI*rand[0]+3.*p[0]*r.x),sin(2.*PI*rand[1]+2.*p[1]*r.y),0.)*p[2]/200.;\n}\n\nvoid main(void) {\n vec2 dt = rc.z/res;\n vec2 uv = (u+dxy.xy-vec2(0.5))*(1.+dxy.z)+vec2(0.5);\n vec2 uc = -rc.xy + (u)*rc.z; // global coords\n vec3 ff = (0.4+0.6*kp[9])*fbm(uc+fbm(uc,1.).yz,0.4+.4*kp[0]);\n vec3 f2 = (0.4+0.6*kp[10])*fbm(-11.*kp[11]*uc+fbm(-17.*kp[10]*uc,0.7).yz,0.7-.4*kp[1]);\n\nvec4 lp,lp2,cv,cu,cv2,cu2;\nfloat aa,bb;\n\nuc=uv;\n\nvec4 cc0 = texture(img00,uv);\n\nuc.y += kp[0]*0.2*rand[3]*ff.z*f2.x*cc0.x;//*mel1;\nuc.x += kp[1]*0.2*rand[3]*ff.y*f2.x*cc0.y;//*mel1;\n\nvec4 cc = texture(img,uc);\n\nff.x += .1*cc0.x;\nf2.x += .1*cc0.y;\n\nfloat th = ff.x;\nfloat dtt = 1.;\n\nvec2 dist = .5*dtt*0.01*(cc.x-cc.w)*vec2(kp[18]*cos(th)*(ff.y+kp[4]*ff.z),kp[19]*sin(th)*(ff.z-kp[4]*ff.y));\ndist.xy += rand[42]*(dist.yx-dist.xy);\nuc+=dist;\n\n aa = cc.x/256. + cc.y;\n bb = cc.z/256. + cc.w;\n lp = laplacian(img,uc,(kp[0]*2.-1.)*f2.x*(1.-aa));\n lp2 = laplacian(img,uc,(kp[1]*2.-1.)*ff.x*bb);\n\n uc.x += dtt*0.1*(lp.x-lp.w)*cos(th)*(ff.y+kp[4]*ff.x);\n uc.y += dtt*0.1*(lp.x-lp.w)*sin(th)*(ff.x-kp[4]*ff.y);\n uc.x += dtt*0.1*(cc.x-cc.w)*cos(th)*(ff.y+kp[4]*ff.x);\n uc.y += dtt*0.1*(cc.x-cc.w)*sin(th)*(ff.x-kp[4]*ff.y);\n\n cv= texture(img, uc + vec2(0, 1)*dt);\n cu= texture(img, uc + vec2(1, 0)*dt);\n cv2= texture(img, uc + vec2(0, -1)*dt);\n cu2= texture(img, uc + vec2(-1, 0)*dt);\n\nfloat da = .4*(1.-kp[15])*(1.-bb)*(lp.x+256.*lp.y)/256. + 3.*( -aa*bb*bb + 0.015*(1.+kp[17])*(1.-aa))*ff.x*ff.x ;\nfloat db = .4*(1.-kp[16])*(1.+kp[7])*(0.02+ff.x*ff.x)*aa*0.5*(lp2.z+256.*lp2.w)/256. + 3.*( aa*bb*bb - 0.04*(1.+1.*kp[6])*bb)*ff.x*ff.x;\n\nfloat dda=kp[15]*0.18*((cu.x/256.+cu.y-cu2.x/256.-cu2.y)*ff.y*kp[18] + (cv.x/256.+cv.y-cv2.x/256.-cv2.y)*ff.z*kp[19]);\nfloat ddb=kp[16]*0.18*((cu.z/256.+cu.w-cu2.z/256.-cu2.w)*f2.y*kp[18] + (cv.z/256.+cv.w-cv2.z/256.-cv2.w)*f2.z*kp[19]);\n\nda -= .3*cc0.x*cc0.x*ff.x;\ndb += .3*cc0.y;\n\ndda*=dda*6.*dtt;\nddb*=ddb*6.*dtt;\nda += dda;//*(1.-dda);\ndb += ddb;//*(1.-ddb);\n\nda*= 46000.;\ndb*= 46000.;\n\n da+=aa*256.*256.*.99;\n db+=bb*256.*256.*.99;\n\nfloat yn = floor(da/256.); // get leading part of da and rescale\nfloat xn = (da-yn*256.);\nfloat wn = floor(db/256.); // get leading part of da and rescale\nfloat zn = (db-wn*256.);\n\ncout = vec4(xn,yn,zn,wn)/256.;\n}",src_colp=header+"\nconst int N = 30;\nconst float Nf =20.;\nconst int Nrand =100;\nconst float Nrandf =100.;\nconst float dn =0.1;\nconst int Nx =512;\nconst float Nxf = .25*512.;\nconst float PI =3.1415926;\nconst int numOctaves = 8;\n\nin vec2 u;\nout vec4 cc;\n\nuniform vec2 res;\nuniform vec2 L;\nuniform float t; // frame number\nuniform highp sampler2D img;\nuniform highp sampler2D img2;\nuniform highp sampler2D img00;\nuniform highp sampler2D pal; // palette\nuniform float rand[Nrand];\nuniform vec3 dxy;\nuniform vec3 rc;\nuniform float kl[N];\n\nvec2 hash2( in vec2 x ) {\n int ii = int(mod(x.x+res.x*x.y,Nrandf)); //counter into array of random #s\n int i2 = int(mod(x.y-res.y*x.x,Nrandf)); //counter into array of random #s\n return vec2(rand[ii],rand[i2]);\n}\nfloat ddot ( in vec2 x, in vec2 y ) { return x.x+y.x + x.y*y.y; }\nvec3 noise( in vec2 p ) {\n vec2 i = floor( p );\n vec2 f = fract( p );\n\n vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);\n vec2 du = 30.0*f*f*(f*(f-2.0)+1.0);\n\n vec2 ga = hash2( i + vec2(0.0,0.0) );\n vec2 gb = hash2( i + vec2(1.0,0.0) );\n vec2 gc = hash2( i + vec2(0.0,1.0) );\n vec2 gd = hash2( i + vec2(1.0,1.0) );\n\n float va = ddot( ga, f - vec2(0.0,0.0) );\n float vb = ddot( gb, f - vec2(1.0,0.0) );\n float vc = ddot( gc, f - vec2(0.0,1.0) );\n float vd = ddot( gd, f - vec2(1.0,1.0) );\n\n return vec3( va + u.x*(vb-va) + u.y*(vc-va) + u.x*u.y*(va-vb-vc+vd), // value\n ga + u.x*(gb-ga) + u.y*(gc-ga) + u.x*u.y*(ga-gb-gc+gd) + // derivatives\n du * (u.yx*(va-vb-vc+vd) + vec2(vb,vc) - va));\n}\n\nvec3 fbm( in vec2 x, in float H )\n{\n float G = exp(-2.*H);\n float f = 1.0;\n float a = 1.0;\n vec3 t = vec3(0.0);\n for( int i=0; i<numOctaves; i++ )\n {\n t += a*noise(f*x);\n f *= 2.0;\n a *= G;\n }\n return t;\n}\n\nvec4 laplacian(in sampler2D img, in vec2 uv, in float dx) {\n vec2 dt = 1./res;\n vec4 rg = texture(img, uv + vec2(-1, -1)*dt)*(0.05+dx);\n rg += texture(img, uv + vec2(-0, -1)*dt)* (0.2-dx);\n rg += texture(img, uv + vec2(1, -1)*dt)* (0.05+dx);\n rg += texture(img, uv + vec2(-1, 0)*dt) * (0.2-dx);\n rg += texture(img, uv + vec2(0, 0)*dt) * -1.;\n rg += texture(img, uv + vec2(1, 0)*dt) * (0.2-dx);\n rg += texture(img, uv + vec2(-1, 1)*dt) * (0.05+dx);\n rg += texture(img, uv + vec2(0, 1)*dt) * (0.2-dx);\n rg += texture(img, uv + vec2(1, 1)*dt) * (0.05+dx);\n\n return rg;\n}\n\nfloat dot3( in vec3 v, in vec3 w) { return v[0]*w[0] + v[1]*w[1] + v[2]*w[2]; }\nvec3 rot3d( in vec3 v, in vec3 k, in float theta) { // rotation of vector v about axis k, angle t with Rodrigues formula:\n return v*cos(theta)+cross(k,v)*sin(theta)+k*dot3(k,v)*(1.-cos(theta));\n}\n\nvoid main(void) //( out vec4 fragColor, in vec2 fragCoord )\n{\nvec2 uv = (u+dxy.xy)*(1.+dxy.z);\nvec2 uc = -rc.xy + u*rc.z;\n\ncc = texture(img,uv); // in [0,1]\nvec4 cco = texture(img2,uv); // in [0,1]\nvec4 cc00 = texture(img00,uv); // in [0,1]\n\nvec3 ff = cc00.xyz;\nvec3 f2 = cc00.yxz;\n\n float aa = (cc.x+256.*cc.y)/256.;\n float bb = (cc.z+256.*cc.w)/256.;\nfloat aao = (cco.x+256.*cco.y)/256.;\nfloat bbo = (cco.z+256.*cco.w)/256.;\n\nvec4 lpo = laplacian(img2,uv,0.9*ff.x*(aao));\nvec4 lp = laplacian(img,uv,0.9*ff.x*(aa));\n\naao=4.*0.03*(lp[0]+lp[1]*256.-lpo[0]-lpo[1]*256.);\nbbo=4.*0.03*(lp[2]+lp[3]*256.-lpo[2]-lpo[3]*256.);\n\nvec4 cc_hsl = texture(pal,vec2(2.*bb*aa+0.4*aa*cc00.x+0.4*bb*cc00.y,ff.xy*bb)); //+ff.yx*aa));\nvec4 cco_hsl = texture(pal,vec2(2.*bbo*aao+0.4*aao*cc00.x+0.4*bbo*cc00.y,ff.xy*bbo)); //+ff.yx*aao));\n\ncc_hsl -= (0.3+.6*rand[37])*(cc_hsl-cco_hsl);\n\n//cc_hsl.x += .3*cc00.x*cc00.x*(3.-2.*cc00.z);\ncc_hsl.x += .5*cc00.x*cc00.z*rand[44];\n\ncc_hsl.x += 0.03*f2.x*bb + rc.x*rc.y; // shift hue\ncc_hsl.x = mod(cc_hsl.x,1.);\n//cc_hsl.z *= 0.2+(3.*bb+6.*aa*bb); // multiply lightness by particle number\ncc_hsl.z *= 0.3+rand[43]*(4.*bb*cc00.z+cc00.x)+(1.-rand[43])*(3.*bb+6.*aa*bb); // multiply lightness by particle number\n\ncc_hsl.y *= 1.0*(1.1-ff.x*bb)*(1.-f2.x*f2.x); // multiply sat by 1-particle number\n\nvec3 rgb = clamp( abs(mod(cc_hsl.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );\nrgb = cc_hsl.z + cc_hsl.y * (rgb-0.5)*(1.0-abs(2.0*cc_hsl.z-1.0));\n\nrgb += rand[39]*(cc_hsl.bgr-rgb);\n\n//rgb += rand[38]*rand[38]*(1.-rgb);\n\nrgb *= rgb*(3.-2.*rgb);\n//rgb *= 1.+cc00.z*(rgb*(3.-2.*rgb)-1.);\nrgb *= .7+.36*rgb*(3.-2.*rgb); //increase contrast, but not too much\n\ncc = vec4(rgb,1.);\n\nvec4 ccoo = vec4(.4+.3*aao-f2.x,.1*(aao+bbo),1.-bbo,1.);\nccoo = mix(ccoo,ccoo.zyxw,1.-ff.y); // change to blue highlights\n\ncc = mix(cc,ccoo,clamp(2.*ff.x*aao,-1.,1.));\ncc=clamp(cc,0.,1.);\n\nfloat fx = fract(uc.x*res.x);//-3.*ff.y);\nfloat fy = fract(uc.y*res.y);//-3.*ff.z);\nfloat r2 = (fx-.5)*(fx-.5)+(fy-.5)*(fy-.5)-0.2*(1.+0.6*kl[16]*cc00.z);\nfloat drr = clamp((r2+.1)*18.,0.,1.);\ncc.rgb *= drr*.5*cc00.z + (1.-drr)*(.8-2.*r2);\n}";let useA,prngA,prngB;class Random{constructor(){useA=!1;let n=function(n){let c=parseInt(n.substr(0,8),16),t=parseInt(n.substr(8,8),16),a=parseInt(n.substr(16,8),16),e=parseInt(n.substr(24,8),16);return function(){c|=0,t|=0,a|=0,e|=0;let n=(c+t|0)+e|0;return e=e+1|0,c=t^t>>>9,t=a+(a<<3)|0,a=a<<21|a>>>11,a=a+n|0,(n>>>0)/4294967296}};prngA=new n(tokenData.hash.substr(2,32)),prngB=new n(tokenData.hash.substr(34,32));for(let n=0;n<1e6;n+=2)prngA(),prngB()}random_dec(){return useA=!useA,useA?prngA():prngB()}}function rnd(){return R.random_dec()}
//Memory Loss by Andrew Mitchell class Random{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),n=parseInt(e.substr(16,8),16),c=parseInt(e.substr(24,8),16);return function(){n|=0;let e=((t|=0)+(r|=0)|0)+(c|=0)|0;return c=c+1|0,t=r^r>>>9,r=n+(n<<3)|0,n=(n=n<<21|n>>>11)+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let t=0;t<1e6;t+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}random_num(e,t){return e+(t-e)*this.random_dec()}random_int(e,t){return Math.floor(this.random_num(e,t+1))}random_bool(e){return this.random_dec()<e}random_choice(e){return e[this.random_int(0,e.length-1)]}}class Mediator{constructor(){}call(e,t,r,n,c,o=0,s=1){n.push(),n.translate(t,r),this.applyRotation(radians(o),n),this.resize(s,n),n.translate(-t,-r),e(c),n.pop()}applyRotation(e,t){t.rotate(e)}resize(e,t){t.scale(e,e)}}let colorPalettes=[["112b73","133081","0f2562","1e87c3","1c7ab0","1f89c7","52a588","5bae91","4a967c","484068","4c446f","443c62","abcfad","7d91ac","36867f"],["c4bf95","c8c49d","ccc8a4","5a780d","526e0c","56740b","799341","7e9a42","a4885c","a68c64","adb279","acaf83","c8c148","bc8f2d"],["eb6521","ed763b","e06324","c74618","bf4418","cf400c","a56a32","a46932","d7c314","decb1b","111d6f","a6bcc1","860f21","2b3706"],["e3d6c7","eee6dd","e0d3c2","eadfd1","c0022d","b6022c","ca0231","721543","5a1136","7da29d","85a8a3","1d4260","1b3e5a","eb85c7","854c8c"],["aa805c","ae8765","ae8d6f","542840","5a2b45","482337","b10726","a60724","417708","52831e","72a277","002ad2","776b9a","c9d191"],["12151d","101219","0e1016","ceb31b","cbb11a","c7ad1a","7f0b25","750a21","be7113","b46c13","397748","cb4b46","408175","d7d98b"],["f8f9fa","e9ecef","dee2e6","ced4da","adb5bd","6c757d","495057","343a40","212529"],["d7d9c5","d5d7c1","d9dbc7","d9dbc7","b32b44","b62b44","b92d46","c58481","c78885","c68480"],["1e6fe8","2674e8","246fe0","1764d9","2a5314","264a12","785019","6e4a17","6350b6","6856b8","851a54","77184c","a48a15","9e8410","9f3a04","953704"],["9c4a6e","f8f1f4","9d4b6f","ebd5df","debaca","e4c8d4","ddbbca","b1597f","cb90a9","d09ab1"],["e8d2a9","ead3a9","ead5ae","e7cfa2","e8d1a6","e8d3ab","b6201e","b3211e","3f799f","40779c","a49228","a08e27","5e6d33","596831"],["dbc7a6","ddcaac","e1cdad","0d1228","0a0e1f","101632","d70200","e00400","c30704","48694c","446448","405e44","d6b32b","d7b52d","122948","102641"],["06142c","071631","06142d","051229","e2d2ac","e3d4b1","e3d5b5","a6b15d","a4af5a","568047","547e45","e8ae77","a77d4d","b1443d","276687"]],random=new Random,mediator=new Mediator,backgroundColor,r1,r2,r3,r4,r5,r6,r7,pgBeziers,finalCanvas,temporaryCanvas,incrementDegree,start,end,curveDirectionLeft,curveDirectionRight,curveFunctionRight,curveFunctionLeft,curveDegreeLeft,curveDegreeRight,curveRadiusRight,curveRadiusLeft,smallerDimension,textColor,circleX,w20,circleFunction,d,i,section,colorPalette,circleRadius,nWidthMax,nWidthMin,black="#0E0E10",black2="#403f42",white="#fdfff5";function shuffle2(e){for(let t=0;t<3;t++)for(let r=e.length-1;r>0;r--){let n=random.random_int(0,e.length-1),c=e[r],o=e[n];e[r]=o,e[n]=c}return e}function setup(){noiseSeed(random.random_int(0,1e4)),incrementDegree=.1,createCanvas(500,500),pgBeziers=createGraphics(500,500),temporaryCanvas=createGraphics(500,500),finalCanvas=createGraphics(500,500),pixelDensity(6),pgBeziers.pixelDensity(6),temporaryCanvas.pixelDensity(6),finalCanvas.pixelDensity(6),strokeJoin(CURVE),colorPalettes=shuffle2(colorPalettes),smallerDimension=windowWidth<windowHeight?windowWidth:windowHeight,backgroundColor="#"+(colorPalette=random.random_choice(colorPalettes))[0];let e=colorPalette[0];pgBeziers.background(backgroundColor),textColor="#"+colorPalette[colorPalette.length-1],colorPalette=shuffle2(colorPalette);for(let t=0;t<colorPalette.length;t++)colorPalette[t]="#"+colorPalette[t];nWidthMin=0,nWidthMax=500,circleFunction=Math.cos,curveFunctionRight=Math.sin,curveFunctionLeft=Math.sin,curveDirectionLeft=random.random_choice([-1,1]),curveDirectionRight=random.random_choice([-1,1]),circleX=0,w20=25,w40=12.5,w80=6.25,ww20=525,h20=height/20,h30=height/30,d=100,i=-8*w20,section=1,curveDegreeRight=PI,curveDegreeLeft=PI,_strokeWeight=2,pgBeziers.noFill(),r1=random.random_bool(.8)?random.random_int(12,25):random.random_int(12,30),r2=(r2=random.random_bool(.98)?random.random_int(-5,-5)+r1:random.random_int(12,25))<10?r1:r2,r3=1.5,r4=1.4,r5=1.3,r6=1.2,r7=1.1,getX=function(e,t){return e/r1},getY=function(e,t){return t/r2};let r={};r.ColorPalette=e,console.log(r)}function draw(){switch(section){case 1:a(),i>height&&section++,i+=1.5*_strokeWeight;break;case 2:a(),i>2*height&&section++,i+=2*_strokeWeight;break;case 3:a(),i>4*height&&(section=4,push(),fill(textColor),stroke("#000000"),500===width?textSize(12):textSize(24),text("Loading...",width/2-28,height/2),pop()),i+=2*_strokeWeight;break;case 4:temporaryCanvas.image(pgBeziers,0,0,width,height),temporaryCanvas.filter(BLUR,10),temporaryCanvas.filter(POSTERIZE,5),section++;break;case 5:finalCanvas.tint(255,128),finalCanvas.image(temporaryCanvas,0,0,width,height),finalCanvas.tint(255,128),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(ERODE),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(ERODE),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(DILATE),finalCanvas.image(pgBeziers,0,0,width,height),finalCanvas.filter(DILATE),clear(),tint(255,255),image(finalCanvas,0,0,width,height),document.getElementsByTagName("canvas")[0].style.width=smallerDimension+"px",document.getElementsByTagName("canvas")[0].style.height=smallerDimension+"px",document.getElementById("defaultCanvas0").style.filter="brightness(1.2) contrast(1.2)",noLoop()}document.getElementsByTagName("canvas")[0].style.width=smallerDimension+"px",document.getElementsByTagName("canvas")[0].style.height=smallerDimension+"px",document.getElementById("defaultCanvas0").style.filter="brightness(1.2) contrast(1.2)"}function a(){circleRadius=random.random_int(width,2*width),curveRadiusRight=random.random_int(0,100),curveRadiusLeft=random.random_int(0,100),start=nWidthMin+(circleX=circleRadius*circleFunction(d))+curveDirectionLeft*curveRadiusLeft*curveFunctionLeft(curveDegreeLeft),end=nWidthMax+circleX+curveDirectionRight*curveRadiusRight*curveFunctionRight(curveDegreeRight),d+=incrementDegree,curveDegreeRight+=incrementDegree,curveDegreeLeft+=incrementDegree;let e=-w20,t=start,r=end,n=width+w20,c=i,o=-w20,s=-w20,$=i;for(let l=0;l<=400;l++){let _=l/400,f=pgBeziers.bezierPoint(e,t,r,n,_),m=pgBeziers.bezierPoint(c,o,s,$,_);f>-w20&&m>-w20&&f<ww20&&m<ww20&&(splat(f,m,r3),splat(f,m-1,r4),splat(f,m-2,r5),splat(f,m-3,r6),splat(f,m-4,r7))}image(pgBeziers,0,0,width,height)}function splat(e,t,r){pgBeziers.push();let n=noise(getX(e,t),getY(e,t)),c=10*n*random.random_int(-1,1);random.random_int(-1,1),pgBeziers.translate(e,t),pgBeziers.rotate(radians(720*n)),pgBeziers.translate(-e,-t);let o=n;o=o<.2?.5*r:o<.4?2*r:o<.6?r:1.5*r,pgBeziers.strokeWeight(o);let s=color(colorPalette[Math.floor(n*colorPalette.length)]);s.setAlpha(255*n),pgBeziers.stroke(s),pgBeziers.bezier(e,t,e,t,e,t+c,e+10,t),pgBeziers.pop()}let value=1;function mouseClicked(){section>4&&(0===value?(clear(),image(finalCanvas,0,0,width,height),value=1):(clear(),image(temporaryCanvas,0,0,width,height),value=0))}function fitToWidth(){document.getElementsByTagName("canvas")[0].style.width=smallerDimension+"px",document.getElementsByTagName("canvas")[0].style.height=smallerDimension+"px"}
Memory Loss is a generative art collection created with p5js. It is all about reminiscence- reminiscing on a place in the past. With Memory Loss I wanted to create something that would be visually quite simple, opening it up to the interpretation of the viewer. When I was young, my mind was flexible, able to fabricate memories of forgotten lands. Robot Pirate Island was never more than a few seconds away. Growing older, this ability dampened. The area of my brain used for imagination was filled with school, work, family, and friends. And yet, when I look at each Memory Loss I see a distant land; a rocky outcrop; a field of wheat; a rough sea.
1-50 of 70