memoscan
← all memos

Memo 0x16a32107…a5ebd6 on Ethereum

eK<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" > <title>Linearity | Motus Art</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/p5.js"></script> </head> <body> <style>html{height:100%}html,body{min-height:100%;margin:0;padding:0}canvas{margin:auto;padding:0;display:block;position:absolute;inset:0}</style><script>window.METADATA = {}; function onMetadata() { window.top?.postMessage( `genart:metadata:${JSON.stringify(window.METADATA)}`, "*" ); } function onDone(index = 0) { window["RENDERED_INDEX"] = index; window.top?.postMessage(`genart:done:${index}`, "*"); window.onImageRendered && window.onImageRendered(index); } function random_hash() { let chars = "0123456789abcdef"; let result = "0x"; for (let i = 64; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; return result; } function setMetadata(prop, value) { window.METADATA[prop] = value; } function getMetadata(prop) { return window.METADATA[prop]; } class Random { seed; decimals; constructor(hash, decimals = 3) { this.seed = parseInt(hash.slice(0, 16), 16); this.decimals = decimals; } random_dec() { this.seed ^= this.seed << 13; this.seed ^= this.seed >> 17; this.seed ^= this.seed << 5; return ( ((this.seed < 0 ? ~this.seed + 1 : this.seed) % 10 ** this.decimals) / 10 ** this.decimals ); } random_between(a, b) { return a + (b - a) * this.random_dec(); } random_int(a, b) { return Math.floor(this.random_between(a, b + 1)); } random_choice(x) { return x[Math.floor(this.random_between(0, x.length * 0.99))]; } } function createKeyListeners(ls) { const l = {}; const add = (ks, f) => (l[ks.join("_")] = f); const c = (n) => l[n] && l[n](); const d = document.body; let ks = []; d.addEventListener("keydown", (e) => { ks.push(e.key); if (ks.length == 2) c(ks.join("_")); }); d.addEventListener("keyup", () => { if (ks.length == 1) c(ks.join("_")); ks = []; }); ls.forEach((l) => add(l.keys, l.fn)); } </script><script id="genart-options">const options = { hash: random_hash() }</script><script>function e(e,i,r,n,a,o,c,l){var h,b,A,f,d,g=o,u=l,R=e,S=i,P=r,M=n,p=a;Math.abs(g)<1e-4?h=P+p:Math.abs(g)>.9999?h=R+p:(b=(S-R)*Math.abs(u),h=P-Math.abs(b),A=Math.abs(p/c),f=new t(P,S,P,R),d=new t(M,S,M,R)),this.getNextLine=function(){if(Math.abs(g)<1e-4){if(h<M){var e=[h,R,h,S];return h+=p,e}}else if(Math.abs(g)>.9999){if(h<S){e=[P,h,M,h];return h+=p,e}}else{var i=h-b/2,r=h+b/2,n=S,a=R;if(h<M+b){for(;i<P&&r<P||i>M&&r>M;)if(i=(h+=A)-b/2,r=h+b/2,h>M+b)return null;var o=new t(i,n,r,a);return o.compare(f)==s.INTERSECTS&&(i=o.getIntersectionX(),n=o.getIntersectionY()),o.compare(d)==s.INTERSECTS&&(r=o.getIntersectionX(),a=o.getIntersectionY()),u>0&&(i=M-(i-P),r=M-(r-P)),h+=A,e=[i,n,r,a]}}return null}}function t(e,t,i,r){var n,a,o,c,l=e,h=t,b=i,A=r,f=Number.MAX_VALUE,d=Number.MAX_VALUE;a=l-b,o=b*h-l*A,c=0==(n=A-h)&&0==a&&0==o,this.compare=function(e){if(this.isUndefined()||e.isUndefined())return s.UNDEFINED;var t=Number.MAX_VALUE,i=Number.MAX_VALUE,r=0,c=0;return Math.abs(a)>1e-5&&(t=-n/a,r=-o/a),Math.abs(e.getB())>1e-5&&(i=-e.getA()/e.getB(),c=-e.getC()/e.getB()),t==Number.MAX_VALUE?i==Number.MAX_VALUE?-o/n!=-e.getC()/e.getA()?s.SEPARATE:h>=Math.min(e.getPy1(),e.getPy2())&&h<=Math.max(e.getPy1(),e.getPy2())?(f=l,d=h,s.INTERSECTS):A>=Math.min(e.getPy1(),e.getPy2())&&A<=Math.max(e.getPy1(),e.getPy2())?(f=b,d=A,s.INTERSECTS):s.SEPARATE:(h-(d=i*(f=l)+c))*(d-A)<-1e-5||(e.getPy1()-d)*(d-e.getPy2())<-1e-5||Math.abs(e.getA())<1e-5&&(e.getPx1()-f)*(f-e.getPx2())<-1e-5?s.SEPARATE:s.INTERSECTS:i==Number.MAX_VALUE?(f=e.getPx1(),d=t*f+r,(e.getPy1()-d)*(d-e.getPy2())<-1e-5||(h-d)*(d-A)<-1e-5||Math.abs(n)<1e-5&&(l-f)*(f-b)<-1e-5?s.SEPARATE:s.INTERSECTS):t==i?r!=c?s.SEPARATE:l>=Math.min(e.getPx1(),e.getPx2())&&l<=Math.max(e.getPy1(),e.getPy2())?(f=l,d=h,s.INTERSECTS):b>=Math.min(e.getPx1(),e.getPx2())&&b<=Math.max(e.getPx1(),e.getPx2())?(f=b,d=A,s.INTERSECTS):s.SEPARATE:(d=t*(f=(c-r)/(t-i))+r,(l-f)*(f-b)<-1e-5||(e.getPx1()-f)*(f-e.getPx2())<-1e-5?s.SEPARATE:s.INTERSECTS)},this.getPx1=function(){return l},this.getPy1=function(){return h},this.getPx2=function(){return b},this.getPy2=function(){return A},this.isUndefined=function(){return c},this.getA=function(){return n},this.getB=function(){return a},this.getC=function(){return o},this.getIntersectionX=function(){return f},this.getIntersectionY=function(){return d},this.getLength=function(e,t,s,i){var r=s-e,n=i-t;return Math.sqrt(r*r+n*n)}}var s={LEFT:1,RIGHT:2,INTERSECTS:3,AHEAD:4,BEHIND:5,SEPARATE:6,UNDEFINED:7},i=function(i){this.sketch=i||window,this.bowing=1,this.roughness=1,this.maxOffset=2,this.numEllipseSteps=9,this.ellipseInc=2*Math.PI/this.numEllipseSteps,this.getOffset=function(e,t){return this.roughness*(this.sketch.random()*(t-e)+e)},this.buildEllipse=function(e,t,s,i,r,n){var a=this.getOffset(-.5,.5)-Math.PI/2;this.sketch.beginShape(),this.sketch.curveVertex(this.getOffset(-r,r)+e+.9*s*Math.cos(a-this.ellipseInc),this.getOffset(-r,r)+t+.9*i*Math.sin(a-this.ellipseInc));for(var o=a;o<2*Math.PI+a-.01;o+=this.ellipseInc)this.sketch.curveVertex(this.getOffset(-r,r)+e+s*Math.cos(o),this.getOffset(-r,r)+t+i*Math.sin(o));this.sketch.curveVertex(this.getOffset(-r,r)+e+s*Math.cos(a+2*Math.PI+.5*n),this.getOffset(-r,r)+t+i*Math.sin(a+2*Math.PI+.5*n)),this.sketch.curveVertex(this.getOffset(-r,r)+e+.98*s*Math.cos(a+n),this.getOffset(-r,r)+t+.98*i*Math.sin(a+n)),this.sketch.curveVertex(this.getOffset(-r,r)+e+.9*s*Math.cos(a+.5*n),this.getOffset(-r,r)+t+.9*i*Math.sin(a+.5*n)),this.sketch.endShape()},this.getIntersectingLines=function(e,i,r){for(var n=[],a=new t(e[0],e[1],e[2],e[3]),o=0;o<i.length;o++){var c=new t(i[o],r[o],i[(o+1)%i.length],r[(o+1)%i.length]);a.compare(c)==s.INTERSECTS&&n.push([a.getIntersectionX(),a.getIntersectionY()])}return n},this.scribbleLine=function(e,t,s,i){var r=(e-s)*(e-s)+(t-i)*(t-i),n=this.maxOffset;this.maxOffset*this.maxOffset*100>r&&(n=Math.sqrt(r)/10);var a=n/2,o=.2+.2*this.sketch.random(),c=this.bowing*this.maxOffset*(i-t)/200,l=this.bowing*this.maxOffset*(e-s)/200;c=this.getOffset(-c,c),l=this.getOffset(-l,l),this.sketch.noFill(),this.sketch.beginShape(),this.sketch.vertex(e+this.getOffset(-n,n),t+this.getOffset(-n,n)),this.sketch.curveVertex(e+this.getOffset(-n,n),t+this.getOffset(-n,n)),this.sketch.curveVertex(c+e+(s-e)*o+this.getOffset(-n,n),l+t+(i-t)*o+this.getOffset(-n,n)),this.sketch.curveVertex(c+e+2*(s-e)*o+this.getOffset(-n,n),l+t+2*(i-t)*o+this.getOffset(-n,n)),this.sketch.curveVertex(s+this.getOffset(-n,n),i+this.getOffset(-n,n)),this.sketch.vertex(s+this.getOffset(-n,n),i+this.getOffset(-n,n)),this.sketch.endShape(),this.sketch.beginShape(),this.sketch.vertex(e+this.getOffset(-a,a),t+this.getOffset(-a,a)),this.sketch.curveVertex(e+this.getOffset(-a,a),t+this.getOffset(-a,a)),this.sketch.curveVertex(c+e+(s-e)*o+this.getOffset(-a,a),l+t+(i-t)*o+this.getOffset(-a,a)),this.sketch.curveVertex(c+e+2*(s-e)*o+this.getOffset(-a,a),l+t+2*(i-t)*o+this.getOffset(-a,a)),this.sketch.curveVertex(s+this.getOffset(-a,a),i+this.getOffset(-a,a)),this.sketch.vertex(s+this.getOffset(-a,a),i+this.getOffset(-a,a)),this.sketch.endShape()},this.scribbleCurve=function(e,t,s,i,r,n,a,o){this.sketch.bezier(e+this.getOffset(-2,2),t+this.getOffset(-2,2),r+this.getOffset(-4,4),n+this.getOffset(-3,3),a+this.getOffset(-3,3),o+this.getOffset(-3,3),s+this.getOffset(-1,1),i+this.getOffset(-1,1)),this.sketch.bezier(e+this.getOffset(-2,2),t+this.getOffset(-2,2),r+this.getOffset(-3,3),n+this.getOffset(-3,3),a+this.getOffset(-3,3),o+this.getOffset(-4,4),s+this.getOffset(-2,2),i+this.getOffset(-2,2))},this.scribbleRect=function(e,t,s,i){var r=s/2,n=i/2,a=Math.min(e-r,e+r),o=Math.max(e-r,e+r),c=Math.min(t-n,t+n),l=Math.max(t-n,t+n);this.scribbleLine(a,c,o,c),this.scribbleLine(o,c,o,l),this.scribbleLine(o,l,a,l),this.scribbleLine(a,l,a,c)},this.scribbleRoundedRect=function(e,t,s,i,r){var n=s/2,a=i/2;if(0==r||r>n||r>a)this.scribbleRect(e,t,s,i);else{var o=Math.min(e-n,e+n),c=Math.max(e-n,e+n),l=Math.min(t-a,t+a),h=Math.max(t-a,t+a);this.scribbleLine(o+r,l,c-r,l,1.5),this.scribbleLine(c,l+r,c,h-r,1.5),this.scribbleLine(c-r,h,o+r,h,1.5),this.scribbleLine(o,h-r,o,l+r,1.5),this.scribbleCurve(o+r,l,o,l+r,o+.1*r,l+.1*r,o+.1*r,l+.1*r),this.scribbleCurve(c-r,l,c,l+r,c-.1*r,l+.1*r,c-.1*r,l+.1*r),this.scribbleCurve(o+r,h,o,h-r,o+.1*r,h-.1*r,o+.1*r,h-.1*r),this.scribbleCurve(c-r,h,c,h-r,c-.1*r,h-.1*r,c-.1*r,h-.1*r)}},this.scribbleEllipse=function(e,t,s,i){var r=Math.abs(s/2),n=Math.abs(i/2);r+=this.getOffset(.05*-r,.05*r),n+=this.getOffset(.05*-n,.05*n),this.buildEllipse(e,t,r,n,1,this.ellipseInc*this.getOffset(.1,this.getOffset(.4,1))),this.buildEllipse(e,t,r,n,1.5,0)},this.scribbleFilling=function(t,s,i,r){if(null!=t&&null!=s&&0!=t.length&&0!=s.length){for(var n=this.sketch.radians(r%180),a=Math.cos(n),o=Math.sin(n),c=Math.tan(n),l=t[0],h=t[0],b=s[0],A=s[0],f=1;f<t.length;f++)l=Math.min(l,t[f]),h=Math.max(h,t[f]),b=Math.min(b,s[f]),A=Math.max(A,s[f]);for(var d=new e(b-1,A+1,l-1,h+1,i,o,a,c),g=null;null!=(g=d.getNextLine());){var u=this.getIntersectingLines(g,t,s);for(f=0;f<u.length;f+=2)if(f<u.length-1){var R=u[f],S=u[f+1];this.scribbleLine(R[0],R[1],S[0],S[1],2)}}}}};var r={easeInCubic:e=>(e/=1)*e*e,easeInExpo:e=>0==e?0:Math.pow(2,10*(e/1-1)),easeInOutCubic:(e,t,s)=>(e/=s/2)<1?s/2*e*e*e+t:s/2*((e-=2)*e*e+2)+t};var n=Ellipses=e=>{const t=PARAMS.cells[e.cell],s=round(25*t.nestedAmount)+1;strokeWeight(10*r.easeInExpo(1-t.nestedAmount)+.5);for(let t=1;t<=s;t++){const i=floor(random(4));push(),translate(e.positionXoffset+(e.columns[e.i].width*e.areaWidth-PARAMS.gap)/2,e.positionYoffset+(e.columns[e.i].rows[e.j]*e.areaHeight-PARAMS.gap)/2),rotate(i*HALF_PI);let r=e.columns[e.i].width*e.areaWidth-PARAMS.gap,n=e.columns[e.i].rows[e.j]*e.areaHeight-PARAMS.gap;i%2==1&&([r,n]=[n,r]),r*=t/s,n*=t/s,e.scribble.scribbleEllipse(0,0,r,n),pop()}},a=Hatchings=(e,t)=>{const s=PARAMS.cells[e.cell];let i=(e.columns[e.i].width*e.areaWidth-PARAMS.gap)/2,n=(e.columns[e.i].rows[e.j]*e.areaHeight-PARAMS.gap)/2;push(),translate(e.positionXoffset+i,e.positionYoffset+n);const a=s.orientation;rotate(HALF_PI*a),a%2==1&&([i,n]=[n,i]);const o=s.hatchingDensity;let c=max(map(o,0,1,1,min(i,n)/3),1),l=10*o+.01;switch(l=constrain(l,.01,c/2),e.scribble.bowing=.5*r.easeInCubic(o)+1,e.scribble.roughness=r.easeInCubic(o)+.25,strokeWeight(l),t){case"Normal":default:e.scribble.scribbleFilling([-i,i,i,-i],[-n,-n,n,n],c,PARAMS.shapeHatchingAngle);break;case"Arrow":e.scribble.scribbleFilling([i,-i,i,-i],[-n,-n,n,n],c,0);break;case"Crossed":e.scribble.scribbleFilling([-i,i,i,-i],[-n,n,-n,n],c,0);break;case"Triangle":e.scribble.scribbleFilling([-i,i,i],[-n,-n,n],c,PARAMS.shapeHatchingAngle);break;case"Diamond":e.scribble.scribbleFilling([0,i,0,-i],[-n,0,n,0],c,s.dec<.25?PARAMS.shapeHatchingAngle:0);break;case"Lighting":e.scribble.scribbleFilling([0,i,-i,0],[-n,0,0,n],c,0)}pop()},o=Rectangles=(e,t)=>{const s=PARAMS.cells[e.cell];let i=round(15*s.nestedAmount)+1,n="scribbleRect",a=8*r.easeInCubic(1-s.nestedAmount)+.5;t&&(n="scribbleRoundedRect",i=max(1,round(i/2)),e.scribble.bowing=1,e.scribble.roughness=1,a/=2),t&&!PARAMS.shapeSingleToggle&&(PARAMS.shapeRoundedRadius=abs(PARAMS.shapeRoundedRadius)),strokeWeight(a),push();let o=e.columns[e.i].width*e.areaWidth-PARAMS.gap,c=e.columns[e.i].rows[e.j]*e.areaHeight-PARAMS.gap;translate(e.positionXoffset+o/2,e.positionYoffset+c/2);for(let t=1;t<=i;t++){const s=o*t/i,r=c*t/i,a=max(1.2*-PARAMS.border,min(s/2,r/2)*PARAMS.shapeRoundedRadius);e.scribble[n](0,0,s,r,a)}pop()},c=Special=e=>{const t=PARAMS.cells[e.cell];let s,i,n;strokeWeight(10*r.easeInExpo(1-t.nestedAmount)+.5),push();let a=e.columns[e.i].width*e.areaWidth-PARAMS.gap,o=e.columns[e.i].rows[e.j]*e.areaHeight-PARAMS.gap;switch(translate(e.positionXoffset+a/2,e.positionYoffset+o/2),floor(5*t.dec)){case 0:PARAMS.hasAnimatedCell="Palmtree";const r=20*t.hatchingDensity+8;for(let t=0;t<=TWO_PI;t+=PI/r)strokeCap(ROUND),e.scribble.scribbleCurve(cos(t+3*PARAMS.tickCounter)*(a/2),sin(t+PARAMS.tickCounter)*(o/2),0,o/2,0,0,0,o/2);break;case 1:PARAMS.hasAnimatedCell="OverlappingSquares";const l=8;for(let t=1;t<l;t++){const s=t/l;e.scribble.scribbleRect(0,0,s*a,s*o)}push(),rotate(QUARTER_PI);const h=sqrt(min(a,o)*min(a,o)+min(a,o)*min(a,o))/2;for(let t=1;t<l;t++){rotate(.3*PARAMS.tickCounter);const s=t/l;e.scribble.scribbleRect(0,0,s*h,s*h)}pop();break;case 2:PARAMS.hasAnimatedCell="BalleticGrid",n=7,s=a/n,i=o/n;for(let t=0;t<n;t++)for(let r=0;r<n;r++){const c=1.4*abs(sin(t/(r+1)+2*PARAMS.tickCounter));let l=-a/2+s*t+s/2;const h=-o/2+i*r+i/2;r%2==0&&(l+=s/2),r%2==0&&t===n-1||e.scribble.scribbleRect(l,h,s*c,i*c)}break;case 3:PARAMS.hasAnimatedCell="DiamondGrid",n=7,s=a/n,i=o/n;const b=min(s,i);for(let t=0;t<n;t++)for(let r=0;r<n;r++){const n=1.5*abs(sin(t*t+2*PARAMS.tickCounter));let c=-a/2+s*t+s/2;const l=-o/2+i*r+i/2;push(),translate(c,l),rotate(QUARTER_PI),e.scribble.scribbleRect(0,0,b*n,b*n),pop()}break;case 4:PARAMS.hasAnimatedCell="Cubes";const A=sqrt(a*a+a*a)/4,f=[{x:-A,y:-A,z:-A},{x:A,y:-A,z:-A},{x:A,y:A,z:-A},{x:-A,y:A,z:-A},{x:-A,y:-A,z:A},{x:A,y:-A,z:A},{x:A,y:A,z:A},{x:-A,y:A,z:A}];var c=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[1,5],[2,6],[3,7]];cubeRotateZ=.5*PARAMS.tickCounter*TWO_PI;for(let e of f){let t=e.x*cos(cubeRotateZ)-e.y*sin(cubeRotateZ),s=e.x*sin(cubeRotateZ)+e.y*cos(cubeRotateZ);e.x=t,e.y=s}cubeRotateX=.2*PARAMS.tickCounter*TWO_PI;for(let e of f){let t=e.y*cos(cubeRotateX)-e.z*sin(cubeRotateX),s=e.y*sin(cubeRotateX)+e.z*cos(cubeRotateX);e.y=t,e.z=s}cubeRotateY=.1*PARAMS.tickCounter*TWO_PI;for(let e of f){let t=e.z*sin(cubeRotateY)+e.x*cos(cubeRotateY),s=e.z*cos(cubeRotateY)-e.x*sin(cubeRotateY);e.x=t,e.z=s}e.scribble.bowing=1.75,e.scribble.roughness=2.5;for(let t=0;t<2;t++){push(),scale(map(t,0,1,.75,1)),t%2==0&&scale(-1,1);for(let t of c)e.scribble.scribbleLine(f[t[0]].x,f[t[0]].y,f[t[1]].x,f[t[1]].y);pop()}}pop()},l=Triangles=e=>{const t=PARAMS.cells[e.cell],s=round(15*t.nestedAmount)+1;strokeWeight(10*r.easeInExpo(1-t.nestedAmount)+.5);for(let i=1;i<=s;i++){push();let r=(e.columns[e.i].width*e.areaWidth-PARAMS.gap)/2,n=(e.columns[e.i].rows[e.j]*e.areaHeight-PARAMS.gap)/2,a=e.columns[e.i].width*e.areaWidth-PARAMS.gap,o=e.columns[e.i].rows[e.j]*e.areaHeight-PARAMS.gap;translate(e.positionXoffset+r,e.positionYoffset+n),rotate(t.orientation*HALF_PI),t.orientation%2==1&&([r,n,a,o]=[n,r,o,a]);const c=i/s,l=r*c,h=n*c;translate(0,-.2*o*c+.2*o),e.scribble.scribbleLine(0,-h,l,h),e.scribble.scribbleLine(l,h,-l,h),e.scribble.scribbleLine(-l,h,0,-h),pop()}};const h=["Ellipses","Rectangles","Rectangles.Rounded","Triangles","Hatch.Normal","Hatch.Arrow","Hatch.Crossed","Hatch.Triangle","Hatch.Diamond","Hatch.Lighting","Curves"],b=e=>{switch(e.scribble.bowing=1,e.scribble.roughness=1,e.scribble.maxOffset=2,strokeCap(PARAMS.cells[e.cell].strokeCap),noFill(),PARAMS.cells[e.cell].type){case"Hatch":default:const t=PARAMS.shape.substr(6);return a(e,t);case"Rectangles":return o(e);case"Rectangles.Rounded":return o(e,!0);case"Triangles":return l(e);case"Ellipses":return n(e);case"Curves":return(e=>{const t=PARAMS.cells[e.cell];let s=round(25*t.nestedAmount)+1;strokeWeight(10*r.easeInExpo(1-t.nestedAmount)+.5),e.positionXoffset,e.positionYoffset;let i=e.columns[e.i].width*e.areaWidth-PARAMS.gap,n=e.columns[e.i].rows[e.j]*e.areaHeight-PARAMS.gap;switch(push(),translate(e.positionXoffset+(e.columns[e.i].width*e.areaWidth-PARAMS.gap)/2,e.positionYoffset+(e.columns[e.i].rows[e.j]*e.areaHeight-PARAMS.gap)/2),PARAMS.shapeCurvePattern){case"denseGrid":case"3dcurves":case"valley":case"smoke":case"scribbled":case"infinity":rotate(t.orientation*HALF_PI),t.orientation%2==1&&([i,n]=[n,i]);break;case"reeds":t.orientation%2==1&&scale(-1,1)}switch(PARAMS.shapeCurvePattern){case"denseGrid":case"scribbled":s=round(s/2)}e.scribble.bowing=1.5,e.scribble.roughness=2,e.scribble.maxOffset=1;for(let r=0;r<=s;r++){const a=r/s;switch(PARAMS.shapeCurvePattern){case"denseGrid":e.scribble.bowing=1.1,e.scribble.roughness=1.5,e.scribble.maxOffset=1.5,e.scribble.scribbleLine(-.5*i,-.5*n,-.5*i+i*a,-.5*n+n),e.scribble.scribbleLine(-.5*i+i,-.5*n+n,-.5*i,-.5*n+n*a);break;case"3dcurves":e.scribble.bowing=1.5,e.scribble.roughness=2,e.scribble.maxOffset=1,e.scribble.scribbleLine(-.5*i+i*a,-.5*n,-.5*i+i,-.5*n+n*a),e.scribble.scribbleLine(-.5*i,-.5*n+n*a,-.5*i+i*a,n+-.5*n);break;case"valley":e.scribble.scribbleCurve(-.5*i+i*a,-.5*n,-.5*i+i*a,-.5*n+n,-.5*i+i,-.5*n,-.5*i+i,-.5*n+n),e.scribble.scribbleCurve(-.5*i+i*a,-.5*n,-.5*i+i*a,-.5*n+n,-.5*i,-.5*n+n,-.5*i,-.5*n);break;case"reeds":e.scribble.scribbleCurve(-.5*i,-.5*n,-.5*i+i,-.5*n+n,-.5*i+i*a,-.5*n+n*a,-.5*i+i,-.5*n);break;case"bikeSpokes":e.scribble.roughness=6;const o=2*max(5,round(s)),c=t.dec<.5?.25:.75;for(let t=0;t<TWO_PI;t+=TWO_PI/o)e.scribble.scribbleCurve(0,0,cos(t)*i*.5,sin(t)*n*.5,cos(t+1)*i*.25,sin(t+1)*n*.25,cos(t+1)*i*c,sin(t+1)*n*c);break;case"spider":e.scribble.scribbleCurve(0,0,i*(r%2-.5),-1*n+.25*n*a+.5*n,0,.5*n,0,-.5*n),e.scribble.scribbleCurve(0,0,i*(r%2-.5),n+-.25*n*a+-.5*n,0,.5*n,0,-.5*n);break;case"plant":const l=t.dec<.5?TWO_PI:PI;e.scribble.scribbleCurve(0,.5*n,cos(a*l)*i/2,sin(a*l)*-n/2,0,.5*n,0,-.5*n);break;case"smoke":e.scribble.scribbleCurve(.5*i,.5*n,-.5*i,-.5*n+n*a,0,.5*n,0,-.5*n);break;case"scribbled":e.scribble.scribbleCurve(0,0,cos(a*TWO_PI)*i/2,sin(a*TWO_PI)*-n/2,sin(a*TWO_PI)*i/2,cos(a*TWO_PI)*-n/2,sin(a*TWO_PI)*i/2,cos(a*TWO_PI)*-n/2);break;case"infinity":e.scribble.scribbleCurve(0,0,0,0,cos(a*TWO_PI)*i,sin(a*TWO_PI)*n,sin(a*TWO_PI)*i,cos(a*TWO_PI)*n)}}pop()})(e);case"Special":return c(e)}};function A(e,t){const s=new Array(e);for(let i=0;i<e;i++)s[i]=noise(i+t,(PARAMS.toggle_animate?PARAMS.tickCounter+=PARAMS.speed:PARAMS.tickCounter)/4),s[i]=max(s[i],.3);const i=s.reduce(((e,t)=>e+t));for(let t=0;t<e;t++)s[t]=s[t]*(1/i);return s}const f=()=>{let e=window.innerWidth,t=e*sqrt(2);return t>window.innerHeight&&(t=window.innerHeight,e=t/sqrt(2)),PARAMS.canvasScale=t/PARAMS.h,{w:round(e),h:round(t)}},d=()=>R.random_choice(["#f9f0de","#ebebe9","#eee","#f6eee3","#fffafa","#faf4e9","#ececec","#f8f0e6","#f2ecda"]),g=()=>R.random_choice(["#392b24","#927154","#2a70ae","#fab511","#385d32","#d83715","#5b3524","#a09684","#3f3e3a","#786e66","#8c4a50","#201c1d","#16474a","#133536","#0d1e5a","#592f56","#65136c","#284555","#412147","#2c52a0","#81556b","#6f624d","#c48337","#294fa1","#fb780d","#344764","#385866","#2b2c57","#1b3e4d","#683041","#ef929e","#844c16","#85172b","#45272f","#275353","#102920","#d14671","#b18e37","#163ba9","#0d254b","#ef9439","#964528","#615125","#f52d7d","#e93323","#90ac93","#1c3f4e","#6f5d2f","#515849","#6b4367","#294535","#353630","#3a83d1"]),u=[[233,59,243],[237,30,120],[66,212,202],[244,199,116]],S=e=>(R.random_dec()<.2?(PARAMS.theme="Dark",PARAMS.colBg=R.random_choice(["#18191d","#1c1c1c","#2c2c2c","#222","#111","#000","#222831","#212121"]),PARAMS.colStroke=R.random_choice(["#a0b08f","#3a83d1","#ff5faf","#afd700","#00afaf","#FFB2FF","#EA80FC","#B64FC8","#67e5e1","#fef14d","#c1ef4b","#afd2e2","#eec7ca","#d55164","#9857bd","#D09CFA","#30AADD","#43919B","#00FFC6","#6EDCD9","#F9D371","#93FFD8","#FF5403","#FBFF00","#7DEDFF"])):(PARAMS.theme="Light",PARAMS.colBg=d(),PARAMS.colStroke=g()),function(e){e.noStroke();for(let t=0;t<55e3;t++){const t=random(e.width),s=random(e.height),i=random(3,7);e.fill(...P.brownLight,.005),e.ellipse(t,s,i),e.fill(...P.brownDark,.005),e.ellipse(t,s+.1*i,i,.8*i)}}(e),function(e){e.stroke(...P.brownMid,.03);for(let t=0;t<75e3;t++){let t=0;t=random(-.25,.25);const s=random(e.width),i=random(e.height),r=random(3,15)/2;e.line(cos(t)*-r+s,sin(t)*-r+i,cos(t)*r+s,sin(t)*r+i)}}(e),PARAMS.canvas="Paper",e),P={brownLight:[208,187,163],brownMid:[146,113,84],brownDark:[57,43,36]};const M=[[170,210,240,.01],[113,201,152,.01],[237,.4],[252,154,154,.01]],p=[[208,187,163],[146,113,84],[57,43,36]],m=()=>{const e=createGraphics(round(PARAMS.w),round(PARAMS.h));e.pixelDensity(pixelDensity()),e.colorMode(RGB,255,255,255,1);const t=R.random_dec();return t<.01?(e=>{e.pixelDensity(1),e.background(0),e.loadPixels();for(let t=0;t<e.height;t++)for(let s=0;s<e.width;s++){const i=4*(t*e.width+s);let r=40*(noise(.005*s,.005*t)+.2*noise(.025*s,.025*t));e.pixels[i]=r,e.pixels[i+1]=r,e.pixels[i+2]=r}e.updatePixels(),PARAMS.canvas="Blackboard",PARAMS.theme="Dark",PARAMS.colBg=[0],PARAMS.colStroke=d()})(e):t<.02?(e=>{PARAMS.colBg=d(),e.background(PARAMS.colBg),e.stroke(...R.random_choice(M)),e.strokeWeight(1),e.translate(R.random_between(-10,0),R.random_between(-10,0));const t=round(R.random_between(10,40)),s=round(5*t);for(let i=0;i<=e.width;i+=t)for(let r=0;r<=e.height;r+=t)e.strokeWeight(1),r%s!=0&&i%s!=0||e.strokeWeight(2),e.line(i,0,i,e.height+20),e.line(0,r,e.width+20,r);PARAMS.canvas="Graphing",PARAMS.theme="Light",PARAMS.colStroke=g()})(e):t<.03?(e=>{PARAMS.colBg=d(),e.background(PARAMS.colBg),e.noStroke();for(let t=0;t<15e4;t++){const t=random(e.width),s=random(e.height),i=random(TWO_PI),r=random(3,20);e.stroke(...random(p),.035),e.line(cos(i)*-r+t,sin(i)*-r+s,cos(i)*r+t,sin(i)*r+s)}PARAMS.canvas="Fiber canvas",PARAMS.theme="Light",PARAMS.colStroke=g()})(e):t<.0325?(e=>{PARAMS.theme="Dark",PARAMS.canvas="Vaporwave",PARAMS.colStroke=R.random_choice(u),PARAMS.colBg="#110d3d";const t=u.filter((e=>e!==PARAMS.colStroke)),s=R.random_choice(t);e.background(PARAMS.colBg);const i=e.canvas.getContext("2d"),n=i.createLinearGradient(0,0,0,e.height);n.addColorStop(0,"rgba(17, 13, 60, 0.5)"),n.addColorStop(.4,"rgba(41, 16, 91, 0.5)"),n.addColorStop(.5,`rgba(${s.join(",")}, 0.5)`),n.addColorStop(.53,"rgba(101, 42, 142, 0.5)"),n.addColorStop(1,"rgba(17, 13, 60, 0.5)"),i.fillStyle=n,e.rect(0,0,e.width,e.height),e.stroke(...s,.4),e.strokeWeight(2);const a=R.random_between(20,50);for(let t=0;t<a;t++){e.line(map(t,0,a,0,e.width),.5*e.height,map(t,0,a,-3*e.width,4*e.width),e.height);const s=r.easeInCubic(t/a)*e.height*.5+.5*e.height;e.line(0,s,e.width,s)}})(e):S(e),e},k=()=>{const e=createGraphics(round(PARAMS.w),round(PARAMS.h));return e.pixelDensity(pixelDensity()),e.colorMode(RGB,255,255,255,1),function(e){const t=e.pixelDensity();e.loadPixels();for(let s=0;s<e.width*t*e.height*t*4;s+=4)e.pixels[s]=e.pixels[s+1]=e.pixels[s+2]=random(200),e.pixels[s+3]=30;e.updatePixels()}(e),function(e){e.noStroke(),e.fill(...P.brownDark,.05);for(let t=0;t<500;t++){const t=random(e.width),s=random(e.height),i=random(1,5);e.push(),e.translate(t,s),e.rotate(random(PI)),e.ellipse(0,0,i,i*random(.5,1)),e.pop()}}(e),e};function w(e){return e<15?"Packed":e<20?"Cozy":e<40?"Orderly":e>=45?"Spacious":void 0}var x=()=>{const e={canvas:PARAMS.canvas,theme:PARAMS.theme,gridSizeX:PARAMS.gridSizeX,gridSizeY:PARAMS.gridSizeY,gridSizeFlip:PARAMS.gridSizeFlip,gap:w(PARAMS.gap),shape:PARAMS.shape,hasAnimatedCell:PARAMS.hasAnimatedCell,hasDifferentShape:PARAMS.hasDifferentShape};Object.keys(e).forEach((t=>{setMetadata(t,e[t])})),onMetadata()};R=new Random(options.hash,4),R.random_distribute=()=>Math.pow(1.57923837*(R.random_dec()-.5),3)+.5,R.random_bell=(e,t)=>e+(t-e)*R.random_distribute(),window.PARAMS={w:1080,h:1080*Math.sqrt(2),border:Math.round(R.random_bell(5,100)),gridSizeX:Math.round(R.random_bell(1,5)),gridSizeY:Math.round(R.random_bell(1,9)),cells:[],gridSizeFlip:R.random_dec()<.5,gap:R.random_bell(10,50),shape:R.random_choice(h),shapeRoundedRadius:R.random_between(-1,1),shapeHatchingAngle:R.random_between(0,360),shapeCurvePattern:R.random_choice(["denseGrid","3dcurves","valley","reeds","bikeSpokes","spider","plant","smoke","scribbled","infinity"]),hasAnimatedCell:"False",hasDifferentShape:!1,tickCounter:0,speed:5e-4,toggle_overlay:!0,toggle_animate:!0,DEBUG:!1,randomSeed:4294967296*R.random_dec()>>>0,noiseSeed:4294967296*R.random_dec()>>>0};const O=new i;let v,C;windowResized=()=>{const e=f();resizeCanvas(e.w,e.h)},setup=()=>{const e=f();createCanvas(e.w,e.h),(()=>{for(let e=0;e<PARAMS.gridSizeX*PARAMS.gridSizeY;e++){PARAMS.cells[e]={type:PARAMS.shape,orientation:R.random_int(0,4),nestedAmount:R.random_distribute(),strokeWeight:R.random_between(1,8),hatchingDensity:R.random_distribute(),strokeCap:R.random_choice(["round","butt"]),dec:R.random_dec()};const t=R.random_dec();t<.005?PARAMS.cells[e].type="Special":t<.1&&(PARAMS.cells[e].type=R.random_choice(h),PARAMS.hasDifferentShape=!0)}})(),v=m(),C=k()},draw=()=>{scale(PARAMS.canvasScale),randomSeed(PARAMS.randomSeed),noiseSeed(PARAMS.noiseSeed),PARAMS.toggle_overlay?(background(PARAMS.colBg),image(v,0,0,PARAMS.w,PARAMS.h)):clear(),translate(PARAMS.border,PARAMS.border);const e=PARAMS.w-2*PARAMS.border,t=PARAMS.h-2*PARAMS.border;let s=PARAMS.gridSizeX,i=PARAMS.gridSizeY;PARAMS.gridSizeFlip&&([s,i]=[i,s]);const r=A(s,0).map(((e,t)=>({i:t,width:e,rows:A(i,t*t)})));let n=PARAMS.gap/2;for(let s=0;s<r.length;s++){s>0&&(n+=r[s-1].width*e);let i=PARAMS.gap/2;for(let a=0;a<r[s].rows.length;a++){a>0&&(i+=r[s].rows[a-1]*t);const o={i:s,j:a,cell:a*r.length+s,positionXoffset:n,positionYoffset:i,columns:r,areaWidth:e,areaHeight:t,scribble:O};PARAMS.DEBUG&&(stroke(233,51,35,map(sin(.1*frameCount),-1,1,75,255)),strokeWeight(1),noFill(),rect(n,i,r[s].width*e-PARAMS.gap,r[s].rows[a]*t-PARAMS.gap)),stroke(PARAMS.colStroke),b(o)}}resetMatrix(),PARAMS.toggle_overlay&&image(C,0,0,PARAMS.w,PARAMS.h),1===frameCount&&(x(),onDone())},keyReleased=()=>{switch(keyCode){case 84:PARAMS.toggle_overlay=!PARAMS.toggle_overlay;break;case 65:PARAMS.toggle_animate=!PARAMS.toggle_animate;break;case 83:save(`Linearity-MotusArt-${options.tokenId}.png`);break;case 68:PARAMS.DEBUG=!PARAMS.DEBUG;break;case 70:fullscreen(!fullscreen());break;case UP_ARROW:PARAMS.speed+=1e-4;break;case DOWN_ARROW:PARAMS.speed-=1e-4;break;case LEFT_ARROW:PARAMS.speed=.001}};</script></body> </html>