memoscan
← all memos

Memo 0x26c7adc8…bb633d on Ethereum

let globalScaler=1,ratio=[3,4],worldSpaceDims=[1800,ratio[1]/ratio[0]*1800],worldMin=Math.min(worldSpaceDims[0],worldSpaceDims[1]);function scaleAgnosticCanvas(){let t=window.innerWidth,e=window.innerHeight;t*(ratio[1]/ratio[0])>e?createCanvas(e*(ratio[0]/ratio[1]),e):createCanvas(t,t*(ratio[1]/ratio[0])),globalScaler=getScalar(pv(0,0),pv(0,worldSpaceDims[0]),pv(0,0),pv(0,width))}class Random{constructor(){this.useA=!1;let t=function(t){let e=parseInt(t.substr(0,8),16),r=parseInt(t.substr(8,8),16),s=parseInt(t.substr(16,8),16),o=parseInt(t.substr(24,8),16);return function(){let t=((e|=0)+(r|=0)|0)+(o|=0)|0;return o=o+1|0,e=r^r>>>9,r=(s|=0)+(s<<3)|0,s=(s=s<<21|s>>>11)+t|0,(t>>>0)/4294967296}};this.prngA=new t(tokenData.hash.substr(2,32)),this.prngB=new t(tokenData.hash.substr(34,32));for(let t=0;t<1e6;t+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}random_num(t,e){return t+(e-t)*this.random_dec()}}let ABR=new Random;function R(){return ABR.random_dec()}function RR(t,e){return ABR.random_num(t,e)}function purgePRNG(t){for(let e=0;e<t;e++)RR(0,1)}function pv(t,e,r){return new createVector(t,e,r)}function prepareColors(){0==palette?(cc[0]=[255,214,227],cc[1]=[74,36,51],cc[2]=[194,68,120],cc[3]=boxFill?[255,255,255]:cc[0]):1==palette?(cc[0]=[242,210,206],cc[1]=[138,0,0],cc[2]=[138,0,0],cc[3]=boxFill?[255,255,255]:cc[0]):2==palette?(cc[0]=[204,232,252],cc[2]=[0,55,94],cc[1]=[0,55,94],cc[3]=boxFill?[255,255,255]:cc[0]):3==palette?(cc[0]=[213,190,237],cc[1]=[55,29,82],cc[2]=[55,29,82],cc[3]=boxFill?[255,255,255]:cc[0]):4==palette?(cc[0]=[163,144,88],cc[1]=[64,44,0],cc[2]=[255,245,199],cc[3]=boxFill?[207,202,140]:cc[0]):5==palette?(cc[0]=[255,255,255],cc[1]=[0,0,0],cc[2]=[0,0,0],cc[3]=[255,255,255]):6==palette&&(cc[0]=[0,0,0],cc[1]=[255,255,255],cc[2]=[255,255,255],cc[3]=[0,0,0]),palette>6&&(cc[0]=boxFill?[204,204,204]:[230,230,230],cc[1]=[0,0,0],cc[3]=boxFill?[255,255,255]:cc[0],7==palette?cc[2]=[33,102,148]:8==palette?cc[2]=[112,59,148]:9==palette?(cc[0]=boxFill?[130,130,130]:[171,171,171],cc[2]=[255,208,0],cc[3]=boxFill?[171,171,171]:cc[0]):10==palette?cc[2]=[34,135,63]:11==palette&&(cc[2]=[219,71,42])),natural&&!boxFill&&(cc[0]=[15,51,79],cc[3]=cc[0],6==palette&&(cc[0]=[0,0,0],cc[3]=cc[0]),3!=palette&&8!=palette||(cc[2]=[147,73,227]),0==palette&&(cc[2]=[230,141,138]),1!=palette&&11!=palette||(cc[2]=[255,42,0]),2!=palette&&7!=palette||(cc[2]=[53,164,242]),3!=palette&&8!=palette||(cc[2]=[168,141,247]),4!=palette&&9!=palette||(cc[2]=[255,222,77]),10==palette&&(cc[2]=[95,194,79])),natural&&boxFill&&(11!=palette&&1!=palette||(cc[0]=[82,1,0],cc[2]=[252,158,139],cc[3]=[140,28,18]),7!=palette&&2!=palette||(cc[0]=[106,140,166],cc[2]=[230,245,255],cc[3]=[0,53,94]),8!=palette&&3!=palette||(cc[0]=[129,92,150],cc[2]=[222,187,237],cc[3]=[56,29,74]),9!=palette&&4!=palette||(cc[0]=[173,150,104],cc[2]=[252,220,76],cc[3]=[69,31,19]),10==palette&&(cc[0]=[0,102,31],cc[2]=[157,186,151],cc[3]=[29,51,35]),5==palette&&(cc[0]=[171,171,171],cc[3]=[171,171,171],cc[2]=[255,255,255]),6==palette&&(cc[0]=[22,22,23],cc[2]=[220,220,222],cc[3]=[42,42,46]),0==palette&&(cc[3]=[212,108,106],cc[2]=[255,207,207],cc[0]=[230,141,138])),textColor=(cc[0][0]+cc[0][1]+cc[0][2])/3<50?[cc[0][0]+100,cc[0][1]+100,cc[0][2]+100]:[cc[0][0]-100,cc[0][1]-100,cc[0][2]-100]}p5.disableFriendlyErrors=!0;let targetBoxes=[],strokeBase=1,yuccas=[],rooms=[],words=[];purgePRNG(100);let flowerPower=R()>.7;purgePRNG(100);let artistStyle=R()>.7?1:0;purgePRNG(100);let palette=Math.floor(RR(0,12));purgePRNG(100);let natural=R()>.85;purgePRNG(100);let boxFill=R()>.45;palette<5&&R()>.8&&(palette=Math.floor(RR(7,12))),flowerPower&&0==artistStyle&&(boxFill=!0);let frankeSquares=[],franke=[[245,7,162],[255,143,102],[77,77,77]],yc=[[97,69,29],[158,120,36],[150,132,111],[140,113,72],[255,250,186],[41,87,13],[89,153,20],[232,194,107]],cc=[],textColor=[];function average3(t,e,r){return pv((t.x+e.x+r.x)/3,(t.y+e.y+r.y)/3)}function soften(t){for(let e=1;e<t.length-1;e++){let r=average3(t[(e-1+t.length)%t.length],t[e%t.length],t[(e+1)%t.length]);t[e%t.length].set(r.x,r.y)}}function getDist(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}function getScalar(t,e,r,s){let o=[getDist(t,e),getDist(r,s)];return o[1]/o[0]}function fitScalar(t,e=10,r=[pv(0,0),pv(width,0),pv(width,height),pv(0,height)]){if(orients=[0,0],bbRatio=dist(t[0].x,t[0].y,t[3].x,t[3].y)/dist(t[0].x,t[0].y,t[1].x,t[1].y),motherRatio=dist(r[0].x,r[0].y,r[3].x,r[3].y)/dist(r[0].x,r[0].y,r[1].x,r[1].y),bbRatio<1&&motherRatio>1)return getScalar(t[0],t[1],pv(r[0].x+e,r[0].y),pv(r[1].x-e,r[1].y));if(bbRatio>1&&motherRatio<1)return getScalar(t[0],t[3],pv(r[0].x,r[0].y+e),pv(r[3].x,r[3].y-e));if(bbRatio>1&&motherRatio>1||bbRatio<1&&motherRatio<1){if(bbRatio<motherRatio)return getScalar(t[0],t[1],pv(r[0].x+e,r[0].y),pv(r[1].x-e,r[1].y));if(bbRatio>motherRatio)return getScalar(t[0],t[3],pv(r[0].x,r[0].y+e),pv(r[3].x,r[3].y-e))}}function canvasAsBB(){return{p1:pv(0,0),p2:pv(width,0),p3:pv(width,height),p4:pv(0,height),width:width,height:height,mp:pv(width/2,height/2)}}function getBB(t){let e=99999999,r=999999999,s=-99999999,o=-99999999;for(let l=0;l<t.length;l++)e=Math.min(e,t[l].x),r=Math.min(r,t[l].y),s=Math.max(s,t[l].x),o=Math.max(o,t[l].y);return{p1:pv(e,r),p2:pv(s,r),p3:pv(s,o),p4:pv(e,o),width:s-e,height:o-r,mp:pv((e+s)/2,(r+o)/2)}}function getBBdepth2(t){let e=99999999,r=999999999,s=-99999999,o=-99999999;for(let l=0;l<t.length;l++)for(let a=0;a<t[l].length;a++)e=Math.min(e,t[l][a].x),r=Math.min(r,t[l][a].y),s=Math.max(s,t[l][a].x),o=Math.max(o,t[l][a].y);return{p1:pv(e,r),p2:pv(s,r),p3:pv(s,o),p4:pv(e,o),width:s-e,height:o-r,mp:pv((e+s)/2,(r+o)/2)}}function combineBB(t){let e=99999999,r=999999999,s=-99999999,o=-99999999;for(let l=0;l<t.length;l++)e=Math.min(e,t[l].p1.x),r=Math.min(r,t[l].p1.y),s=Math.max(s,t[l].p3.x),o=Math.max(o,t[l].p3.y);bbWidth=s-e,bbHeight=o-r;let l=pv((e+s)/2,(r+o)/2);return{p1:pv(e,r),p2:pv(s,r),p3:pv(s,o),p4:pv(e,o),width:bbWidth,height:bbHeight,mp:l}}function scaleAndCenter(t,e){let r,s=getBB(t),o=160*R()+40;r=bounds[0]/bounds[1]>s[1]/s[2]?getScalar(s[0][1],s[0][2],pv(ori[0]+0,ori[1]+o),pv(ori[0]+0,ori[1]+bounds[1]-o)):getScalar(s[0][0],s[0][1],pv(ori[0]+o,ori[1]+0),pv(ori[0]+bounds[0]-o,ori[1]+0));for(let e=0;e<t.length;e++)t[e].sub(s[3].x,s[3].y),t[e].mult(r);s=getBB(t);for(let r=0;r<t.length;r++)if(e){let e=pv(ori[0]+bounds[0]/2,ori[1]+bounds[1]-(ori[1]+bounds[1])/8-(s[0][2].y-s[0][1].y)/2);t[r].add(e.x+-0,e.y)}else{let e=pv(ori[0]+bounds[0]/2,ori[1]+bounds[1]/2);t[r].add(e.x+-0,e.y)}if((s=getBB(t))[0][0].y<ori[1]+o)for(let e=0;e<t.length;e++){t[e].sub(s[3].x,s[3].y);let r=pv(ori[0]+bounds[0]/2,ori[1]+bounds[1]/2);t[e].add(r.x+-0,r.y)}}function pointDir(t,e){let r=degrees(Math.atan2(e.y-t.y,e.x-t.x)),s=p5.Vector.fromAngle(radians(r));return degrees(s.heading())}function pointFrom(t,e,r){return pv(t.x-Math.sin(radians(e))*r,t.y+Math.cos(radians(e))*r)}function rotatePoint(t,e,r){return t.sub(e.x,e.y),t.rotate(r),t.add(e.x,e.y),t}function breakLinks(t){let e=[];for(let r=0;r<t.length;r++)e.push(pv(t[r].x,t[r].y));return t=e,e}function quickLine(t,e){line(t.x,t.y,e.x,e.y)}function inflate(t,e,r=1,s=1){let o=[];o.push(pointFrom(t[0],findNormal2Pt(t[0],t[1]),e*r));for(let l=1;l<t.length-1;l++)o.push(pointFrom(t[l],findNormal3Pt(t[l-1],t[l],t[l+1]),e*map(l,1,t.length-1,r,s)));o.push(pointFrom(t[t.length-1],findNormal2Pt(t[t.length-2],t[t.length-1]),e*s)),o.push(pointFrom(t[t.length-1],findNormal2Pt(t[t.length-1],t[t.length-2]),e*s));for(let l=t.length-2;l>0;l--)o.push(pointFrom(t[l],findNormal3Pt(t[l+1],t[l],t[l-1]),e*map(l,t.length-1,1,s,r)));return o.push(pointFrom(t[0],findNormal2Pt(t[0],t[1])+180,e*r)),o}function findNormal3Pt(t,e,r){let s=pointDir(t,e),o=pointDir(e,r),l=p5.Vector.fromAngle(radians(s)),a=p5.Vector.fromAngle(radians(o));return degrees(l.heading())-degrees(a.angleBetween(l))/2}function findNormal2Pt(t,e){return pointDir(t,e)}function scaleArr(t,e=1,r){t=t.map(t=>{t.sub(r.x,r.y),t.mult(e),t.add(r.x,r.y)})}function scaleArrDouble(t,e=1,r){t.map(t=>{scaleArr(t,e,r)})}function translateArrDepth1(t,e,r){breakLinks(t);for(let s=0;s<t.length;s++){let o=pv(t[s].x,t[s].y);o.sub(e.x,e.y),o.add(r.x,r.y),t[s]=o}}function translateArrDepth2(t,e,r){for(let s=0;s<t.length;s++)translateArrDepth1(t[s],e,r)}function contour(t,e){let r=[];for(let s=0;s<t.length;s++){let o=pointNormal(t[(s-1+t.length)%t.length],t[s],t[(s+1)%t.length]),l=pointFrom(t[s],o,e);r.push(l)}return r}function pointNormal(t,e,r){let s=pointDir(t,e),o=pointDir(e,r),l=Math.atan2(Math.sin(radians(s))+Math.sin(radians(o)),Math.cos(radians(s))+Math.cos(radians(o)));return degrees(l)+180}function getBoxData(t){return{width:t[1].x-t[0].x,height:t[2].y-t[1].y,mp:pv((t[0].x+t[1].x)/2,(t[1].y+t[2].y)/2)}}function boxToBB(t){let e=getBoxData(t);return{p1:t[0],p2:t[1],p3:t[2],p4:t[3],width:e.width,height:e.height,mp:e.mp}}function hyperIntersect(t,e,r,s){var o,l,a;return 0!==(o=(e.x-t.x)*(s.y-r.y)-(s.x-r.x)*(e.y-t.y))&&(a=((s.y-r.y)*(s.x-t.x)+(r.x-s.x)*(s.y-t.y))/o,l=((t.y-e.y)*(s.x-t.x)+(e.x-t.x)*(s.y-t.y))/o,0<a&&a<1&&0<=l&&l<=1)}function pointInsideShape(t,e){let r=0;for(let s=0;s<e.length;s++)hyperIntersect(pv(-1e5,1e5),t,e[s],e[(s+1)%e.length])&&r++;return r%2==1&&r>0}