0xa86c…55c4

All memos sent from and to 0xa86c…55c4.

// Meshy (1998, 2024) by Golan Levin // https://www.flong.com/archive/projects/meshy // https://www.youtube.com/watch?v=MzCPUBve6xE // https://vimeo.com/223001204 // Meshy is an interactive environment in which the user's // strokes scaffold a gauzy mesh of animated elements. The mesh // continually bridges the user's two most recent marks. // By drawing, users can tease the mesh in real-time. // Written in JavaScript with the HTML5 Canvas API. // // Draw two marks to begin. // Key commands: // f: toggle Fullscreen // a: toggle Autoplay // d: toggle Debug // n: generate New mesh // r: Reset system // h: show Help let Cnvs; let myABRandom;let myABFeatures;let meshyStyle=0; let ctx,nClx,currSamp,fSinceMUp; let currAutoF=0;let currPathI=0; let myTch=[]; const nPaths=2; const maxNPaths=2; const nBezSamp=375; const quadDim=0.0175; const nResamp=75; const nFadeFrames=80; const txSize=14; const showHelpDur=4000; const waitToAutoDur=30000; const autoLen=360; const auDel=120; const tau=2*Math.PI; const F=false; const T=true; let myMX=0;let myMY=0; let splStr=10; let myW,myH; let pathAr=[]; let pathBzAr=[]; let drawArr=[]; let bt=[]; let bt2=[]; let bt3=[]; let omt=[]; let omt2=[]; let omt3=[]; let bto2=[]; let bt2o=[]; let bShowInf=bEnableAut=T; let bBegun=bSpecialCase=bDrawDebug=bAut=bMPressed=F; let begunT,appStartT,lastPokeT,helpStartT,startDebugT; let tapCount=0; const MWHALE=0; const MSCRIB=1; const MSTEER=2; const MMIXY1=3; const MMIXY2=4; const MWHAL2=5; const MSTER2=6; const MSRIB2=7; let gestA=[];let gestB=[]; let clix=[]; let CHASH; function setup(){ Cnvs=document.createElement('canvas'); Cnvs.width=720;Cnvs.height=405; document.body.appendChild(Cnvs); setInterval(myDraw,1000/60); appStartT=Date.now();lastPokeT=startDebugT=0; onResizeCanvas(); window.addEventListener('mousedown',onMouseDown); window.addEventListener('mousemove',onMouseMove); window.addEventListener('mouseup',onMouseUp); window.addEventListener('keydown',onKeyPress); window.addEventListener('resize',onResizeCanvas); document.addEventListener('fullscreenchange',onResizeCanvas); document.addEventListener('webkitfullscreenchange',onResizeCanvas); document.addEventListener('mozfullscreenchange',onResizeCanvas); document.addEventListener('msfullscreenchange',onResizeCanvas); Cnvs.addEventListener('touchstart',onTouchStart); Cnvs.addEventListener('touchmove',onTouchMove); Cnvs.addEventListener('touchend',onTouchEnd); Cnvs.style.cursor='crosshair'; CHASH=tokenData.hash; myRandomReset(CHASH); myABFeatures=calculateFeatures(tokenData); meshyStyle=myABFeatures.Style; let sty=getOpt([[0,25],[1,8],[2,2],[3,15],[4,5],[5,15],[6,15],[7,10]]);//needed initMeshy();} function onResizeCanvas(){ const pxRat=window.devicePixelRatio||1; myW=window.innerWidth;myH=window.innerHeight; Cnvs.width=myW*pxRat;Cnvs.height=myH*pxRat; Cnvs.style.width=myW+'px';Cnvs.style.height=myH+'px'; ctx=Cnvs.getContext('2d');ctx.scale(pxRat,pxRat);} function initMeshy(){ fSinceMUp=currSamp=nClx=currPathI=0; helpStartT=myMils(); pathAr=new Array(maxNPaths); pathBzAr=new Array(maxNPaths); drawArr=new Array(maxNPaths); makeBezArrays(); for(let i=0;i<maxNPaths;i++){ pathAr[i]=[];pathBzAr[i]=[]; drawArr[i]=new Array(nResamp); for(let j=0;j<nResamp;j++){ drawArr[i][j]=new Vec3f(); }}createStarter();} function makeBezArrays(){ for(let p=0;p<nBezSamp;p++){bt[p]=p/(nBezSamp-1); bt2[p]=bt[p]*bt[p];bt3[p]=bt[p]*bt2[p];omt[p]=1-bt[p]; omt2[p]=omt[p]*omt[p];omt3[p]=omt[p]*omt2[p]; bto2[p]=3*bt[p]*omt2[p];bt2o[p]=3*bt2[p]*omt[p];}} function myDraw(){ ctx.fillStyle='black';ctx.fillRect(0,0,myW,myH); simulate();render();drawDebug();drawInfo();autoPlay();} function autoPlay(){ if(bEnableAut){let prevbAut=bAut; let elapsed=myMils()-lastPokeT;bAut=(elapsed>waitToAutoDur); let splen=autoLen-auDel;let pt;if(bAut&&!prevbAut){ currAutoF=0;autoPress();}else if(!bAut&&prevbAut){ pt=getAutoPt(currAutoF/splen);myMouseReleased(pt.x,pt.y); }else if(bAut){Cnvs.style.cursor='none'; if(currAutoF<autoLen){currAutoF++;if(currAutoF<splen){ pt=getAutoPt(currAutoF/splen);myMouseDragged(pt.x,pt.y);} }else{pt=getAutoPt(currAutoF/splen);myMouseReleased(pt.x,pt.y);autoPress();} }else if(!bAut){Cnvs.style.cursor='crosshair';}}} let ap1,ap2,ap3,ap4; function autoPress(){currAutoF=0;let a=-0.3;let b=1.3; ap1=new Vec3f(myW*myRAB(0,1),myH*myRAB(a,b),0); ap2=new Vec3f(myW*myRAB(a,b),myH*myRAB(a,b),0); ap3=new Vec3f(myW*myRAB(a,b),myH*myRAB(a,b),0); ap4=new Vec3f(myW*myRAB(0,1),myH*myRAB(a,b),0); let pt=getAutoPt(currAutoF/(autoLen-auDel)); myMousePressed(pt.x,pt.y);} function getAutoPt(t){ let pt=calcPureBezVec3f(t,ap1,ap2,ap3,ap4); return new Vec3f(pt.x,pt.y,0);} function drawDebug(){ if(bDrawDebug){let cols=["lime","red"];for(let j=0;j<2;j++){ ctx.strokeStyle=cols[j];ctx.beginPath(); for(let i=0;i<pathAr[j].length;i++){ let px=pathAr[j][i].x;let py=pathAr[j][i].y; if(i==0){ctx.moveTo(px,py);}ctx.lineTo(px,py);}ctx.stroke();} let elapsed=myMils()-startDebugT;if(bAut||(elapsed>120000)){ bDrawDebug=F;}}} function simulate(){currSamp++;fSinceMUp++;blurGesture();} function blurGesture(){ if(bMPressed){let A=0.025;let B=1-2*A; let path=pathAr[currPathI];let npm1=path.length-1; if(npm1>2){for(let i=1;i<npm1;i++){ let v0=path[i-1],v1=path[i],v2=path[i+1]; let px=A*v0.x+B*v1.x+A*v2.x;let py=A*v0.y+B*v1.y+A*v2.y; let pz=A*v0.z+B*v1.z+A*v2.z;path[i].set(px,py,pz);} calcBezPath(currPathI);resampVec(currPathI);}}} function render(){ if(nClx>0){let offset=(bMPressed)?0:-1; let fromI=(currPathI-1+offset+nPaths)%nPaths; let toI=(currPathI+offset+nPaths)%nPaths;drawStem(pathBzAr[toI]); if((toI%2==1)||bAut||(myTch.length>1)){drawStem(pathBzAr[fromI]);} if(nClx!=1||currPathI!=1||bSpecialCase){ let num=nPaths-1;if(nClx<nPaths){num=currPathI;} for(let i=0;i<=num;i++){ fromI=(i-1+offset+nPaths)%nPaths;toI=(i+offset+nPaths)%nPaths; if(toI%2==1){let fromArr=drawArr[fromI];let toArr=drawArr[toI]; if(nPaths==2||currPathI!=(fromI-offset)%nPaths){ drawMesh(fromArr,toArr);}}}}}else{let n=Math.min(nClx,nPaths); for(let p=0;p<=n;p++){drawStem(pathBzAr[p]);}}} function drawInfo(){ if(bShowInf){ctx.font=txSize+"px 'Times New Roman'"; ctx.textAlign='center';ctx.textBaseline='middle'; let str=[]; str.push("𝑀𝑒𝑠ℎ𝑦 (1998, 2024) by Golan Levin"); str.push("Interactive Gestural Abstraction"); str.push("⸻"); str.push("Draw two marks to begin"); str.push("Dibuja dos marcas para comenzar"); str.push("Tracez deux marques pour commencer"); str.push("Desenhe duas marcas para começar"); str.push("Zeichnen Sie zwei Markierungen, um zu beginnen"); str.push("Нарисуйте две отметки, чтобы начать"); str.push("始めるために2つの線を描いてください"); str.push("आरंभ करने के लिए दो निशान बनाएं"); str.push("ارسم علامتين للبدء"); str.push("画两条线开始"); let elapsed=myMils()-helpStartT; if(elapsed>showHelpDur){bShowInf=F; }else{let tx=myW/2;let ty=myH/4; let ry=ty+((txSize)*5.5); let frac=Math.min(1,elapsed/showHelpDur); frac=1-Math.pow(frac,2.5); for(let i=1;i<30;i++){let tw=i*14;let th=i*11; ctx.fillStyle="rgba(0,0,0,"+(frac/10)+")"; ctx.beginPath();ctx.ellipse(tx,ry,tw/2,th/2,0,0,tau); ctx.closePath();ctx.fill();} ctx.fillStyle="rgba(255,255,255,"+frac+")"; for(let i=0;i<str.length;i++){ ctx.fillText(str[i],myW/2,myH/4+i*txSize*1.125);}}}} function createStarter(){ nClx=currPathI=0; for(let p=0;p<pathBzAr.length;p++){ pathAr[p]=[];pathBzAr[p]=[];} genStarterGestures(); let srcGest=[gestA,gestB]; for(let g=0;g<2;g++){let aGest=srcGest[g]; for(let i=0;i<aGest.length;i++){ let p=aGest[i];pathAr[currPathI].push(new Vec3f(p.x,p.y,0));} calcBezPath(currPathI);resampVec(currPathI); nClx++;currPathI=nClx%nPaths;} fSinceMUp=nFadeFrames;} function onKeyPress(ev){ lastPokeT=myMils();let k=ev.key.toLowerCase(); if(k=='d'){bDrawDebug=!bDrawDebug; if(bDrawDebug)startDebugT=myMils(); }else if(k=='f'){togFullScr(); }else if(k=='r'){myRandomReset(CHASH); meshyStyle=getOpt([[0,25],[1,8],[2,2],[3,15],[4,5],[5,15],[6,15],[7,10]]); createStarter();bShowInf=T;helpStartT=myMils(); }else if(k=='n'){ meshyStyle=getOpt([[0,25],[1,8],[2,2],[3,15],[4,5],[5,15],[6,15],[7,10]]); createStarter(); }else if(k=='a'){bEnableAut=!bEnableAut; }else{bShowInf=!bShowInf;if(bShowInf){helpStartT=myMils();}}} function handleToggleClix(mx,my){ clix.push(new Vec3f(mx,my,0));if(clix.length>10){clix.splice(0,1);let dh=0; for(let i=0;i<9;i++){let dx=clix[i+1].x-clix[i].x;let dy=clix[i+1].y-clix[i].y; dh=Math.max(dh,Math.sqrt(dx*dx+dy*dy));} if(dh<20){clix=[];togFullScr();}}} function togFullScr(){ if(!document.fullscreenElement&&!document.webkitFullscreenElement){ if(Cnvs.requestFullscreen){Cnvs.requestFullscreen(); }else if(Cnvs.webkitRequestFullscreen){Cnvs.webkitRequestFullscreen();} }else{if(document.exitFullscreen){document.exitFullscreen(); }else if(document.webkitExitFullscreen){document.webkitExitFullscreen();}}} function onMouseMove(ev){ lastPokeT=myMils();const rect=Cnvs.getBoundingClientRect(); myMX=ev.clientX-rect.left;myMY=ev.clientY-rect.top; if(bMPressed){myMouseDragged(myMX,myMY);}} function myMouseDragged(mx,my){ bBegun=T;pathAr[currPathI].push(new Vec3f(mx,my,0)); fSinceMUp=0;calcBezPath(currPathI);resampVec(currPathI);} function onMouseDown(ev){ bAut=F;bMPressed=T;lastPokeT=myMils(); const rect=Cnvs.getBoundingClientRect(); myMX=ev.clientX-rect.left;myMY=ev.clientY-rect.top; myMousePressed(myMX,myMY);handleToggleClix(myMX,myMY);} function myMousePressed(mx,my){ if(!bBegun){begunT=myMils(); pathAr[0]=[];pathAr[1]=[];pathBzAr[0]=[];pathBzAr[1]=[]; currPathI=1;nClx=0;bBegun=T;} bSpecialCase=F;if((nClx==1)&&(currPathI==1)){ bSpecialCase=T;}currPathI=nClx%nPaths; pathAr[currPathI]=[];pathBzAr[currPathI]=[]; pathAr[currPathI].push(new Vec3f(mx,my,0)); pathAr[currPathI].push(new Vec3f(mx+1,my+1,0)); fSinceMUp=0;calcBezPath(currPathI);resampVec(currPathI);} function onMouseUp(ev){ bAut=F;lastPokeT=myMils(); const rect=Cnvs.getBoundingClientRect(); myMX=ev.clientX-rect.left;myMY=ev.clientY-rect.top; myMouseReleased(myMX,myMY);} function myMouseReleased(mx,my){ bMPressed=F;calcBezPath(currPathI);resampVec(currPathI); nClx++;currPathI=nClx%nPaths;fSinceMUp=0;bSpecialCase=F;} function onTouchStart(ev){ if(ev.touches.length>2){myTch=[];return;} ev.preventDefault();if(myTch.length<2){ let which=-1;let mx=-1,my=-1; for(let tu of ev.touches){let existI=-1; for(let i=0;i<myTch.length;i++){ if(myTch[i].id===tu.identifier){ existI=i;break;}}mx=tu.clientX;my=tu.clientY; if(existI>-1){which=existI; myTch[existI].x=mx;myTch[existI].y=my; }else{handleToggleClix(mx,my); currPathI=(currPathI+1)%2; which=currPathI;if(myTch.length<2){ myTch.push({id:tu.identifier,x:mx,y:my}); }}}if(which!=-1){bBegun=T;fSinceMUp=0;bAut=F; lastPokeT=myMils();bMPressed=myTch.length==1; pathAr[which]=[];pathBzAr[which]=[]; pathAr[which].push(new Vec3f(mx,my,0)); calcBezPath(which);resampVec(which); if(myTch.length==2){pathAr[(which+1)%2]=[]; pathBzAr[(which+1)%2]=[];}}}} function onTouchMove(ev){ if(ev.touches.length>2){myTch=[];return;} ev.preventDefault(); for(let tu of ev.touches){ for(let i=0;i<myTch.length;i++){ if(myTch[i].id===tu.identifier){ let mx=tu.clientX;let my=tu.clientY; myTch[i].x=mx;myTch[i].y=my; fSinceMUp=0;lastPokeT=myMils(); let which=(myTch.length==1)?currPathI:(currPathI+i+1)%2; pathAr[which].push(new Vec3f(mx,my,0)); calcBezPath(which);resampVec(which);break;}}}} function onTouchEnd(ev){ ev.preventDefault();myTch=[];bAut=F; bSpecialCase=bMPressed=F;lastPokeT=myMils();fSinceMUp=0;} function getPathLen(path){ let len=0;for(let i=0;i<(path.length-1);i++){ let lo=path[i],hi=path[i+1]; let dx=lo.x-hi.x,dy=lo.y-hi.y; len+=Math.sqrt(dx*dx+dy*dy);}return len;} function calcBezPath(pathIndex){ const nBez=10;let path=pathAr[pathIndex]; pathBzAr[pathIndex]=[]; let nSourcePts=path.length; let p0=new Vec3f();let p1=new Vec3f(); let p2=new Vec3f();let p3=new Vec3f(); let last_pt=new Vec3f();let next_pt=new Vec3f(); if(nSourcePts<5){for(let g=0;g<nSourcePts;g++){ let src=path[g]; pathBzAr[pathIndex].push(new Vec3f(src.x,src.y,0)); }}else{for(let i=0;i<nSourcePts;i++){ if(i==1){p3=path[1],p0=path[0];next_pt=path[2]; last_pt.set(p0.x-(p3.x-p0.x)/4,p0.y-(p3.y-p0.y)/4,0); }else if(i==0){next_pt=path[1],p3=path[0]; p0.set(p3.x-(next_pt.x-p3.x)/4,p3.y-(next_pt.y-p3.y)/4,0); last_pt.set(p3.x-(next_pt.x-p3.x)/2,p3.y-(next_pt.y-p3.y)/2,0); }else if(i==nSourcePts-1){p3=path[i],p0=path[i-1]; last_pt=path[i-2];next_pt=p3; }else{p3=path[i],p0=path[i-1]; last_pt=path[i-2];next_pt=path[i+1];} let dx0=p0.x-last_pt.x;let dy0=p0.y-last_pt.y; let d0=Math.sqrt(dx0*dx0+dy0*dy0); let dx1=p3.x-p0.x;let dy1=p3.y-p0.y; let d1=Math.sqrt(dx1*dx1+dy1*dy1); let dx2=next_pt.x-p3.x;let dy2=next_pt.y-p3.y; let d2=Math.sqrt(dx2*dx2+dy2*dy2); let dAtp0=(d0+d1)/2;let dAtp3=(d1+d2)/2; p0.set(p0.x,p0.y,dAtp0);p3.set(p3.x,p3.y,dAtp3); let tan_inx=(p3.x-last_pt.x)/6; let tan_iny=(p3.y-last_pt.y)/6; let tan_inz=(p3.z-d0)/6; let tan_outx=(next_pt.x-p0.x)/6; let tan_outy=(next_pt.y-p0.y)/6; let tan_outz=(d2-p0.z)/6; let p1x=p0.x+tan_inx;let p1y=p0.y+tan_iny;let p1z=p0.z+tan_inz; let p2x=p3.x-tan_outx;let p2y=p3.y-tan_outy;let p2z=p3.z-tan_outz; p1.set(p1x,p1y,p1z);p2.set(p2x,p2y,p2z); for(let j=0;j<nBez;j++){let pt=calcPureBezVec3f(j/nBez,p0,p1,p2,p3); pathBzAr[pathIndex].push(pt);}}}} function resampVec(I){ let path=pathBzAr[I]; let resampledPath=drawArr[I]; let nResampPts=nResamp; let nPathPts=path.length; if(nPathPts>0){ let totalPathLength=getPathLen(path); let RSL=totalPathLength/nResampPts; let prevRem=RSL;let p=0;if(nPathPts<=1){ for(p=0;p<nResampPts;p++){let lo=path[0]; let px=lo.x+p*0.0001;let py=lo.y+p*0.0001;let pz=lo.z+p*0.0001; resampledPath[p].set(px,py,pz); }}else{for(let i=0;i<nPathPts-1;i++){ let lo=path[i];let hi=path[i+1]; let Dx=hi.x-lo.x;let Dy=hi.y-lo.y;let Dz=hi.z-lo.z; let segLen=Math.sqrt(Dx*Dx+Dy*Dy); let ASL=segLen;let dx=Dx/segLen;let dy=Dy/segLen; let RSLdx=dx*RSL;let RSLdy=dy*RSL;let needsL=RSL-prevRem; if(ASL>=needsL){let remainder=ASL; let px=lo.x+needsL*dx;let py=lo.y+needsL*dy;let pz=lo.z+Dz/2; if(p<nResampPts){resampledPath[p].set(px,py,pz); remainder-=needsL;p++;}let nPtsToDo=Math.floor(remainder/RSL); for(let d=0;d<nPtsToDo;d++){px+=RSLdx;py+=RSLdy; if(p<nResampPts){resampledPath[p].set(px,py,pz); remainder-=RSL;p++;}}prevRem=remainder; }else{prevRem+=ASL;}}}}} function drawStem(path){ if(fSinceMUp<nFadeFrames){let nSegs=path.length;if(nSegs>1){ let col=Math.max(0,nFadeFrames-fSinceMUp)/nFadeFrames; let skip=(bAut)?6:1;for(let i=0;i<nSegs;i+=skip){ let c=(i/nSegs)*col;let g=c*c*255; ctx.fillStyle="rgb("+g+","+g+","+g+")"; ctx.beginPath();ctx.arc(path[i].x,path[i].y,0.5,0.5,tau); ctx.fill();}}}} function drawMesh(fromArr,toArr){ let sizef=0.5;let c=0;let spacing=25; let nbsm1=nBezSamp-1;let nrsm1=nResamp-1; let roundSamp=Math.round(currSamp); let splBreath=2.5*Math.sin(myMils()/5000); for(let i=0;i<nrsm1;i++){ let splNoise=(myNoise(i/nrsm1+myMils()/4000)-0.5); splStr=10+splNoise+splBreath; let p1a=fromArr[i];let p1b=fromArr[i+1]; let p4a=toArr[i];let p4b=toArr[i+1]; let p1x=(p1a.x+p1b.x)/2;let p1y=(p1a.y+p1b.y)/2;let p1z=(p1a.z+p1b.z)/2; let p4x=(p4a.x+p4b.x)/2;let p4y=(p4a.y+p4b.y)/2;let p4z=(p4a.z+p4b.z)/2; let p2x=p1x+(p1a.y-p1b.y)*splStr; let p2y=p1y+(p1b.x-p1a.x)*splStr; let p2z=p1z+(p1b.z-p1a.z)*splStr; let p3x=p4x-(p4a.y-p4b.y)*splStr; let p3y=p4y-(p4b.x-p4a.x)*splStr; let p3z=p4y-(p4b.z-p4a.z)*splStr; for(let s=0;s<nbsm1;s++){ if(s%spacing==0&&(s+roundSamp+1)%nBezSamp!=0){ let sa=(s+roundSamp)%nBezSamp;let sb=(s+roundSamp+1)%nBezSamp; let omt3sa=omt3[sa];let bto2sa=bto2[sa]; let bt2osa=bt2o[sa];let bt3sa=bt3[sa]; let omt3sb=omt3[sb];let bto2sb=bto2[sb]; let bt2osb=bt2o[sb];let bt3sb=bt3[sb]; let pax=omt3sa*p1x+bto2sa*p2x+bt2osa*p3x+bt3sa*p4x; let pay=omt3sa*p1y+bto2sa*p2y+bt2osa*p3y+bt3sa*p4y; let paz=omt3sa*p1z+bto2sa*p2z+bt2osa*p3z+bt3sa*p4z; let pbx=omt3sb*p1x+bto2sb*p2x+bt2osb*p3x+bt3sb*p4x; let pby=omt3sb*p1y+bto2sb*p2y+bt2osb*p3y+bt3sb*p4y; let pbz=omt3sb*p1z+bto2sb*p2z+bt2osb*p3z+bt3sb*p4z; sizef=(paz+pbz)*quadDim; let pbmax=(pbx-pax)*sizef; let pbmay=(pby-pay)*sizef; let pamby=(pay-pby)*sizef; let b1x=pax-pbmax*2;let b1y=pay-pbmay*2; let b2x=pbx+pbmax*2;let b2y=pby+pbmay*2; c=(1-Math.cos((sa/nBezSamp)*tau))/2; ctx.strokeStyle="rgba(255,255,255,"+c+")"; let avx=(pax+pbx)/2;let avy=(pay+pby)/2; let b4x=avx+pamby;let b4y=avy+pbmax; let b3x=avx-pamby;let b3y=avy-pbmax; ctx.beginPath();ctx.moveTo(b1x,b1y); ctx.lineTo(b3x,b3y);ctx.lineTo(b2x,b2y); ctx.lineTo(b4x,b4y);ctx.lineTo(b1x,b1y); ctx.stroke();}}}} function calcPureBezVec3f(t,p1,p2,p3,p4){ let t2=t*t;let t3=t*t2;let onemt=1-t; let onemt2=onemt*onemt;let onemt3=onemt*onemt2; let ptx=onemt3*p1.x+3*t*onemt2*p2.x+3*t2*onemt*p3.x+t3*p4.x; let pty=onemt3*p1.y+3*t*onemt2*p2.y+3*t2*onemt*p3.y+t3*p4.y; let ptz=onemt3*p1.z+3*t*onemt2*p2.z+3*t2*onemt*p3.z+t3*p4.z; let pt=new Vec3f(ptx,pty,ptz);return pt;} function calculateFeatures(tokDat){ class CFRandom {constructor(){ this.useA=F;let CFsfc32=function(uint128Hex){ let a=parseInt(uint128Hex.substring(0,8),16); let b=parseInt(uint128Hex.substring(8,16),16); let c=parseInt(uint128Hex.substring(16,24),16); let d=parseInt(uint128Hex.substring(24,32),16); return function(){a|=0;b|=0;c|=0;d|=0;let t=(((a+b)|0)+d)|0; d=(d+1)|0;a=b^(b>>>9);b=(c+(c<<3))|0;c=(c<<21)|(c>>>11);c=(c+t)|0; return (t>>>0)/4294967296;};}; this.prngA=new CFsfc32(tokDat.hash.substring(2,34)); this.prngB=new CFsfc32(tokDat.hash.substring(34,66)); for(let i=0;i<1e6;i+=2){this.prngA();this.prngB();}} cfRandomDec(){this.useA=!this.useA;return this.useA?this.prngA():this.prngB();}} let myCFRandom=new CFRandom(); function cfR01(){let n=myCFRandom.cfRandomDec();return n=~~(32768*n)/32768,n} const cfRandPick=(arr)=>arr[(cfR01()*arr.length)|0]; function cfGetOpt(options){let choices=[];for(let i in options){ choices=choices.concat(new Array(options[i][1]).fill(options[i][0]));}return cfRandPick(choices);}; function cfResetRnd(newhash){tokDat.hash=newhash;myCFRandom=new CFRandom();} cfResetRnd(tokDat.hash); let sty=cfGetOpt([[0,25],[1,8],[2,2],[3,15],[4,5],[5,15],[6,15],[7,10]]); return {"Style":sty};} function genStarterGestures(){ gestA=[];gestB=[]; if(meshyStyle==MWHALE){ let nBezSetsA=getOpt([[1,65],[2,30],[3,5]]); let nBezSetsB=getOpt([[1,45],[2,30],[3,20],[4,5]]); let baseA=0.3+0.15*Math.pow(myR01(),0.75); let baseB=0.7-0.15*Math.pow(myR01(),0.75); let cPtsA=genBezCtrPtSet(nBezSetsA,baseA); let cPtsB=genBezCtrPtSet(nBezSetsB,baseB); gestA=genBezGest(cPtsA,nBezSetsA); gestB=genBezGest(cPtsB,nBezSetsB); }else if(meshyStyle==MSCRIB){gestA=genScribGest();gestB=genScribGest(); }else if(meshyStyle==MSTEER){gestA=genSteerGest(-1);gestB=genSteerGest(1); }else if(meshyStyle==MMIXY1){gestA=genSteerGest();gestB=genScribGest(); }else if(meshyStyle==MMIXY2){let nBezSetsB=2;let baseB=myRAB(0.4,0.6); let cPtsB=genBezCtrPtSet(nBezSetsB,baseB); gestB=genBezGest(cPtsB,nBezSetsB);gestA=genScribGest(); }else if(meshyStyle==MWHAL2){ let nBezSetsA=getOpt([[1,5],[2,35],[3,40],[4,20]]); let baseA=myRAB(0.5,0.6);let cPtsA=genBezCtrPtSet(nBezSetsA,baseA); gestA=genBezGest(cPtsA,nBezSetsA);gestB=genNearDupGest(gestA); }else if(meshyStyle==MSRIB2){gestA=genScribGest();gestB=genNearDupGest(gestA); }else if(meshyStyle==MSTER2){gestA=genSteerGest();gestB=genNearDupGest(gestA); }recenterGests();} function recenterGests(){ let mx=0,my=0; for(let i=0;i<(gestA.length);i++){mx+=gestA[i].x;my+=gestA[i].y;} for(let i=0;i<(gestB.length);i++){mx+=gestB[i].x;my+=gestB[i].y;} mx/=(gestA.length+gestB.length);my/=(gestA.length+gestB.length); let dx=(myW/2-mx),dy=(myH/2-my); for(let i=0;i<(gestA.length);i++){gestA[i].x+=dx;gestA[i].y+=dy;} for(let i=0;i<(gestB.length);i++){gestB[i].x+=dx;gestB[i].y+=dy;}} function genNearDupGest(gIn){ let gOut=[];let rAmp=myW*myRAB(0.618,1.618); let r1=myRAB(0,rAmp*0.25);let r2=rAmp-r1; for(let i=0;i<(gIn.length-1);i++){ let px=gIn[i].x,py=gIn[i].y; let qx=gIn[i+1].x,qy=gIn[i+1].y; let r=myMap(i,0,gIn.length,r1-(rAmp/2),r2-(rAmp/2)); let dx=qx-px,dy=qy-py;let dh=Math.sqrt(dx*dx+dy*dy); if(dh>0){let gx=px+r*dy/dh;let gy=py-r*dx/dh; gx=(gx+px)/2;gy=(gy+(py-r))/2; gx=myW*myMap(gx/myW,0.1,0.9,-0.1,1.1); gOut.push(new Vec3f(gx,gy,0)); }}return gOut;} function genSteerGest(lr){ let gest=[];let nSteerPts=myRInt(40,120); let cy=myH*myRAB(0.4,0.6);let cx=0.5; if(lr>0.5){cx=myW*myRAB(0.6,0.75); }else if(lr<-0.5){cx=myW*myRAB(0.25,0.4); }else{cx=myW*myRAB(0.4,0.6);} let px=cx;let py=cy; let t=myRAB(0,100);let ori=myRAB(0,tau); let dt=tau*myRAB(0.001,0.013);let dori=myRAB(0.08,0.2); let speed=myW/nSteerPts;for(let i=0;i<nSteerPts;i++){ ori+=dori*myMap(myNoise(t),0,1,0-tau,tau)/2; let dx=speed*Math.cos(ori);let dy=speed*Math.sin(ori); gest.push(new Vec3f(px,py,0)); px+=dx;py+=dy;t+=dt; }return gest;} function genScribGest(){ let nTurns=getOpt([[1,35],[2,30],[3,12],[4,10],[5,10],[6,3]]); let noiSpd=myRAB(0.05,0.5);let gest=[]; let cx=myW*myRAB(0.45,0.55);let cy=myH*myRAB(0.45,0.55); let toff=myRAB(0,100);let ori=myRAB(0,tau); let ecc=myRAB(1,1.5);let rMag=myRAB(0.1,0.4); let rVar=myRAB(0.1,0.9);let sgn=(myR01()<0.1)?-1:1; let dcx=Math.pow(myR01(),2)*myRAB(0,0.1); let nScribPts=nTurns*60; for(let i=0;i<nScribPts;i++){ let t=myMap(i,0,nScribPts,0,sgn*tau*nTurns); let rn=myNoise(toff-t*noiSpd);let r=myMap(rn,0,1,1-rVar,1); let rx=myH*r*rMag;let ry=myH*r*rMag*ecc; let x=rx*Math.cos(t);let y=ry*Math.sin(t); let ox=cx+myW*myMap(i,0,nScribPts,-dcx,dcx); let px=ox+x*Math.cos(ori)-y*Math.sin(ori); let py=cy+x*Math.sin(ori)+y*Math.cos(ori); gest.push(new Vec3f(px,py,0)); }return gest;} function genBezCtrPtSet(nBezSets,cy){ let nControlPts=1+nBezSets*3;let cPts=[]; let x0=0.1,x1=0.9;let xp=myRAB(0.5,1); if(myR01()<0.5){xp=1/xp;}let wig=0.3; for(let i=0;i<nControlPts;i++){ let t=myMap(i,0,nControlPts-1,0,1); let tx=Math.pow(t,xp); let px=myW*myMap(tx,0,1,x0,x1); let py=myH*cy+myH*myRAB(-wig,wig); if((i>3)&&(i%3==1)){ py=cPts[i-1].y+(cPts[i-1].y-cPts[i-2].y); }cPts.push(new Vec3f(px,py,0)); }return cPts;} function genBezGest(cPts,nBezSets){ let gestPts=[];let nPoints=60/nBezSets; for(let j=0;j<nBezSets;j++){for(let i=0;i<nPoints;i++){ let t=i/(nPoints-0),n=j*3; let p=calcPureBezVec3f(t,cPts[n],cPts[n+1],cPts[n+2],cPts[n+3]); gestPts.push(p);}}return gestPts;} class Vec3f{ constructor(inx,iny,inz){ if(inx===undefined){this.set(0,0,0); }else{this.set(inx,iny,inz);}} set(inx,iny,inz){this.x=inx;this.y=iny;this.z=inz;}} function myMap(val,a1,b1,a2,b2){ return a2+(b2-a2)*((val-a1)/(b1-a1));} function myMils(){return Date.now()-appStartT;} function myNoise(x){ const freqArr=[7,17,31,67,109]; const phasArr=[0.3,0.7,1.1,1.7,2.3]; let val=0,amp=0.5;for(let i=0;i<freqArr.length;i++){ let freq=freqArr[i]*0.2;let phas=phasArr[i]; val+=amp*Math.sin(phas+freq*x);amp*=0.5;}return (1+val)/2;} class Random{ constructor(){this.useA=F;let sfc32=function(uint128Hex){ let a=parseInt(uint128Hex.substring(0,8),16); let b=parseInt(uint128Hex.substring(8,16),16); let c=parseInt(uint128Hex.substring(16,24),16); let d=parseInt(uint128Hex.substring(24,32),16); return function(){a|=0;b|=0;c|=0;d|=0;let t=(((a+b)|0)+d)|0; d=(d+1)|0;a=b^(b>>>9);b=(c+(c<<3))|0;c=(c<<21)|(c>>>11);c=(c+t)|0; return (t>>>0)/4294967296;};}; this.prngA=new sfc32(tokenData.hash.substring(2,34)); this.prngB=new sfc32(tokenData.hash.substring(34,66)); for(let i=0;i<1e6;i+=2){this.prngA();this.prngB();}} random_dec(){this.useA = !this.useA;return this.useA?this.prngA():this.prngB();} random_num(a,b){return a+(b-a)*this.random_dec();} random_int(a,b){return Math.floor(this.random_num(a,b+1));} random_bool(p){return this.random_dec()<p;} random_choice(list){return list[this.random_int(0,list.length-1)];}} function myRandomReset(newhash){ tokenData.hash=newhash?newhash:CHASH; myABRandom=new Random();} function myR01(){let r=myABRandom.random_dec();r=~~(r*32768)/32768;return r;} function myRA(a){return (a*myR01());} function myRAB(a,b){return a+((b-a)*myR01());} function myRInt(a,b){return Math.floor(myRAB(a,b+1));} const randPick=(arr)=>arr[(myR01()*arr.length)|0]; const getOpt=function(options){let choices=[];for(let i in options){ choices=choices.concat(new Array(options[i][1]).fill(options[i][0])); }return randPick(choices);}; document.addEventListener('DOMContentLoaded',function(){setup();});
*Meshy* (1998, minted 2024) is an interactive gestural abstraction in which a participant's strokes are used to scaffold a gauzy mesh of animated elements. The mesh continually bridges the user's two most recent marks; by drawing, users can tease the mesh in real-time. In addition to its interactive mode, each token is initialized with a uniquely generated mesh composition. *Meshy* was originally developed in 1998, while Levin was a researcher in the Aesthetics and Computation Group at the MIT Media Laboratory. This official NFT release was produced in July 2024 for the exhibition "Awaken, Metamagical Hands", curated by John Maeda and Robert Norton for Gazelli Art House, London. The code has been ported from C++ and Java to JavaScript, and is rendered with the HTML5 Canvas API. To get started with *Meshy*, draw two gestural strokes using your mouse, touchpad, or multitouch tablet surface. After thirty seconds without interaction, *Meshy* will enter a self-playing generative mode. Each Meshy token is initialized with a uniquely generated composition that can be recalled using the "r" key, and whose space of possibilities can be explored using the "n" key.
require=function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);throw(f=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",f}c=n[i]={exports:{}},e[i][0].call(c.exports,function(r){return o(e[i][1][r]||r)},c,c.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(require,module,exports){!function(root,factory){"use strict";"object"==typeof exports?module.exports=factory():"function"==typeof define&&define.amd?define(factory):root.MersenneTwister=factory()}(this,function(){ /** * A standalone, pure JavaScript implementation of the Mersenne Twister pseudo random number generator. Compatible * with Node.js, requirejs and browser environments. Packages are available for npm, Jam and Bower. * * @module MersenneTwister * @author Raphael Pigulla <pigulla@four66.com> * @license See the attached LICENSE file. * @version 0.2.3 */ /* The license file for MersenneTwister: Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Most comments were stripped from the source. If needed you can still find them in the original C code: * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c * * The original port to JavaScript, on which this file is based, was done by Sean McCullough. It can be found at: * https://gist.github.com/banksean/300494 */ "use strict";function MersenneTwister(seed){void 0===seed&&(seed=(new Date).getTime()),this.mt=new Array(N),this.mti=625,this.seed(seed)}var N=624,M=397,instance=( /** * Initializes the state vector by using one unsigned 32-bit integer "seed", which may be zero. * * @since 0.1.0 * @param {number} seed The seed value. */ MersenneTwister.prototype.seed=function(seed){var s;for(this.mt[0]=seed>>>0,this.mti=1;this.mti<N;this.mti++)s=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30,this.mt[this.mti]=(1812433253*((4294901760&s)>>>16)<<16)+1812433253*(65535&s)+this.mti,this.mt[this.mti]>>>=0}, /** * Initializes the state vector by using an array key[] of unsigned 32-bit integers of the specified length. If * length is smaller than 624, then each array of 32-bit integers gives distinct initial state vector. This is * useful if you want a larger seed space than 32-bit word. * * @since 0.1.0 * @param {array} vector The seed vector. */ MersenneTwister.prototype.seedArray=function(vector){var s,i=1,j=0,k=N>vector.length?N:vector.length;for(this.seed(19650218);0<k;k--)s=this.mt[i-1]^this.mt[i-1]>>>30,this.mt[i]=(this.mt[i]^(1664525*((4294901760&s)>>>16)<<16)+1664525*(65535&s))+vector[j]+j,this.mt[i]>>>=0,j++,N<=++i&&(this.mt[0]=this.mt[623],i=1),j>=vector.length&&(j=0);for(k=623;k;k--)s=this.mt[i-1]^this.mt[i-1]>>>30,this.mt[i]=(this.mt[i]^(1566083941*((4294901760&s)>>>16)<<16)+1566083941*(65535&s))-i,this.mt[i]>>>=0,N<=++i&&(this.mt[0]=this.mt[623],i=1);this.mt[0]=2147483648}, /** * Generates a random unsigned 32-bit integer. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.int=function(){var y,kk,mag01=new Array(0,2567483615);if(this.mti>=N){for(625===this.mti&&this.seed(5489),kk=0;kk<227;kk++)y=2147483648&this.mt[kk]|2147483647&this.mt[kk+1],this.mt[kk]=this.mt[kk+M]^y>>>1^mag01[1&y];for(;kk<623;kk++)y=2147483648&this.mt[kk]|2147483647&this.mt[kk+1],this.mt[kk]=this.mt[kk+(M-N)]^y>>>1^mag01[1&y];y=2147483648&this.mt[623]|2147483647&this.mt[0],this.mt[623]=this.mt[396]^y>>>1^mag01[1&y],this.mti=0}return y=this.mt[this.mti++],(y=(y=(y=(y^=y>>>11)^y<<7&2636928640)^y<<15&4022730752)^y>>>18)>>>0}, /** * Generates a random unsigned 31-bit integer. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.int31=function(){return this.int()>>>1}, /** * Generates a random real in the interval [0;1] with 32-bit resolution. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.real=function(){return this.int()*(1/4294967295)}, /** * Generates a random real in the interval ]0;1[ with 32-bit resolution. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.realx=function(){return(this.int()+.5)*(1/4294967296)}, /** * Generates a random real in the interval [0;1[ with 32-bit resolution. * * Same as .rnd() method - for consistency with Math.random() interface. * * @since 0.2.0 * @returns {number} */ MersenneTwister.prototype.random= /** * Generates a random real in the interval [0;1[ with 32-bit resolution. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.rnd=function(){return this.int()*(1/4294967296)}, /** * Generates a random real in the interval [0;1[ with 53-bit resolution. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.rndHiRes=function(){return 1/9007199254740992*(67108864*(this.int()>>>5)+(this.int()>>>6))},new MersenneTwister); /** * Instantiates a new Mersenne Twister. * * @constructor * @alias module:MersenneTwister * @since 0.1.0 * @param {number=} seed The initial seed value. */ /** * A static version of [rnd]{@link module:MersenneTwister#rnd} on a randomly seeded instance. * * @static * @function random * @memberof module:MersenneTwister * @returns {number} */ return MersenneTwister.random=function(){return instance.rnd()},MersenneTwister})},{}],2:[function(require,module,exports){ /* drawing.js - Drawing around a skeleton with a pen. Copyright 2004-5, 2013 Rhea Myers <rhea@myers.studio> Copyright 2023 Myers Studio Ltd. This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ // Keep these names lowercase as they should be in the object... var MersenneTwister=require("./MersenneTwister"),Polyline=require("./polyline"),Turtle=require("./turtle"),Palette=require("./palette");function Drawing(width,height,num_points,seed){"string"==typeof seed?(this.rng=new MersenneTwister,this.rng.seedArray((hex=>{for(var numValues=Math.floor(hex.length/2),ints=new Uint32Array(numValues),c=0;c<hex.length;c+=2)ints[Math.floor(c/2)]=parseInt(hex.substr(c,2),16);return ints})(seed))):this.rng=new MersenneTwister(seed),this.width=width,this.height=height,this.skeleton=this.make_skeleton(this.width,this.height,num_points),this.pen=this.make_pen(),this.first_point=this.pen.position,this.outline=new Polyline,this.palette=new Palette(this.rng),this.outline_width=1+Math.ceil(7*this.rng.random())} /*Drawing.prototype.make_skeleton = function (width, height, num_points) { // Inset skeleton 2 * the pen distance from the edge to avoid cropping var inset = pen_distance * 2; var skeleton = new Polyline (); skeleton.random_points_in_bounds (this.rng, inset, inset, width - (inset * 2), height - (inset * 2), num_points); return skeleton; };*/ Drawing.prototype.make_skeleton=function(width,height,num_points){ // Inset skeleton 2 * the pen distance from the edge to avoid cropping var skeleton=new Polyline;return skeleton.random_points_in_bounds_sep(this.rng,16,16,width-16,height-32,num_points, // Really, really, avoid loops. 32),skeleton},Drawing.prototype.make_pen=function(){var top_left=this.skeleton.top_leftmost_point();return top_left.y-=8,new Turtle(top_left,8,1.5,1,1)},Drawing.prototype.should_finish=function(){var point_count=this.outline.points.length,first_point=this.outline.points[0];return 5e3<point_count||4<point_count&&this.pen.position.distance_to_point(first_point)<this.pen.forward_step},Drawing.prototype.next_pen_distance=function(){return this.skeleton.distance_to_point(this.pen.next_point_would_be())},Drawing.prototype.next_pen_too_far=function(){return 1.5*this.rng.random()<8-this.next_pen_distance(this.skeleton)},Drawing.prototype.next_pen_too_close=function(){return 1.5*this.rng.random()<this.next_pen_distance(this.skeleton)-8},Drawing.prototype.ensure_next_pen_far_enough=function(){for(;this.next_pen_too_close(this.skeleton);)this.pen.left()},Drawing.prototype.ensure_next_pen_close_enough=function(){for(;this.next_pen_too_far(this.skeleton);)this.pen.right()},Drawing.prototype.adjust_next_pen=function(){this.ensure_next_pen_far_enough(),this.ensure_next_pen_close_enough()},Drawing.prototype.to_next_point=function(){return this.adjust_next_pen(),this.pen.forward(),this.outline.append(this.pen.position),this.point_count++,this.pen.position},module.exports=Drawing},{"./MersenneTwister":1,"./palette":4,"./polyline":6,"./turtle":7}],3:[function(require,module,exports){ /* drawing_svg.js - Draw to SVG. Copyright 2004-5, 2013 Rhea Myers <rhea@myers.studio> Copyright 2023 Myers Studio, Ltd. This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ require("./MersenneTwister");function DrawingSVG(svg,num_points,randseed){this.svg=svg,this.drawing=new Drawing(svg.viewBox.baseVal.width,svg.viewBox.baseVal.height,num_points,randseed),(svg=this.svg.getElementById("background")).style.fill="white",svg.style.stroke=this.drawing.palette.to_css(this.drawing.palette.background),svg.style.strokeWidth=10,num_points=this.svg.getElementById("skeleton"),this.clear_path(num_points),num_points.style.fill="none",num_points.style.stroke=this.drawing.palette.to_css(this.drawing.palette.foreground),num_points.style.strokeWidth=1,randseed=this.svg.getElementById("fill"),this.clear_path(randseed),randseed.style.fill=this.drawing.palette.to_css(this.drawing.palette.foreground),svg=this.svg.getElementById("outline"),this.clear_path(svg),svg.style.fill="none",svg.style.stroke=this.drawing.palette.to_css(this.drawing.palette.outline),svg.style.strokeWidth=this.drawing.outline_width,svg.style.strokeLinejoin="round",svg.style.strokeLinecap="round"}var Drawing=require("./drawing");DrawingSVG.prototype.update=function(){var active=!1;return this.drawing.should_finish()||(this.drawing.to_next_point(),active=!0),active},DrawingSVG.prototype.drawSkeleton=function(){this.svg.getElementById("skeleton").setAttributeNS(null,"d",this.polyline_to_path(this.drawing.skeleton))},DrawingSVG.prototype.drawOutline=function(){this.svg.getElementById("outline").setAttributeNS(null,"d",this.polyline_to_path(this.drawing.outline))},DrawingSVG.prototype.drawFill=function(){this.svg.getElementById("fill").setAttributeNS(null,"d",this.polyline_to_path(this.drawing.outline))},DrawingSVG.prototype.drawInProgress=function(){this.drawSkeleton(),this.drawOutline()},DrawingSVG.prototype.drawComplete=function(){var background=this.svg.getElementById("background"),background=(background.style.stroke="none",background.style.strokeWidth="0",background.style.fill=this.drawing.palette.to_css(this.drawing.palette.background),this.svg.getElementById("skeleton"));background.style.stroke="none",background.style.strokeWidth="0",this.drawOutline(),this.drawFill()},DrawingSVG.prototype.polyline_to_path=function(polyline){for(var d=" M "+polyline.points[0].x.toFixed(3)+" "+polyline.points[0].y.toFixed(3),i=1;i<polyline.points.length;i++)d+=" L "+polyline.points[i].x.toFixed(3)+" "+polyline.points[i].y.toFixed(3);return d},DrawingSVG.prototype.clear_path=function(element){element.setAttributeNS(null,"d","")},module.exports=DrawingSVG},{"./MersenneTwister":1,"./drawing":2}],4:[function(require,module,exports){function Palette(rng){this.background=this.make_colour(rng),this.foreground=this.make_colour(rng),this.outline=this.make_colour(rng)}Palette.prototype.random_percentage=function(rng){return Math.round(100*rng.random())},Palette.prototype.random_angle=function(rng){return Math.floor(360*rng.random())},Palette.prototype.make_colour=function(rng){return{h:this.random_angle(rng),s:this.random_percentage(rng),l:this.random_percentage(rng)}},Palette.prototype.to_css=function(colour){return`hsl(${colour.h}deg ${colour.s}% ${colour.l}%)`},module.exports=Palette},{}],5:[function(require,module,exports){function Point(x,y){this.x=x,this.y=y}Point.prototype.distance_to_point=function(p){return Math.sqrt(Math.pow(p.x-this.x,2)+Math.pow(p.y-this.y,2))},module.exports=Point},{}],6:[function(require,module,exports){function Polyline(){this.points=[]} /* polyline.js - A polyline. Copyright 2004-5, 2013 Rhea Myers <rhea@myers.studio> Copyright 2023 Myers Studio Ltd. This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ var Point=require("./point");Polyline.prototype.append=function(p){ // Push is slllllllllow this.points.push(p)},Polyline.prototype.random_point_in_bounds=function(rng,x,y,width,height){width=rng.random()*width,rng=rng.random()*height;return new Point(x+width,y+rng)},Polyline.prototype.random_points_in_bounds=function(rng,x,y,width,height,count){for(var i=0;i<count;i++){var p=this.random_point_in_bounds(rng,x,y,width,height);this.append(p)}}, // http://www.gamasutra.com/features/20000210/lander_l3.htm Polyline.prototype.nearest_point_on_line=function(a,b,c){ // SEE IF a IS THE NEAREST POINT - ANGLE IS OBTUSE var nearest_x,dot_ta=(c.x-a.x)*(b.x-a.x)+(c.y-a.y)*(b.y-a.y);return dot_ta<=0?new Point(a.x,a.y): // SEE IF b IS THE NEAREST POINT - ANGLE IS OBTUSE (c=(c.x-b.x)*(a.x-b.x)+(c.y-b.y)*(a.y-b.y))<=0?new Point(b.x,b.y):(nearest_x=a.x+(b.x-a.x)*dot_ta/(dot_ta+c),b=a.y+(b.y-a.y)*dot_ta/(dot_ta+c),new Point(nearest_x,b))},Polyline.prototype.distance_from_line_to_point=function(a,b,c){return this.nearest_point_on_line(a,b,c).distance_to_point(c)},Polyline.prototype.distance_to_point=function(p){for(var distance_to_poly=Number.MAX_VALUE,i=1;i<this.points.length;i++){var a=this.points[i-1],b=this.points[i],a=this.distance_from_line_to_point(a,b,p);a<distance_to_poly&&(distance_to_poly=a)}return distance_to_poly}, // Generate random points that will not result in the polyline having // any points too close to its lines. // This is to avoid the pen getting trapped by small gaps between points // or between points and lines. Polyline.prototype.random_points_in_bounds_sep=function(rng,x,y,width,height,count,sep){if(count<2)throw new Error("We must generate at least 2 points!");var genp=()=>this.random_point_in_bounds(rng,x,y,width,height); // We need at least one line to test distances from. for(this.append(genp()),this.append(genp());this.points.length<count;){var p=genp(),dist=this.distance_to_point(p); // Is this point to close to any existing lines? if(!(dist<sep)){ // Are any existing points too close to the new line segment // that would be formed by adding the new point? let ok=!0;var q=this.points[this.points.length-1];for(let i=0;i<this.points.length-1;i++)if(this.distance_from_line_to_point(q,p,this.points[i])<sep){ok=!1;break}ok&&this.append(p)}}},Polyline.prototype.top_leftmost_point=function(){for(var top_leftmost=this.points[0],i=1;i<this.points.length;i++)(this.points[i].y<=top_leftmost.y||this.points[i].y==top_leftmost.y&&this.points[i].x<top_leftmost.x)&&(top_leftmost=this.points[i]);return new Point(top_leftmost.x,top_leftmost.y)},module.exports=Polyline},{"./point":5}],7:[function(require,module,exports){function Turtle(position,forward_step,turn_step){this.direction=90,this.position=position,this.forward_step=forward_step,this.turn_step=turn_step} /* turtle.js - A classic computer graphics 'turtle'. Copyright 2004-5, 2013 Rhea Myers <rhea@myers.studio> This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ var Point=require("./point"),DEGREES_TO_RADIANS=2*Math.PI/360;Turtle.prototype.left=function(){this.direction-=this.turn_step},Turtle.prototype.right=function(){this.direction+=this.turn_step},Turtle.prototype.forward=function(){this.position=this.next_point_would_be()},Turtle.prototype.next_point_would_be=function(){var x=this.position.x+this.forward_step*Math.sin(this.direction*DEGREES_TO_RADIANS),y=this.position.y+this.forward_step*Math.cos(this.direction*DEGREES_TO_RADIANS);return new Point(x,y)},module.exports=Turtle},{"./point":5}],artblocks:[function(require,module,exports){ /* drawing_artblocks.js - Draw to SVG using artblocks hash. Copyright 2023 Myers Studio, Ltd. This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ const DrawingSVG=require("./drawing_svg"),WIDTH=1920,HEIGHT=1080;let svg,drawing;function draw(){drawing.update()?(drawing.drawInProgress(),requestAnimationFrame(draw)):drawing.drawComplete()}document.addEventListener("DOMContentLoaded",function init(){!function createSVGElement(){var existingSvg=document.getElementById("svg");null!=existingSvg&&document.body.remove(existingSvg),(svg=document.createElementNS("http://www.w3.org/2000/svg","svg")).id="svg",svg.setAttribute("viewBox",`0 0 ${WIDTH} `+HEIGHT),(existingSvg=svg.appendChild(document.createElementNS("http://www.w3.org/2000/svg","rect"))).id="background",existingSvg.style.fill="white",existingSvg.setAttribute("width",WIDTH),existingSvg.setAttribute("height",HEIGHT),svg.appendChild(document.createElementNS("http://www.w3.org/2000/svg","path")).id="skeleton",svg.appendChild(document.createElementNS("http://www.w3.org/2000/svg","path")).id="fill",svg.appendChild(document.createElementNS("http://www.w3.org/2000/svg","path")).id="outline",document.body.appendChild(svg)}(),drawing=new DrawingSVG(svg,12,tokenData.hash),requestAnimationFrame(draw)})},{"./drawing_svg":3}]},{},["artblocks"]);
*draw-something* (2004-present) was inspired by my desire to better appreciate and understand Harold Cohen's *AARON* programme, which I had been aware of since childhood. The version seen here, *draw-something-onchain*, is an early JavaScript implementation that has been modified to use the *Art Blocks* token hash as its initial random state seed. To create a drawing, *draw-something-onchain* starts by placing random lines within the format bounds to create a guide form or skeleton. It then draws around this using an algorithm that was derived from observing my own hand while drawing. Finally it colours the resulting drawing using colours chosen randomly in the Hue/Saturation/Lightness colour space. This generates intriguing colour schemes varying from pastel to psychedelic. This process functions as as both drafting and sketching, abstraction and representation. It is, as much of my art is, a model of almost precisely how art is *not* made. Saying how is left as an exercise for the viewer.
*draw-something* (2004-present) was inspired by my desire to better appreciate and understand Harold Cohen's *AARON* programme, which I had been aware of since childhood. The version seen here, *draw-something-onchain*, is an early JavaScript implementation that has been modified to use the *Art Blocks* token hash as its initial random state seed. To create a drawing, *draw-something-onchain* starts by placing random lines within the format bounds to create a guide form or skeleton. It then draws around this using an algorithm that was derived from observing my own hand while drawing. Finally it colours the resulting drawing using colours chosen randomly in the Hue/Saturation/Lightness colour space. This generates intriguing colour schemes varying from pastel to psychedelic. This process functions as as both drafting and sketching, abstraction and representation. It is, as much of my art is, a model of almost precisely how art is *not* made. Saying how is left as an exercise for the viewer.
*draw-something* (2004-present) was inspired by my desire to better understand Harold Cohen's *AARON* program, which I had first encountered as a child. This version, *draw-something-onchain*, is taken from an early JavaScript implementation of the programme, modified to use an Art Blocks token hash as its initial seed for randomization. *draw-something-onchain* starts by drawing random lines to provide a guide form or skeleton. It then encloses these carefully in a bounding form using an algorithm derived from observing my own hand while drawing. Finally it colours the drawing using colours chosen randomly in the Hue/Saturation/Lightness colour space, which generates intriguing colour schemes varying from pastel to psychedelic. This process functions as as both drafting and sketching, abstraction and representation. It is, as much of my art is, a model of almost precisely how art is *not* made. Saying how is left as an exercise for the viewer.
require=function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);throw(f=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",f}c=n[i]={exports:{}},e[i][0].call(c.exports,function(r){return o(e[i][1][r]||r)},c,c.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(require,module,exports){!function(root,factory){"use strict";"object"==typeof exports?module.exports=factory():"function"==typeof define&&define.amd?define(factory):root.MersenneTwister=factory()}(this,function(){ /** * A standalone, pure JavaScript implementation of the Mersenne Twister pseudo random number generator. Compatible * with Node.js, requirejs and browser environments. Packages are available for npm, Jam and Bower. * * @module MersenneTwister * @author Raphael Pigulla <pigulla@four66.com> * @license See the attached LICENSE file. * @version 0.2.3 */ /* The license file for MersenneTwister: Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Most comments were stripped from the source. If needed you can still find them in the original C code: * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c * * The original port to JavaScript, on which this file is based, was done by Sean McCullough. It can be found at: * https://gist.github.com/banksean/300494 */ "use strict";function MersenneTwister(seed){void 0===seed&&(seed=(new Date).getTime()),this.mt=new Array(N),this.mti=625,this.seed(seed)}var N=624,M=397,instance=( /** * Initializes the state vector by using one unsigned 32-bit integer "seed", which may be zero. * * @since 0.1.0 * @param {number} seed The seed value. */ MersenneTwister.prototype.seed=function(seed){var s;for(this.mt[0]=seed>>>0,this.mti=1;this.mti<N;this.mti++)s=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30,this.mt[this.mti]=(1812433253*((4294901760&s)>>>16)<<16)+1812433253*(65535&s)+this.mti,this.mt[this.mti]>>>=0}, /** * Initializes the state vector by using an array key[] of unsigned 32-bit integers of the specified length. If * length is smaller than 624, then each array of 32-bit integers gives distinct initial state vector. This is * useful if you want a larger seed space than 32-bit word. * * @since 0.1.0 * @param {array} vector The seed vector. */ MersenneTwister.prototype.seedArray=function(vector){var s,i=1,j=0,k=N>vector.length?N:vector.length;for(this.seed(19650218);0<k;k--)s=this.mt[i-1]^this.mt[i-1]>>>30,this.mt[i]=(this.mt[i]^(1664525*((4294901760&s)>>>16)<<16)+1664525*(65535&s))+vector[j]+j,this.mt[i]>>>=0,j++,N<=++i&&(this.mt[0]=this.mt[623],i=1),j>=vector.length&&(j=0);for(k=623;k;k--)s=this.mt[i-1]^this.mt[i-1]>>>30,this.mt[i]=(this.mt[i]^(1566083941*((4294901760&s)>>>16)<<16)+1566083941*(65535&s))-i,this.mt[i]>>>=0,N<=++i&&(this.mt[0]=this.mt[623],i=1);this.mt[0]=2147483648}, /** * Generates a random unsigned 32-bit integer. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.int=function(){var y,kk,mag01=new Array(0,2567483615);if(this.mti>=N){for(625===this.mti&&this.seed(5489),kk=0;kk<227;kk++)y=2147483648&this.mt[kk]|2147483647&this.mt[kk+1],this.mt[kk]=this.mt[kk+M]^y>>>1^mag01[1&y];for(;kk<623;kk++)y=2147483648&this.mt[kk]|2147483647&this.mt[kk+1],this.mt[kk]=this.mt[kk+(M-N)]^y>>>1^mag01[1&y];y=2147483648&this.mt[623]|2147483647&this.mt[0],this.mt[623]=this.mt[396]^y>>>1^mag01[1&y],this.mti=0}return y=this.mt[this.mti++],(y=(y=(y=(y^=y>>>11)^y<<7&2636928640)^y<<15&4022730752)^y>>>18)>>>0}, /** * Generates a random unsigned 31-bit integer. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.int31=function(){return this.int()>>>1}, /** * Generates a random real in the interval [0;1] with 32-bit resolution. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.real=function(){return this.int()*(1/4294967295)}, /** * Generates a random real in the interval ]0;1[ with 32-bit resolution. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.realx=function(){return(this.int()+.5)*(1/4294967296)}, /** * Generates a random real in the interval [0;1[ with 32-bit resolution. * * Same as .rnd() method - for consistency with Math.random() interface. * * @since 0.2.0 * @returns {number} */ MersenneTwister.prototype.random= /** * Generates a random real in the interval [0;1[ with 32-bit resolution. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.rnd=function(){return this.int()*(1/4294967296)}, /** * Generates a random real in the interval [0;1[ with 53-bit resolution. * * @since 0.1.0 * @returns {number} */ MersenneTwister.prototype.rndHiRes=function(){return 1/9007199254740992*(67108864*(this.int()>>>5)+(this.int()>>>6))},new MersenneTwister); /** * Instantiates a new Mersenne Twister. * * @constructor * @alias module:MersenneTwister * @since 0.1.0 * @param {number=} seed The initial seed value. */ /** * A static version of [rnd]{@link module:MersenneTwister#rnd} on a randomly seeded instance. * * @static * @function random * @memberof module:MersenneTwister * @returns {number} */ return MersenneTwister.random=function(){return instance.rnd()},MersenneTwister})},{}],2:[function(require,module,exports){ /* drawing.js - Drawing around a skeleton with a pen. Copyright 2004-5, 2013 Rhea Myers <rhea@myers.studio> Copyright 2023 Myers Studio Ltd. This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ // Keep these names lowercase as they should be in the object... var MersenneTwister=require("./MersenneTwister"),Polyline=require("./polyline"),Turtle=require("./turtle"),Palette=require("./palette");function Drawing(width,height,num_points,seed){"string"==typeof seed?(this.rng=new MersenneTwister,this.rng.seedArray((hex=>{for(var numValues=Math.floor(hex.length/2),ints=new Uint32Array(numValues),c=0;c<hex.length;c+=2)ints[Math.floor(c/2)]=parseInt(hex.substr(c,2),16);return ints})(seed))):this.rng=new MersenneTwister(seed),this.width=width,this.height=height,this.skeleton=this.make_skeleton(this.width,this.height,num_points),this.pen=this.make_pen(),this.first_point=this.pen.position,this.outline=new Polyline,this.palette=new Palette(this.rng),this.outline_width=1+Math.ceil(7*this.rng.random())} /*Drawing.prototype.make_skeleton = function (width, height, num_points) { // Inset skeleton 2 * the pen distance from the edge to avoid cropping var inset = pen_distance * 2; var skeleton = new Polyline (); skeleton.random_points_in_bounds (this.rng, inset, inset, width - (inset * 2), height - (inset * 2), num_points); return skeleton; };*/ Drawing.prototype.make_skeleton=function(width,height,num_points){ // Inset skeleton 2 * the pen distance from the edge to avoid cropping var skeleton=new Polyline;return skeleton.random_points_in_bounds_sep(this.rng,16,16,width-16,height-32,num_points, // Really, really, avoid loops. 32),skeleton},Drawing.prototype.make_pen=function(){var top_left=this.skeleton.top_leftmost_point();return top_left.y-=8,new Turtle(top_left,8,1.5,1,1)},Drawing.prototype.should_finish=function(){var point_count=this.outline.points.length,first_point=this.outline.points[0];return 5e3<point_count||4<point_count&&this.pen.position.distance_to_point(first_point)<this.pen.forward_step},Drawing.prototype.next_pen_distance=function(){return this.skeleton.distance_to_point(this.pen.next_point_would_be())},Drawing.prototype.next_pen_too_far=function(){return 1.5*this.rng.random()<8-this.next_pen_distance(this.skeleton)},Drawing.prototype.next_pen_too_close=function(){return 1.5*this.rng.random()<this.next_pen_distance(this.skeleton)-8},Drawing.prototype.ensure_next_pen_far_enough=function(){for(;this.next_pen_too_close(this.skeleton);)this.pen.left()},Drawing.prototype.ensure_next_pen_close_enough=function(){for(;this.next_pen_too_far(this.skeleton);)this.pen.right()},Drawing.prototype.adjust_next_pen=function(){this.ensure_next_pen_far_enough(),this.ensure_next_pen_close_enough()},Drawing.prototype.to_next_point=function(){return this.adjust_next_pen(),this.pen.forward(),this.outline.append(this.pen.position),this.point_count++,this.pen.position},module.exports=Drawing},{"./MersenneTwister":1,"./palette":4,"./polyline":6,"./turtle":7}],3:[function(require,module,exports){ /* drawing_svg.js - Draw to SVG. Copyright 2004-5, 2013 Rhea Myers <rhea@myers.studio> Copyright 2023 Myers Studio, Ltd. This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ require("./MersenneTwister");function DrawingSVG(svg,num_points,randseed){this.svg=svg,this.drawing=new Drawing(svg.viewBox.baseVal.width,svg.viewBox.baseVal.height,num_points,randseed),(svg=this.svg.getElementById("background")).style.fill="white",svg.style.stroke=this.drawing.palette.to_css(this.drawing.palette.background),svg.style.strokeWidth=10,num_points=this.svg.getElementById("skeleton"),this.clear_path(num_points),num_points.style.fill="none",num_points.style.stroke=this.drawing.palette.to_css(this.drawing.palette.foreground),num_points.style.strokeWidth=1,randseed=this.svg.getElementById("fill"),this.clear_path(randseed),randseed.style.fill=this.drawing.palette.to_css(this.drawing.palette.foreground),svg=this.svg.getElementById("outline"),this.clear_path(svg),svg.style.fill="none",svg.style.stroke=this.drawing.palette.to_css(this.drawing.palette.outline),svg.style.strokeWidth=this.drawing.outline_width,svg.style.strokeLinejoin="round",svg.style.strokeLinecap="round"}var Drawing=require("./drawing");DrawingSVG.prototype.update=function(){var active=!1;return this.drawing.should_finish()||(this.drawing.to_next_point(),active=!0),active},DrawingSVG.prototype.drawSkeleton=function(){this.svg.getElementById("skeleton").setAttributeNS(null,"d",this.polyline_to_path(this.drawing.skeleton))},DrawingSVG.prototype.drawOutline=function(){this.svg.getElementById("outline").setAttributeNS(null,"d",this.polyline_to_path(this.drawing.outline))},DrawingSVG.prototype.drawFill=function(){this.svg.getElementById("fill").setAttributeNS(null,"d",this.polyline_to_path(this.drawing.outline))},DrawingSVG.prototype.drawInProgress=function(){this.drawSkeleton(),this.drawOutline()},DrawingSVG.prototype.drawComplete=function(){var background=this.svg.getElementById("background"),background=(background.style.stroke="none",background.style.strokeWidth="0",background.style.fill=this.drawing.palette.to_css(this.drawing.palette.background),this.svg.getElementById("skeleton"));background.style.stroke="none",background.style.strokeWidth="0",this.drawOutline(),this.drawFill()},DrawingSVG.prototype.polyline_to_path=function(polyline){for(var d=" M "+polyline.points[0].x.toFixed(3)+" "+polyline.points[0].y.toFixed(3),i=1;i<polyline.points.length;i++)d+=" L "+polyline.points[i].x.toFixed(3)+" "+polyline.points[i].y.toFixed(3);return d},DrawingSVG.prototype.clear_path=function(element){element.setAttributeNS(null,"d","")},module.exports=DrawingSVG},{"./MersenneTwister":1,"./drawing":2}],4:[function(require,module,exports){function Palette(rng){this.background=this.make_colour(rng),this.foreground=this.make_colour(rng),this.outline=this.make_colour(rng)}Palette.prototype.random_percentage=function(rng){return Math.round(100*rng.random())},Palette.prototype.random_angle=function(rng){return Math.floor(360*rng.random())},Palette.prototype.make_colour=function(rng){return{h:this.random_angle(rng),s:this.random_percentage(rng),l:this.random_percentage(rng)}},Palette.prototype.to_css=function(colour){return`hsl(${colour.h}deg ${colour.s}% ${colour.l}%)`},module.exports=Palette},{}],5:[function(require,module,exports){function Point(x,y){this.x=x,this.y=y}Point.prototype.distance_to_point=function(p){return Math.sqrt(Math.pow(p.x-this.x,2)+Math.pow(p.y-this.y,2))},module.exports=Point},{}],6:[function(require,module,exports){function Polyline(){this.points=[]} /* polyline.js - A polyline. Copyright 2004-5, 2013 Rhea Myers <rhea@myers.studio> Copyright 2023 Myers Studio Ltd. This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ var Point=require("./point");Polyline.prototype.append=function(p){ // Push is slllllllllow this.points.push(p)},Polyline.prototype.random_point_in_bounds=function(rng,x,y,width,height){width=rng.random()*width,rng=rng.random()*height;return new Point(x+width,y+rng)},Polyline.prototype.random_points_in_bounds=function(rng,x,y,width,height,count){for(var i=0;i<count;i++){var p=this.random_point_in_bounds(rng,x,y,width,height);this.append(p)}}, // http://www.gamasutra.com/features/20000210/lander_l3.htm Polyline.prototype.nearest_point_on_line=function(a,b,c){ // SEE IF a IS THE NEAREST POINT - ANGLE IS OBTUSE var nearest_x,dot_ta=(c.x-a.x)*(b.x-a.x)+(c.y-a.y)*(b.y-a.y);return dot_ta<=0?new Point(a.x,a.y): // SEE IF b IS THE NEAREST POINT - ANGLE IS OBTUSE (c=(c.x-b.x)*(a.x-b.x)+(c.y-b.y)*(a.y-b.y))<=0?new Point(b.x,b.y):(nearest_x=a.x+(b.x-a.x)*dot_ta/(dot_ta+c),b=a.y+(b.y-a.y)*dot_ta/(dot_ta+c),new Point(nearest_x,b))},Polyline.prototype.distance_from_line_to_point=function(a,b,c){return this.nearest_point_on_line(a,b,c).distance_to_point(c)},Polyline.prototype.distance_to_point=function(p){for(var distance_to_poly=Number.MAX_VALUE,i=1;i<this.points.length;i++){var a=this.points[i-1],b=this.points[i],a=this.distance_from_line_to_point(a,b,p);a<distance_to_poly&&(distance_to_poly=a)}return distance_to_poly}, // Generate random points that will not result in the polyline having // any points too close to its lines. // This is to avoid the pen getting trapped by small gaps between points // or between points and lines. Polyline.prototype.random_points_in_bounds_sep=function(rng,x,y,width,height,count,sep){if(count<2)throw new Error("We must generate at least 2 points!");var genp=()=>this.random_point_in_bounds(rng,x,y,width,height); // We need at least one line to test distances from. for(this.append(genp()),this.append(genp());this.points.length<count;){var p=genp(),dist=this.distance_to_point(p); // Is this point to close to any existing lines? if(!(dist<sep)){ // Are any existing points too close to the new line segment // that would be formed by adding the new point? let ok=!0;var q=this.points[this.points.length-1];for(let i=0;i<this.points.length-1;i++)if(this.distance_from_line_to_point(q,p,this.points[i])<sep){ok=!1;break}ok&&this.append(p)}}},Polyline.prototype.top_leftmost_point=function(){for(var top_leftmost=this.points[0],i=1;i<this.points.length;i++)(this.points[i].y<=top_leftmost.y||this.points[i].y==top_leftmost.y&&this.points[i].x<top_leftmost.x)&&(top_leftmost=this.points[i]);return new Point(top_leftmost.x,top_leftmost.y)},module.exports=Polyline},{"./point":5}],7:[function(require,module,exports){function Turtle(position,forward_step,turn_step){this.direction=90,this.position=position,this.forward_step=forward_step,this.turn_step=turn_step} /* turtle.js - A classic computer graphics 'turtle'. Copyright 2004-5, 2013 Rhea Myers <rhea@myers.studio> This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ var Point=require("./point"),DEGREES_TO_RADIANS=2*Math.PI/360;Turtle.prototype.left=function(){this.direction-=this.turn_step},Turtle.prototype.right=function(){this.direction+=this.turn_step},Turtle.prototype.forward=function(){this.position=this.next_point_would_be()},Turtle.prototype.next_point_would_be=function(){var x=this.position.x+this.forward_step*Math.sin(this.direction*DEGREES_TO_RADIANS),y=this.position.y+this.forward_step*Math.cos(this.direction*DEGREES_TO_RADIANS);return new Point(x,y)},module.exports=Turtle},{"./point":5}],artblocks:[function(require,module,exports){ /* drawing_artblocks.js - Draw to SVG using artblocks hash. Copyright 2023 Myers Studio, Ltd. This file is part of draw-something js. draw-something js is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. draw-something js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ const DrawingSVG=require("./drawing_svg"),WIDTH=1920,HEIGHT=1080;let svg,drawing;function draw(){drawing.update()?(drawing.drawInProgress(),requestAnimationFrame(draw)):drawing.drawComplete()}document.addEventListener("DOMContentLoaded",function init(){!function createSVGElement(){var existingSvg=document.getElementById("svg");null!=existingSvg&&document.body.remove(existingSvg),(svg=document.createElementNS("http://www.w3.org/2000/svg","svg")).id="svg",svg.setAttribute("viewBox",`0 0 ${WIDTH} `+HEIGHT),(existingSvg=svg.appendChild(document.createElementNS("http://www.w3.org/2000/svg","rect"))).id="background",existingSvg.style.fill="white",existingSvg.setAttribute("width",WIDTH),existingSvg.setAttribute("height",HEIGHT),svg.appendChild(document.createElementNS("http://www.w3.org/2000/svg","path")).id="skeleton",svg.appendChild(document.createElementNS("http://www.w3.org/2000/svg","path")).id="fill",svg.appendChild(document.createElementNS("http://www.w3.org/2000/svg","path")).id="outline",document.body.appendChild(svg)}(),drawing=new DrawingSVG(svg,12,tokenData.hash),requestAnimationFrame(draw)})},{"./drawing_svg":3}]},{},["artblocks"]);
***Laterals*** began with a simple premise: to evoke a sense of deliberate structure despite the purely aleatoric nature of the underlying algorithm. The title refers to the various rotations given to the cuboids that conform to the scenes. The pieces are constructed with fundamental primitives in three-dimensional computer graphics. The organization of the objects on the scene originates from different noise distributions. I chose an isometric projection to create a certain ambiguity in depth. That allows for interesting dynamics of colour, light and shadow. I am fascinated by how, as humans, we are bound and almost desperate to find order, meaning and patterns, even in the face of explicitly random events. **Note:** The piece's configurations are determined by their mint number. While they fully generate in real-time, they are a pre-selection of random structures encoded in an "alias" described in the feature set of any given piece. That means that there are only 50 possible pre-selected outputs that can occur, based on minting order from 0 to 49. **Exporting instructions** You may export your pieces to disk with different resolutions via the interactive controls. If you intend to make a printout, ensure you first disable the background effects (using *shift+N*) and only then export. Otherwise, you will be exporting additional digital textures unnecessary for printing on paper. **Controls** **shift+O**: export at current resolution **shift+E**: export at 4k **shift+S**: export at 6k **shift+N**: remove background effects **shift+B**: add background effects
ottom=-5,s.shadow.mapSize.set(6*i.x,6*i.y),s}function generateCubeMap(){var e=document.createElement("canvas");const t=1024,r=1024;e.width=t,e.height=r;var a=e.getContext("2d");function i(e,t,r){e.addColorStop(0,t),e.addColorStop(1,r),a.fillStyle=e}function s(e){a.fillStyle=e,a.fillRect(0,0,t,r)}function n(e){let s={x:.65,y:.05};var n=a.createRadialGradient(t*s.x,r*s.y,204.8,t*s.x,r*s.y,819.2);i(n,"white","#777065");const o=e?[.15,1]:[0,.75];a.fillRect(t*o[0],153.6,t*o[1],409.6),e&&(s={x:.5,y:.5},i(n=a.createRadialGradient(t*s.x,r*s.y,204.8,t*s.x,r*s.y,614.4),"white","blue"),a.fillRect(153.6,358.4,716.8,204.8)),s={x:.5,y:.1},i(n=a.createRadialGradient(t*s.x,r*s.y,512,t*s.x,r*s.y,921.6),"#3d3c3b","#777065"),a.fillRect(0,614.4,t,921.6)}let o=[];const l=[n,n,s,s,function(e){let s={x:.5,y:.5};var n=a.createRadialGradient(t*s.x,r*s.y,0,t*s.x,r*s.y,512);i(n,"white","#858ba0"),a.fillRect(0,358.4,t,204.8),s={x:.5,y:.1},i(n=a.createRadialGradient(t*s.x,r*s.y,409.6,t*s.x,r*s.y,819.2),"white","#777065"),a.fillRect(0,614.4,t,921.6)},function(e){i(a.createRadialGradient(512,512,204.8,512,512,768),"white","blue"),a.fillRect(0,358.4,t,256)}],u=[!0,!1,"000000","3f3d3c",1,1];for(let i=0;i<6;i++)a.fillStyle="#000000",a.fillRect(0,0,t,r),l[i](u[i]),o.push(e.toDataURL());return o}function getParams(){let e=mintParams.rotation,t=mintParams.sphereSettings[1],r=mintParams.circleSettings[1];return{palette:palettes[mintParams.color],ratioMode:1,cameraZ:10,viewSize:2.5,bgMode:0,background:new THREE.Color(mintParams.background[0],mintParams.background[1],mintParams.background[2]),wrapMode:"mirror",toneMappingExposure:1.75,baseColor:new THREE.Vector4(1,1,1,1),generalScale:mintParams.generalScale,lightPos1:mintParams.lights[0][0],lightIntensity1:mintParams.lights[0][1],lightPos2:mintParams.lights[1][0],lightIntensity2:mintParams.lights[1][1],boxSimplexFreq:1e3,boxBaseScale:.5,boxOpacity:.9,boxEnvIntensity:.3,boxRoughness:.5,boxMetalness:.1,boxRotation:90,boxInstances:mintParams.boxSettings[0],boxScaleRange:mintParams.boxSettings[1],boxPosRange:mintParams.boxSettings[2],boxMeshRot:e,boxVtxDisp:0,boxColoringMode:mintParams.boxSettings[3],sphereOpacity:.8,sphereEnvIntensity:.9,sphereRoughness:.9,sphereMetalness:.3,sphereRotation:0,sphereInstances:mintParams.sphereSettings[0],sphereScaleRange:[t,t,t],spherePosRange:mintParams.sphereSettings[2],sphereMeshPos:[0,0,0],sphereMeshRot:e,sphereVtxDisp:0,sphereColoringMode:[0,0],circleOpacity:.75,circleMeshPosition:[0,0,3],circleEnvIntensity:1,circleRoughness:1,circleMetalness:1,circleBaseScale:.5,circleRotation:0,circleInstances:mintParams.circleSettings[0],circleScaleRange:[r,r,r],circlePosRange:mintParams.circleSettings[2],circleMeshRot:e,circleVtxDisp:0,circleColoringMode:[0,0],lineOpacity:.25,lineRotation:90,lineInstances:mintParams.lineSettings[0],lineScaleRange:[mintParams.lineSettings[1][0],mintParams.lineSettings[1][1],mintParams.lineSettings[1][1]],linePosRange:mintParams.sphereSettings[2],lineMeshRot:e,lineVtxDisp:0,lineColoringMode:[1,0],saoBias:mintParams.saoBias,saoIntensity:.38,saoScale:.5,saoKernelRadius:85,saoMinResolution:5e-4,saoBlurRadius:60,saoBlurStdDev:20,saoBlurDepthCutoff:.0015,bloomThreshold:mintParams.bloom[0],bloomStrength:mintParams.bloom[1],bloomRadius:mintParams.bloom[2],displacementOctaves:3,noiseSeed:100*R.r(),applyCanvas:!0,canvasDetail:2.5,grainAmt:.05}}function customPBRMaterial(e,t){e.uniforms=t;const r="#include <common>\n#define I int\n#define F float\n#define V2 vec2\n#define V3 vec3\n#define V4 vec4\n#define FR fract\n#define M mix\nuniform vec4 uBC; uniform vec3 uSR; uniform vec3 uPR;uniform float uRT;uniform float uVD;uniform float uGS;attribute int aID;attribute vec3 aPos;attribute vec3 aScale;attribute vec3 aAxis;attribute vec3 aColor;varying vec2 vUv;varying vec4 vc;flat varying int vTexID;flat varying int vvi;varying vec3 vrv;varying float vRatio;mat4 rotationMatrix(V3 v, F a){v=normalize(v);F s=sin(a);F c=cos(a);F oc=1.-c;return mat4(oc*v.x*v.x+c, oc*v.x*v.y-v.z*s, oc*v.z*v.x+v.y*s, 0.,oc*v.x*v.y+v.z*s, oc*v.y*v.y+c, oc*v.y*v.z-v.x*s, 0.,oc*v.z*v.x-v.y*s, oc*v.y*v.z+v.x*s,oc*v.z*v.z+c,0.,0.,0.,0.,1.);}F hash11(F p){p = FR(p*.1031);p*=p+ 33.33;p*=p+p;return FR(p);}V3 hash31(F p) {V3 p3 = FR(V3(p)*V3(.1031,.1030,.0973));p3+=dot(p3,p3.yzx+33.33); return FR((p3.xxy+p3.yzz)*p3.zyx);}",a="I id=aID; I vid=gl_VertexID; V3 NS=hash31(F(id)*3.+F(vid))*2.-1.; V3 P=transformed; V3 SC=aScale*uSR; V3 TS=aPos*uPR;V3 NP=P*SC;V4 RT=rotationMat*V4(NP, 1.);NP=RT.xyz;NP+=TS;NP+=NS*uVD;NP*=uGS;transformed=NP;vUv=uv;vc=V4(1.);vvi=vid;vrv=hash31(F(id));";e.onBeforeCompile=e=>{for(const r in t)e.uniforms[r]=t[r];e.vertexShader=e.vertexShader.replace("#include <common>",r),e.vertexShader=e.vertexShader.replace("#include <beginnormal_vertex>"," #include <beginnormal_vertex>\nmat4 rotationMat = rotationMatrix(aAxis, radians(uRT));V4 NN=rotationMat*V4(objectNormal, 1);objectNormal=normalize(NN.xyz);"),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`#include <begin_vertex>\n${a} vc = V4(aColor,1.)*uBC;\n `),e.fragmentShader=e.fragmentShader.replace("#include <common>","#include <common>\n#define I int\n#define V2 vec2\n#define V3 vec3\n#define V4 vec4\n#define FR fract\n#define M mix\n#define GRAD 1 \n#define SEMI 3\n#define SGRAD 4\nvarying vec4 vc;varying vec2 vUv;flat varying int vvi;varying vec3 vrv;uniform vec3 uC0;uniform vec3 uC1;uniform vec3 uC2;uniform vec3 uC3;uniform vec3 uC4;uniform vec2 uCM;"),e.fragmentShader=e.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );","V2 uv=vUv;V4 diffuseColor=V4(vc.rgb,opacity);V3 cs[5]=V3[5](uC0,uC1,uC2,uC3,uC4);I i=I(vrv.x * 2.99);I j=I(vrv.y*1.99);I m=I(uCM.x);I o=I(uCM.y);V3 fc=diffuseColor.rgb;if(m==GRAD){fc=M(diffuseColor.rgb,cs[(i+o)%5],uv[j]);}else if(m==SEMI){V3 color=vvi<6?cs[(0+o)%5]:vvi<12?cs[(1+o)%5]:vvi<18?cs[(2+o)%5]:cs[(4+o)%5];fc=color;}else if(m==SGRAD){V3 color=vvi<6?M(cs[(0+o)%5],cs[(1+o)%5],(uv.x+uv.y)*.5):vvi<12?M(cs[(2+o)%5],cs[(3+o)%5],uv.x):vvi<18?M(cs[(4+o)%5],cs[(0+o)%5],uv.y):M(cs[(1+o)%5],cs[(2+o)%5],(uv.y+uv.x)*.5);fc=color;}diffuseColor.rgb=fc;")};const i=new THREE.MeshDepthMaterial({depthPacking:THREE.RGBADepthPacking});return i.onBeforeCompile=e=>{for(const r in t)e.uniforms[r]=t[r];e.vertexShader=e.vertexShader.replace("#include <common>",r),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>",`#include <begin_vertex>\nmat4 rotationMat=rotationMatrix(aAxis,radians(uRT));${a}`)},[e,i]}function getNoiseTexture(e,t,r,a){return{shader:new THREE.ShaderMaterial({uniforms:{uTime:u(0),uRes:u(e),uSeed:u(t)},vertexShader:"varying vec2 vUv;void main(){vUv = uv;gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.);}",fragmentShader:`\n #define PI 3.141592\n #define FL float\nvarying vec2 vUv;uniform float uTime;uniform vec2 uRes;uniform float uSeed;${simplexNoise}FL fbm(vec3 x, FL f, FL g, FL amp, FL o){FL t=0.;FL a=1.;for(int i=0;i<${a};i++){t+=psrdnoise(f*x,vec3(0.),1.);f*=2.;a*=g;}return t*amp+o;}void main(){vec2 res=uRes;vec2 uv=vUv;FL aspect=res.x/res.y;uv.x*=aspect;${r}gl_FragColor = vec4(vec3(c),1.);}`}),pixelFormat:{depthBuffer:!1,stencilBuffer:!1,format:THREE.RGBAFormat,type:THREE.FloatType,internalFormat:"RGB8"}}}function displacementShader(e,t){return{uniforms:{tDiffuse:u(null),uRes:u([e.x*t,e.y*t]),sNoise:u(null),uCF:u([p.canvasDetail,p.applyCanvas]),uGF:u(p.grainAmt),uPF:u(postFX?1:0)},vertexShader:"varying vec2 vUv; void main(){gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);vUv=uv;}",fragmentShader:"#define TAU 6.28318530718\n#define V2 vec2\n#define V3 vec3\n#define V4 vec4\n#define FL float\n\nuniform sampler2D tDiffuse;uniform vec2 uRes;uniform sampler2D sNoise;uniform vec2 uCF;uniform float uGF;uniform float uPF;varying vec2 vUv;FL hash12(V2 p){V3 p3=fract(V3(p.xyx)*.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}V2 uvS(V2 p,V2 r){return p+.6*sin(p*r*TAU)/TAU/r;}V4 sno(V2 p,V2 r){V2 uv=p/r;uv=uvS(uv,r);return texture(sNoise,uv);}V3 gct(V2 xy,FL s,V2 q){V4 r=sno(xy*1.2/sqrt(s),q)-sno(xy*1.2/sqrt(s)+V2(1,-1)*1.5,q);return .95+.05*r.xxx+.05*r.xyz;}void main(){V2 uv=vUv;V2 xy=gl_FragCoord.xy;V4 data=texture2D(tDiffuse,uv);V3 C=data.rgb;FL S=uCF.x;V3 ca=gct(xy,S,uRes);C=mix(C,C*ca,uCF.y*uPF);FL gr=hash12(xy)*uGF;C+=(C*gr*uPF);gl_FragColor=V4(C,1.);}"}}function createNoiseTexture(e,t){return noisePass=getNoiseTexture(e,p.noiseSeed,"FL c=fbm(vec3(uv,uSeed),15.,.7,.2,.3);c+=fbm(vec3(uv,uSeed),193.,.4,.15,.05);",p.displacementOctaves),writeStaticTexture(renderer,{x:e.x,y:e.y},noisePass.pixelFormat,noisePass.shader)}const setArrayIdxs=(e,t,r)=>{e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2]},setAttr=(e,t,r,a)=>{a.setAttribute(e,new THREE.InstancedBufferAttribute(t,r))},af32=e=>new Float32Array(3*e),ai32=e=>new Int32Array(e);function createAttributes(e){return{ids:ai32(e),pos:af32(e),sca:af32(e),axi:af32(e),col:af32(e),rot:ai32(e)}}function updateAttributes(e,t,r,a,i,s){e.ids[a]=s[0],setArrayIdxs(e.sca,i,s[2]),setArrayIdxs(e.pos,i,s[3]),setArrayIdxs(e.axi,i,s[4]),setArrayIdxs(e.col,i,s[5]),t.position.set(0,0,0),t.updateMatrix(),r.setMatrixAt(a,t.matrix)}function setAttributes(e,t){setAttr("aID",e.ids,1,t),setAttr("aPos",e.pos,3,t),setAttr("aScale",e.sca,3,t),setAttr("aAxis",e.axi,3,t),setAttr("aColor",e.col,3,t)}function createInstances(e,t,r,a,i=!1,s=[]){const n=Math.sqrt(e),o=createNoise2D(new Random),l=new THREE.Object3D;let u=createAttributes(e);const h=p.boxSimplexFreq;for(let t=0,r=0,c=e;t<c;t++,r+=3){let e=[parseInt(t%n)/n*h,parseInt(t/n)/n*h];const c=[.5*o(e[0],e[1])+.5,.5*o(e[0]+h,e[1]+h)+.5,.5*o(e[0]+2*h,e[1]+2*h)+.5];let d,m=s.length;if(m<1){d=[o(e[0]+3*h,e[1]+3*h),o(e[0]+4*h,e[1]+4*h),o(e[0]+5*h,e[1]+5*h)]}else d=s[t%m];const f=o(e[0]+6*h,e[1]+6*h);let v=[0,0,0],g=1,x=p.palette[0];f<.25?(v=[0,1,0],x=p.palette[1]):f<.5?(v=[0,0,1],x=p.palette[2]):f<.75?(v=[-1,0,0],x=p.palette[0]):g=0,i&&(x=p.palette[R.ri(0,4)]);updateAttributes(u,l,a,t,r,[t,g,c,d,v,toRGB(x)])}setAttributes(u,r)}function createSphereInstances(e,t,r,a){const i=new THREE.Object3D;let s=createAttributes(e),n=[];for(let t=0,r=0,o=e;t<o;t++,r+=3){const e=R.r(),o=[e,e,e],l=[R.rr(-1,1),R.rr(-1,1),R.rr(-1,1)];n.push(l);const u=R.r();let h=[0,0,0],c=1;u<.25?h=[0,1,0]:u<.5?h=[0,0,1]:u<.75?h=[-1,0,0]:c=0,updateAttributes(s,i,a,t,r,[t,c,o,l,h,toRGB(p.palette[R.rc([0,3,4])])])}return setAttributes(s,r),n}function createCircleInstances(e,t,r,a){const i=createNoise2D(new Random);let s=100;const n=Math.floor(Math.sqrt(e)),o=new THREE.Object3D;let l=createAttributes(e);for(let t=0,r=0,u=e;t<u;t++,r+=3){let e=[parseInt(t%n)/n*s,parseInt(t/n)/n*s];const u=R.r(),h=[u,u,u],c=[i(e[0]+s,e[1]+s),i(e[0]+200,e[1]+200),i(e[0]+300,e[1]+300)],d=R.r();let m=[0,0,0],f=1;d<.25?m=[0,1,0]:d<.5?m=[0,0,1]:d<.75?m=[-1,0,0]:f=0,updateAttributes(l,o,a,t,r,[t,f,h,c,m,toRGB(p.palette[R.ri(0,4)])])}setAttributes(l,r)}function applyCubeMap(e,t,r=!1,a=null){const i=new THREE.PMREMGenerator(renderer),s=(new THREE.CubeTextureLoader).load(e,(()=>{for(let e of t)e.envMap=i.fromCubemap(s).texture;i.dispose(),composer.render(),r&&exportCustom()}))}function prepareMesh(e,t){e.receiveShadow=e.castShadow=e.frustumCulled=!0,e.customDepthMaterial=t,e.needsUpdate=!0,scene.add(e)}function getDim(e,t=null){let r=window.innerHeight,a=window.innerHeight;return null!==t&&(r=a=t),r*=.75,{x:r,y:a,a:.75}}function makeUniforms(e,t,r,a,i){return{uGS:u(p.generalScale),uC0:u(toRGB(p.palette[0])),uC1:u(toRGB(p.palette[1])),uC2:u(toRGB(p.palette[2])),uC3:u(toRGB(p.palette[3])),uC4:u(toRGB(p.palette[4])),uRT:u(e),uSR:u(t),uPR:u(r),uBC:u(p.baseColor),uVD:u(a),uCM:u(i)}}function init(e=null){R=new Random,p=getParams(),dim=getDim(p.ratioMode,e),scene=new THREE.Scene,renderer=new THREE.WebGLRenderer({antialias:!0,preserveDrawingBuffer:1,powerPreference:"high-performance"}),createContainer(renderer),renderer.setSize(dim.x,dim.y),renderer.setClearColor(p.background,1),renderer.physicallyCorrectLights=!0,renderer.toneMapping=THREE.ACESFilmicToneMapping,renderer.toneMappingExposure=p.toneMappingExposure,renderer.outputEncoding=THREE.sRGBEncoding,renderer.shadowMap.enabled=!0,renderer.shadowMap.type=THREE.PCFSoftShadowMap;const t=new THREE.Vector2;renderer.getDrawingBufferSize(t),dim={x:t.width,y:t.height,a:t.width/t.height};renderer.setPixelRatio(2);const r=p.viewSize;camera=new THREE.OrthographicCamera(-r*dim.a,r*dim.a,r,-r,.1,30),camera.position.set(0,0,p.cameraZ);let a=new THREE.MeshStandardMaterial;a.envMapIntensity=p.boxEnvIntensity,a.roughness=p.boxRoughness,a.metalness=p.boxMetalness,a.opacity=p.boxOpacity,a.transparent=!0;let i=new THREE.MeshStandardMaterial;i.envMapIntensity=p.sphereEnvIntensity,i.roughness=p.sphereRoughness,i.metalness=p.sphereMetalness,i.opacity=p.sphereOpacity,i.transparent=!0;let s=new THREE.MeshStandardMaterial;s.envMapIntensity=1,s.roughness=p.circleRoughness,s.metalness=p.circleMetalness,s.opacity=p.circleOpacity,s.transparent=!0;let n,o,l,u=new THREE.MeshStandardMaterial;u.envMapIntensity=p.boxEnvIntensity,u.roughness=p.boxRoughness,u.metalness=p.boxMetalness,u.opacity=p.lineOpacity,u.transparent=!0,materialsList=[a,u,i,s],n=makeUniforms(p.boxRotation,p.boxScaleRange,p.boxPosRange,p.boxVtxDisp,p.boxColoringMode);const h=customPBRMaterial(a,n);o=h[0],l=h[1];let c=p.boxBaseScale,d=new THREE.BoxBufferGeometry(c,c,c),m=new THREE.InstancedMesh(d,o,p.boxInstances);prepareMesh(m,l),createInstances(p.boxInstances,o,d,m),m.rotation.set(toRadians(p.boxMeshRot[0]),toRadians(p.boxMeshRot[1]),toRadians(p.boxMeshRot[2])),n=makeUniforms(p.sphereRotation,p.sphereScaleRange,p.spherePosRange,p.sphereVtxDisp,p.sphereColoringMode);const f=customPBRMaterial(i,n);o=f[0],l=f[1];let v=new THREE.SphereBufferGeometry(1,32,32),g=new THREE.InstancedMesh(v,o,p.sphereInstances);prepareMesh(g,l);let x=createSphereInstances(p.sphereInstances,o,v,g);g.position.set(p.sphereMeshPos[0],p.sphereMeshPos[1],p.sphereMeshPos[2]),g.rotation.set(toRadians(p.sphereMeshRot[0]),toRadians(p.sphereMeshRot[1]),toRadians(p.sphereMeshRot[2])),n=makeUniforms(p.circleRotation,p.circleScaleRange,p.circlePosRange,p.circleVtxDisp,p.circleColoringMode);const E=customPBRMaterial(s,n);o=E[0],l=E[1];let M=new THREE.CircleBufferGeometry(p.circleBaseScale,32),T=new THREE.InstancedMesh(M,o,p.circleInstances);prepareMesh(T,l),createCircleInstances(p.circleInstances,o,M,T),T.position.set(p.circleMeshPosition[0],p.circleMeshPosition[1],p.circleMeshPosition[2]),n=makeUniforms(p.lineRotation,p.lineScaleRange,p.linePosRange,p.lineVtxDisp,p.lineColoringMode);const S=customPBRMaterial(u,n);o=S[0],l=S[1],c=p.boxBaseScale;let C=new THREE.BoxBufferGeometry(c,c,c),y=new THREE.InstancedMesh(C,o,p.lineInstances);y.receiveShadow=y.castShadow=y.frustumCulled=!1,y.customDepthMaterial=l,y.needsUpdate=!0,scene.add(y),createInstances(p.boxInstances,o,C,y,!0,x),y.rotation.set(toRadians(p.boxMeshRot[0]),toRadians(p.boxMeshRot[1]),toRadians(p.boxMeshRot[2]));const b=new THREE.AmbientLight(16777215,.25);scene.add(b);let D=getDirLight(p.lightPos1,16777215,p.lightIntensity1,!0,dim);scene.add(D);let P=getDirLight(p.lightPos2,16777215,p.lightIntensity2,!0,dim);scene.add(P);let w=913;const B=new THREE.WebGLMultisampleRenderTarget(dim.x,dim.y,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});composer=new EffectComposer(renderer,B),composer.setSize(2*dim.x,2*dim.y);let F=new RenderPass(scene,camera);composer.addPass(F);let A=new SAOPass(scene,camera,!0,!1);A.resolution.set(2*dim.x,2*dim.y),A.params.saoBias=p.saoBias,A.params.saoScale=p.saoScale,A.params.saoKernelRadius=dim.y>w?p.saoKernelRadius*Math.pow(dim.y/w,1.24):p.saoKernelRadius,A.params.saoIntensity=dim.y>w?p.saoIntensity*Math.pow(w/dim.y,.5):p.saoIntensity,A.params.saoMinResolution=p.saoMinResolution,A.params.saoBlurRadius=p.saoBlurRadius,A.params.saoBlurStdDev=p.saoBlurStdDev,A.params.saoBlurDepthCutoff=p.saoBlurDepthCutoff,composer.addPass(A),saoComposer=new EffectComposer(renderer),saoComposer.setSize(2*dim.x,2*dim.y),saoComposer.renderToScreen=!1,saoComposer.addPass(F),saoComposer.addPass(A);let H=new UnrealBloomPass(dim,.1,.5,.75);H.threshold=p.bloomThreshold,H.radius=p.bloomRadius,H.strength=dim.y>w?p.bloomStrength*Math.pow(w/dim.y,.33):p.bloomStrength,composer.addPass(H);let V=createNoiseTexture(dim,2);postfxPass=new ShaderPass(displacementShader(dim,2)),postfxPass.uniforms.sNoise.value=V,composer.addPass(postfxPass),camera.lookAt(m.position),window.addEventListener("resize",onWindowResize),document.addEventListener("keydown",onDocumentKeyDown,!1)}function updateResize(){const e=new THREE.Vector2;renderer.getDrawingBufferSize(e);const t={x:e.width,y:e.height,aspect:e.width/e.height};noisePass.shader.uniforms.uRes.value=[t.x,t.y],postfxPass.uniforms.uRes.value=[t.x,t.y],camera.aspect=t.aspect,camera.updateProjectionMatrix()}function sizeTransform(e=null,t=2){let r=getDim(p.ratioMode,e);renderer.setSize(r.x,r.y),renderer.setPixelRatio(t),updateResize(),composer.render()}function onWindowResize(){sizeTransform()}function onDocumentKeyDown(e){var t=e.which;if(e.shiftKey)switch(t){case 69:sizeTransform(3840,1),exportCustom();break;case 83:sizeTransform(5760,1),exportCustom();break;case 66:postFX=!0,postfxPass.uniforms.uPF.value=postFX,composer.render();break;case 78:postFX=!1,postfxPass.uniforms.uPF.value=postFX,composer.render();break;case 79:composer.render(),exportCustom()}}const saveFile=function(e,t){const r=document.createElement("a");"string"==typeof r.download?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):location.replace(uri)};function exportCustom(){let e;Date.now||(Date.now=function(){return(new Date).getTime()});let t=Math.floor(Date.now()/1e3);try{const r="image/png";e=renderer.domElement.toDataURL(r),saveFile(e.replace(r,"image/octet-stream"),`Laterals#${mintNumber}_${t}.png`)}catch(e){return void console.log(e)}sizeTransform(window.innerHeight)}init(null),applyCubeMap(cubemap,materialsList);
s(e,t,r,a,i){e.getClearColor(this.originalClearColor);const s=e.getClearAlpha(),n=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,null!=a&&(e.setClearColor(a),e.setClearAlpha(i||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=n,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)}renderOverride(e,t,r,a,i){e.getClearColor(this.originalClearColor);const s=e.getClearAlpha(),n=e.autoClear;e.setRenderTarget(r),e.autoClear=!1,a=t.clearColor||a,i=t.clearAlpha||i,null!=a&&(e.setClearColor(a),e.setClearAlpha(i||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=n,e.setClearColor(this.originalClearColor),e.setClearAlpha(s)}setSize(e,t){this.beautyRenderTarget.setSize(e,t),this.saoRenderTarget.setSize(e,t),this.blurIntermediateRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.depthRenderTarget.setSize(e,t),this.saoMaterial.uniforms.size.value.set(e,t),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.needsUpdate=!0,this.vBlurMaterial.uniforms.size.value.set(e,t),this.vBlurMaterial.needsUpdate=!0,this.hBlurMaterial.uniforms.size.value.set(e,t),this.hBlurMaterial.needsUpdate=!0}}SAOPass.OUTPUT={Beauty:1,Default:0,SAO:2,Depth:3,Normal:4};const LuminosityHighPassShader={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new THREE.Color(0)},defaultOpacity:{value:0}},vertexShader:"varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}",fragmentShader:"uniform sampler2D tDiffuse;uniform vec3 defaultColor;uniform float defaultOpacity,luminosityThreshold,smoothWidth;varying vec2 vUv;void main(){vec4 d=texture2D(tDiffuse,vUv);vec3 v=vec3(.299,.587,.114);float l=dot(d.xyz,v);vec4 t=vec4(defaultColor.xyz,defaultOpacity);float s=smoothstep(luminosityThreshold,luminosityThreshold+smoothWidth,l);gl_FragColor=mix(t,d,s);}"};class UnrealBloomPass extends Pass{constructor(e,t,r,a){super(),this.strength=t,this.radius=r,this.threshold=a,this.resolution=new THREE.Vector2(e.x,e.y),this.clearColor=new THREE.Color(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let i=Math.round(this.resolution.x/2),s=Math.round(this.resolution.y/2);this.renderTargetBright=new THREE.WebGLRenderTarget(i,s,{type:THREE.HalfFloatType}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){const t=new THREE.WebGLRenderTarget(i,s,{type:THREE.HalfFloatType});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);const r=new THREE.WebGLRenderTarget(i,s,{type:THREE.HalfFloatType});r.texture.name="UnrealBloomPass.v"+e,r.texture.generateMipmaps=!1,this.renderTargetsVertical.push(r),i=Math.round(i/2),s=Math.round(s/2)}const n=LuminosityHighPassShader;this.highPassUniforms=THREE.UniformsUtils.clone(n.uniforms),this.highPassUniforms.luminosityThreshold.value=a,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new THREE.ShaderMaterial({uniforms:this.highPassUniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}),this.separableBlurMaterials=[];const o=[3,5,7,9,11];i=Math.round(this.resolution.x/2),s=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(o[e])),this.separableBlurMaterials[e].uniforms.texSize.value=new THREE.Vector2(i,s),i=Math.round(i/2),s=Math.round(s/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1),new THREE.Vector3(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const l=CopyShader;this.copyUniforms=THREE.UniformsUtils.clone(l.uniforms),this.blendMaterial=new THREE.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:THREE.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new THREE.Color,this.oldClearAlpha=1,this.basic=new THREE.MeshBasicMaterial({transparent:!0}),this.fsQuad=new FullScreenQuad(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let r=Math.round(e/2),a=Math.round(t/2);this.renderTargetBright.setSize(r,a);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(r,a),this.renderTargetsVertical[e].setSize(r,a),this.separableBlurMaterials[e].uniforms.texSize.value=new THREE.Vector2(r,a),r=Math.round(r/2),a=Math.round(a/2)}render(e,t,r,a,i){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const s=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let n=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=n.texture,this.separableBlurMaterials[t].uniforms.direction.value=UnrealBloomPass.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=UnrealBloomPass.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this.fsQuad.render(e),n=this.renderTargetsVertical[t];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(r),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}getSeperableBlurMaterial(e){return new THREE.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new THREE.Vector2(.5,.5)},direction:{value:new THREE.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}",fragmentShader:"#include <common>\nvarying vec2 vUv;uniform sampler2D colorTexture;uniform vec2 texSize,direction;float gaussianPdf(float e,float v){return.39894*exp(-.5*e*e/(v*v))/v;}void main(){vec2 v=1./texSize;float A=float(SIGMA),e=gaussianPdf(0.,A);vec4 c=texture2D(colorTexture,vUv)*e;for(int f=1;f<KERNEL_RADIUS;f++){float S=float(f),d=gaussianPdf(S,A);vec2 g=direction*v*S;vec4 i=texture2D(colorTexture,vUv+g),r=texture2D(colorTexture,vUv-g);c+=(i+r)*d;e+=2.*d;}gl_FragColor=vec4(c/e);}"})}getCompositeMaterial(e){return new THREE.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}",fragmentShader:"varying vec2 vUv;uniform sampler2D blurTexture1,blurTexture2,blurTexture3,blurTexture4,blurTexture5;uniform float bloomStrength,bloomRadius,bloomFactors[NUM_MIPS];uniform vec3 bloomTintColors[NUM_MIPS];float lerpBloomFactor(const float b){float v=1.2-b;return mix(b,v,bloomRadius);}void main(){gl_FragColor=bloomStrength*(lerpBloomFactor(bloomFactors[0])*vec4(bloomTintColors[0],1)*texture2D(blurTexture1,vUv)+lerpBloomFactor(bloomFactors[1])*vec4(bloomTintColors[1],1)*texture2D(blurTexture2,vUv)+lerpBloomFactor(bloomFactors[2])*vec4(bloomTintColors[2],1)*texture2D(blurTexture3,vUv)+lerpBloomFactor(bloomFactors[3])*vec4(bloomTintColors[3],1)*texture2D(blurTexture4,vUv)+lerpBloomFactor(bloomFactors[4])*vec4(bloomTintColors[4],1)*texture2D(blurTexture5,vUv));}"})}}let R,dim,p,renderer,scene,camera,composer,clock,materialsList;UnrealBloomPass.BlurDirectionX=new THREE.Vector2(1,0),UnrealBloomPass.BlurDirectionY=new THREE.Vector2(0,1);let noisePass,postfxPass,saoComposer,postFX=!0,cubemap=generateCubeMap(),simplexNoise="vec4 v(vec4 a){vec4 b=mod(a,289.);return mod((b*34.+10.)*b,289.);}float psrdnoise(vec3 f,vec3 o,float F){const mat3 G=mat3(0.,1.,1.,1.,0.,1.,1.,1.,0.),I=mat3(-.5,.5,.5,.5,-.5,.5,.5,.5,-.5);vec3 H;H=G*f;vec3 a=floor(H),J=fract(H),w=step(J.xyx,J.yzz),K=1.-w,L=vec3(K.z,w.xy),M=vec3(K.xy,w.z),Z=min(L,M),_=max(L,M),k=a+Z,l=a+_,m=a+vec3(1.),g,h,i,j;g=I*a,h=I*k,i=I*l,j=I*m;vec3 x=f-g,y=f-h,z=f-i,A=f-j;if(any(greaterThan(o,vec3(0.)))){vec4 p=vec4(g.x,h.x,i.x,j.x),q=vec4(g.y,h.y,i.y,j.y),r=vec4(g.z,h.z,i.z,j.z);p=o.x>0.?mod(p,o.x):p,q=o.y>0.?mod(q,o.y):q,r=o.z>0.?mod(r,o.z):r,a=floor(G*vec3(p.x,q.x,r.x)+.5),k=floor(G*vec3(p.y,q.y,r.y)+.5),l=floor(G*vec3(p.z,q.z,r.z)+.5),m=floor(G*vec3(p.w,q.w,r.w)+.5);}vec4 B=v(v(v(vec4(a.z,k.z,l.z,m.z))+vec4(a.y,k.y,l.y,m.y))+vec4(a.x,k.x,l.x,m.x)),N=B*3.883222,b=B*-.00692+.99654,O=B*.108706,s=cos(N),t=sin(N),C=sqrt(1.-b*b),c,d,e;if(F!=0.){vec4 S=s*C,T=t*C,oa=b,D=sin(O),E=cos(O),P=t*D-s*E,pa=mix(P*t,D,b),qa=mix(-P*s,E,b),ra=-(T*E+S*D),U=vec4(sin(F)),V=vec4(cos(F));c=V*S+U*pa,d=V*T+U*qa,e=V*oa+U*ra;}else c=s*C,d=t*C,e=b;vec3 aa=vec3(c.x,d.x,e.x),ba=vec3(c.y,d.y,e.y),ca=vec3(c.z,d.z,e.z),da=vec3(c.w,d.w,e.w);vec4 n=.5-vec4(dot(x,x),dot(y,y),dot(z,z),dot(A,A));n=max(n,0.);vec4 ea=n*n,fa=ea*n,ga=vec4(dot(aa,x),dot(ba,y),dot(ca,z),dot(da,A));float sa=dot(fa,ga);return 39.5*sa;}";function makeMint(e,t,r,a,i,s,n,o,l,u,h,c){return{hash:e,lights:t,color:r,rotation:a,boxSettings:i,sphereSettings:s,circleSettings:n,lineSettings:o,generalScale:l,bloom:u,saoBias:h,background:c}}function getMint(e,t=0){let r,a={0:makeMint("0xDeterminant",[[[-5,2,3],.25],[[5,3,3],1.5]],0,[45,45,0],[2e3,[1,.25,.13],[1,1.5,1],[0,0]],[250,.035,[1,2,1]],[0,.1,[1,1.5,1]],[500,[10,.005]],3,[.38,.38,1],40,[.1,.1,.1]),1:makeMint("0xAmaranthEsquiva",[[[2.2,1.5,2.7],1],[[2,-5,5],1]],593,[45,45,0],[2e3,[1,3,.02],[1,1.5,3.5],[4,3]],[500,.02,[1,1.5,1]],[500,.01,[1,1.5,1]],[100,[30,.005]],3,[.3,.33,1],40,[.1,.1,.1]),2:makeMint("0xAnhidridaex",[[[-5,-.2,5],1.04],[[-5,5,5],.85]],532,[45,45,0],[2e3,[2,.05,.5],[1,1.45,.5],[1,0]],[1e3,.015,[1,1.4,1]],[1e3,.01,[1,1,1]],[2e3,[2,.003]],1.5,[.5,.3,1],40,[.1,.1,.1]),3:makeMint("0xApexLiminal",[[[-.5,.8,5],1],[[-.1,2,5],1]],1435,[45,-45,0],[2e3,[1,2,.02],[1,2,1],[1,1]],[50,.02,[1.3,1.5,1.1]],[500,.01,[1,1,1]],[200,[20,.005]],2,[.25,.28,1],48,[.1,.1,.1]),4:makeMint("0xAxialApathy",[[[1.5,1.5,5],1],[[5,5,5],1]],1185,[-45,0,45],[2e3,[.04,.35,1],[.5,.5,.9],[1,0]],[300,.015,[.5,.5,1]],[500,.008,[.75,1,0]],[200,[10,.003]],2.3,[.4,.28,1],40,[.1,.11,.1]),5:makeMint("0xBekhertinsHark",[[[2,2,5],1],[[.3,.3,5],.7]],270,[45,45,90],[2500,[1,.25,.13],[1.5,1.5,1.5],[1,0]],[500,.015,[1,1.5,1]],[1e3,.015,[1,1.5,1]],[500,[10,.005]],2.5,[.33,.24,1],50,[.05,.05,.05]),6:makeMint("0xDexhathroneBarbican",[[[5,2,5],2.5],[[5,1,5],2.5]],448,[45,0,0],[2500,[.25,.02,1.5],[1,1,1],[4,1]],[500,.035,[1,1.5,1]],[1e3,.015,[1,1.5,1]],[100,[10,.005]],2.5,[.5,.15,1],40,[.1,.1,.1]),7:makeMint("0xDeviantMillica",[[[-5,-3.3,5],1],[[-1.9,2,.8],1.28]],162,[45,-50,0],[1e3,[1,1,1],[2,.15,2],[4,2]],[2e3,.015,[1.5,.5,2]],[1e3,.01,[1.5,2,1]],[300,[5,.005]],2,[.5,.25,1],50,[.1,.1,.1]),8:makeMint("0xFantomPaper",[[[-5,5,5],.25],[[0,1,2],1]],1499,[-45,0,45],[3e3,[1.89,1.41,.025],[1.25,1.25,2.2],[1,0]],[500,.02,[1.3,1.3,2]],[200,.01,[1.5,1.5,2]],[300,[10,.005]],1,[.35,.4,1],40,[.12,.12,.15]),9:makeMint("0xDaemonFluxus",[[[0,5,1],.3],[[5,.8,3],.8]],592,[56.5,30,53],[500,[1,3.5,.1],[.5,.5,1],[4,1]],[500,.01,[1,1.5,1]],[500,.01,[1,1.5,1]],[150,[10,.005]],3.65,[.15,.33,1],50,[1,.01,.01]),10:makeMint("0xCetraParallax",[[[-2,0,3],.75],[[.5,1,3],.8]],532,[56.5,30,53],[2e3,[1,.25,.75],[1.5,1,1],[1,0]],[500,.015,[1,2,1]],[1e3,.01,[1,1,1]],[100,[20,.005]],3,[.33,.19,1],41,[.4,.4,.4]),11:makeMint("0xElephantStaircase",[[[-2.5,-1.5,5],.75],[[-5,2,5],.9]],200,[45,-50,0],[1e3,[1,1,1],[2,.15,2],[1,2]],[250,.015,[1.5,1,1]],[500,.01,[1,1,1]],[50,[25,.005]],3,[.25,.2,1],45,[1,0,0]),12:makeMint("0xAldebaran",[[[3.6,2,5],.9],[[.8,3.3,3],.8]],1050,[45,45,0],[2e3,[.05,2,2.75],[1.1,1.6,1.1],[1,0]],[1e3,.02,[1,2.15,1]],[500,.018,[1,2,1]],[1e3,[4,.005]],1,[.4,.3,1],39,[.1,.135,.12]),13:makeMint("0xAhrkanaCetrum",[[[2,3.5,5],.6],[[0,1,5],.8]],4,[-45,0,-45],[2e3,[.25,1,.5],[1,1.3,1],[1,0]],[500,.035,[2.3,1.6,2.1]],[120,.1,[1.2,1,.4]],[200,[10,.004]],3,[.5,.18,1],42,[.3,.3,.3]),14:makeMint("0xViracocha",[[[.7,-5,5],.33],[[5,5,5],1.5]],591,[45,45,0],[2e3,[1,.6,.02],[1,.8,1],[1,0]],[1e3,.01,[1,1,1]],[1e3,.005,[1,1,1]],[1e3,[1.25,.005]],3.4,[.15,.33,1],50,[1,.1,.1]),15:makeMint("0xFermiRizhome",[[[-2,5,5],.75],[[0,2.5,5],.75]],200,[45,45,0],[1e3,[.5,2,1],[1,2,1],[1,1]],[1e3,.012,[1.25,2.05,1.25]],[500,.01,[1.4,2.5,1]],[1e3,[5,.005]],1.1,[.3,.21,1],40,[.13,.1,.1]),16:makeMint("0xFortressFaladakh",[[[-5,5,5],1],[[-1,2,5],1.25]],4,[45,45,0],[1e3,[1,1,1],[1,1,2],[1,2]],[250,.015,[1.5,1,1]],[500,.01,[1,1,1]],[300,[5,.005]],3,[.7,.18,1],45,[1,.1,.1]),17:makeMint("0xAhltaEdifice",[[[5,5,5],.35],[[-4,1.3,2],1]],1412,[-45,0,45],[3e3,[.05,1.5,.3],[.65,.6,2.8],[1,0]],[500,.02,[1,1,2.25]],[200,.01,[1,1.5,1]],[500,[4,.005]],1,[.2,.56,1],35,[.1,.105,.1]),18:makeMint("0xDecafonAvaricis",[[[-5,5,5],1.5],[[.5,.5,5],1.5]],264,[45,45,0],[1e3,[1,.1,1],[1,1.5,2],[4,2]],[500,.015,[1,1,1]],[1e3,.01,[1,1,1]],[50,[20,.005]],3,[.5,.12,1],45,[.1,.1,.8]),19:makeMint("0xAmaru",[[[5,2.5,5],1.25],[[2,1,5],1]],591,[56.5,30,53],[2e3,[1,4.5,.03],[.5,.5,1],[1,0]],[1e3,.01,[1,1,1]],[1e3,.005,[1,1,1]],[250,[5,.005]],3,[.2,.2,1],45,[.9,.5,.1]),20:makeMint("0xGhoikerinku",[[[1,1,5],1],[[5,5,5],1]],421,[45,45,0],[2e3,[.75,1.5,.25],[1,1.5,.7],[1,0]],[500,.03,[1,1,1]],[500,.02,[1,1,1]],[250,[50,.005]],3,[.3,.2,1],43,[.3,.9,.1]),21:makeMint("0xAnagramInverted",[[[-5,5,5],1],[[-5,0,5],1.5]],424,[45,45,0],[1e3,[1,.9,1],[1,1,2],[4,2]],[500,.015,[1,1,1]],[1500,.01,[1,1,1]],[100,[50,.005]],3,[.5,.15,1],50,[.1,.1,.8]),22:makeMint("0xEntoCholeoptera",[[[.2,5,5],1],[[-1.8,5,5],1]],175,[-45,0,45],[1e3,[.1,.3,1.8],[1,1,1.3],[1,3]],[250,.03,[1,1,1.5]],[1500,.01,[1.2,1.5,0]],[250,[5,.008]],1.35,[.33,.3,1],40,[.1,.1,.12]),23:makeMint("0xCloromorphicolAbatica",[[[3.1,2.5,5],1],[[-2,2,2.5],.5]],1040,[45,-45,0],[2e3,[1,.03,3],[1,1,1],[1,4]],[100,.02,[2.2,1.25,2]],[500,.01,[1,1,1]],[50,[10,.005]],2.35,[.15,.28,1],47,[1,0,1]),24:makeMint("0xBoulderSculptorica",[[[-5,5,5],.75],[[0,1,2],1.4]],1498,[-45,0,45],[2200,[2.7,1.41,.025],[1.4,.75,2],[1,0]],[500,.02,[1.5,1.5,1.8]],[1e3,.01,[3,3,0]],[500,[10,.005]],1,[.35,.32,1],42,[.1,.11,.15]),25:makeMint("0xHorizonVertical",[[[-5,1,5],1],[[2.5,3,5],1]],200,[45,45,0],[1002,[2,2,.5],[1,1,1],[1,2]],[250,.015,[1.32,2.6,1]],[1e3,.01,[1,1.5,1]],[100,[30,.005]],2.5,[.6,.18,1],45,[0,.5,1]),26:makeMint("0xFerraraHallucina",[[[-5,-3.3,5],1],[[-1.9,2,.8],1.28]],1050,[45,-50,0],[1e3,[1.3,.45,1],[2,.15,2],[4,2]],[800,.015,[1.5,.5,2]],[500,.01,[1.5,2,1]],[300,[5,.005]],2,[.5,.28,1],50,[.4,.1,.25]),27:makeMint("0xCaminataBifurcata",[[[0,5,5],.5],[[5,5,5],1]],362,[45,45,90],[2e3,[1,.25,.13],[1.5,1.5,1.5],[1,3]],[500,.035,[1,1.5,1]],[800,.01,[1,1.5,1]],[500,[10,.005]],2.5,[.35,.3,1],50,[.4,.4,.5]),28:makeMint("0xCorniusAngle",[[[-5,5,5],1],[[5,5,5],1]],1250,[0,-45,45],[2e3,[.025,1,3.5],[1,.38,.38],[3,1]],[60,.01,[1.22,1,1.31]],[1e3,.005,[1.4,1.5,0]],[240,[4,.01]],1.75,[.2,6,1],38,[.02,.02,.02]),29:makeMint("0xDehfaMinim",[[[-5,5,5],1.8],[[-1.5,5,5],1]],306,[45,45,0],[2e3,[3.5,3.27,.04],[-1.08,.64,1.1],[1,1]],[100,.02,[1.5,1.2,1.5]],[1e3,.01,[2,2,0]],[400,[30,.003]],2.3,[.15,.25,1],45,[1,.01,.01]),30:makeMint("0xAncoraBeatha",[[[5,5,5],1],[[-5,5,5],.75]],389,[45,45,90],[2500,[1,.6,.01],[.7,1.5,1.6],[4,3]],[200,.02,[1,1,1]],[1e3,.015,[2,2,2]],[200,[10,.005]],2,[.2,.25,1],42,[.08,.08,.12]),31:makeMint("0xDhenteMicelia",[[[-5,5,5],.5],[[0,.8,5],.5]],593,[45,45,0],[2500,[.75,2.5,.025],[.7,1.5,1.3],[4,4]],[200,.02,[1,1,1]],[1e3,.015,[2,2,2]],[100,[10,.005]],2.3,[.15,.37,1],42,[.05,.05,.08]),32:makeMint("0xEhafaDehafa",[[[1,1,5],1.5],[[1.5,-5,5],2]],1498,[45,45,0],[1e3,[2,.05,1.4],[1.6,1.9,1],[1,1]],[100,.02,[1.7,2.1,1]],[500,.015,[2,2,0]],[400,[5,.005]],1,[.35,.25,1],42,[.1,.1,.16]),33:makeMint("0xDecaFern",[[[0,4,5],.8],[[3.3,3,2],.8]],449,[56.5,-30,-53],[2e3,[1,3.5,.025],[.5,.5,1],[1,2]],[60,.015,[.6,.75,1]],[0,.005,[-.5,.5,3]],[240,[20,.003]],3.5,[.4,.3,1],50,[.1,.1,.1]),34:makeMint("0xFehrriDexatrone",[[[-5,5,2.5],1],[[5,5,5],1]],1330,[45,0,0],[2500,[.25,.02,1.5],[1,1,1],[3,0]],[100,.015,[.85,1,1]],[2e3,.01,[1,1.5,1]],[100,[10,.005]],2.5,[.5,.25,1],38,[.11,.1,.1]),35:makeMint("0xFacaciaNubia",[[[-3,5,5],.5],[[2.5,0,1.5],.75]],135,[45,45,0],[1e3,[1.5,1.5,.5],[1,1,1],[4,0]],[500,.01,[1.4,1.16,.98]],[1e3,.008,[1,1,1]],[200,[30,.005]],3,[.25,.26,1],45,[1,.1,.5]),36:makeMint("0xEblemaFahr",[[[-5,5,5],.75],[[-5,5,5],.75]],4,[45,-50,0],[1e3,[1,1,1],[2.25,.45,1.85],[4,4]],[2e3,.015,[1.5,.5,2]],[1e3,.01,[1.5,2,1]],[0,[20,.005]],2,[.35,.17,1],50,[.9,.3,.1]),37:makeMint("0xDheliosFarenheit",[[[-5,5,5],1.5],[[-5,0,5],1.5]],532,[45,45,0],[1e3,[1,1,1],[1,1,2],[4,2]],[500,.015,[1.4,1.31,1.05]],[1500,.007,[1,1,1]],[0,[25,.005]],3,[.75,.08,1],45,[.1,.1,.1]),38:makeMint("0xHeliosTrifacta",[[[5,3,3],2],[[-3.5,3.5,3],1]],259,[-45,0,45],[1250,[1,1.4,.02],[2,2,1.5],[1,4]],[100,.03,[0,1,4]],[500,.01,[1,1,1]],[200,[20,.005]],2,[.18,.15,1],40,[.1,.1,.1]),39:makeMint("0xDaedalus",[[[0,5,5],.35],[[2.5,1,2],1]],1499,[-45,0,45],[3e3,[.05,.91,.21],[1.25,1.25,2.1],[1,2]],[500,.02,[1,1,1.5]],[200,.01,[1,1.5,1]],[0,[5,.005]],2,[.38,.5,1],40,[.02,.02,.02]),40:makeMint("0xBehringerCabe",[[[-3,3.4,3],1],[[5,0,5],.5]],1095,[56.5,30,53],[1e3,[3,.1,7],[.5,.5,.5],[1,3]],[50,.02,[4,2.1,1.4]],[0,.02,[1.5,3,0]],[150,[25,.005]],1.3,[.35,.3,1],42,[.05,.09,.12]),41:makeMint("0xCefacHeamedh",[[[-5,2.8,5],.75],[[0,1,2],1.4]],179,[45,45,0],[2520,[2.5,1.41,.025],[1,2,1],[1,4]],[500,.025,[1.3,2,1.3]],[500,.01,[1,2,0]],[1e3,[5,.005]],1,[.32,.32,1],40,[.08,.08,.08]),42:makeMint("0xAbaceAhlta",[[[-5,.5,5],.8],[[0,3,2],.8]],1499,[0,45,-45],[2e3,[1,3.5,.05],[.5,.5,1],[1,1]],[550,.01,[1,1,1]],[1e3,.006,[1,1,1]],[100,[20,.005]],3.5,[.25,.25,1],43,[.1,.1,.1]),43:makeMint("0xEbehfAfaha",[[[1.4,.5,5],.75],[[5,5,5],.75]],1200,[45,45,90],[2500,[1.5,.5,.05],[.45,1.8,2],[4,3]],[100,.015,[1,1,1]],[500,.015,[2,2,2]],[200,[10,.005]],2.2,[.33,.25,1],42,[.05,.05,.05]),44:makeMint("0xDeahAfurah",[[[-5,5,5],1.5],[[.3,.3,5],1.5]],384,[45,45,0],[1e3,[1,1,1],[1,1,2],[4,2]],[500,.015,[1,1,1]],[1500,.01,[1,1,1]],[100,[23.8,.005]],3,[.4,.18,1],48,[.1,.1,.1]),45:makeMint("0xAherialDeah",[[[5,5,5],1],[[-5,.8,5],1]],385,[45,-45,0],[2e3,[2.5,.75,.01],[2,-.5,1.5],[1,0]],[100,.02,[1.02,.5,2.8]],[1e3,.012,[1,2,0]],[50,[20,.005]],2.25,[.25,.25,1],42,[.1,.1,.1]),46:makeMint("0xDarhaDendra",[[[1,1,5],1],[[0,1,5],1]],1040,[45,45,0],[1e3,[.05,2,2],[1,2,1],[1,0]],[500,.02,[1.1,1.95,1.3]],[1e3,.01,[2,2,1]],[200,[20,.005]],1.15,[.15,.25,1],45,[.1,.1,.12]),47:makeMint("0xFahciaAbea",[[[-2.5,3,3],1.5],[[1,3.4,3],.75]],360,[-45,0,45],[1250,[1,1.4,.01],[2,2,1.5],[1,4]],[200,.03,[1.5,1.5,1.5]],[1e3,.01,[1,2,1]],[100,[20,.005]],2,[.2,.22,1],40,[.1,.1,.1]),48:makeMint("0xBehmensAhmad",[[[5,5,5],.8],[[3,1.5,5],.8]],1e3,[45,45,90],[2500,[1,.8,.05],[.25,2,2],[4,2]],[200,.02,[1,1,1]],[1e3,.015,[2,2,2]],[50,[10,.005]],2,[.35,.25,1],45,[.01,.01,.01]),49:makeMint("0xCeaFehen",[[[1,3.2,5],.8],[[.7,1.2,2],.8]],1399,[45,0,45],[2e3,[.5,2.5,.02],[.5,.5,1],[1,2]],[50,.01,[1,1,1]],[500,.01,[1,1,0]],[400,[20,.005]],3.5,[.25,.28,1],42,[.1,.1,.1])};if(e in a)r=a[e];else{r=a[e%50]}return tokenData.hash=r.hash,null!=t&&(r.color=t),r}function u(e){return{value:e}}function toRGB(e){return[((e=Math.floor(e))>>16&255)/255,(e>>8&255)/255,(255&e)/255]}const toRadians=e=>Math.PI/180*e;function getRenderTarget(e,t,r,a){let i=new THREE.WebGLRenderTarget(e,t,r),s=new THREE.OrthographicCamera(-1,1,1,-1,0,1),n=new THREE.Scene,o=new THREE.PlaneGeometry(2,2),l=new THREE.Mesh(o,a);return n.add(l),{target:i,scene:n,camera:s}}function writeStaticTexture(e,t,r,a){let i=getRenderTarget(t.x,t.y,r,a);return e.setRenderTarget(i.target),e.render(i.scene,i.camera),e.setRenderTarget(null),i.target.texture}function createContainer(e){let t=document.createElement("div");return t.setAttribute("id","threecanvas"),t.setAttribute("class","threecanvas"),t.appendChild(e.domElement),document.body.appendChild(t),t}function getDirLight(e,t,r,a,i){const s=new THREE.DirectionalLight(t,r);return s.position.set(e[0],e[1],e[2]),s.castShadow=a,s.shadow.camera.near=0,s.shadow.camera.far=10,s.shadow.camera.left=-5,s.shadow.camera.right=5,s.shadow.camera.top=5,s.shadow.camera.b
"use strict";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),a=parseInt(e.substr(16,8),16),i=parseInt(e.substr(24,8),16);return function(){let e=((t|=0)+(r|=0)|0)+(i|=0)|0;return i=i+1|0,t=r^r>>>9,r=(a|=0)+(a<<3)|0,a=(a=a<<21|a>>>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 e=0;e<1e6;e+=2)this.prngA(),this.prngB()}r(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}rr(e,t){return e+(t-e)*this.r()}ri(e,t){return Math.floor(this.rr(e,t+1))}rb(e){return this.r()<e}rc(e){return e[this.ri(0,e.length-1)]}}let projectNumber=Math.floor(parseInt(tokenData.tokenId)/1e6),mintNumber=parseInt(tokenData.tokenId)%1e6,mintParams=getMint(mintNumber,null),palettes={0:[7693161,16777215,12510188,14063714,16132628],4:[16777215,12510188,14063714,16132628,7693161],135:[8729183,15166307,7591828,10868960,4038310],162:[14146010,16777215,2965326,15937100,7782105],175:[4164769,3648955,16295204,16208664,16193555],179:[3648955,16295204,16208664,16193555,4164769],200:[5917265,9486258,15854272,15643238,15291745],264:[3054034,10874106,10066329,16136494,1330043],270:[5863782,15387781,13730120,10823211,6497604],259:[5467272,9486813,16777215,16295460,4213607],306:[16184298,3420720,4148561,8097393,10138301],360:[16365676,13855870,10971777,6708088,4676985],362:[6708088,4676985,16365676,13855870,10971777],384:[2524806,6011551,15510591,15026239,1323071],385:[3500688,7643582,15986141,13909793,15438702],389:[7643582,15986141,13909793,15438702,3500688],421:[3853501,16207127,10382956,7570324,5151658],424:[10382956,7570324,5151658,3853501,16207127],448:[8952518,2435136,16285726,16710124,13950206],449:[13950206,8952518,2435136,16285726,16710124],532:[7455903,16776436,5283251,1064539,14959703],591:[16287775,2898241,4217189,12571613,15790303],592:[15790303,16287775,2898241,4217189,12571613],593:[12571613,15790303,16287775,2898241,4217189],1e3:[6869478,10934999,14672843,15893807,16345088],1040:[40879,6900027,13316670,15361856,15517776],1050:[4110254,8308398,14276518,16686492,16661630],1095:[42949,4177866,16314854,11395384,9354496],1185:[11717462,15462272,16694591,15627118,11156826],1200:[11121322,12831414,15396552,15589302,15190446],1250:[16462923,2629918,1209212,638651,16512708],1330:[16119285,15198183,3289650,9961472,12059651],1399:[3117457,3061675,9610025,15449362,224394],1412:[16686125,9474150,10274987,16711110,16015639],1435:[5065801,3420977,9681252,2527151,2772337],1498:[16301685,9286084,6312564,13643836,14967131],1499:[14967131,16301685,9286084,6312564,13643836]};var F2=.5*(Math.sqrt(3)-1),G2=(3-Math.sqrt(3))/6,fastFloor=function(e){return 0|Math.floor(e)},grad2=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]);function createNoise2D(e){var t=buildPermutationTable(e),r=new Float64Array(t).map((function(e){return grad2[e%12*2]})),a=new Float64Array(t).map((function(e){return grad2[e%12*2+1]}));return function(e,i){var s,n,o=0,l=0,u=0,h=(e+i)*F2,c=fastFloor(e+h),d=fastFloor(i+h),m=(c+d)*G2,p=e-(c-m),f=i-(d-m);p>f?(s=1,n=0):(s=0,n=1);var v=p-s+G2,g=f-n+G2,x=p-1+2*G2,R=f-1+2*G2,E=255&c,M=255&d,T=.5-p*p-f*f;if(T>=0){var S=E+t[M];o=(T*=T)*T*(r[S]*p+a[S]*f)}var C=.5-v*v-g*g;if(C>=0){var y=E+s+t[M+n];l=(C*=C)*C*(r[y]*v+a[y]*g)}var b=.5-x*x-R*R;if(b>=0){var D=E+1+t[M+1];u=(b*=b)*b*(r[D]*x+a[D]*R)}return 70*(o+l+u)}}function buildPermutationTable(e){for(var t=new Uint8Array(512),r=0;r<256;r++)t[r]=r;for(r=0;r<255;r++){var a=r+~~(e.r()*(256-r)),i=t[r];t[r]=t[a],t[a]=i}for(r=256;r<512;r++)t[r]=t[r-256];return t}const CopyShader={uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")};class EffectComposer{constructor(e,t){if(this.renderer=e,void 0===t){const r=e.getSize(new THREE.Vector2);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,(t=new THREE.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new ShaderPass(CopyShader),this.clock=new THREE.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let r=!1;for(let t=0,a=this.passes.length;t<a;t++){const a=this.passes[t];if(!1!==a.enabled){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),a.needsSwap){if(r){const t=this.renderer.getContext(),r=this.renderer.state.buffers.stencil;r.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),r.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==THREE.MaskPass&&(a instanceof THREE.MaskPass?r=!0:a instanceof THREE.ClearMaskPass&&(r=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new THREE.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const r=this._width*this._pixelRatio,a=this._height*this._pixelRatio;this.renderTarget1.setSize(r,a),this.renderTarget2.setSize(r,a);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(r,a)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}class Pass{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}}class FullScreenQuad{constructor(e){const t=new THREE.BufferGeometry;t.setAttribute("position",new THREE.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),t.setAttribute("uv",new THREE.Float32BufferAttribute([0,2,0,0,2,0],2)),this._mesh=new THREE.Mesh(t,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,new THREE.OrthographicCamera(-1,1,1,-1,0,1))}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class ShaderPass extends Pass{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof THREE.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=THREE.UniformsUtils.clone(e.uniforms),this.material=new THREE.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new FullScreenQuad(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}}class RenderPass extends Pass{constructor(e,t,r,a,i){super(),this.scene=e,this.camera=t,this.overrideMaterial=r,this.clearColor=a,this.clearAlpha=void 0!==i?i:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new THREE.Color}render(e,t,r){const a=e.autoClear;let i,s;e.autoClear=!1,void 0!==this.overrideMaterial&&(s=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=s),e.autoClear=a}}const SAOShader={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new THREE.Vector2(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new THREE.Matrix4},cameraInverseProjectionMatrix:{value:new THREE.Matrix4},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}},vertexShader:"\n\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"\n#include <common>\n#define I int\n#define FL float\n#define V2 vec2\n#define V3 vec3\n#define V4 vec4\nvarying V2 vUv;\n#if DIFFUSE_TEXTURE==1\nuniform sampler2D tDiffuse;\n#endif\nuniform sampler2D tDepth;\n#if NORMAL_TEXTURE==1\nuniform sampler2D tNormal;\n#endif\nuniform FL cameraNear,cameraFar;uniform mat4 cameraProjectionMatrix,cameraInverseProjectionMatrix;uniform FL scale,intensity,bias,kernelRadius,minResolution;uniform V2 size;uniform FL randomSeed;\n#include <packing>\nV4 getDefaultColor(const V2 v){\n#if DIFFUSE_TEXTURE==1\nreturn texture2D(tDiffuse,vUv);\n#else\nreturn V4(1);\n#endif\n}FL getDepth(const V2 v){\n#if DEPTH_PACKING==1\nreturn unpackRGBAToDepth(texture2D(tDepth,v));\n#else\nreturn texture2D(tDepth,v).x;\n#endif\n}FL getViewZ(const FL v){\n#if PERSPECTIVE_CAMERA==1\nreturn perspectiveDepthToViewZ(v,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(v,cameraNear,cameraFar);\n#endif\n}V3 getViewPosition(const V2 v,const FL c,const FL f){FL g=cameraProjectionMatrix[2][3]*f+cameraProjectionMatrix[3][3];V4 r=V4((V3(v,c)-.5)*2.,1);r*=g;return(cameraInverseProjectionMatrix*r).xyz;}V3 getViewNormal(const V3 v,const V2 c){\n#if NORMAL_TEXTURE==1\nreturn unpackRGBToNormal(texture2D(tNormal,c).xyz);\n#else\nreturn normalize(cross(dFdx(v),dFdy(v)));\n#endif\n}FL scaleDividedByCameraFar,minResolutionMultipliedByCameraFar;FL getOcclusion(const V3 v,const V3 c,const V3 g){V3 t=g-v;FL r=length(t),N=scaleDividedByCameraFar*r;return max(0.,(dot(c,t)-minResolutionMultipliedByCameraFar)/N-bias)/(1.+pow2(N));}const FL ANGLE_STEP=PI2*FL(NUM_RINGS)/FL(NUM_SAMPLES),INV_NUM_SAMPLES=1./FL(NUM_SAMPLES);FL getAmbientOcclusion(const V3 v){scaleDividedByCameraFar=scale/cameraFar;minResolutionMultipliedByCameraFar=minResolution*cameraFar;V3 c=getViewNormal(v,vUv);FL f=rand(vUv+randomSeed)*PI2;V2 g=V2(kernelRadius*INV_NUM_SAMPLES)/size,r=g;FL s=0.,t=0.;for(I u=0;u<NUM_SAMPLES;u++){V2 N=vUv+V2(cos(f),sin(f))*g;g+=r;f+=ANGLE_STEP;FL S=getDepth(N);if(S>=1.-EPSILON)continue;FL m=getViewZ(S);V3 E=getViewPosition(N,S,m);s+=getOcclusion(v,c,E);t+=1.;}if(t==0.)discard;return s*(intensity/t);}void main(){FL v=getDepth(vUv);if(v>=1.-EPSILON)discard;FL c=getViewZ(v);V3 t=getViewPosition(vUv,v,c);FL g=getAmbientOcclusion(t);gl_FragColor=getDefaultColor(vUv);gl_FragColor.xyz*=1.-g;}\n"},DepthLimitedBlurShader={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new THREE.Vector2(512,512)},sampleUvOffsets:{value:[new THREE.Vector2(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:"\n#include <common>\nuniform vec2 size;varying vec2 vUv,vInvSize;void main(){vUv=uv;vInvSize=1./size;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}\n",fragmentShader:"#include <common>\n#include <packing>\nuniform sampler2D tDiffuse,tDepth;uniform float cameraNear,cameraFar,depthCutoff;uniform vec2 sampleUvOffsets[KERNEL_RADIUS+1];uniform float sampleWeights[KERNEL_RADIUS+1];varying vec2 vUv,vInvSize;float getDepth(const vec2 v){\n#if DEPTH_PACKING==1\nreturn unpackRGBAToDepth(texture2D(tDepth,v));\n#else\nreturn texture2D(tDepth,v).x;\n#endif\n}float getViewZ(const float v){\n#if PERSPECTIVE_CAMERA==1\nreturn perspectiveDepthToViewZ(v,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(v,cameraNear,cameraFar);\n#endif\n}void main(){float v=getDepth(vUv);if(v>=1.-EPSILON)discard;float f=-getViewZ(v);bool r=false,c=false;float e=sampleWeights[0];vec4 t=texture2D(tDiffuse,vUv)*e;for(int i=1;i<=KERNEL_RADIUS;i++){float s=sampleWeights[i];vec2 g=sampleUvOffsets[i]*vInvSize,u=vUv+g;float a=-getViewZ(getDepth(u));if(abs(a-f)>depthCutoff)r=true;if(!r)t+=texture2D(tDiffuse,u)*s,e+=s;u=vUv-g;a=-getViewZ(getDepth(u));if(abs(a-f)>depthCutoff)c=true;if(!c)t+=texture2D(tDiffuse,u)*s,e+=s;}gl_FragColor=t/e;}\n"},BlurShaderUtils={createSampleWeights:function(e,t){const r=[];for(let a=0;a<=e;a++)r.push(gaussian(a,t));return r},createSampleOffsets:function(e,t){const r=[];for(let a=0;a<=e;a++)r.push(t.clone().multiplyScalar(a));return r},configure:function(e,t,r,a){e.defines.KERNEL_RADIUS=t,e.uniforms.sampleUvOffsets.value=BlurShaderUtils.createSampleOffsets(t,a),e.uniforms.sampleWeights.value=BlurShaderUtils.createSampleWeights(t,r),e.needsUpdate=!0}};function gaussian(e,t){return Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t)}const UnpackDepthRGBAShader={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1);}",fragmentShader:"uniform float opacity;uniform sampler2D tDiffuse;varying vec2 vUv;\n#include <packing>\nvoid main(){float v=1.-unpackRGBAToDepth(texture2D(tDiffuse,vUv));gl_FragColor=vec4(vec3(v),opacity);}"};class SAOPass extends Pass{constructor(e,t,r=!1,a=!1,i=new THREE.Vector2(256,256)){let s;super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.supportsDepthTextureExtension=r,this.supportsNormalTexture=a,this.originalClearColor=new THREE.Color,this._oldClearColor=new THREE.Color,this.oldClearAlpha=1,this.params={output:0,saoBias:.5,saoIntensity:.18,saoScale:1,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},this.resolution=new THREE.Vector2(i.x,i.y),this.saoRenderTarget=new THREE.WebGLRenderTarget(this.resolution.x,this.resolution.y),this.blurIntermediateRenderTarget=this.saoRenderTarget.clone(),this.beautyRenderTarget=this.saoRenderTarget.clone(),this.normalRenderTarget=new THREE.WebGLRenderTarget(this.resolution.x,this.resolution.y,{minFilter:THREE.NearestFilter,magFilter:THREE.NearestFilter}),this.depthRenderTarget=this.normalRenderTarget.clone(),this.supportsDepthTextureExtension&&(s=new THREE.DepthTexture,s.type=THREE.UnsignedShortType,this.beautyRenderTarget.depthTexture=s,this.beautyRenderTarget.depthBuffer=!0),this.depthMaterial=new THREE.MeshDepthMaterial,this.depthMaterial.depthPacking=THREE.RGBADepthPacking,this.depthMaterial.blending=THREE.NoBlending,this.normalMaterial=new THREE.MeshNormalMaterial,this.normalMaterial.blending=THREE.NoBlending,void 0===SAOShader&&console.error("THREE.SAOPass relies on THREE.SAOShader"),this.saoMaterial=new THREE.ShaderMaterial({defines:Object.assign({},SAOShader.defines),fragmentShader:SAOShader.fragmentShader,vertexShader:SAOShader.vertexShader,uniforms:THREE.UniformsUtils.clone(SAOShader.uniforms)}),this.saoMaterial.extensions.derivatives=!0,this.saoMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.saoMaterial.defines.NORMAL_TEXTURE=this.supportsNormalTexture?1:0,this.saoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.saoMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?s:this.depthRenderTarget.texture,this.saoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.saoMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.blending=THREE.NoBlending,void 0===DepthLimitedBlurShader&&console.error("THREE.SAOPass relies on THREE.DepthLimitedBlurShader"),this.vBlurMaterial=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(DepthLimitedBlurShader.uniforms),defines:Object.assign({},DepthLimitedBlurShader.defines),vertexShader:DepthLimitedBlurShader.vertexShader,fragmentShader:DepthLimitedBlurShader.fragmentShader}),this.vBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.vBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.vBlurMaterial.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.vBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?s:this.depthRenderTarget.texture,this.vBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.vBlurMaterial.blending=THREE.NoBlending,this.hBlurMaterial=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(DepthLimitedBlurShader.uniforms),defines:Object.assign({},DepthLimitedBlurShader.defines),vertexShader:DepthLimitedBlurShader.vertexShader,fragmentShader:DepthLimitedBlurShader.fragmentShader}),this.hBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.hBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.hBlurMaterial.uniforms.tDiffuse.value=this.blurIntermediateRenderTarget.texture,this.hBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?s:this.depthRenderTarget.texture,this.hBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.hBlurMaterial.blending=THREE.NoBlending,void 0===CopyShader&&console.error("THREE.SAOPass relies on CopyShader"),this.materialCopy=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(CopyShader.uniforms),vertexShader:CopyShader.vertexShader,fragmentShader:CopyShader.fragmentShader,blending:THREE.NoBlending}),this.materialCopy.transparent=!0,this.materialCopy.depthTest=!1,this.materialCopy.depthWrite=!1,this.materialCopy.blending=THREE.CustomBlending,this.materialCopy.blendSrc=THREE.DstColorFactor,this.materialCopy.blendDst=THREE.ZeroFactor,this.materialCopy.blendEquation=THREE.AddEquation,this.materialCopy.blendSrcAlpha=THREE.DstAlphaFactor,this.materialCopy.blendDstAlpha=THREE.ZeroFactor,this.materialCopy.blendEquationAlpha=THREE.AddEquation,void 0===UnpackDepthRGBAShader&&console.error("THREE.SAOPass relies on THREE.UnpackDepthRGBAShader"),this.depthCopy=new THREE.ShaderMaterial({uniforms:THREE.UniformsUtils.clone(UnpackDepthRGBAShader.uniforms),vertexShader:UnpackDepthRGBAShader.vertexShader,fragmentShader:UnpackDepthRGBAShader.fragmentShader,blending:THREE.NoBlending}),this.fsQuad=new FullScreenQuad(null)}render(e,t,r){if(this.renderToScreen&&(this.materialCopy.blending=THREE.NoBlending,this.materialCopy.uniforms.tDiffuse.value=r.texture,this.materialCopy.needsUpdate=!0,this.renderPass(e,this.materialCopy,null)),1===this.params.output)return;e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setRenderTarget(this.depthRenderTarget),e.clear(),this.saoMaterial.uniforms.bias.value=this.params.saoBias,this.saoMaterial.uniforms.intensity.value=this.params.saoIntensity,this.saoMaterial.uniforms.scale.value=this.params.saoScale,this.saoMaterial.uniforms.kernelRadius.value=this.params.saoKernelRadius,this.saoMaterial.uniforms.minResolution.value=this.params.saoMinResolution,this.saoMaterial.uniforms.cameraNear.value=this.camera.near,this.saoMaterial.uniforms.cameraFar.value=this.camera.far;const i=this.params.saoBlurDepthCutoff*(this.camera.far-this.camera.near);this.vBlurMaterial.uniforms.depthCutoff.value=i,this.hBlurMaterial.uniforms.depthCutoff.value=i,this.vBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.vBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.hBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.hBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.params.saoBlurRadius=Math.floor(this.params.saoBlurRadius),this.prevStdDev===this.params.saoBlurStdDev&&this.prevNumSamples===this.params.saoBlurRadius||(BlurShaderUtils.configure(this.vBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new THREE.Vector2(0,1)),BlurShaderUtils.configure(this.hBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new THREE.Vector2(1,0)),this.prevStdDev=this.params.saoBlurStdDev,this.prevNumSamples=this.params.saoBlurRadius),e.setClearColor(0),e.setRenderTarget(this.beautyRenderTarget),e.clear(),e.render(this.scene,this.camera),this.supportsDepthTextureExtension||this.renderOverride(e,this.depthMaterial,this.depthRenderTarget,0,1),this.supportsNormalTexture&&this.renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this.renderPass(e,this.saoMaterial,this.saoRenderTarget,16777215,1),this.params.saoBlur&&(this.renderPass(e,this.vBlurMaterial,this.blurIntermediateRenderTarget,16777215,1),this.renderPass(e,this.hBlurMaterial,this.saoRenderTarget,16777215,1));let s=this.materialCopy;3===this.params.output?this.supportsDepthTextureExtension?(this.materialCopy.uniforms.tDiffuse.value=this.beautyRenderTarget.depthTexture,this.materialCopy.needsUpdate=!0):(this.depthCopy.uniforms.tDiffuse.value=this.depthRenderTarget.texture,this.depthCopy.needsUpdate=!0,s=this.depthCopy):4===this.params.output?(this.materialCopy.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.materialCopy.needsUpdate=!0):(this.materialCopy.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.materialCopy.needsUpdate=!0),0===this.params.output?s.blending=THREE.CustomBlending:s.blending=THREE.NoBlending,this.renderPass(e,s,this.renderToScreen?null:r),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}renderPas
***Laterals*** began with a simple premise: to evoke a sense of deliberate structure despite the purely aleatoric nature of the underlying algorithm. The title refers to the various rotations given to the cuboids that conform to the scenes.
class e{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),n=parseInt(e.substr(8,8),16),r=parseInt(e.substr(16,8),16),o=parseInt(e.substr(24,8),16);return function(){t|=0,n|=0,r|=0,o|=0;let e=(t+n|0)+o|0;return o=o+1|0,t=n^n>>>9,n=r+(r<<3)|0,r=r<<21|r>>>11,r=r+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()}}function t(e){return l(i()*e)}function n(e,t){return l(i()*(t-e))+e}function r(e,t){return i()*(t-e)+e}function o(e){return e[t(e.length)]}function a(e){return Math.abs(e)}function l(e){return Math.floor(e)}let c=new e,i=function(){return c.random_dec()};var f=1e3;let u=document.createElement("div");u.style.width=window.innerWidth+"px",u.style.height=window.innerHeight+"px";var s=window.devicePixelRatio||1,g=Math.max(window.innerWidth,window.innerHeight);document.body.style.backgroundColor="#000000";var d=g/f;const v=document.createElement("canvas");document.body.appendChild(v),v.width=g,v.height=g,u.style.position="absolute",u.style.overflow="hidden",v.parentElement.appendChild(u),v.style.left="50%",v.style.top="50%",v.style.position="relative",v.style.transform="translate(-50%,-50%)",u.appendChild(v);const x=v.getContext("webgl");x.viewport(0,0,x.drawingBufferWidth,x.drawingBufferHeight);let m,h,b,_,p=!0,E=/\bHeadlessChrome/.test(navigator.userAgent),T=0;var C=0;function R(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255]}function y(e){return e.map(R)}let A=[];function F(e,t){e.includes(t)||e.push(t)}function D(e,n){for(;e.length>n;){let n=t(e.length);e.splice(n,1)}return e}function M(e){return A.length<100&&F(A,e),e}function U(e){let t=Array.from({length:e-1},(()=>i())),n=t.reduce(((e,t)=>e+t),0),r=t.map((e=>e/n*.99));r.push(1-r.reduce(((e,t)=>e+t),0));let o=0,a=[];for(let t=0;t<e;t++)o+=r[t],o=Number(o.toFixed(3)),a.push(o);return a}const I=["#ffadad","#ffd6a5","#fdffb6","#caffbf","#9bf6ff","#a0c4ff","#bdb2ff","#ffc6ff"],P=["#ade8f4","#90e0ef","#caf0f8","#d8f3dc","#d9ed92","#e9c46a","#f5cb5c","#ffcb91"],B=["#f08080","#cd5c5c","#dc143c","#b22222","#ff1493","#ff4500","#ff7f50","#ff8c00"],w=["#191970","#000080","#00008b","#483d8b","#4b0082","#6a0dad","#7b68ee","#8b008b"];let L=[[["#bf4040","#d55757","#e67272","#f39292","#fbb6b6"],["#260d0d","#471212","#6c1313","#951111","#c20a0a"]],[["#e052a5","#ec6cb7","#f589c8","#fca9d9","#ffccea"],["#570f39","#710e48","#8e0b57","#ac0767","#cc0077"]],[["#bf8a40","#d5a057","#e6b672","#f3cb92","#fbdeb6"],["#261c0d","#473112","#6c4713","#955e11","#c2750a"]],[["#f7b36e","#fac28a","#fdd2a8","#fee2c6","#fff2e6"],["#c2660a","#d77008","#ec7906","#fc8309","#ff8c1a"]],[["#8040bf","#9657d5","#ac72e6","#c292f3","#d9b6fb"],["#1a0d26","#2d1247","#40136c","#531195","#660ac2"]],[["#e0d452","#eae06e","#f2ea8c","#f8f2ac","#fcf9cf"],["#6c6513","#8b8114","#ac9f13","#cebf11","#f2df0d"]],[["#40bf40","#57d557","#72e672","#92f392","#b6fbb6"],["#0d260d","#124712","#136c13","#119511","#0ac20a"]],[["#4095bf","#57abd5","#72bfe6","#92d3f3","#b6e4fb"],["#0d1e26","#123647","#134f6c","#116995","#0a85c2"]],[["#4040bf","#5757d5","#7272e6","#9292f3","#b6b6fb"],["#0d0d26","#121247","#13136c","#111195","#0a0ac2"]]],S=[],V=[],X=6,q=$e(X),N=0;const G=6,O=10,W=2,H=4,Y=-10,$=10;Ye(),A=y(A);let z=i()>.5,k=i()>.5,K=i()>.5,j=i()>.5,J=100,Q=i()*J+J,Z=["c0","c1","c2","c3","c4"],ee=["c0","c1","c2","c3","c4"],te=[],ne=["2","4","6","8","10","12","16"],re="",oe=[];for(let e=0;e<10;e++)oe.push(o(A));A=dt(A);var ae=.01;te=U(A.length);let le,ce=ee.length;for(let e=0;e<A.length;e++)le=te[e],re+=(e>0?"else if ":"if ")+"(idx < loopPoint * float("+le+")) {\n",re+=" gloss = "+o(ne)+".;\n",re+=" cIn = "+e+".;\n",re+=" c = c"+e+";\n",re+="}\n";let ie="";for(let e=0;e<A.length;e++)ie+="vec3 c"+e+" = vec3("+A[e][0]+","+A[e][1]+","+A[e][2]+");\n";var fe=x.createFramebuffer();x.bindFramebuffer(x.FRAMEBUFFER,fe);var ue=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,ue);var se=[-1,-1,1,-1,-1,1,-1,1,1,-1,1,1];x.bufferData(x.ARRAY_BUFFER,new Float32Array(se),x.STATIC_DRAW);var ge=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,ge);var de=[0,0,1,0,0,1,0,1,1,0,1,1];function ve(e,t,n,r,o){var a=e.createTexture();return e.bindTexture(e.TEXTURE_2D,a),n?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,r,o,0,e.RGBA,e.UNSIGNED_BYTE,null):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),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.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),a}function xe(e,t,n,r,o){e.useProgram(t);var a=e.getAttribLocation(t,"a_position");e.enableVertexAttribArray(a),e.bindBuffer(e.ARRAY_BUFFER,ue),e.vertexAttribPointer(a,2,e.FLOAT,!1,0,0);var l=e.getAttribLocation(t,"a_texCoord");e.enableVertexAttribArray(l),e.bindBuffer(e.ARRAY_BUFFER,ge),e.vertexAttribPointer(l,2,e.FLOAT,!1,0,0);for(let r=0;r<n.length;++r){e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,n[r]);var c=e.getUniformLocation(t,"u_image"+(r+1));e.uniform1i(c,r)}for(let t=0;t<r.length;++t){let n=r[t],a=o[t];Array.isArray(a)?1===a.length?e.uniform1fv(n,a):2===a.length?e.uniform2fv(n,a):3===a.length?e.uniform3fv(n,a):4===a.length&&e.uniform4fv(n,a):e.uniform1f(n,a)}e.drawArrays(e.TRIANGLES,0,6)}function me(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;e.deleteShader(r)}function he(e,t,n){var r=me(e,e.VERTEX_SHADER,t),o=me(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,o),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;e.deleteProgram(a)}x.bufferData(x.ARRAY_BUFFER,new Float32Array(de),x.STATIC_DRAW);var be="\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",_e=ve(x,S[0].canvas,!1),pe=ve(x,S[1].canvas,!1),Ee=ve(x,S[2].canvas,!1),Te=ve(x,S[3].canvas,!1),Ce=ve(x,S[4].canvas,!1),Re=ve(x,S[5].canvas,!1),ye=ve(x,null,!0,g,g),Ae=ve(x,null,!0,g,g),Fe=ve(x,null,!0,g,g),De=ve(x,null,!0,g,g),Me=`\nprecision highp float;\nuniform float tick;\n\nvoid main()\n{\n ${ie}\n\n float w = float(${g});\n float M = float(${d});\n vec2 st = floor(gl_FragCoord.xy / M);\n st.x += 1000.;\n st.y += 1000.;\n \n float idx = sqrt(st.y * st.x)/(250. * mod(st.x,6. + float(${s}))) + 1.;\n idx += abs(st.y - 500.)/1000.;\n idx *= st.y/10.;\n idx *= mod(st.y,.1) + .1;\n idx /= mod((mod(st.x,1200.) + 1.) * 10000.,10.1) * st.x/100. + 0.0001;\n idx *= (mod(st.x,.1) + .1) * 500.;\n //idx /= 10.5;\n idx += (tick * .04);\n //idx /= .5;\n\n vec3 c;\n float cIn;\n float idxO = 200.;\n\n float loopCap = float(${ce}); // max value before color values cycle back\n float loopPoint = loopCap * 100.;\n idx = mod(abs(idx),loopPoint);\n\n float gloss = 0.;\n ${re}\n gl_FragColor = vec4(c,1.);\n}\n`,Ue=he(x,be,Me);let Ie=x.createTexture();x.bindTexture(x.TEXTURE_2D,Ie),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.LINEAR),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE);let Pe=new Uint8Array(3*A.length);for(let e=0;e<A.length;e++)Pe[3*e]=255*A[e][0],Pe[3*e+1]=255*A[e][1],Pe[3*e+2]=255*A[e][2];x.texImage2D(x.TEXTURE_2D,0,x.RGB,A.length,1,0,x.RGB,x.UNSIGNED_BYTE,Pe),x.activeTexture(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,Ie);var Be=x.createFramebuffer();x.bindFramebuffer(x.FRAMEBUFFER,Be),x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,ye,0);var we="\nprecision highp float;\nuniform sampler2D u_image1;\nuniform sampler2D u_image2;\nuniform sampler2D u_image3;\nuniform sampler2D u_image4;\nuniform sampler2D u_image5;\nuniform sampler2D u_image6;\nuniform sampler2D u_image7;\nuniform vec3 t0;\nuniform vec3 t1;\nuniform vec3 t2;\nuniform vec3 t3;\nuniform vec3 t4;\nuniform vec3 t5;\nvarying highp vec2 v_texCoord;\n\nvec3 rgb2hsv(vec3 c)\n{\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n\nfloat comp(vec3 c0, vec3 c1) {\n float tr = .075;\n //return all(lessThan(abs(rgb2hsv(c0.rgb) - rgb2hsv(c1)), vec3(tr)));\n float v = abs(rgb2hsv(c0.rgb).x - rgb2hsv(c1.rgb).x);\n if (v < tr) {\n return v;\n }\n return 1000.;\n}\n\nvoid main() {\n \n\n vec3 l0 = texture2D(u_image1, v_texCoord).rgb;\n vec3 l1 = texture2D(u_image2, vec2(v_texCoord.x,1. - v_texCoord.y)).rgb;\n vec3 l2 = texture2D(u_image3, vec2(v_texCoord.x,1. - v_texCoord.y)).rgb;\n vec3 l3 = texture2D(u_image4, vec2(v_texCoord.x,1. - v_texCoord.y)).rgb;\n vec3 l4 = texture2D(u_image5, vec2(v_texCoord.x,1. - v_texCoord.y)).rgb;\n vec3 l5 = texture2D(u_image6, vec2(v_texCoord.x,1. - v_texCoord.y)).rgb;\n\n vec3 art = texture2D(u_image7, vec2(abs(v_texCoord.x),v_texCoord.y)).rgb;\n float cV1 = comp(art,l1);\n float cV2 = comp(art,l2);\n float cV3 = comp(art,l3);\n float cV4 = comp(art,l4);\n float cV5 = comp(art,l5);\n\n float minVal = 1000.;\n vec3 minLn = art;\n float t = .25;\n l0 = mix(l0,t0,t);\n l1 = mix(l1,t1,t);\n l2 = mix(l2,t2,t);\n l3 = mix(l3,t3,t);\n l4 = mix(l4,t4,t);\n l5 = mix(l5,t5,t);\n\n if (cV1 < minVal) { minVal = cV1; minLn = l1; }\n if (cV2 < minVal) { minVal = cV2; minLn = l2; }\n if (cV3 < minVal) { minVal = cV3; minLn = l3; }\n if (cV4 < minVal) { minVal = cV4; minLn = l4; }\n if (cV5 < minVal) { minVal = cV5; minLn = l5; }\n\n gl_FragColor = vec4(minLn,1.);\n //gl_FragColor = vec4(art,1.);\n\n\n}\n",Le=he(x,be,we),Se=x.createFramebuffer();x.bindFramebuffer(x.FRAMEBUFFER,Se),x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,De,0);var Ve=`\nprecision highp float;\nvarying highp vec2 v_texCoord;\nuniform sampler2D u_image1;\n\nvec3 rgb2hsv(vec3 c)\n{\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n\nbool comp(vec3 c0, vec3 c1) {\n float tr = .05;\n return abs(rgb2hsv(c0.rgb).x - rgb2hsv(c1).x) < tr;\n}\n\nvec4 getAverageSurrounding(sampler2D u_sampler, vec2 texCoord) {\n // Calculate the size of a single texel\n vec2 oneTexel = vec2(1.0) / vec2(float(${g}),float(${g}));\n vec4 averageColor = vec4(0.0);\n averageColor += texture2D(u_sampler, texCoord + oneTexel * vec2(-1, 1)); // NW\n averageColor += texture2D(u_sampler, texCoord + oneTexel * vec2(0, 1)); // N\n averageColor += texture2D(u_sampler, texCoord + oneTexel * vec2(1, 1)); // NE\n averageColor += texture2D(u_sampler, texCoord + oneTexel * vec2(1, 0)); // E\n averageColor += texture2D(u_sampler, texCoord + oneTexel * vec2(1, -1)); // SE\n averageColor += texture2D(u_sampler, texCoord + oneTexel * vec2(0, -1)); // S\n averageColor += texture2D(u_sampler, texCoord + oneTexel * vec2(-1, -1)); // SW\n averageColor += texture2D(u_sampler, texCoord + oneTexel * vec2(-1, 0)); // W\n\n\n // Divide by the total number of texels to get the average\n averageColor /= 8.0;\n return averageColor;\n}\n\nvoid main() {\n${ie} \n vec2 resultCoords = vec2(v_texCoord.x, v_texCoord.y);\n vec2 resultCoords0 = vec2(v_texCoord.x, v_texCoord.y);\n\n float tp;\n\n float rsx = resultCoords.x;\n\n gl_FragColor = texture2D(u_image1, resultCoords);\n \n float a = abs(.5 - resultCoords.y);\n float b = abs(.5 - resultCoords.x);\n \n vec4 color2 = texture2D(u_image1, vec2(resultCoords.x,resultCoords.y));\n color2 += texture2D(u_image1, vec2(abs(gl_FragColor.r - resultCoords0.x),abs(gl_FragColor.g - resultCoords0.y)));\n gl_FragColor = mix(gl_FragColor,color2,abs(gl_FragColor.r - color2.b));\n gl_FragColor = texture2D(u_image1, resultCoords);\n //gl_FragColor.xyz *= 6.2;\n //gl_FragColor.xyz *= .1;\n if (comp(gl_FragColor.rgb,c3)) {\n vec4 avg = getAverageSurrounding(u_image1, v_texCoord);\n //gl_FragColor += avg/2.;\n}\n gl_FragColor.w = 1.;\n}`,Xe=he(x,be,Ve);let qe="precision highp float;\nvarying highp vec2 v_texCoord;\n\nuniform sampler2D u_image1;\n\n\nvoid main() {\n gl_FragColor = texture2D(u_image1, v_texCoord);\n}";var Ne=he(x,be,qe),Ge=x.createFramebuffer();x.bindFramebuffer(x.FRAMEBUFFER,Ge),x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,Fe,0);let Oe=[x.getUniformLocation(Le,"t0"),x.getUniformLocation(Le,"t1"),x.getUniformLocation(Le,"t2"),x.getUniformLocation(Le,"t3"),x.getUniformLocation(Le,"t4"),x.getUniformLocation(Le,"t5")],We=Array(6).fill([]);function He(){x.clear(x.COLOR_BUFFER_BIT|x.DEPTH_BUFFER_BIT),x.bindFramebuffer(x.FRAMEBUFFER,Be),xe(x,Ue,[Ie],[x.getUniformLocation(Ue,"tick")],[C]);for(let e=0;e<V.length;e++)We[e]=xt(V[e]);x.bindFramebuffer(x.FRAMEBUFFER,Se),xe(x,Le,[_e,pe,Ee,Te,Ce,Re,ye],Oe,We),x.bindFramebuffer(x.FRAMEBUFFER,null),xe(x,Xe,[De],[],[])}function Ye(){for(N=0;N<X;N++){if(_=S[N],0==N){_.fillStyle=L[nt()][tt()][t(5)],_.fillRect(0,0,v.width,v.height);continue}let e=Math.floor(r(4,10));e=Math.floor(r(4,10));for(let t=0;t<e;t++){h=ft(r(100,400),r(100,400),r(100,900),r(100,900),0,r(60,120));let e=st(h,.6,[20,60],[0,359],[60,100]);h=ut(h,e),b=[h],rt(b)}let n=Math.floor(r(8,30));for(let e=0;e<n;e++){let e=ct({x:r(50,950),y:r(1100,1300)},r(-105,-75),r(1,3),20);je(M(L[nt()][tt()][t(5)]),e)}e=Math.floor(r(4,10));for(let t=0;t<e;t++)h=it(r(8,60),r(-4,-2)-5),b=[h],rt(b);if(i()>.8){e=Math.floor(r(8,30));let n=M(L[nt()][0][t(5)]),o={x:r(300,700),y:r(300,700)},a=r(0,359);for(let t=0;t<e;t++){h=it(Math.floor(r(4,9)),r(.1,.7),[10,30],o.x,o.y);let e=st(h,.8,[8,20],[0,359],[5,20]);h=ut(h,e),b=[h],rt(b,n,0),o=lt(o,a,50),a+=r(-45,45)}}}}function $e(e){const n=Array.from({length:9},((e,t)=>t));let r=[];for(let a=0;a<e;a++){let e=[];const l=t(2)+1;if(0!==a&&l>1){const t=r[a-1];e.push(t[t.length-1])}for(;e.length<l;){const t=o(n);e.includes(t)||e.push(t)}r.push(e);let c=document.createElement("canvas");c.style.display="none",document.body.appendChild(c);let i=c.getContext("2d");if(c.width=g,c.height=g,V.push([o(w),o(I),o(P),o(B)]),a>0){let e=Math.pow(2,a-1),t=(g-g*e)/4;i.translate(t,g*(1-e)),i.scale(e,e)}S.push(i)}return r}const ze=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),ke=(e,t)=>({x:e.x*t,y:e.y*t});function Ke(e){return e.right.reverse(),[...e.left,...e.right]}function je(e,t){et(Ke(t))}function Je(e,t,n,r,o,a){_.save(),_.translate(e*d,t*d),_.rotate(o),_.fillStyle=a,Qe(_,-n/2,-r/2,n,r,r/2),_.restore()}function Qe(e,t,n,r,o,a){e.beginPath(),e.moveTo((t+a)*d,n*d),e.arcTo((t+r)*d,n*d,(t+r)*d,(n+o)*d,a*d),e.arcTo((t+r)*d,(n+o)*d,t*d,(n+o)*d,a*d),e.arcTo(t*d,(n+o)*d,t*d,n*d,a*d),e.arcTo(t*d,n*d,(t+r)*d,n*d,a*d),e.closePath(),e.fill()}function Ze(e,t,n,o,a){const l=n-e,c=o-t,f=Math.atan2(c,l)*(180/Math.PI);for(let n=0;n<=1;n+=.05*i())if(i()<.6){const o=e+l*n,i=t+c*n;let u=f+r(Y,$);u*=Math.PI/180,Je(o,i,r(G,O),r(W,H),u,a)}}function et(e){let n=tt();_.fillStyle=M(L[nt()][n][t(5)]),_.beginPath(),_.moveTo(e[0].x*d,e[0].y*d);for(let t=1;t<e.length;t++)_.lineTo(e[t].x*d,e[t].y*d);_.closePath(),_.fill();for(let r=0;r<e.length;r++)if(r+1!=e.length/2&&r+1!=e.length){const o=e[r],a=e[(r+1)%e.length];Ze(o.x,o.y,a.x,a.y,M(L[nt()][1-n][t(5)]))}}function tt(){return i()>.5?0:1}function nt(){if(N<0||N>=q.length)return null;const e=q[N];return e[t(e.length)]}function rt(e,n=null,r=null){e.forEach((e=>{let o=null==r?tt():r,a=null==n?M(L[nt()][o][t(5)]):n;_.fillStyle=a,_.beginPath(),_.moveTo(e[0].x*d,e[0].y*d);for(let t=1;t<e.length;t++)_.lineTo(e[t].x*d,e[t].y*d);_.closePath(),_.fill();for(let t=0;t<e.length;t++){const n=e[t],r=e[(t+1)%e.length];a=M(L[nt()][1-o][Math.floor(2*i())]),Ze(n.x,n.y,r.x,r.y,a)}}))}function ot(e,t,n,r){let o=n*Math.PI/180;return{x:e+r*Math.cos(o),y:t+r*Math.sin(o)}}function at(e,t,n,r){return{left:ot(e,t,n-90,r),right:ot(e,t,n+90,r)}}function lt(e,t,n){let r=ot(0,0,t,n);return{x:e.x+r.x,y:e.y+r.y}}function ct(e,t,n,o){let a,l=e,c=[],f=[],u=t,s=n;for(let e=0;e<o;e++){let e=at(l.x,l.y,u,s);c.push(e.left),f.push(e.right),u+=30*i()-15,s+=r(-1,1),s<2&&(s=2),a=lt(l,u,50*i()+50),l.x=a.x,l.y=a.y}return{left:c,right:f}}function it(e,t=.2,n=[10,30],o=null,a=null){const l=[],c=r(n[0],n[1]),f=null==o?r(100,900):o,u=null==a?r(100,900):a;for(let n=0;n<e;n++){const r=2*Math.PI*n/e;let o=c*(1+i()*t);const a={x:f+Math.cos(r)*o,y:u+Math.sin(r)*o};l.push(a)}return l.sort(((e,t)=>Math.atan2(e.y-u,e.x-f)-Math.atan2(t.y-u,t.x-f))),l}function ft(e,t,n,r,o,a){let l=[],c=0,i=2*Math.PI/a;for(let f=0;f<a;f++){let a=n+e*Math.cos(c)*Math.cos(o)-t*Math.sin(c)*Math.sin(o),f=r+e*Math.cos(c)*Math.sin(o)+t*Math.sin(c)*Math.cos(o);l.push({x:a,y:f}),c+=i}return l}function ut(e,t){return e.map((e=>{let{x:n,y:r}=e;return t.forEach((e=>{let{posX:t,posY:o,direction:a,length:l,radius:c}=e,i=n-t,f=r-o;if(Math.sqrt(i*i+f*f)<=c){let e=a*Math.PI/180,t=l*Math.cos(e),o=l*Math.sin(e);n+=t,r+=o}})),{x:n,y:r}}))}function st(e,n,o,a,l){let c=Math.floor(e.length*n),i=[];for(let n=0;n<c;n++){let n=t(e.length),{x:c,y:f}=e[n],u=r(o[0],o[1]),s=r(a[0],a[1]),g=r(l[0],l[1]);i.push({posX:c,posY:f,direction:s,length:u,radius:g})}return i}function gt(){m=Date.now(),p&&(E?(He(),C++):m-T<100&&(p&&(tCa=(m-T)/16,He()),C+=tCa)),T=m,requestAnimationFrame(gt)}function dt(e){let t,n=e.length;for(;0!=n;)t=l(i()*n),n--,[e[n],e[t]]=[e[t],e[n]];return e}function vt(e,t,n){return"#"+((1<<24)+(Math.round((1-n)*parseInt(e.slice(1,3),16)+n*parseInt(t.slice(1,3),16))<<16)+(Math.round((1-n)*parseInt(e.slice(3,5),16)+n*parseInt(t.slice(3,5),16))<<8)+Math.round((1-n)*parseInt(e.slice(5,7),16)+n*parseInt(t.slice(5,7),16))).toString(16).slice(1)}function xt(e){let t,n=new Date,r=n.getHours(),o=n.getMinutes(),[a,l,c,i]=e;return t=r>=6&&r<7?o<30?vt(a,l,o/30):vt(l,c,(o-30)/30):r>=7&&r<19?c:r>=19&&r<20?o<30?vt(c,i,o/30):vt(i,a,(o-30)/30):a,mt(t)}function mt(e){return[parseInt(e.slice(1,3),16)/255,parseInt(e.slice(3,5),16)/255,parseInt(e.slice(5,7),16)/255]}requestAnimationFrame(gt);
"Efflorescence" was made in response to the vibrant colors present in Harold Cohen's "In AARON’s Garden" series. It is my hope that Efflorescence feels like exploring AARON’s Garden from my perspective. I accentuated its multilayered relationships of color and applied motion techniques I've developed over the years to evoke a sense of curiosity. My process to create this kinetic art series started with re-creating the core concepts of "In AARON’s Garden", including a weighted analysis of Cohen’s color palettes. In each piece, five unique scenes are produced and layered together in varied depths; sometimes you’ll notice a detail-view of a branch or flower while other times you’ll see a larger expanse of foliage. A wash of semi-glitch strokes partially reveals each scene based on color relationships. The state of constant motion gives life and mystery to each layer, blending them together and highlighting different aspects as time progresses. The scene also evolves based on the viewer’s time of day. Subtle tints (derived from Cohen’s palettes) emerge to represent sunrise, day, sunset, and night. The title comes from the state of blooming of a flower; "Efflorescence" is an active word and emphasizes the importance of change within nature. When I look at "In AARON’s Garden", I find a wonderful world of color and variety. I wanted to capture this and reinforce the importance of change, growth, and exploration.
function draw(){if(generated&&!force)playing&&millis()-time>FLOWER_REST&&(time=millis(),currentHash=randomHash(),generated=!1);else{generate(currentHash),skyFromColor=color(P.background()),skyToColor=color(P.X[0]),skyProgression=R.O(0,1),fundo=lerpColor(skyFromColor,skyToColor,skyProgression),background(fundo);let e;e=R.A()<.5?color("#F2EBDC"):fundo,rG1=new RG({x:-100,y:scaler.height()/R.O(1.05,1.2),width:scaler.width()+100,height:scaler.height()/2,stroke:e,fill:P.X[0],direction:RG.Ee,Ae:R.O(0,10),Oe:R.O(0,10),Ne:R.O(.1,.5),De:R.N(7,21),Qe:50,je:R.N(0,360),Xe:10,Ye:1}),rG2=new RG({x:-100,y:scaler.height()/R.O(1.2,1.35),width:scaler.width()+100,height:500,stroke:P.X[0],fill:P.X[1],direction:RG.Ee,Ae:R.O(0,10),Oe:R.O(0,10),Ne:R.O(.1,.5),De:R.N(7,21),Qe:50,je:R.N(0,360),Xe:10,Ye:1}),rG3=new RG({x:-100,y:scaler.height()/R.O(1.35,1.55),width:scaler.width()+100,height:500,stroke:P.X[1],fill:P.X[2],direction:RG.Ee,Ae:R.O(0,10),Oe:R.O(0,10),Ne:R.O(.1,.5),De:R.N(7,21),Qe:50,je:R.N(0,360),Xe:10,Ye:1}),esp1=new Esp({seed:createVector(R.N(0,scaler.width()),scaler.height()),height:scaler.height()*R.O(.3,.7),angle:R.O(-10,10),we:R.O(50,500),ge:R.O(4,8),Se:R.O(1,1.2),be:2,ue:[{weight:10,color:P.Y[1]},{weight:6,color:P.Y[0]},{weight:2,color:P.background()}]}),esp2=new Esp({seed:createVector(R.N(0,scaler.width()),scaler.height()),height:scaler.height()*R.O(.3,.7),angle:R.O(-10,10),we:R.O(50,500),ge:R.O(4,8),Se:R.O(1,1.2),be:2,ue:[{weight:10,color:P.Y[1]},{weight:6,color:P.Y[0]},{weight:2,color:P.background()}]}),esp3=new Esp({seed:createVector(R.N(0,scaler.width()),scaler.height()),height:scaler.height()*R.O(.3,.7),angle:R.O(-10,10),we:R.O(50,500),ge:R.O(4,8),Se:R.O(1,1.2),be:2,ue:[{weight:10,color:P.Y[1]},{weight:6,color:P.Y[0]},{weight:2,color:P.background()}]}),esp4=new Esp({seed:createVector(R.N(0,scaler.width()),scaler.height()),height:scaler.height()*R.O(.3,.8),angle:R.O(-10,10),we:R.O(50,0),ge:R.O(4,8),Se:R.O(1,1.2),be:2,ue:[{weight:10,color:P.Y[1]},{weight:6,color:P.Y[0]},{weight:2,color:P.background()}]}),esp5=new Esp({seed:createVector(R.N(0,scaler.width()),scaler.height()),height:scaler.height()*R.O(.65,.99),angle:R.O(-20,20),we:R.O(100,700),ge:R.O(4,12),Se:R.O(1,1.2),be:2,ue:[{weight:10,color:P.Y[1]},{weight:6,color:P.Y[0]},{weight:2,color:P.background()}]}),esp6=new Esp({seed:createVector(R.N(0,scaler.width()),scaler.height()),height:scaler.height()*R.O(.65,.99),angle:R.O(-20,20),we:R.O(100,700),ge:R.O(4,12),Se:R.O(1,1.2),be:2,ue:[{weight:10,color:P.Y[1]},{weight:6,color:P.Y[0]},{weight:2,color:P.background()}]});var t=GP.Z(P.J),s=((flower1=new Flower(esp1.Pe,R.N(190,210),0,P)).Ve(1,0,{$:P.Y[0],ct:2,borderColor:P.Y[1],lt:function(e,t){return{a:45.5,b:92.7,Rt:R.O(49,99),ft:R.O(.3,1.8),ut:R.O(20.4,40.4),m:R.O(5.2,5.4),position:e,size:t,qe:.01,vt:0,dt:3,phiMax:3}}}),flower1.We(function(){push();for(let e=0;e<R.N(6,12);e++){var t=R.N(-90,90),s=R.N(-130,-80);stroke(P.Y[1]),strokeWeight(2),noFill(),bezier(0,0,0,0,t+R.N(-20,20),s+R.N(-20,20),t,s),noStroke(),fill(P.Y[1]),ellipse(t,s,10,10),fill(P.background()),ellipse(t,s,5,5)}pop()}),(flower2=new Flower(esp2.Pe,R.N(190,210),0,P)).Ve(1,0,{$:lerpColor(skyFromColor,skyToColor,skyProgression),ct:2,borderColor:P.Y[1],lt:function(e,t){return{a:45.5,b:92.7,Rt:R.O(49,99),ft:R.O(.3,1.8),ut:R.O(20.4,40.4),m:R.O(5.2,5.4),position:e,size:t,qe:.01,vt:0,dt:3,phiMax:3}}}),flower2.We(function(){push();for(let e=0;e<R.N(6,12);e++){var t=R.N(-90,90),s=R.N(-130,-80);stroke(P.Y[1]),strokeWeight(2),noFill(),bezier(0,0,0,0,t+R.N(-20,20),s+R.N(-20,20),t,s),noStroke(),fill(P.Y[1]),ellipse(t,s,10,10),fill(P.background()),ellipse(t,s,5,5)}pop()}),(flower3=new Flower(esp3.Pe,R.N(190,210),0,P)).Ve(1,0,{$:P.background(),ct:2,borderColor:P.Y[1],lt:function(e,t){return{a:45.5,b:92.7,Rt:R.O(49,99),ft:R.O(.3,1.8),ut:R.O(20.4,40.4),m:R.O(5.2,5.4),position:e,size:t,qe:.01,vt:0,dt:3,phiMax:3}}}),flower3.We(function(){push();for(let e=0;e<R.N(6,12);e++){var t=R.N(-90,90),s=R.N(-130,-80);stroke(P.Y[1]),strokeWeight(2),noFill(),bezier(0,0,0,0,t+R.N(-20,20),s+R.N(-20,20),t,s),noStroke(),fill(P.Y[1]),ellipse(t,s,10,10),fill(P.background()),ellipse(t,s,5,5)}pop()}),(flower4=new Flower(esp4.Pe,R.N(190,210),0,P)).Ve(1,0,{$:P.Y[0],ct:2,borderColor:P.Y[1],lt:function(e,t){return{a:45.5,b:92.7,Rt:R.O(49,99),ft:R.O(.3,1.8),ut:R.O(20.4,40.4),m:R.O(5.2,5.4),position:e,size:t,qe:.01,vt:0,dt:3,phiMax:3}}}),flower4.We(function(){push();for(let e=0;e<R.N(6,12);e++){var t=R.N(-90,90),s=R.N(-130,-80);stroke(P.Y[1]),strokeWeight(2),noFill(),bezier(0,0,0,0,t+R.N(-20,20),s+R.N(-20,20),t,s),noStroke(),fill(P.Y[1]),ellipse(t,s,10,10),fill(P.background()),ellipse(t,s,5,5)}pop()}),(flower5=new Flower(esp5.Pe,R.N(150,170),0,P)).Ve(1,0,{$:P.Y[1],ct:2,borderColor:P.Y[0],lt:function(e,t){return{a:45.5,b:92.7,Rt:R.O(49,99),ft:R.O(.3,1.8),ut:R.O(20.4,40.4),m:R.O(5.2,5.4),position:e,size:t,qe:.01,vt:0,dt:3,phiMax:3}}}),flower5.We(function(){push();for(let e=0;e<R.N(6,12);e++){var t=R.N(-90,90),s=R.N(-110,-80);stroke(P.Y[0]),strokeWeight(2),noFill(),bezier(0,0,0,0,t+R.N(-20,20),s+R.N(-20,20),t,s),noStroke(),fill(P.Y[0]),ellipse(t,s,10,10),fill(P.background()),ellipse(t,s,5,5)}pop()}),(flower6=new Flower(esp6.Pe,R.N(150,170),0,P)).Ve(1,0,{$:P.background(),ct:2,borderColor:P.Y[1],lt:function(e,t){return{a:45.5,b:92.7,Rt:R.O(49,99),ft:R.O(.3,1.8),ut:R.O(20.4,40.4),m:R.O(5.2,5.4),position:e,size:t,qe:.01,vt:0,dt:3,phiMax:3}}}),flower6.We(function(){push();for(let e=0;e<R.N(6,12);e++){var t=R.N(-90,90),s=R.N(-110,-80);stroke(P.Y[1]),strokeWeight(2),noFill(),bezier(0,0,0,0,t+R.N(-20,20),s+R.N(-20,20),t,s),noStroke(),fill(P.Y[1]),ellipse(t,s,10,10),fill(P.background()),ellipse(t,s,5,5)}pop()}),leavesLast=[],leavesSecondLayer=[],leaves=[],leavesBack=[],R.N(0,30)),i=R.N(0,30),r=R.N(0,30),o=R.N(0,200);for(let e=0;e<o;e++)leavesBack[e]=new Leaves({x:R.N(0,scaler.width()),y:R.N(0,scaler.height()),fill:P.X[0],stroke:t.$,ke:1,ye:P.background(),rotation:radians(R.O(0,360)),type:"elliptic",me:1,Fe:R.N(15,30)});for(let e=0;e<r;e++)leavesLast[e]=new Leaves({x:R.N(0,scaler.width()),y:R.N(0,scaler.height()),fill:t.$,stroke:t.$,ke:2,ye:P.background(),rotation:radians(R.O(0,360)),type:"elliptic",me:1.4,Fe:R.N(15,30)});for(let e=0;e<i;e++)leavesSecondLayer[e]=new Leaves({x:R.N(0,scaler.width()),y:R.N(0,scaler.height()),fill:P.X[R.N(0,2)],stroke:P.X[2],ke:2,ye:P.background(),rotation:radians(R.O(0,360)),type:"elliptic",me:1.6,Fe:R.N(15,30)});for(let e=0;e<s;e++)leaves[e]=new Leaves({x:R.N(0,scaler.width()),y:R.N(0,scaler.height()),fill:P.X[R.N(0,2)],stroke:P.X[1],ke:2,ye:P.background(),rotation:radians(R.O(0,360)),type:"elliptic",me:2,Fe:R.N(15,30)});rocks1=[];var a=createVector(R.O(0,scaler.width()),830);for(let e=0;e<R.O(3,5);e++)rocks1.push(new Boulder(a.x+R.O(100,300),a.y+R.O(-40,40),R.O(150,250),R.N(4,5),100,P.Y[0],PI+HALF_PI));rocks2=[];var h=createVector(R.O(0,scaler.width()),640);for(let e=0;e<R.O(3,5);e++)rocks2.push(new Boulder(h.x+R.O(-400,400),h.y,R.O(150,250),4,50,P.X[0],PI+HALF_PI));rocks3=[];var l=createVector(R.O(100,scaler.width()-100),900);for(let e=0;e<R.N(3,8);e++)rocks3.push(new Boulder(l.x+R.O(-800,1e3),l.y,R.O(500,1200),4,200,P.Y[1],PI+HALF_PI));rocks4=[];var n=createVector(R.O(100,scaler.width()-100),1600);for(let e=0;e<R.N(3,8);e++)rocks4.push(new Boulder(n.x+R.O(-800,1e3),n.y,R.O(500,1200),4,200,P.Y[1],PI+HALF_PI));if(R.A()<.3)for(let e=0;e<leavesBack.length;e++)leavesBack[e].fe();if(R.A()<.9&&(esp5.fe(),flower5.fe()),R.A()<.9&&(esp6.fe(),flower6.fe()),R.A()<.9)for(let e=0;e<rocks3.length;e++)rocks3[e].fe();if(rG3.fe(),R.A()<.9)for(let e=0;e<leavesLast.length;e++)leavesLast[e].fe();if(R.A()<.9&&(esp4.fe(),flower4.fe()),R.A()<.9)for(let e=0;e<rocks2.length;e++)rocks2[e].fe();if(R.A()<.65&&rG2.fe(),R.A()<.9)for(let e=0;e<leavesSecondLayer.length;e++)leavesSecondLayer[e].fe();if(R.A()<.9)for(let e=0;e<rocks1.length;e++)rocks1[e].fe();if(R.A()<.9&&(esp1.fe(),flower1.fe()),R.A()<.9&&(esp2.fe(),flower2.fe()),R.A()<.9&&(esp3.fe(),flower3.fe()),rG1.fe(),R.A()<.9)for(let e=0;e<leaves.length;e++)leaves[e].fe();if(R.A()<.9)for(let e=0;e<rocks4.length;e++)rocks4[e].fe();force?force=!1:(console.log("[🏵️]: Generated art: "+currentHash),generated=!0)}}function keyPressed(){" "==key&&((playing=!playing)?console.log("[🏵️]: Playing..."):console.log("[🏵️]: Stopped"))}function randomHash(){let e="0x";for(var t=0;t<64;t++)e+=Math.floor(16*Math.random()).toString(16);return e}function generate(e){var e=(R=new Random(e)).N(0,359),t=new Date(1981,7,21),s=new Date(2023,6,21),i=GP.q(e,78,34),s=new Date(t.getTime()+R.O(0,1)*(s.getTime()-t.getTime()));features={Pt:"Forget Noise",wt:"#"+i[0].toString(16)+i[1].toString(16)+i[2].toString(16),Location:R.N(0,90)+"° "+R.N(0,59)+"' "+R.N(0,59)+'" '+R.j(["N","S"])+" / "+R.N(0,180)+"° "+R.N(0,59)+"' "+R.N(0,59)+'" '+R.j(["W","E"]),gt:["January","February","March","April","May","June","July","August","September","October","November","December"][s.getMonth()]+" "+s.getDate()+", "+s.getFullYear()},P=new GP(GP.K(e),R)}
class Ornament{constructor(e,t,s){this.Te=e,this.palette=s,this.Be=t}show(){this.Te(this.Be,this.palette)}}class RG{constructor(e){this.position=createVector(e.x,e.y),this.width=e.width,this.height=e.height,this.stroke=e.stroke,this.fill=e.fill,e.direction&&[RG.Ee,RG.ze,RG._e,RG.He].includes(e.direction)?this.direction=e.direction:this.direction=RG.Ee,this.Ae=e.Ae,this.Oe=e.Oe,this.Ne=e.Ne,this.De=e.De,this.Qe=e.Qe,this.je=e.je,this.Xe=e.Xe,this.Ye=e.Ye,this.seed=R.O(0,100)}K(){}Je(e,t,s){push(),translate(e,t),rotate(s*radians(180));e=s*R.N(25,55),strokeWeight(2),stroke(this.stroke),t=R.A();t<.5?fill(this.fill):t<.6?fill(this.stroke):noFill(),ellipse(0,0,e*this.Xe,e*this.Ye),strokeWeight(2.4),line(-(e*this.Xe)/2,0,e*this.Xe,0),pop()}fe(){noiseSeed(this.seed);let i,e,r,t,o=(this.direction==RG.Ee?(i=e=>e<this.width,e=e=>e<this.height,r=e=>e+this.De,t=e=>e+this.De):this.direction==RG.ze?(i=e=>e>-this.width,e=e=>e<this.height,r=e=>e-this.De,t=e=>e+this.De):this.direction==RG._e?(i=e=>e<this.width,e=e=>e>-this.height,r=e=>e+this.De,t=e=>e-this.De):this.direction==RG.He&&(i=e=>e>-this.width,e=e=>e>-this.height,r=e=>e-this.De,t=e=>e-this.De),push(),translate(this.position.x,this.position.y),this.Oe);for(let s=0;e(s);s=t(s)){o+=this.Ne;let t=this.Ae;for(let e=0;i(e);e=r(e))t+=this.Ne,this.Je(e,s,noise(t,o))}pop()}static Ee=1;static ze=2;static _e=3;static He=4}class Supershape{constructor(e,t,s){this.position=createVector(e,t),this.Ue={a:{name:"a",value:1,step:.1,random:()=>this.randomizer.O(0,100)},b:{name:"b",value:1,step:.1,random:()=>this.randomizer.O(0,100)},p1:{name:"p1",value:1,step:.1,random:()=>this.randomizer.O(0,100)},p2:{name:"p2",value:1,step:.1,random:()=>this.randomizer.O(0,100)},p3:{name:"p3",value:1,step:.1,random:()=>this.randomizer.O(0,100)},m:{name:"m",value:0,step:.1,random:()=>this.randomizer.O(0,100)},phiMin:{name:"Φ min",value:0,step:.5,unit:"π",random:()=>0},phiMax:{name:"Φ max",value:4,step:.5,unit:"π",random:()=>2*this.randomizer.N(1,4)},r:{name:"r",value:200,step:1,unit:"px",random:()=>200}},this.qe=.01,this.Ke(0)}Ze(e){return this.$e().f(e,this)}get(e){return this.Ue[e].value}Ke(e){this.et=e}$e(){return Supershape.tt[this.et]}fe(){push(),translate(this.position.x,this.position.y),beginShape();for(let e=this.get("phiMin")*PI;e<this.get("phiMax")*PI;e+=this.qe){var t=this.st(e),s=this.Ze(e)*t*cos(e),t=this.Ze(e)*t*sin(e);vertex(s,t)}endShape(CLOSE),pop()}st(e){var t=1/this.get("a")*cos(e*this.get("m")/4),t=abs(t),e=(t=pow(t,this.get("p2")),1/this.get("b")*sin(e*this.get("m")/4)),e=abs(e),t=(e=pow(e,this.get("p3")),pow(t+e,1/this.get("p1")));return 0===t?0:1/t}re(){this.points=[];for(let e=this.get("phiMin")*PI;e<this.get("phiMax")*PI;e+=this.qe){var t=this.st(e),s=this.Ze(e)*t*cos(e),t=this.Ze(e)*t*sin(e);this.points.push(createVector(s,t))}}it(t){for(let e=0;e<Object.keys(t).length;e++){var s=Object.keys(t)[e];t[s]&&(this.Ue[s].value=t[s])}}static tt=[{},{},{},{description:"|cos(m/2*PHI)*r|",f:(e,t)=>abs(cos(t.get("m")*e/2)*t.get("r")),rt:(e,t)=>{var s=t.findMax();let i=0;i=abs(s.x)>=abs(s.y)?abs(e/(t.st(s.phi)*cos(s.phi))):abs(e/(t.st(s.phi)*sin(s.phi))),t.Ue.r.value=i}},{}]}class Tepal{constructor(e,t,s,i,r){this.position=e,this.size=t,this.rotation=s,this.Be=i,this.ot=r,this.K()}K(){this.ht=this.Be.lt(this.position,this.size,this.ot),this.shape=[],this.nt()}show(){translate(this.position.x,this.position.y),rotate(radians(this.rotation)),translate(-this.position.x,-this.position.y),this.fe()}fe(){push(),fill(this.Be.$),stroke(this.Be.borderColor),strokeWeight(this.Be.ct),beginShape();for(let e=0;e<this.shape.length;e++)curveVertex(this.shape[e].x,this.shape[e].y);endShape(),pop()}nt(){var t=new Supershape(this.position.x,this.position.y);t.Ue.m.value=this.ht.m,t.Ue.a.value=this.ht.a,t.Ue.b.value=this.ht.b,t.Ue.p1.value=this.ht.Rt,t.Ue.p2.value=this.ht.ft,t.Ue.p3.value=this.ht.ut,t.Ke(this.ht.dt),t.Ue.phiMax.value=this.ht.phiMax,t.Ue.r.value=this.ht.size/2,t.qe=this.ht.qe,t.re();for(let e=0;e<t.points.length;e++){var s=this.ht.vt;this.shape.push(createVector(t.points[e].x+s,t.points[e].y+s))}}}let T,R,P,G;const FLOWER_REST=1e4;let currentHash,playing=!0,generated=!1,time=0,force=!1;window.addEventListener("resize",function(e){force=!0},!0);let skyFromColor,skyToColor,fundo,rG1,rG2,rG3,esp1,esp2,esp3,flower1,flower2,flower3,leaves=[],leavesSecondLayer=[],leavesLast=[],leavesBack=[],rocks1=[],rocks2=[],rocks3=[],rocks4=[];function setup(){createAdaptiveCanvas(1600,900),currentHash=tokenData.hash,noCursor()}
function createAdaptiveGraphics(e,t,s){e=new AdaptiveBuffer(createGraphics(e,t),s);return scaler.t(e),scaler.i(),e}function addAdaptiveGraphics(e,t){e=new AdaptiveBuffer(e,t);scaler.t(e),scaler.i()}p5.prototype.scaler=void 0,p5.prototype.createAdaptiveCanvas=function(e,t,s){var i=createCanvas(e,t);return scaler=new Scaler(e,t,void 0===s||s),i},p5.prototype.o=function(){void 0!==scaler&&scale(scaler.scale())},window.addEventListener("resize",function(e){scaler.h()},!0),p5.prototype.registerMethod("pre",p5.prototype.o);class AdaptiveBuffer{#l;#p;constructor(e,t){this.#l=e,this.#p=t}R(){this.#p(this.#l)}u(){return this.#l}}class Scaler{#v;#P;#g;#k;#S;#F;#G;constructor(e,t,s){this.#v=e,this.#P=t,this.#g=this.#v/this.#P,this.#S=s,this.#G=[],this.#S&&this.h()}h(){if(this.#S){let e,t;var s,i,r,o;t=void 0!==this.#F?(o=getComputedStyle(this.#F),s=parseFloat(o.paddingLeft)+parseFloat(o.paddingRight),i=parseFloat(o.paddingTop)+parseFloat(o.paddingBottom),r=parseFloat(o.borderLeftWidth)+parseFloat(o.borderRightWidth),o=parseFloat(o.borderTopWidth)+parseFloat(o.borderBottomWidth),e=this.#F.offsetWidth-s-r,this.#F.offsetHeight-i-o):(e=window.innerWidth,window.innerHeight),this.V(e,t)}}C(e){this.V(this.#v*e,this.#P*e)}V(e,t){let s,i;var r=Math.abs(this.#v-e),o=Math.abs(this.#P-t);Math.min(r,o)==r?(s=e,(i=e/this.#g)>t&&(i=t,s=t*this.#g)):(i=t,(s=t*this.#g)>e&&(s=e,i=e/this.#g)),this.#k=s/this.#v,resizeCanvas(s,i),this.i()}width(){return this.#v}height(){return this.#P}scale(){return this.#k}i(){for(let e=0;e<this.#G.length;e++)this.#G[e].u().pixelDensity(max(Math.ceil(this.#k)*displayDensity()*1.2,displayDensity())),this.#G[e].R()}t(e){this.#G.push(e)}W(e){this.#F=e,this.h()}L(){return mouseX/this.#k}M(){return mouseY/this.#k}I(){return pmouseX/this.#k}T(){return pmouseY/this.#k}}class Random{constructor(e){this.hash=e,this.B=!1;function t(e){let t=parseInt(e.substr(0,8),16),s=parseInt(e.substr(8,8),16),i=parseInt(e.substr(16,8),16),r=parseInt(e.substr(24,8),16);return function(){t|=0,s|=0,i|=0,r|=0;var e=(t+s|0)+r|0;return r=r+1|0,t=s^s>>>9,s=i+(i<<3)|0,i=(i=i<<21|i>>>11)+e|0,(e>>>0)/4294967296}}this._=new t(this.hash.substr(2,32)),this.H=new t(this.hash.substr(34,32));for(let e=0;e<1e6;e+=2)this._(),this.H()}A(){return this.B=!this.B,this.B?this._():this.H()}O(e,t){return e+(t-e)*this.A()}N(e,t){return Math.floor(this.O(e,t+1))}D(e){return this.A()<e}j(e){return e[this.N(0,e.length-1)]}}class GP{constructor(e,t){this.backgroundColor=e[0],this.X=[e[1],e[2],e[3]],this.Y=[e[4],e[5]],this.J=[...this.X,...this.Y],this.random=t}background(){return this.backgroundColor}U(t,s){s=s||[];for(let e=0;e<s.length;e++)t.splice(t.indexOf(s[e]),1);var e=this.random.j(t);return s.push(e),e}static q(e,t,s){let i,r,o,a,h,l,n,c;var e=e/360,t=t/100,p=s/100;switch(l=p*(1-t),n=p*(1-(h=6*e-(a=Math.floor(6*e)))*t),c=p*(1-(1-h)*t),a%6){case 0:i=p,r=c,o=l;break;case 1:i=n,r=p,o=l;break;case 2:i=l,r=p,o=c;break;case 3:i=l,r=n,o=p;break;case 4:i=c,r=l,o=p;break;case 5:i=p,r=l,o=n}return[Math.round(255*i),Math.round(255*r),Math.round(255*o)]}static K(e){var t=[];return t.push(GP.q(41,9,95)),t.push(GP.q(e,78,34)),t.push(GP.q((e+9)%360,30,54)),t.push(GP.q((e+4)%360,25,74)),t.push(GP.q((e+189)%360,29,85)),t.push(GP.q((e+182)%360,49,65)),t}static Z=e=>{for(var t=[...e],s=[];0<t.length;){var i=R.N(0,t.length-1);s.push(t[i]),t.splice(i,1)}var r={};if(r.$=s[0],r.borderColor=s[1],2<s.length)for(let e=2;e<s.length;e++)r["color"+(e-1)]=s[e];return r}}class Boulder{constructor(e,t,s,i,r,o,a){for(this.position=createVector(e,t),this.size=s,this.ee=i,this.te=r,this.color=o,this.se=a,this.ie=[],this.re();!this.validate();)this.re();this.oe(),this.ae()}re(){var t=[];for(let e=0;e<360;e++)t.push(e);this.he=[];for(let e=0;e<this.ee;e++){var s=R.N(0,t.length-1);this.he.push(t[s]),t.splice(s,1)}this.he.sort(function(e,t){return e-t});for(let e=0;e<this.he.length;e++)this.he[e]=radians(this.he[e]);this.points=[];for(let e=0;e<this.he.length;e++){var i=cos(this.he[e])*this.size,r=sin(this.he[e])*this.size;this.points.push(createVector(i,r))}}le(){this.ne=createVector(this.points.reduce((e,t)=>e+t.x,0)/this.points.length,this.points.reduce((e,t)=>e+t.y,0)/this.points.length);var e=R.N(0,this.he.length-1),t=cos(this.he[e])*this.size/2,e=sin(this.he[e])*this.size/2,t=createVector(t-this.ne.x,e-this.ne.y);return createVector(this.ne.x+R.N(0,t.x),this.ne.y+R.N(0,t.y))}oe(){this.ie.push(this.le()),this.ce=[];for(let s=0;s<this.points.length;s++){let e,t=(e=s==this.points.length-1?0:s+1,this.ie[0]);for(let e=0;e<this.ie.length;e++){var i=dist(this.points[s].x,this.points[s].y,t.x,t.y);dist(this.points[s].x,this.points[s].y,this.ie[e].x,this.ie[e].y)<i&&(t=this.ie[e])}this.ce.push([this.points[s],this.points[e],t])}}pe(){let t=0,s=TWO_PI;for(let e=0;e<this.he.length;e++){var i=abs(this.se-this.he[e]);i<s&&(s=i,t=e)}var r=[];for(let e=0;e<this.ce.length;e++)r.push(this.ce[(e+t)%this.ce.length]);this.ce=r}ae(){this.pe();var t=ceil(this.ce.length/2),s=(this.Re=[],50/t);let i;for(let e=0;e<t;e++){var r=Math.floor(red(this.color)-s*e),o=Math.floor(green(this.color)-s*e),a=Math.floor(blue(this.color)-s*e);i=color(r,o,a),this.Re.push(i)}let h=-1;for(let e=t;e<this.ce.length;e++){var l=Math.floor(red(i)+s*h),n=Math.floor(green(i)+s*h),c=Math.floor(blue(i)+s*h);this.Re.push(color(l,n,c)),h++}}validate(){var s=[];for(let t=0;t<this.points.length;t++){let e;e=t==this.points.length-1?0:t+1;var i=dist(this.points[t].x,this.points[t].y,this.points[e].x,this.points[e].y);s.push(i)}for(let e=0;e<s.length;e++)if(s[e]<this.te)return!1;return!0}fe(){push(),translate(this.position.x,this.position.y);var e=color(red(this.color),green(this.color),blue(this.color));fill(e),noStroke(),beginShape();for(let e=0;e<this.points.length;e++)vertex(this.points[e].x,this.points[e].y);endShape(CLOSE),noStroke();for(let t=0;t<this.ce.length;t++){fill(this.Re[t]),beginShape();for(let e=0;e<this.ce[t].length;e++)vertex(this.ce[t][e].x,this.ce[t][e].y);endShape(CLOSE)}pop()}}class Esp{constructor(t){this.seed=t.seed,this.height=t.height,this.angle=t.angle-90,this.ue=t.ue,this.de=[],this.ve=[];var e=this.height,e=createVector(this.seed.x+e*cos(radians(this.angle)),this.seed.y+e*sin(radians(this.angle))),e=(this.Pe=e,R.D(.5));let s,i,r,o;var a=this.seed.y-this.Pe.y,h=(i=this.seed.y-a/3,o=this.seed.y-2*a/3,r=e?(s=this.seed.x+R.O(-abs(t.we),0),this.Pe.x+R.O(0,abs(t.we))):(s=this.seed.x+R.O(0,abs(t.we)),this.Pe.x+R.O(-abs(t.we),0)),this.ve=[this.seed.x,this.seed.y,s,i,r,o,this.Pe.x,this.Pe.y],this.points=[],.35*dist(this.ve[0],this.ve[1],this.ve[6],this.ve[7]));let l=0;t.ge&&(l=floor(.7*h/t.ge-1));for(let e=0;e<=h;e++){var n,c=e/h,p=bezierPoint(this.ve[0],this.ve[2],this.ve[4],this.ve[6],c),c=bezierPoint(this.ve[1],this.ve[3],this.ve[5],this.ve[7],c);this.points.push(createVector(p,c)),0<l&&e%l==0&&(n=atan2(this.points[e<5?0:e-5].y-c,this.points[e<5?0:e-5].x-p),this.de.push(new Leaves({x:p,y:c+R.N(-10,10),fill:P.background(),stroke:P.Y[1],ke:t.be,ye:P.Y[1],rotation:n-radians(R.N(40,70)),type:"elliptic",me:t.Se,Fe:1})),this.de.push(new Leaves({x:p,y:c+R.N(-10,10),fill:P.background(),stroke:P.Y[1],ke:t.be,ye:P.Y[1],rotation:n-radians(R.N(100,130)),type:"elliptic",me:t.Se,Fe:1})))}}Ge(t,e){push(),noFill(),stroke(e);for(let e=1;e<this.points.length;e++){var s=e-1,s=this.points[s];strokeWeight(map(this.points[e].y,0,scaler.height(),t,t)),line(s.x,s.y,this.points[e].x,this.points[e].y)}pop()}fe(){for(let e=0;e<this.de.length;e++)this.de[e].fe();for(let e=0;e<this.ue.length;e++)this.Ge(this.ue[e].weight,this.ue[e].color)}}class Flower{constructor(e,t,s,i){this.position=e,this.size=t,this.ue=[],this.xe=s,this.angle=R.N(-15,15),this.palette=i}Ve(e,t,s,i){let r;i&&(i=this.ue.length-1,0<=length)&&(r=this.ue[i]);i=new Tepal(this.Ce(),this.size*e,t,s,r);return this.ue.push(i),i}We(e,t){e=new Ornament(e,t,this.palette);return this.ue.push(e),e}Ce(){return createVector(R.O(-this.xe,this.xe),R.O(-this.xe,this.xe))}fe(){push(),translate(this.position.x,this.position.y),rotate(radians(this.angle));for(let e=0;e<this.ue.length;e++)this.ue[e].noRotation&&rotate(radians(-this.angle)),this.ue[e].show(),this.ue[e].noRotation&&rotate(radians(this.angle));pop()}rotate(e){this.angle=e}}class Leaves{constructor(e){this.position=createVector(e.x,e.y),this.fill=e.fill,this.stroke=e.stroke,this.ke=e.ke,this.ye=e.ye,this.rotation=e.rotation,this.type=e.type,this.me=e.me,this.Fe=e.Fe*this.me,this.Le=40*this.me,this.Me=R.O(.1,.5),this.Ie=R.O(.1,.5)}fe(){"elliptic"==this.type&&(push(),strokeWeight(this.ke),stroke(this.stroke),fill(this.fill),translate(this.position.x,this.position.y),rotate(this.rotation),translate(0,-this.Fe),beginShape(),curveVertex(0,0),curveVertex(0,0),curveVertex(this.Le*-this.Me,-1*this.Le),curveVertex(0,-2*this.Le),curveVertex(this.Le*this.Ie,-1*this.Le),curveVertex(0,0),curveVertex(0,0),endShape(),stroke(this.ye),line(0,this.Fe,0,-2*this.Le),pop())}}
One that contains all: "Dance to Forgotten Noise" is an algorithm that continually generates images of a synthetic landscape, offering endless perspectives of the scenery. Each drawing is a temporary materialization of a whole set of possible outcomes. Leaves dance through space, carried by an unseen wind, while flowers wobble and rocks occasionally defy gravity, seemingly weightless. These transient moments come and go, leaving fleeting memories, forgotten noises in our minds.