0x329f…702e

All memos sent from and to 0x329f…702e.

/* * variables */ let debugMode = false; const DEFAULT_HEIGHT = 1920; const DEFAULT_WIDTH = 1080; const MAX_HEIGHT = 3840; const MAX_WIDTH = 2160; let R; let WIDTH, HEIGHT; let hash; let hashPairs = []; let decPairs = []; let mainCanvas; let nSeed; let rSeed; let canvasScale; let saveBoolean = false; let params, features; let graphics, centerPosition, centerAngle; /* * setup p5.js */ function setup() { params = setupParams(); setupCanvas(); frameRate(60); if (debugMode) { let features = structuredClone(params); delete features.Colors; delete features.LineColors; delete features.LineDiagonals; delete features.LineParams; print("================================================"); print("features"); print(features); print("================================================"); // return features; } } /* * draw p5.js */ function draw() { clear(); drawPattern(); if (debugMode) { // imageMode(CORNER); // image(graphics, 0, 0, 100, 100); } } function drawPattern() { graphics.clear(); let offset = graphics.width / 20; let margin = offset / 1; let cellSize = params.Cells; let d = int( (graphics.width - offset * 2 - margin * (cellSize - 1)) / cellSize ); for (let j = 0; j < cellSize; j++) { for (let i = 0; i < cellSize; i++) { let index = j * cellSize + i; let lineParam = params.LineParams[index]; let lineDiagonal = lineParam.LineDiagonal; let x = int(offset + i * (d + margin)); let y = int(offset + j * (d + margin)); if (lineDiagonal) { drawFreqLine(x, y, x + d, y + d, lineParam, graphics); } else { drawFreqLine(x + d, y, x, y + d, lineParam, graphics); } } } clear(); blendMode(BLEND); switch (params.BlendMode) { case "ADD": background(0, 0, 10); blendMode(ADD); break; case "BLEND": background(0, 0, 0); blendMode(BLEND); break; case "BURN": background(0, 0, 92); blendMode(BURN); break; } for (let i = 0; i < params.Iteration; i++) { let eachLayer = graphics.get(); eachLayer.resize( (layerScale = int( map( sin( ((i * 360) / params.Iteration) * map(params.Cells, 4, 13, 1, 3) + 2 * frameCount ), -1, 1, WIDTH / 50, WIDTH / 4 ) )), layerScale ); push(); translate(WIDTH / 2, HEIGHT / 2); translate(centerPosition.x, centerPosition.y); switch (params.Position) { case "Planet": break; case "Satellite": translate( (cos(+(i / params.Iteration) * 360) * WIDTH) / 8, (sin(+(i / params.Iteration) * 360) * HEIGHT) / 8 ); break; case "Comet": translate( (cos(frameCount * 1 + (i / params.Iteration) * 360) * WIDTH) / 8, (sin((frameCount * 2) / 3 + (i / params.Iteration) * 360) * HEIGHT) / 8 ); break; } rotate( ((i * 360) / params.Iteration) * 1.5 + 360 / params.Iteration / 2 + (frameCount / 2) * (params.Rotation == "Clockwise" ? 1 : -1) ); scale((m = tan(((i * 90) / params.Iteration + frameCount / 5) % 90))); let nx = sin((i * 90) / params.Iteration + frameCount / 5) * 100; let ny = cos((i * 90) / params.Iteration + frameCount / 6) * 100; if (params.Distortion == "On") { shearY(10 * sin((i / params.Iteration) * 360 + frameCount / 2)); } imageMode(CENTER); image(eachLayer, nx, ny, width, width); if (params.BlendMode == "BURN") { image(eachLayer, nx, ny, width, width); } pop(); } } function drawFreqLine(x1, y1, x2, y2, lineParam, target) { let d = dist(x1, y1, x2, y2); let a = atan2(y2 - y1, x2 - x1); let h1 = lineParam.FreqA; let h2 = lineParam.FreqB; let f1 = map(sin(x1 + y1 * width + frameCount * h1), -1, 1, 0, 1); let f2 = map(cos(x2 + y2 * width + frameCount * h2), -1, 1, 0, 1); target.drawingContext.setLineDash[d]; target.drawingContext.lineDashOffset = ((max(f1, f2) * d + frameCount) / 10) % (d * 2); f1 = easeInOutCirc(f1); f2 = easeInOutCirc(f2); let s1 = d * f1; let s2 = d * f2; let strokeColor = lineParam.Color.lineColor; let pointColor = lineParam.Color.pointColor; target.strokeCap(SQUARE); if (lineParam.Type == "Line") { let t = dist(s1, 0, s2, 0) / d; target.push(); target.translate(x1, y1); target.rotate(a); target.strokeCap(PROJECT); target.noFill(); target.stroke(strokeColor); target.strokeWeight((d / 50) * max(1 - f2, 1 - f1) * sqrt(2)); target.line(s1, 0, s2, 0); // line(0, 0, d*t, 0); if (lineParam.Point == "Circle") { target.stroke(pointColor); target.strokeWeight((d / 10) * (1 - f1) * sqrt(2)); target.point(s1, 0); target.strokeWeight((d / 10) * (1 - f2) * sqrt(2)); target.point(s2, 0); } else if (lineParam.Point == "Square") { target.push(); target.translate(s1, 0); target.rotate(45 + f1 * 360); target.rectMode(CENTER); target.fill(strokeColor); target.noStroke(); target.rect(0, 0, ((d / 5) * (1 - f1)) / sqrt(2)); target.pop(); target.push(); target.translate(s2, 0); target.rotate(45 + f2 * 360); target.rectMode(CENTER); target.fill(strokeColor); target.noStroke(); target.rect(0, 0, ((d / 5) * (1 - f1)) / sqrt(2)); target.pop(); } target.pop(); } else if (lineParam.Type == "Arc") { let a1 = 90 * f1; let a2 = 90 - 90 * f2; let d2 = d / sqrt(2); target.push(); target.translate(min(x1, x2) + d2 / 2, min(y1, y2) + d2 / 2); target.rotate(lineParam.Angle); target.translate(-d2 / 2, -d2 / 2); target.noFill(); target.stroke(strokeColor); target.strokeWeight((d / 50) * max(1 - f2, 1 - f1) * sqrt(2)); if (abs(a1 - a2) > 0.1) { target.arc(0, 0, d2 * 2, d2 * 2, min(a1, a2), max(a1, a2)); } if (lineParam.Point == "Circle") { target.stroke(pointColor); target.strokeWeight((d / 10) * (1 - f1) * sqrt(2)); target.point(cos(a1) * d2, sin(a1) * d2); target.strokeWeight((d / 10) * (1 - f2) * sqrt(2)); target.point(cos(a2) * d2, sin(a2) * d2); } else if (lineParam.Point == "Square") { target.push(); target.translate(cos(a1) * d2, sin(a1) * d2); target.rotate(45 + f1 * 360); target.rectMode(CENTER); target.fill(strokeColor); target.noStroke(); target.rect(0, 0, ((d / 5) * (1 - f1)) / sqrt(2)); target.pop(); target.push(); target.translate(cos(a2) * d2, sin(a2) * d2); target.rotate(45 + f2 * 360); target.rectMode(CENTER); target.fill(strokeColor); target.noStroke(); target.rect(0, 0, ((d / 5) * (1 - f1)) / sqrt(2)); target.pop(); } target.pop(); } } function setupParams() { hash = tokenData.hash; if (debugMode) { // hash = "0x622fb6114b74ada47abf7a4721f697623f8c33c89adbe098367416c808cd8447"; } R = new Random(); if (debugMode) { print("================================================"); print("debugMode", debugMode); print("hash", hash); print("================================================"); } for (let j = 0; j < 32; j++) { hashPairs.push(hash.slice(2 + j * 2, 4 + j * 2)); } decPairs = hashPairs.map((x) => { return parseInt(x, 16); }); let params = getParams(decPairs); if (debugMode) { print(params); print("================================================"); print("Palette : ", params.Palette); print("Colors : ", params.Colors); print("Cells : ", params.Cells); print("Iteration : ", params.Iteration); print("Position : ", params.Position); print("LineType : ", params.LineType); print("PointType : ", params.PointType); print("Distortion : ", params.Distortion); print("Rotation : ", params.Rotation); print("BlendMode : ", params.BlendMode); print("================================================"); } return params; } function getParams(decPairs) { const colorOjbect = colorScheme[decPairs[1] % colorScheme.length]; let blendModeChoices = ["ADD", "BLEND", "BURN"]; let cellSize = (decPairs[2] % 10) + 4; let iteration = constrain(decPairs[3] % 20, 6, 20); let lineColors = []; for (let i = 0; i < cellSize * cellSize; i++) { lineColors.push(R.random_choice(colorOjbect.colors)); } let lineDiagonals = []; for (let i = 0; i < cellSize * cellSize; i++) { lineDiagonals.push(R.random_bool(0.5)); } let distortion = decPairs[4] % 4 == 0 ? "On" : "Off"; let position = decPairs[5] % 11 > 5 ? "Planet" : "Satellite"; position = decPairs[5] % 11 == 0 ? "Comet" : position; let rotation = decPairs[6] % 2 == 0 ? "Clockwise" : "Counterclockwise"; let blendModeChoice = R.random_choice(blendModeChoices); let lineParams = []; const lineType = R.random_choice(["Line", "Arc", "Mix"]); const pointType = R.random_choice(["Square", "Circle", "Mix"]); for (let i = 0; i < cellSize * cellSize; i++) { let freqA = (R.random_num(1, 5) / 2) * (R.random_bool(0.5) ? -1 : 1); let freqB = (R.random_num(1, 5) / 2) * (R.random_bool(0.5) ? -1 : 1); let lineDiagonal = R.random_bool(0.5); let strokeColor = R.random_choice(colorOjbect.colors); let c1 = R.random_choice(colorOjbect.colors); let c2 = R.random_choice(colorOjbect.colors); while (c1 == c2) { c2 = R.random_choice(colorOjbect.colors); } strokeColor = { lineColor: c1, pointColor: c2, }; let type; if (lineType == "Arc") { type = "Arc"; } else if (lineType == "Line") { type = "Line"; } else { type = R.random_choice(["Line", "Arc"]); } let pType; if (pointType == "Square") { pType = "Square"; } else if (pointType == "Circle") { pType = "Circle"; } else { pType = R.random_choice(["Square", "Circle"]); } lineParams.push({ Color: strokeColor, LineDiagonal: lineDiagonal, FreqA: freqA, FreqB: freqB, Type: type, Point: pType, Angle: R.random_choice([0, 90, 180, 270]), }); } centerAngle = R.random_num(0, 360); return { Palette: colorOjbect.name, Colors: colorOjbect.colors, Cells: cellSize, Iteration: iteration, Position: position, LineType: lineType, PointType: pointType, Distortion: distortion, Rotation: rotation, LineColors: lineColors, LineDiagonals: lineDiagonals, LineParams: lineParams, BlendMode: blendModeChoice, }; } function setupCanvas() { pixelDensity(1); WIDTH = windowWidth; HEIGHT = windowHeight; canvasScale = HEIGHT / DEFAULT_HEIGHT; mainCanvas = createCanvas(WIDTH, HEIGHT); let w = constrain( max(WIDTH, HEIGHT) / 4, max(WIDTH, HEIGHT) / 2, MAX_HEIGHT / 2 ); graphics = createGraphics(w, w); colorMode(HSB, 360, 100, 100, 100); angleMode(DEGREES); graphics.colorMode(HSB, 360, 100, 100, 100); graphics.angleMode(DEGREES); noSmooth(); centerPosition = createVector(0, 0); if (decPairs[6] % 10 < 3) { centerPosition.add( p5.Vector.fromAngle(centerAngle).mult(min(WIDTH, HEIGHT) / 10) ); } } function calculateCanvasSize() { const aspectRatioWidth = 9; const aspectRatioHeight = 16; let canvasWidth, canvasHeight; if (windowWidth * (aspectRatioHeight / aspectRatioWidth) <= windowHeight) { canvasWidth = windowWidth; canvasHeight = windowWidth * (aspectRatioHeight / aspectRatioWidth); } else { canvasHeight = windowHeight; canvasWidth = windowHeight * (aspectRatioWidth / aspectRatioHeight); } if (canvasHeight > MAX_HEIGHT) { canvasHeight = MAX_HEIGHT; canvasWidth = canvasHeight * (aspectRatioWidth / aspectRatioHeight); } if (saveBoolean) { canvasWidth = MAX_WIDTH; canvasHeight = MAX_HEIGHT; } return { width: canvasWidth, height: canvasHeight, }; } /** * color palette for drawing */ const colorScheme = [ { name: "Benedictus", colors: ["#F27EA9", "#366CD9", "#5EADF2", "#636E73", "#F2E6D8"], }, { name: "Cross", colors: ["#D962AF", "#58A6A6", "#8AA66F", "#F29F05", "#F26D6D"], }, { name: "Demuth", colors: ["#222940", "#D98E04", "#F2A950", "#BF3E21", "#F2F2F2"], }, { name: "Hiroshige", colors: ["#1B618C", "#55CCD9", "#F2BC57", "#F2DAAC", "#F24949"], }, { name: "Hokusai", colors: ["#074A59", "#F2C166", "#F28241", "#F26B5E", "#F2F2F2"], }, { name: "Indigo", colors: ["#023059", "#459DBF", "#87BF60", "#D9D16A", "#F2F2F2"], }, { name: "Java", colors: ["#632973", "#02734A", "#F25C05", "#F29188", "#F2E0DF"], }, { name: "Kandinsky", colors: ["#8D95A6", "#0A7360", "#F28705", "#D98825", "#F2F2F2"], }, { name: "Monet", colors: ["#4146A6", "#063573", "#5EC8F2", "#8C4E03", "#D98A29"], }, { name: "Nizami", colors: ["#034AA6", "#72B6F2", "#73BFB1", "#F2A30F", "#F26F63"], }, { name: "Renoir", colors: ["#303E8C", "#F2AE2E", "#F28705", "#D91414", "#F2F2F2"], }, { name: "VanGogh", colors: ["#424D8C", "#84A9BF", "#C1D9CE", "#F2B705", "#F25C05"], }, { name: "RiverSide", colors: ["#906FA6", "#025951", "#252625", "#D99191", "#F2F2F2"], }, ]; /** * Random Generator Class */ class Random { constructor() { this.useA = false; let sfc32 = function (uint128Hex) { let a = parseInt(uint128Hex.substr(0, 8), 16); let b = parseInt(uint128Hex.substr(8, 8), 16); let c = parseInt(uint128Hex.substr(16, 8), 16); let d = parseInt(uint128Hex.substr(24, 8), 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; }; }; // seed prngA with first half of tokenData.hash this.prngA = new sfc32(hash.substr(2, 32)); // seed prngB with second half of tokenData.hash this.prngB = new sfc32(hash.substr(34, 32)); for (let i = 0; i < 1e6; i += 2) { this.prngA(); this.prngB(); } } // random number between 0 (inclusive) and 1 (exclusive) random_dec() { this.useA = !this.useA; return this.useA ? this.prngA() : this.prngB(); } // random number between a (inclusive) and b (exclusive) random_num(a, b) { return a + (b - a) * this.random_dec(); } // random integer between a (inclusive) and b (inclusive) // requires a < b for proper probability distribution random_int(a, b) { return Math.floor(this.random_num(a, b + 1)); } // random boolean with p as percent liklihood of true random_bool(p) { return this.random_dec() < p; } // random value in an array of items random_choice(list) { return list[this.random_int(0, list.length - 1)]; } } function windowResized() { resizeCanvas(windowWidth, windowHeight); WIDTH = windowWidth; HEIGHT = windowHeight; let w = constrain( max(WIDTH, HEIGHT) / 4, max(WIDTH, HEIGHT) / 2, MAX_HEIGHT / 2 ); centerPosition = createVector(0, 0); if (decPairs[6] % 10 < 3) { centerPosition.add( p5.Vector.fromAngle(centerAngle).mult(min(WIDTH, HEIGHT) / 10) ); } graphics.width = w; graphics.height = w; } function easeInOutCirc(x) { return x < 0.5 ? (1 - Math.sqrt(1 - Math.pow(2 * x, 2))) / 2 : (Math.sqrt(1 - Math.pow(-2 * x + 2, 2)) + 1) / 2; } function easeInOutElastic(x) { const c5 = (2 * Math.PI) / 4.5; return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? -(Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5)) / 2 : (Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5)) / 2 + 1; }
"JaggedMemories" focuses on anti-aliasing, a characteristic of on-screen media, and expresses jaggies and pixel characteristics in a unique approach to animation. Inspired by Takawo's past work "SinteredMemories," it shows the moment when memories of the past intersect with future possibilities.
let hash,R,M,mainCanvas,defaultHeight=5e3,defaultWidth=9*defaultHeight/16,saveBoolean=!1,hashPairs=[],decPairs=[],circles=[];const browserName=function(e){switch(!0){case e.indexOf("edge")>-1:return"MS Edge";case e.indexOf("edg/")>-1:return"Edge/Chromium";case e.indexOf("opr")>-1&&!!window.opr:return"Opera";case e.indexOf("chrome")>-1&&!!window.chrome:return"Chrome";case e.indexOf("trident")>-1:return"MS IE";case e.indexOf("firefox")>-1:return"Mozilla Firefox";case e.indexOf("safari")>-1:return"Safari";default:return"other"}}(window.navigator.userAgent.toLowerCase());function setup(){setupParams(),setupCanvas(),circles=createCirclePacking(100,defaultWidth*M,defaultHeight*M,params.Composition)}function draw(){switch(background(decPairs[8]%2==0?color(0,0,15):color(0,0,90)),drawGradientFrame(),push(),translate(defaultWidth/2*M,defaultHeight/2*M),push(),rotate(30*R.random_dec()*(R.random_dec()>.5?-1:1)),"On"==params.Shear&&(shearX(5*R.random_dec()*(R.random_dec()>.5?-1:1)),shearY(5*R.random_dec()*(R.random_dec()>.5?-1:1))),params.order){case"Accend":circles.sort(((e,a)=>a.diameter-e.diameter));break;case"Descend":circles.sort(((e,a)=>e.diameter-a.diameter))}let e=0;if("Back"==params.Spot)for(let a of circles)e++<100&&drawSpot(a.x,a.y,6*a.diameter,100);drawingContext.shadowColor=color(0,0,0,33),drawingContext.shadowBlur=M*defaultHeight/50;for(let e of circles)recursiveArc(e.x,e.y,0,360,0,3*e.diameter,3);if("Front"==params.Spot)for(let a of circles)e++<100&&drawSpot(a.x,a.y,6*a.diameter,100);pop(),pop(),push(),translate(defaultWidth/2*M,defaultHeight/2*M),drawPostEffect(),pop(),noLoop(),saveBoolean&&save("Marching_Resonances_"+hash+".png")}function drawGradientFrame(){let e=360*R.random_dec(),a=R.random_dec()*defaultWidth*M/2,r=R.random_dec()*defaultHeight*M/2;if(push(),strokeWeight(.5*M),"On"==params.Frame){for(let o=0;o<2;o++){let n=defaultWidth/map(o,0,2,20,7)*M;if(push(),1==o){let o=360*R.random_dec(),n=drawingContext.createConicGradient(o,width/2+cos(e)*a,height/2+sin(e)*r);n.addColorStop(0,params.Colors[0]),n.addColorStop(1/3,params.Colors[1]),n.addColorStop(2/3,params.Colors[2]),n.addColorStop(1,params.Colors[0]),drawingContext.fillStyle=n}else fill(55,5,95);setupFrame(n,n,width-2*n,height-2*n),pop()}drawingContext.clip()}}function setupParams(){hash=tokenData.hash,console.log("hash : "+hash),seed=parseInt(hash.slice(0,16),16),noiseSeed(seed),randomSeed(seed);for(let e=0;e<32;e++)hashPairs.push(hash.slice(2+2*e,4+2*e));decPairs=hashPairs.map((e=>parseInt(e,16))),params=getParams(decPairs),console.log("================================================"),console.log("Frame : ",params.Frame),console.log("Order : ",params.Order),console.log("Shape : ",params.Shape),console.log("Shear : ",params.Shear),console.log("Colors : ",params.Colors),console.log("Gradient : ",params.Gradient),console.log("Composition : ",params.Composition),console.log("Palette : ",params.Palette),console.log("Constant : ",params.Constant),console.log("Spot : ",params.Spot),console.log("================================================")}function setupCanvas(){let e,a;saveBoolean?(e=9*defaultHeight/16,a=defaultHeight):(e=9*windowHeight/16,a=windowHeight),mainCanvas=createCanvas(e,a),colorMode(HSB,360,100,100,100),angleMode(DEGREES),smooth(),pixelDensity(1),grainBuffer=createGraphics(width,height,WEBGL),grainShader=grainBuffer.createShader(vert,frag),console.log("width : "+width),console.log("height : "+height),console.log("================================================"),M=height/defaultHeight,console.log("M : "+M),R=new Random}function keyPressed(){"s"!=key&&"S"!=key||(saveBoolean=!0,setup(),draw())}class Random{constructor(){this.useA=!1;let e=function(e){let a=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),o=parseInt(e.substr(16,8),16),n=parseInt(e.substr(24,8),16);return function(){a|=0,r|=0,o|=0,n|=0;let e=(a+r|0)+n|0;return n=n+1|0,a=r^r>>>9,r=o+(o<<3)|0,o=o<<21|o>>>11,o=o+e|0,(e>>>0)/4294967296}};this.prngA=new e(hash.substr(2,32)),this.prngB=new e(hash.substr(34,32));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}random_num(e,a){return e+(a-e)*this.random_dec()}random_int(e,a){return Math.floor(this.random_num(e,a+1))}random_bool(e){return this.random_dec()<e}random_choice(e){return e[this.random_int(0,e.length-1)]}}function getParams(e){const a=["On","Off"],r=["Curve","Straight","Mix"],o=["Conic","Radial","Mix","Solid"],n=["Accend","Descend","Mix"],t=colorScheme[e[1]%colorScheme.length];let s=e[10]%9,i=e[12]%9;switch(s){case 0:case 1:case 2:case 3:case 4:case 5:case 6:s=n[0];break;case 7:s=n[1];break;case 8:s=n[2]}switch(i){case 0:case 2:case 4:case 6:i=r[0];break;case 1:case 3:case 5:case 7:i=r[2];break;case 8:i=r[1]}return{Frame:e[0]%10>3?"On":"Off",Palette:t.name,Colors:t.colors,Composition:e[2]%10>5?"Random":"Packing",Shear:a[e[3]%a.length],Shape:r[e[8]%r.length],Order:s,Gradient:o[e[5]%o.length],Constant:1+e[12]%10,Spot:e[13]%2==0?"Back":"Front"}}const colorScheme=[{name:"Golden Thread Butterfly",colors:["#f19b4e","#7f6640","#dc5845","#e4d6c8","#929e79","#472c2a"]},{name:"Navy Lion Peony",colors:["#83834f","#e0c786","#30363d","#db2f38","#66989c","#e9ded1"]},{name:"Charcoal Wind",colors:["#151015","#511a28","#8e563a","#fcfbfa","#bf9969","#718282"]},{name:"Wisteria Spring",colors:["#e6bc8a","#da4742","#202125","#909062","#dba380","#dcc6b9"]},{name:"Fragrant Ground",colors:["#73924d","#eb9f48","#b19564","#aabcb2","#f0e3d7","#6b4b2b"]},{name:"Lagenaria Siceraria",colors:["#f0ebe1","#d8ccb3","#cd2a41","#8bc08f","#f69fac","#c4714c"]},{name:"Tang grass",colors:["#f9f5ec","#d8ae6a","#d4824b","#588c92","#89bfb3","#b55847"]},{name:"Pearl and Dragon",colors:["#dad7c3","#c7895a","#343530","#899c63","#60827d","#d6b58a"]},{name:"Red Dragon",colors:["#e5e9e9","#da2034","#8db4bb","#4f6a31","#6ab26d","#e4bc89"]},{name:"Phoenix Peony",colors:["#3c3e46","#ddded7","#c07552","#5b6984","#809c73","#c3ae98"]},{name:"Kara Ori",colors:["#4d4638","#f77843","#fbc836","#d8b85a","#6c6e47","#b0e3ee"]},{name:"Yu-Zen Dyeing",colors:["#f5da30","#338ab6","#8a8740","#73563f","#332321","#e0dfdf"]},{name:"Bird and Flower",colors:["#abb163","#e9e1cb","#9b7c4a","#74a7a0","#e46641","#5a5925"]},{name:"Japanese Ink",colors:["#000000","#aaaaaa","#7f7f7f","#c9c9c9","#ffffff","#7f6640"]}],vert="\nprecision highp float;\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nvarying vec2 vVertTexCoord;\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vVertTexCoord = aTexCoord;\n}\n",frag="\nprecision highp float;\nvarying vec2 vVertTexCoord;\n\nuniform sampler2D source;\nuniform float noiseSeed;\nuniform float noiseAmount;\n\nfloat rand(vec2 n) { \n return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);\n}\n\nvoid main() {\n // GorillaSun's grain algorithm\n vec4 inColor = texture2D(source, vVertTexCoord);\n gl_FragColor = clamp(inColor + vec4(\n mix(-noiseAmount, noiseAmount, fract(noiseSeed + rand(vVertTexCoord * 1981.820))),\n mix(-noiseAmount, noiseAmount, fract(noiseSeed + rand(vVertTexCoord * 1990.116))),\n mix(-noiseAmount, noiseAmount, fract(noiseSeed + rand(vVertTexCoord * 2020.118))),\n 0.\n ), 0., 1.);\n}\n";function setupFrame(e,a,r,o){drawFrame(createPoints(e,a,r,o))}function createPoints(e,a,r,o){let n=[createVector(e,a),createVector(e+r,a),createVector(e+r,a+o),createVector(e,a+o)],t=[];for(let e=0;e<n.length;e++){let a=n[e],s=n[(e+1)%n.length],i="On"==params.Shear?min(r,o)/80:0;for(let e=0;e<1;e+=.1){let n=p5.Vector.lerp(a,s,e),d=noise(r/2+n.x/r,o/2+n.y/o)*TWO_PI;n.add(p5.Vector.fromAngle(d).mult(i)),t.push(n)}}return t}function drawFrame(e){strokeWeight(.5*M),stroke(0,0,20),beginShape();for(let a=0;a<e.length;a++)vertex(e[a%e.length].x,e[a%e.length].y);endShape(CLOSE)}function createCirclePacking(e,a,r,o){let n=[];if("Random"===o)for(let o=0;o<e/2;o++){let e={x:(R.random_dec()-.5)*a,y:(R.random_dec()-.5)*r,diameter:r/15+R.random_dec()*r/15};n.push(e)}else{let o=0;const t=100;for(;n.length<e&&o<t;){let e={x:(R.random_dec()-.5)*a,y:(R.random_dec()-.5)*r,diameter:r/15+R.random_dec()*r/15},t=!0;for(let a=0;a<n.length;a++)if(dist(e.x,e.y,n[a].x,n[a].y)<(e.diameter+n[a].diameter)/2){t=!1;break}t&&n.push(e),o++}}return n}function recursiveArc(e,a,r,o,n,t,s){if(s<0)return;if(r>o){let e=r;r=o,o=e}if(n>t){let e=n;n=t,t=e}push(),translate(e,a);let i=1e3*R.random_dec(),d=1e3*R.random_dec(),c=90*noise(i,d),l=r+(sin(i+a/100+c*s)/2+.5)*(o-r),h=n+(cos(d+e/100+c*s)/2+.5)*(t-n);0==s?(drawArc(0,0,r,l,n,h),drawArc(0,0,l,o,n,h),drawArc(0,0,r,l,h,t),drawArc(0,0,l,o,h,t)):(recursiveArc(0,0,r,l,n,h,s-1),recursiveArc(0,0,l,o,n,h,s-1),recursiveArc(0,0,r,l,h,t,s-1),recursiveArc(0,0,l,o,h,t,s-1)),pop()}function drawArc(e,a,r,o,n,t){let s,i=params.Colors.concat(),d=R.random_dec()>.5,c=R.random_choice([4,2,1,.5,1/4,1/8,1/16,1/32,1/64])*params.Constant/5,l=R.random_choice([4,2,1,.5,1/4,1/8,1/16,1/32,1/64])*params.Constant/5;l=c,i=arrayShuffle(i),push(),translate(e,a),rotate(90*R.random_dec());let h=radians(r);switch("Safari"==browserName&&(h+=PI/2),params.Gradient){case"Conic":s=drawingContext.createConicGradient(h,0,0),d=!0;break;case"Solid":case"Mix":s=d?drawingContext.createConicGradient(h,0,0):drawingContext.createRadialGradient(0,0,max(0,n/2),0,0,max(0,2*t));break;case"Radial":s=drawingContext.createRadialGradient(0,0,max(0,n/2),0,0,max(0,3*t/2)),d=!1}if(d&&"Solid"!=params.Gradient?(s.addColorStop(0,i[0]),s.addColorStop(1,i[0]),s.addColorStop(constrain(1*(o-r)/360/2,0,1),i[2]),s.addColorStop(constrain(1*(o-r)/360,0,1),i[1])):"Solid"!=params.Gradient&&(s.addColorStop(0,i[0]),s.addColorStop(.5,i[2]),s.addColorStop(1,i[1])),"Solid"==params.Gradient){let e,a=0;for(let r=0;r<o/360;r+=e){let n=decPairs[a++%decPairs.length];e=o/(decPairs[n%decPairs.length]%5+2)/360,s.addColorStop(r,i[n%i.length]),0==r&&s.addColorStop(1,i[n%i.length]);let t=constrain(r+e-.001,0,1);isNaN(t)&&(t=0),s.addColorStop(t,i[3*n++%i.length])}}o-r<3||n<5*M||t-n<30*M?(noFill(),noStroke()):(stroke(0,0,20),strokeWeight(.5*M),fill(0,0,90)),drawingContext.fillStyle=s,push();let m=R.random_dec()>.5?-1:1;"On"==params.Shear&&(shearX(m*R.random_dec()*9),shearY(m*R.random_dec()*9));let f=1,u=[];switch(beginShape(),params.Shape){case"Straight":f=R.random_dec()<.9?.334*abs(o-r):1;break;case"Curve":f=1;break;case"Mix":f=R.random_dec()>.5?1:.5*abs(o-r)}for(let e=r;e<=o;e+=f){u.push(f);let a=t*sin(.5*e)*map(sin(map(e,r,o,0,360*c)),-1,1,.5,1);vertex(cos(e)*a,sin(e)*a)}u.reverse();for(let e=o;e>=r;e-=f){f=u[0],u.splice(0,1);let a=n*sin(.5*e)*map(sin(map(e,r,o,0,7*l)),-1,1,.5,1);vertex(cos(e)*a,sin(e)*a)}endShape(CLOSE),pop(),pop()}function arrayShuffle(e){for(let a=e.length-1;0<a;a--){let r=Math.floor(R.random_dec()*(a+1)),o=e[a];e[a]=e[r],e[r]=o}return e}function drawSpot(e,a,r,o){push(),translate(e,a),drawingContext.shadowBlur=0,drawingContext.shadowColor=null;for(let e=0;e<o;e++){let e=360*R.random_dec(),a=randomGaussian(.1,.5)*r/2;blob(cos(e)*a,sin(e)*a,1+randomGaussian(.1,R.random_dec())*a/25)}blendMode(BLEND),pop()}function blob(e,a,r){push(),translate(e,a),noStroke(),decPairs[8]%2==0?(blendMode(ADD),fill(0,0,100,4)):(blendMode(MULTIPLY),fill(0,0,0,2)),curveTightness(-2*R.random_dec()-1),beginShape();let o=[];for(let e=0;e<3;e++){let a=120*e,n=r/2+R.random_dec()*r,t={x:cos(a)*n,y:sin(a)*n};curveVertex(t.x,t.y),o.push(t)}for(let e of o)curveVertex(e.x,e.y);endShape(),pop()}function drawPostEffect(){imageMode(CENTER);let e=getTexture(width,height);push(),"Chrome"==browserName?drawingContext.globalAlpha=.6:("Safari"==browserName||"Mozilla Firefox"==browserName)&&(drawingContext.globalAlpha=.05),image(e,0,0,width,height),e.remove(),drawingContext.globalAlpha=1,pop(),grainBuffer.clear(),grainBuffer.reset(),grainBuffer.push(),grainBuffer.shader(grainShader),grainShader.setUniform("source",mainCanvas),grainShader.setUniform("noiseAmount",map(M,.1,2,.001,.1)),grainBuffer.rectMode(CENTER),grainBuffer.noStroke(),grainBuffer.rect(0,0,width,height),grainBuffer.pop(),push(),image(grainBuffer,0,0,width,height),grainBuffer.remove(),resetShader(),pop()}function getTexture(e,a){const r=createGraphics(e,a);r.randomSeed(seed),r.colorMode(HSB,360,100,100,100),r.angleMode(DEGREES),r.strokeWeight(1*M);for(let o=0;o<e;o+=20*e/defaultWidth)for(let n=0;n<a;n+=20*a/defaultHeight){let t=R.random_num(75,105),s=max(e,a)/2;r.stroke(0,0,100,3*R.random_dec()),r.line(o+r.cos(t)*s,n+r.sin(t)*s,o+r.cos(t+180)*s,n+r.sin(t+180)*s)}return r}
let hash,R,M,mainCanvas,defaultHeight=5e3,defaultWidth=9*defaultHeight/16,saveBoolean=!1,hashPairs=[],decPairs=[],circles=[];const browserName=function(e){switch(!0){case e.indexOf("edge")>-1:return"MS Edge";case e.indexOf("edg/")>-1:return"Edge/Chromium";case e.indexOf("opr")>-1&&!!window.opr:return"Opera";case e.indexOf("chrome")>-1&&!!window.chrome:return"Chrome";case e.indexOf("trident")>-1:return"MS IE";case e.indexOf("firefox")>-1:return"Mozilla Firefox";case e.indexOf("safari")>-1:return"Safari";default:return"other"}}(window.navigator.userAgent.toLowerCase());function setup(){setupParams(),setupCanvas(),circles=createCirclePacking(100,defaultWidth*M,defaultHeight*M,params.Composition)}function draw(){switch(background(decPairs[8]%2==0?color(0,0,15):color(0,0,90)),drawGradientFrame(),push(),translate(defaultWidth/2*M,defaultHeight/2*M),push(),rotate(30*R.random_dec()*(R.random_dec()>.5?-1:1)),"On"==params.Shear&&(shearX(5*R.random_dec()*(R.random_dec()>.5?-1:1)),shearY(5*R.random_dec()*(R.random_dec()>.5?-1:1))),params.order){case"Accend":circles.sort(((e,a)=>a.diameter-e.diameter));break;case"Descend":circles.sort(((e,a)=>e.diameter-a.diameter))}let e=0;if("Back"==params.Spot)for(let a of circles)e++<100&&drawSpot(a.x,a.y,6*a.diameter,100);drawingContext.shadowColor=color(0,0,0,33),drawingContext.shadowBlur=M*defaultHeight/50;for(let e of circles)recursiveArc(e.x,e.y,0,360,0,3*e.diameter,3);if("Front"==params.Spot)for(let a of circles)e++<100&&drawSpot(a.x,a.y,6*a.diameter,100);pop(),pop(),push(),translate(defaultWidth/2*M,defaultHeight/2*M),drawPostEffect(),pop(),noLoop(),saveBoolean&&save("Marching_Resonances_"+hash+".png")}function drawGradientFrame(){let e=360*R.random_dec(),a=R.random_dec()*defaultWidth*M/2,r=R.random_dec()*defaultHeight*M/2;if(push(),strokeWeight(.5*M),"On"==params.Frame){for(let o=0;o<2;o++){let t=defaultWidth/map(o,0,2,20,7)*M;if(push(),1==o){let o=360*R.random_dec(),t=drawingContext.createConicGradient(o,width/2+cos(e)*a,height/2+sin(e)*r);t.addColorStop(0,params.Colors[0]),t.addColorStop(1/3,params.Colors[1]),t.addColorStop(2/3,params.Colors[2]),t.addColorStop(1,params.Colors[0]),drawingContext.fillStyle=t}else fill(55,5,95);setupFrame(t,t,width-2*t,height-2*t),pop()}drawingContext.clip()}}function setupParams(){hash=tokenData.hash,seed=parseInt(hash.slice(0,16),16),noiseSeed(seed),randomSeed(seed);for(let e=0;e<32;e++)hashPairs.push(hash.slice(2+2*e,4+2*e));decPairs=hashPairs.map((e=>parseInt(e,16))),params=getParams(decPairs)}function setupCanvas(){let e,a;saveBoolean?(e=9*defaultHeight/16,a=defaultHeight):(e=9*windowHeight/16,a=windowHeight),mainCanvas=createCanvas(e,a),colorMode(HSB,360,100,100,100),angleMode(DEGREES),smooth(),pixelDensity(1),grainBuffer=createGraphics(width,height,WEBGL),grainShader=grainBuffer.createShader(vert,frag),M=height/defaultHeight,R=new Random}function keyPressed(){"s"!=key&&"S"!=key||(saveBoolean=!0,setup(),draw())}class Random{constructor(){this.useA=!1;let e=function(e){let a=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),o=parseInt(e.substr(16,8),16),t=parseInt(e.substr(24,8),16);return function(){a|=0,r|=0,o|=0,t|=0;let e=(a+r|0)+t|0;return t=t+1|0,a=r^r>>>9,r=o+(o<<3)|0,o=o<<21|o>>>11,o=o+e|0,(e>>>0)/4294967296}};this.prngA=new e(hash.substr(2,32)),this.prngB=new e(hash.substr(34,32));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}random_num(e,a){return e+(a-e)*this.random_dec()}random_int(e,a){return Math.floor(this.random_num(e,a+1))}random_bool(e){return this.random_dec()<e}random_choice(e){return e[this.random_int(0,e.length-1)]}}function getParams(e){const a=["On","Off"],r=["Curve","Straight","Mix"],o=["Conic","Radial","Mix","Solid"],t=["Accend","Descend","Mix"],n=colorScheme[e[1]%colorScheme.length];let i=e[10]%9,d=e[12]%9;switch(i){case 0:case 1:case 2:case 3:case 4:case 5:case 6:i=t[0];break;case 7:i=t[1];break;case 8:i=t[2]}switch(d){case 0:case 2:case 4:case 6:d=r[0];break;case 1:case 3:case 5:case 7:d=r[2];break;case 8:d=r[1]}return{Frame:e[0]%10>3?"On":"Off",Palette:n.name,Colors:n.colors,Composition:e[2]%10>5?"Random":"Packing",Shear:a[e[3]%a.length],Shape:r[e[8]%r.length],Order:i,Gradient:o[e[5]%o.length],Constant:1+e[12]%10,Spot:e[13]%2==0?"Back":"Front"}}const colorScheme=[{name:"Golden Thread Butterfly",colors:["#f19b4e","#7f6640","#dc5845","#e4d6c8","#929e79","#472c2a"]},{name:"Navy Lion Peony",colors:["#83834f","#e0c786","#30363d","#db2f38","#66989c","#e9ded1"]},{name:"Charcoal Wind",colors:["#151015","#511a28","#8e563a","#fcfbfa","#bf9969","#718282"]},{name:"Wisteria Spring",colors:["#e6bc8a","#da4742","#202125","#909062","#dba380","#dcc6b9"]},{name:"Fragrant Ground",colors:["#73924d","#eb9f48","#b19564","#aabcb2","#f0e3d7","#6b4b2b"]},{name:"Lagenaria Siceraria",colors:["#f0ebe1","#d8ccb3","#cd2a41","#8bc08f","#f69fac","#c4714c"]},{name:"Tang grass",colors:["#f9f5ec","#d8ae6a","#d4824b","#588c92","#89bfb3","#b55847"]},{name:"Pearl and Dragon",colors:["#dad7c3","#c7895a","#343530","#899c63","#60827d","#d6b58a"]},{name:"Red Dragon",colors:["#e5e9e9","#da2034","#8db4bb","#4f6a31","#6ab26d","#e4bc89"]},{name:"Phoenix Peony",colors:["#3c3e46","#ddded7","#c07552","#5b6984","#809c73","#c3ae98"]},{name:"Kara Ori",colors:["#4d4638","#f77843","#fbc836","#d8b85a","#6c6e47","#b0e3ee"]},{name:"Yu-Zen Dyeing",colors:["#f5da30","#338ab6","#8a8740","#73563f","#332321","#e0dfdf"]},{name:"Bird and Flower",colors:["#abb163","#e9e1cb","#9b7c4a","#74a7a0","#e46641","#5a5925"]},{name:"Japanese Ink",colors:["#000000","#aaaaaa","#7f7f7f","#c9c9c9","#ffffff","#7f6640"]}],vert="\nprecision highp float;\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nvarying vec2 vVertTexCoord;\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vVertTexCoord = aTexCoord;\n}\n",frag="\nprecision highp float;\nvarying vec2 vVertTexCoord;\n\nuniform sampler2D source;\nuniform float noiseSeed;\nuniform float noiseAmount;\n\nfloat rand(vec2 n) { \n return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);\n}\n\nvoid main() {\n // GorillaSun's grain algorithm\n vec4 inColor = texture2D(source, vVertTexCoord);\n gl_FragColor = clamp(inColor + vec4(\n mix(-noiseAmount, noiseAmount, fract(noiseSeed + rand(vVertTexCoord * 1981.820))),\n mix(-noiseAmount, noiseAmount, fract(noiseSeed + rand(vVertTexCoord * 1990.116))),\n mix(-noiseAmount, noiseAmount, fract(noiseSeed + rand(vVertTexCoord * 2020.118))),\n 0.\n ), 0., 1.);\n}\n";function setupFrame(e,a,r,o){drawFrame(createPoints(e,a,r,o))}function createPoints(e,a,r,o){let t=[createVector(e,a),createVector(e+r,a),createVector(e+r,a+o),createVector(e,a+o)],n=[];for(let e=0;e<t.length;e++){let a=t[e],i=t[(e+1)%t.length],d="On"==params.Shear?min(r,o)/50:0;for(let e=0;e<1;e+=.1){let t=p5.Vector.lerp(a,i,e),s=noise(r/2+t.x/r,o/2+t.y/o)*TWO_PI;t.add(p5.Vector.fromAngle(s).mult(d)),n.push(t)}}return n}function drawFrame(e){strokeWeight(.5*M),stroke(0,0,20),beginShape();for(let a=0;a<e.length;a++)vertex(e[a%e.length].x,e[a%e.length].y);endShape(CLOSE)}function createCirclePacking(e,a,r,o){let t=[];if("Random"==o)for(let o=0;o<e/2;o++){let e={x:(R.random_dec()-.5)*a,y:(R.random_dec()-.5)*r,diameter:r/15+R.random_dec()*r/15};t.push(e)}else{let o=0,n=100;for(;t.length<e;){let e={x:(R.random_dec()-.5)*a,y:(R.random_dec()-.5)*r,diameter:r/15+R.random_dec()*r/15},i=!0;for(let a of t)if(dist(e.x,e.y,a.x,a.y)<(e.diameter+a.diameter)/2){i=!1;break}if(i&&t.push(e),o++,o>n)break}}return t}function recursiveArc(e,a,r,o,t,n,i){if(i<0)return;if(r>o){let e=r;r=o,o=e}if(t>n){let e=t;t=n,n=e}push(),translate(e,a);let d=1e3*R.random_dec(),s=1e3*R.random_dec(),c=90*noise(d,s),l=r+(sin(d+a/100+c*i)/2+.5)*(o-r),f=t+(cos(s+e/100+c*i)/2+.5)*(n-t);0==i?(drawArc(0,0,r,l,t,f),drawArc(0,0,l,o,t,f),drawArc(0,0,r,l,f,n),drawArc(0,0,l,o,f,n)):(recursiveArc(0,0,r,l,t,f,i-1),recursiveArc(0,0,l,o,t,f,i-1),recursiveArc(0,0,r,l,f,n,i-1),recursiveArc(0,0,l,o,f,n,i-1)),pop()}function drawArc(e,a,r,o,t,n){let i,d=params.Colors.concat(),s=R.random_dec()>.5,c=R.random_choice([4,2,1,.5,1/4,1/8,1/16,1/32,1/64])*params.Constant/5,l=R.random_choice([4,2,1,.5,1/4,1/8,1/16,1/32,1/64])*params.Constant/5;l=c,d=arrayShuffle(d),push(),translate(e,a),rotate(90*R.random_dec());let f=radians(r);switch("Safari"==browserName&&(f+=PI/2),params.Gradient){case"Conic":i=drawingContext.createConicGradient(f,0,0),s=!0;break;case"Solid":case"Mix":i=s?drawingContext.createConicGradient(f,0,0):drawingContext.createRadialGradient(0,0,max(0,t/2),0,0,max(0,2*n));break;case"Radial":i=drawingContext.createRadialGradient(0,0,max(0,t/2),0,0,max(0,3*n/2)),s=!1}if(s&&"Solid"!=params.Gradient?(i.addColorStop(0,d[0]),i.addColorStop(1,d[0]),i.addColorStop(constrain(1*(o-r)/360/2,0,1),d[2]),i.addColorStop(constrain(1*(o-r)/360,0,1),d[1])):"Solid"!=params.Gradient&&(i.addColorStop(0,d[0]),i.addColorStop(.5,d[2]),i.addColorStop(1,d[1])),"Solid"==params.Gradient){let e,a=0;for(let r=0;r<o/360;r+=e){let t=decPairs[a++%decPairs.length];e=o/(decPairs[t%decPairs.length]%5+2)/360,i.addColorStop(r,d[t%d.length]),0==r&&i.addColorStop(1,d[t%d.length]),i.addColorStop(constrain(r+e-.001,0,1),d[3*t++%d.length])}}o-r<3||t<5*M||n-t<30*M?(noFill(),noStroke()):(stroke(0,0,20),strokeWeight(.5*M),fill(0,0,90)),drawingContext.fillStyle=i,push();let h=R.random_dec()>.5?-1:1;"On"==params.Shear&&(shearX(h*R.random_dec()*9),shearY(h*R.random_dec()*9));let m=1,u=[];switch(beginShape(),params.Shape){case"Straight":m=R.random_dec()<.9?.334*abs(o-r):1;break;case"Curve":m=1;break;case"Mix":m=R.random_dec()>.5?1:.5*abs(o-r)}for(let e=r;e<=o;e+=m){u.push(m);let a=n*sin(.5*e)*map(sin(map(e,r,o,0,360*c)),-1,1,.5,1);vertex(cos(e)*a,sin(e)*a)}u.reverse();for(let e=o;e>=r;e-=m){m=u[0],u.splice(0,1);let a=t*sin(.5*e)*map(sin(map(e,r,o,0,7*l)),-1,1,.5,1);vertex(cos(e)*a,sin(e)*a)}endShape(CLOSE),pop(),pop()}function arrayShuffle(e){for(let a=e.length-1;0<a;a--){let r=Math.floor(R.random_dec()*(a+1)),o=e[a];e[a]=e[r],e[r]=o}return e}function drawSpot(e,a,r,o){push(),translate(e,a),drawingContext.shadowBlur=0,drawingContext.shadowColor=null;for(let e=0;e<o;e++){let e=360*R.random_dec(),a=randomGaussian(.1,.5)*r/2;blob(cos(e)*a,sin(e)*a,1+randomGaussian(.1,R.random_dec())*a/25)}blendMode(BLEND),pop()}function blob(e,a,r){push(),translate(e,a),noStroke(),decPairs[8]%2==0?(blendMode(ADD),fill(0,0,100,4)):(blendMode(MULTIPLY),fill(0,0,0,2)),curveTightness(-2*R.random_dec()-1),beginShape();let o=[];for(let e=0;e<3;e++){let a=120*e,t=r/2+R.random_dec()*r,n={x:cos(a)*t,y:sin(a)*t};curveVertex(n.x,n.y),o.push(n)}for(let e of o)curveVertex(e.x,e.y);endShape(),pop()}function drawPostEffect(){imageMode(CENTER);let e=getTexture(width,height);push(),"Chrome"==browserName?drawingContext.globalAlpha=.6:("Safari"==browserName||"Mozilla Firefox"==browserName)&&(drawingContext.globalAlpha=.05),image(e,0,0,width,height),e.remove(),drawingContext.globalAlpha=1,pop(),grainBuffer.clear(),grainBuffer.reset(),grainBuffer.push(),grainBuffer.shader(grainShader),grainShader.setUniform("source",mainCanvas),grainShader.setUniform("noiseAmount",map(M,.1,2,.001,.1)),grainBuffer.rectMode(CENTER),grainBuffer.noStroke(),grainBuffer.rect(0,0,width,height),grainBuffer.pop(),push(),image(grainBuffer,0,0,width,height),grainBuffer.remove(),resetShader(),pop()}function getTexture(e,a){const r=createGraphics(e,a);r.randomSeed(seed),r.colorMode(HSB,360,100,100,100),r.angleMode(DEGREES),r.strokeWeight(1*M);for(let o=0;o<e;o+=20*e/defaultWidth)for(let t=0;t<a;t+=20*a/defaultHeight){let n=R.random_num(75,105),i=max(e,a)/2;r.stroke(0,0,100,3*R.random_dec()),r.line(o+r.cos(n)*i,t+r.sin(n)*i,o+r.cos(n+180)*i,t+r.sin(n+180)*i)}return r}
The central theme of this series, featuring recursive divisions of circles and polygons, originated from sketches in September 2022. As is often the case for me, my sketches begin without a vital purpose, taking on a fluid and undefined quality. They resemble malleable clay, combining and reworking multiple small ideas until mutable elements and immutable structures emerge. I have crafted the present collection of works by refining and developing these structures, pushing them as far away from the original image as possible while ensuring coherence. Incorporating a color palette inspired by traditional Japanese dyes, shading techniques mindful of harmony, and methods such as circle packing and transformation builds upon the foundation of my previous work. However, this new collection consciously explores the concepts of convergence and divergence within and beyond the canvas. Furthermore, I have created a unique and remarkable series by envisioning their display in a traditional Japanese residence, such as the historic Asakura House. * High-resolution images can be exported by pressing the "S" key.