memoscan
← all memos

Memo 0x4b02f9a9…adccae on Ethereum

function draw(){color(23,100,200);background(cc[0]),drawFlowerPower(),rooms.forEach(t=>{t.drawFill(),stroke(cc[2]),t.drawBack()}),rooms.forEach((t,e,r)=>{yuccas[e].forEach(t=>{t.display()})}),rooms.forEach(t=>{stroke(cc[2]),noFill(),t.drawFront()}),showWords&&drawWords(words)}function createFlowerPower(){if(flowerPower&&1===artistStyle){let t=worldSpaceDims[0]/grid[0]/20;frankeSquares.push(generateFrankeSquares(t)),frankeSquares.push(generateFrankeSquares(2*t)),frankeSquares.push(generateFrankeSquares(4*t))}}function drawFlowerPower(){if(flowerPower&&1===artistStyle){let t=worldSpaceDims[0]/grid[0]/20;strokeWeight(.09*t*globalScaler),drawFrankeSquares(0),drawFrankeSquares(1),drawFrankeSquares(2)}}function generateFrankeSquares(t){let e=[];for(let r=0;r<worldSpaceDims[0];r+=2*t)for(let s=0;s<worldSpaceDims[1];s+=2*t){let o=RR(2*-t,2*t),l=RR(2*-t,2*t);e.push([pv(r+o,s+l),pv(r+t+o,s+l),pv(r+t+o,s+t+l),pv(r+o,s+t+l)])}return e=e.filter(t=>!!(pointInBounds(t[0])&&pointInBounds(t[1])&&pointInBounds(t[2])&&pointInBounds(t[3])))}function pointInBounds(t){return t.x>=.005*worldSpaceDims[1]&&t.x<=worldSpaceDims[0]-.005*worldSpaceDims[1]&&t.y>=.012*worldSpaceDims[1]&&t.y<=worldSpaceDims[1]-.012*worldSpaceDims[1]}function drawFrankeSquares(t){noFill(),stroke(franke[t]),frankeSquares[t].forEach(t=>{beginShape(),prepareColors(),vertex(t[0].x*globalScaler,t[0].y*globalScaler),vertex(t[1].x*globalScaler,t[1].y*globalScaler),vertex(t[2].x*globalScaler,t[2].y*globalScaler),vertex(t[3].x*globalScaler,t[3].y*globalScaler),endShape(CLOSE)})}function createGrid(){let t=[1,1];return R()>.39&&(t=[Math.floor(RR(0,3))+1,Math.floor(RR(0,3))+1],RR(0,1)>.83&&(t=RR(0,1)>.8?[8,8]:[4,Math.floor(RR(4,7))])),t}function createTargetBoxes(t){let e=[],r=.038;flowerPower&&0==artistStyle&&(r=.06);let s=worldSpaceDims[0]*r,o=worldSpaceDims[1]*r,l=worldSpaceDims[0]-2*s,a=worldSpaceDims[1]-2*o;for(let t=0;t<l;t+=l/grid[0])for(let r=0;r<a;r+=a/grid[1])t+l/grid[0]<worldSpaceDims[0]-s&&r+a/grid[1]<worldSpaceDims[1]-o&&e.push(pv(t+s+l/grid[0]/2,.01*-worldSpaceDims[1]+r+o+a/grid[1]/2));let i=e.map(t=>[pv(t.x-(worldSpaceDims[0]-2*s)/grid[0]/2,t.y-(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x+(worldSpaceDims[0]-2*s)/grid[0]/2,t.y-(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x+(worldSpaceDims[0]-2*s)/grid[0]/2,t.y+(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x-(worldSpaceDims[0]-2*s)/grid[0]/2,t.y+(worldSpaceDims[1]-2*o)/grid[1]/2)]),n=Math.floor(RR(0,i.length)),h=getBoxData(i[n]);return h.width/h.height<.5&&RR(0,1)>.5?(i[n][2].set(i[n][2].x,h.mp.y),i[n][3].set(i[n][3].x,h.mp.y),i.push(i[n].map(t=>pv(t.x,t.y+h.mp.y)))):h.width/h.height>1.5&&RR(0,1)>.5&&(i[n][1].set(h.mp.x,i[n][1].y),i[n][2].set(h.mp.x,i[n][2].y),i.push(i[n].map(t=>pv(t.x+h.mp.x,t.y)))),i=i.map(t=>contour(t,.008*-worldSpaceDims[0]))}function createRooms(){targetBoxes.map(t=>{rooms.push(new Room(t))})}function drawArr(t){beginShape(),t.forEach(t=>{vertex(t.x,t.y)}),endShape(CLOSE)}function prepareYuccas(){for(let t=0;t<rooms.length;t++){yuccas[t]=[];for(let e=0;e<rooms[t].slices.length;e++){let r=Math.floor(abs(RR(0,4)));1==rooms.length&&1==rooms[0].slices.length&&(r=5),yuccas[t].push(new Yucca(r));let s=getBoxData(rooms[t].slices[e]),o=.0012*s.height,l=(s.width-yuccas[t][yuccas[t].length-1].stemBaseWidth*o)*R();yuccas[t][yuccas[t].length-1].moveAndScale(o,pv(0,0),pv(rooms[t].slices[e][0].x+l+yuccas[t][yuccas[t].length-1].stemBaseWidth*o/2,rooms[t].slices[e][2].y))}}}function fitToTargetBox(t,e){let r=pv((t[0].x+t[1].x)/2,(t[1].y+t[2].y)/2),s=[];yuccas[e].forEach(t=>{s.push(t.gatherBBs())}),s.push(rooms[e].gatherBBs());let o=combineBB(s),l=fitScalar([o.p1,o.p2,o.p3,o.p4],0,t);yuccas[e].forEach(t=>{t.moveAndScale(l,o.mp,r)}),rooms[e].moveAndScale(l,o.mp,r)}function keyPressed(){"p"==key&&exportSVG(worldSpaceDims[0],worldSpaceDims[1]),"c"==key&&(showWords=!showWords,draw())}p5.disableFriendlyErrors=!0;