0x294f…bc6d

All memos sent from and to 0x294f…bc6d.

## *Spire (Bokashi Cone)* explores soft gradations of color. In traditional Japanese woodblock printing, bokashi refers to the technique of applying ink to the print in a manner that produces a subtle transition of tone or color. The resulting look of a bokashi effect can be described as a hazy gradient. The technique was famously used by Hokusai in Red Fuji (c. 1830), as well as by many other artists of that time period. In Bokashi Cone, the technique takes center stage. Each cone form is rendered in soft gradations of color that span from light to dark. The effect is very subtle in some instances, and more pronounced in others. Further heightening the bokashi is the transition of hue within each gradient, a process which would be laboriously difficult to reproduce with traditional block-printing techniques. Bokashi Cone's generative color model means that the colors are chosen algorithmically without the artist needing to assemble predefined palettes. Each cone has its very own unique generative color theme and gradient.
function scaleAgnosticCanvas(t=[16,9]){let e=window.innerWidth,n=window.innerHeight;e*(t[1]/t[0])>n?createCanvas(n*(t[0]/t[1]),n):createCanvas(e,e*(t[1]/t[0]))}function keyPressed(){"p"===key&&exportSVG(width,height,svgAll),"s"===key&&save(`${tokenData.hash}.png`)}let prngCount=0;class Random{constructor(t){prngCount++,this.useA=!1;let e=function(t){let e=parseInt(t.substr(0,8),16),n=parseInt(t.substr(8,8),16),r=parseInt(t.substr(16,8),16),s=parseInt(t.substr(24,8),16);return function(){e|=0,n|=0,r|=0,s|=0;let t=(e+n|0)+s|0;return s=s+1|0,e=n^n>>>9,n=r+(r<<3)|0,r=r<<21|r>>>11,r=r+t|0,(t>>>0)/4294967296}};this.prngA=new e(t.substr(2,32)),this.prngB=new e(t.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()}makeHash(){let t="0123456789abcdef",e="0x";for(let n=64;n>0;--n)e+=t[this.next(0,t.length,!0)];return e}next(t,e,n=!1){return!0!==t&&!1!==t||(t=void 0),!0!==e&&!1!==e||(e=void 0),null==t&&null==e&&(t=0,e=1),void 0!==t&&null==e&&(e=t,t=0),n?Math.floor(this.random_num(t,e)):this.random_num(t,e)}purge(t){for(let e=0;e<t;e++)this.random_num(0,1)}}let cob,colors,cob2,colors2,R=new Random(tokenData.hash);function pv(t,e,n){return new createVector(t,e,n)}function hyperIntersect(t,e,n,r){var s,o,i;return 0!==(s=(e.x-t.x)*(r.y-n.y)-(r.x-n.x)*(e.y-t.y))&&(i=((r.y-n.y)*(r.x-t.x)+(n.x-r.x)*(r.y-t.y))/s,o=((t.y-e.y)*(r.x-t.x)+(e.x-t.x)*(r.y-t.y))/s,0<i&&i<1&&0<=o&&o<=1)}function ptOfIntersection(t,e,n,r){if(t.x===e.x&&t.y===e.y||n.x===r.x&&n.y===r.y)return!1;if(denominator=(r.y-n.y)*(e.x-t.x)-(r.x-n.x)*(e.y-t.y),0===denominator)return!1;let s=((r.x-n.x)*(t.y-n.y)-(r.y-n.y)*(t.x-n.x))/denominator,o=((e.x-t.x)*(t.y-n.y)-(e.y-t.y)*(t.x-n.x))/denominator;return!(s<0||s>1||o<0||o>1)&&pv(t.x+s*(e.x-t.x),t.y+s*(e.y-t.y))}function lineIntersectsCurveBetter(t,e,{closed:n=!1}={}){let r=[];if(!1===n)for(let n=0;n<e.length-1;n++)hyperIntersect(t[0],t[1],e[n],e[n+1])&&r.push(ptOfIntersection(t[0],t[1],e[n],e[n+1]));else for(let n=0;n<e.length;n++)hyperIntersect(t[0],t[1],e[n],e[(n+1)%e.length])&&r.push(ptOfIntersection(t[0],t[1],e[n],e[(n+1)%e.length]));return r.length>0&&r}function exportSVG(t,e,n){let r=createWriter("svgfile"+tokenData.tokenId+".svg");r.write(svgBeginDocument(t/100,e/100)),r.write(svgBeginGroup("MainLayer")),n.forEach((t=>{r.write(svgCurve(t.shape,t.rgb_color,"noStroke"))})),r.write(svgEndGroup()),r.write(svgEndDocument()),r.close()}function svgBeginDocument(t,e){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'in" height="'+e+'in" viewBox="0 0 '+100*t+" "+100*e+'" style="background-color:hsl(100, 0%, 100%);" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="1.1.1 (c3084ef, 2021-09-22)">\n'}function svgEndDocument(){return"</svg>"}function svgBeginGroup(t,e="noFill",n="noStroke",r=0,s="square",o="miter",i="inline"){return'<g fill="'+svgParseColor(e)+'" stroke="'+svgParseColor(n)+'" display="'+i+'" stroke-width="'+r+'" stroke-linecap="'+s+'" stroke-linejoin="'+o+'" id="'+t+'" inkscape:groupmode="layer" inkscape:label="'+t+'">\n'}function svgEndGroup(){return"</g>\n"}function svgCurve(t,e="noFill",n="noStroke",r=0,s="square"){path='<polyline points="';for(let e=0;e<t.length;e++)path+=t[e].x+" "+t[e].y+" ";return e="noFill"==e?"":'fill="'+svgParseColor(e)+'" ',n="noStroke"==n?"":'stroke="'+svgParseColor(n)+'" ',r=0===r?"":'stroke-width="'+r+'" ',s="square"==s?"":'stroke-linecap="'+s+'"',path+='" '+e+n+r+s+"/>\n",path}function svgParseColor(t){return"noFill"==t||"noStroke"==t?"none":"rgb("+t[0]+","+t[1]+","+t[2]+")"}function average3(t,e,n){return pv((t.x+e.x+n.x)/3,(t.y+e.y+n.y)/3,(t.z+e.z+n.z)/3)}function motherGloveScalar(t,{motherBB:e=getCanvasAsBB(),padding:n=0}={}){let r,s=quickDist(t.p1,t.p4)/quickDist(t.p1,t.p2),o=quickDist(e.p1,e.p4)/quickDist(e.p1,e.p2);return s<=1&&o>=1?r=1:s>=1&&o<=1?r=2:(s>=1&&o>=1||s<=1&&o<=1)&&(s<=o?r=1:s>=o&&(r=2)),1===r?getScalar(t.p1,t.p2,pv(e.p1.x+n,e.p1.y),pv(e.p2.x-n,e.p2.y)):2===r&&getScalar(t.p1,t.p4,pv(e.p1.x,e.p1.y+n),pv(e.p4.x,e.p4.y-n))}function soften(t,{start:e=1,end:n=-1,loops:r=1,preserveZ:s=!1}={}){for(let o=0;o<r;o++)for(let r=e;r<t.length+n;r++){let e;e=average3(t[(r-1+t.length+t.length)%t.length],t[(r+t.length)%t.length],t[(r+1+t.length)%t.length]),s?t[(r+t.length)%t.length].set(e.x,e.y,t[(r+t.length)%t.length].z):t[(r+t.length)%t.length].set(e.x,e.y,e.z)}}function pointFrom(t,e,n){return pv(t.x-Math.sin(radians(e))*n,t.y+Math.cos(radians(e))*n)}function pointAng(t,e){let n=degrees(Math.atan2(e.y-t.y,e.x-t.x))-90,r=p5.Vector.fromAngle(radians(n));return degrees(r.heading())}function pointPerp(t,e){let n=degrees(Math.atan2(e.y-t.y,e.x-t.x)),r=p5.Vector.fromAngle(radians(n));return degrees(r.heading())}function quickDist(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}function getScalar(t,e,n,r){let s=[Math.hypot(e.x-t.x,e.y-t.y),Math.hypot(r.x-n.x,r.y-n.y)];return s[1]/s[0]}function getBB(t=[pv(0,0),pv(width,0),pv(width,height),pv(0,height)],{padding:e=0}={}){let n=99999999,r=999999999,s=-99999999,o=-99999999;for(let e=0;e<t.length;e++)n=Math.min(n,t[e].x),r=Math.min(r,t[e].y),s=Math.max(s,t[e].x),o=Math.max(o,t[e].y);return{p1:pv(n+e,r+e),p2:pv(s-e,r+e),p3:pv(s-e,o-e),p4:pv(n+e,o-e),width:s-e-(n+e),height:o-e-(r+e),mp:pv((n+s)/2,(r+o)/2)}}function makeBBofSize(t,{w:e=100,h:n=100}={}){let r=t.x-e/2,s=t.x+e/2,o=t.y-n/2,i=t.y+n/2;return{p1:pv(r,o),p2:pv(s,o),p3:pv(s,i),p4:pv(r,i),width:s-r,height:i-o,mp:pv((r+s)/2,(o+i)/2)}}function rotatePoint(t,e,n){t.sub(e.x,e.y),t.rotate(n),t.add(e.x,e.y)}function rotateShape(t,e,n){t.forEach((t=>{rotatePoint(t,e,radians(n))}))}function quickLine(t,e){line(t.x,t.y,e.x,e.y)}function drawArr(t,{closed:e=!1}={}){beginShape(),t.forEach((t=>{vertex(t.x,t.y)})),e?endShape(CLOSE):endShape()}function scaleArr(t,e,n=1,r=!1){t.forEach((t=>{"object"==typeof t&&Array.isArray(t)&&null!==t&&r?scaleArr(t,e,n,r):"object"!=typeof t||Array.isArray(t)||(t.sub(e.x,e.y),t.mult(n),t.add(e.x,e.y))}))}function translateArr(t,e,n,r=!1){t.forEach(((t,s)=>{"object"==typeof t&&Array.isArray(t)&&null!==t&&r?translateArr(t,e,n,r):"object"!=typeof t||Array.isArray(t)||(t.sub(e.x,e.y),t.add(n.x,n.y))}))}function combineBB(t){let e=99999999,n=999999999,r=-99999999,s=-99999999;for(let o=0;o<t.length;o++)e=Math.min(e,t[o].p1.x),n=Math.min(n,t[o].p1.y),r=Math.max(r,t[o].p3.x),s=Math.max(s,t[o].p3.y);return{p1:pv(e,n),p2:pv(r,n),p3:pv(r,s),p4:pv(e,s),width:r-e,height:s-n,mp:pv((e+r)/2,(n+s)/2)}}function addPointsToShapeEvenly(t,e,{start:n=0,end:r=-2}={}){for(let s=t.length+r;s>=n;s--){let n=dist(t[(s+t.length)%t.length].x,t[(s+t.length)%t.length].y,t[(s+1+t.length)%t.length].x,t[(s+1+t.length)%t.length].y);if(n>e){let r=[],o=Math.floor(n/e);for(let e=1;e<o;e++){let n=lerp(t[(s+t.length)%t.length].x,t[(s+1+t.length)%t.length].x,map(e,0,o,0,1)),i=lerp(t[(s+t.length)%t.length].y,t[(s+1+t.length)%t.length].y,map(e,0,o,0,1));r.push(pv(n,i))}t.splice(s+1,0,...r)}}-1==r&&t.push(pv(t[0].x,t[0].y,t[0].z))}function getCanvasAsArray({padding:t=0}={}){let e=[];return e.push(pv(0+t,0+t)),e.push(pv(width-t,0+t)),e.push(pv(width-t,height-t)),e.push(pv(0+t,height-t)),e}function getCanvasAsBB({padding:t=0}={}){let e={p1:pv(0+t,0+t),p2:pv(width-t,0+t),p3:pv(width-t,height-t),p4:pv(0+t,height-t)};return e.mp=pv((e.p1.x+e.p2.x)/2,(e.p2.y+e.p3.y)/2),e.width=e.p2.x-e.p1.x,e.height=e.p3.y-e.p2.y,e}function easingFunction(t,e,n=.8){switch(e){case 0:return easeInSine(t);case 1:return easeOutSine(t);case 2:return easeInOutSine(t);case 3:return easeInCubic(t);case 4:return easeOutCubic(t);case 5:return easeInOutCubic(t);case 6:return easeBellCurve(t,n);case 7:return easeBeta(t);case 8:return easeProbability(t);case 9:return easeOneLiner(t,.2);case 10:return easeOutBounce(t);case 11:return easeSemiCircle(t,n);case 12:return easeOneLiner(t,n);case 13:return easeOutBack(t)}}function easeInSine(t){return 1-Math.cos(t*Math.PI/2)}function easeOutSine(t){return Math.sin(t*Math.PI/2)}function easeInOutSine(t){return-(Math.cos(Math.PI*t)-1)/2}function easeInCubic(t){return t*t*t}function easeOutCubic(t){return 1-Math.pow(1-t,3)}function easeInOutCubic(t){return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}function easeBellCurve(t,e){return(Math.sin(2*PI*(t-1/4))+e)/(2*e)}function easeBeta(t,e=2){return pow(2,e)*pow(t,e-1)*pow(1-t,e-1)}function easeProbability(t,e=2,n=5){return 4*pow(t,e-1)*pow(1-t,n-1)}function easeOutBack(t){const e=1.70158;return 1+2.70158*Math.pow(t-1,3)+e*Math.pow(t-1,2)}function easeOutBounce(t){const e=7.5625,n=2.75;return t<1/n?e*t*t:t<2/n?e*(t-=1.5/n)*t+.75:t<2.5/n?e*(t-=2.25/n)*t+.9375:e*(t-=2.625/n)*t+.984375}function easeSemiCircle(t,e=1){return 2/pow(PI*e,2)*sqrt(pow(e,2)-pow(t,2))}function easeOneLiner(t,e){return(1-t)*(1-Math.cos(t*e*2*Math.PI))}function findPointAlongSpline(t,e){if(1===e){let e=pv(t[t.length-1].x,t[t.length-1].y);return e.z=t.length-1,e.ang=pointAng(t[t.length-2],t[t.length-1]),e}if(0===e){let e=pv(t[0].x,t[0].y);return e.z=0,e.ang=pointAng(t[0],t[1]),e}let n=splineDist(t)*e,r=0;for(let e=1;e<t.length;e++){if(r+=quickDist(t[e-1],t[e]),r===n){let n=pv(t[e].x,t[e].y);return n.z=e,n.ang=pointAng(t[e-1],t[e]),n}if(r>n){r-=quickDist(t[e-1],t[e]);let s=(n-r)/quickDist(t[e-1],t[e]),o=pv(lerp(t[e-1].x,t[e].x,s),lerp(t[e-1].y,t[e].y,s));return o.z=e-1,o.ang=pointAng(t[e-1],t[e]),o}}return!1}function splineDist(t){let e=0;for(let n=0;n<t.length-1;n++)e+=quickDist(t[n],t[n+1]);return e}function makeRandomRect(t,{sz:e=[100,100],pointSpacing:n=0,loops:r=0,closed:s=!1,fitToBB:o=getCanvasAsBB(),rotate:i=0}={}){let a=[],l=[e[0],e[1]];a.push(pv(t.x-l[0]/2,t.y-l[1]/2)),a.push(pv(t.x+l[0]/2,t.y-l[1]/2)),a.push(pv(t.x+l[0]/2,t.y+l[1]/2)),a.push(pv(t.x-l[0]/2,t.y+l[1]/2)),!0===s&&a.push(pv(t.x-l[0]/2,t.y-l[1]/2));let h=makeBBofSize(t,{w:e[0],h:e[1]}),p=getBB(a);0!==i&&rotateShape(a,p.mp,i);let u=motherGloveScalar(p,{motherBB:h});return scaleArr(a,p.mp,u),a}class COB{constructor(t,{hue:e=R.next(0,360,!0),saturation:n=60,brightness:r=100,length:s=R.next(50,100)}={}){this.style=t,this.saturation=n,this.brightness=r,this.hue=e,this.sampleLength=s,this.paletteSize=100,this.defineColorCurves(),this.refreshColor({saturation:this.saturation,brightness:this.brightness}),this.refreshSampleLine({hue:this.hue,length:this.sampleLength})}generateBlank(){this.gb=createGraphics(360,100),this.gb.colorMode(HSB),this.gb.background(0,100,100),this.gb.pixelDensity(1),this.gb.strokeWeight(2)}defineColorCurves(){this.opacityCurve=[pv(0,100),pv(40,100),pv(40,20),pv(200,0),pv(200,100),pv(280,0),pv(320,0),pv(360,100),pv(360,100)],addPointsToShapeEvenly(this.opacityCurve,5),soften(this.opacityCurve,{loops:40})}refreshColor({saturation:t=this.saturation,brightness:e=this.brightness}={}){this.generateBlank(),this.gb.strokeWeight(3),this.gb.background(0,83,41);for(let n=40;n<200;n++)this.gb.stroke(map(n,40,200,60,190),t/2,(1-easingFunction(map(n,40,200,.5,.2),12))*e),this.gb.line(n,0,n,100);for(let n=40;n<140;n++)this.gb.stroke(30,t,e-e/4,map(n,40,140,1,0)),this.gb.line(n,0,n,100);for(let n=200;n<350;n++)this.gb.stroke(0,t/1.5,e),this.gb.line(n,0,n,100);for(let n=0;n<360;n++){let r=lineIntersectsCurveBetter([pv(n,-100),pv(n,200)],this.opacityCurve);!0===vintage||!0===bluePeriod||!0===fullSat?this.gb.stroke(n,100,100,map(r[0].y,0,100,0,1)):this.gb.stroke(n,t,e,map(r[0].y,0,100,0,1)),this.gb.line(n,0,n,100)}for(let t=0;t<50;t++)this.gb.stroke(0,0,100,easingFunction(map(t,0,50,.9,0),!0===vintage||!0===bluePeriod?0:3)),this.gb.line(0,t,360,t),this.gb.stroke(0,0,0,easingFunction(map(t+50,50,100,0,.9),!0===vintage||!0===bluePeriod?0:3)),this.gb.line(0,t+50,360,t+50);if(!0===vintage)for(let t=-2;t<=362;t++)this.gb.stroke(18,100,!0===bluePeriod?30:45,!0===bluePeriod?.53:.35),this.gb.line(t,0,t,100);if(!0===bluePeriod)for(let t=-2;t<=362;t++)this.gb.stroke(205,100,!0===vintage?40:35,!0===vintage?.2:.4),this.gb.line(t,0,t,100);if(!0===vintage&&!0===bluePeriod)for(let t=0;t<50;t++)this.gb.stroke(0,0,100,easingFunction(map(t,0,50,.35,0),0)),this.gb.line(0,t,360,t),this.gb.stroke(0,0,0,easingFunction(map(t+50,50,100,0,.35),0)),this.gb.line(0,t+50,360,t+50);this.gb.image(this.gb,0,0),this.gb.loadPixels()}refreshSampleLine({hue:t=this.hue,length:e=this.sampleLength}={}){let n=pv(t=(t+360)%360,50),r=R.next(0,90);this.sampleLine=[],this.sampleLine.push(pointFrom(n,r,e/2)),this.sampleLine.push(n),this.sampleLine.push(pointFrom(n,(r+180)%360,e/2)),this.sampleLine.forEach(((t,e)=>{t.y>100&&this.sampleLine[e].set(t.x,95),t.y<0&&this.sampleLine[e].set(t.x,5)})),this.sampleLine.push(pv(this.sampleLine[this.sampleLine.length-1].x,5)),this.sampleLine.unshift(pv(this.sampleLine[0].x,95)),addPointsToShapeEvenly(this.sampleLine,10),soften(this.sampleLine,{loops:7,start:1,end:-1})}getColorAt(t){let e=findPointAlongSpline(this.sampleLine,t);return this.getColor(e.x,e.y)}getColorCount(t){let e,n,r,s,o=[];this.saturation<50?(r="up",e=(100-this.saturation)/t):(r="down",e=this.saturation/t),this.brightness<50?(s="up",n=(100-this.brightness)/t):(s="down",n=this.brightness/t);for(let i=0;i<=t;i++){let a=this.getColorAt(map(i,0,t,0,1));o.push(a),0===this.style?("down"===r?this.saturation=this.saturation-e:"up"===r&&(this.saturation=this.saturation+e),"down"===s?this.brightness=this.brightness-n:"up"===s&&(this.brightness=this.brightness+n)):1===this.style&&("down"===r?this.saturation=this.saturation-e:"up"===r&&(this.saturation=this.saturation+e)),this.refreshColor({saturation:this.saturation,brightness:this.brightness})}return o}getColor(t,e){let n=1*(floor(e)*this.gb.width+floor(t))*4;return[this.gb.pixels[n],this.gb.pixels[n+1],this.gb.pixels[n+2],this.gb.pixels[n+3]]}displayCurves(){noFill(),stroke(0),drawArr(this.opacityCurve,{scaled:!1});let t=findPointAlongSpline(this.opacityCurve,map(mouseX,0,width,0,1));circle(t.x,t.y,5);for(let t=0;t<360;t++)t%10==0&&(fill(0),noStroke(),textSize(5),text(t,t,110),noFill(),stroke(0),strokeWeight(.5),line(t,0,t,105));noFill(),stroke(0),drawArr(this.sampleLine,{scaled:!1})}display(){image(this.gb,0,0)}}let localSpace,spireStyle,dia,newHeight,depth,face,bounds,hue,stretch,primaryColorStyle,spiralStyle,partitionStyle,warp,vintage,bluePeriod,fullSat,parts=[],svgGroup=[],colorIndex=0,cilAng=.9,svgAll=[],saveCounter=0,timeNow=0;function setup(){scaleAgnosticCanvas([6,8]),background(204,196,175),localSpace=getBB(makeRandomRect(pv(300,400),{sz:[600,800]})),noLoop(),resetVariables(),createParts(),drawTheBackground(),drawTheStack()}function draw(){}function resetVariables(){R=new Random(tokenData.hash),R.purge(1e3),svgAll=[],parts=[],spireStyle=R.next()>.95?1:0,svgGroup=[],colorIndex=0,cilAng=1===spireStyle?R.next(.2,.9):R.next()>.95?0:R.next(.2,.9),dia=localSpace.width/2,rate=R.next()>.15?1.001:R.next()>.5?1.01:1.0001,dia=localSpace.width/2,depth=1,bounds=getCanvasAsArray({padding:.01*min(width,height)}),primaryColorStyle=R.next()>.3?1:0,spiralStyle=R.next()>.8,partitionStyle=R.next()>.82,enableStepDown=R.next()>.85,warp=R.next()>.82,vintage=R.next()>.88,bluePeriod=R.next()>.92,fullSat=R.next()>.25,hue=R.next(0,360),newHeight=pv(localSpace.width/2,localSpace.height+R.next(600,-400)),stretch=R.next(30,180)}function createParts(){for(;newHeight.y>localSpace.p1.y;)[newHeight,data]=makeCylinder(newHeight,dia,depth),parts.push(data),dia/=rate,enableStepDown&&R.next()>.993&&(dia/=1.2),depth*=rate;if(!0===spiralStyle){let t=0,e=12,n=R.next(50,100),r=R.next()>.5?-1:1;parts.forEach(((s,o)=>{for(let i in s)translateArr(s[i],pv(0,0),pv(sin(radians(t))*easingFunction(map(o,0,parts.length,0,1),e)*n*r,cos(radians(t))*easingFunction(map(o,0,parts.length,0,1),e)*n*cilAng*r));t+=3}))}if(!0===partitionStyle){let t=Math.floor(parts.length/8),e=Math.floor(parts.length/4),n=!1;for(let r=Math.floor(t/2);r<Math.floor(parts.length-t/2);r++){n=r%e>=0&&r%e<t;for(let t in parts[r])translateArr(parts[r][t],pv(0,0),pv(!0===n?70:-70,0))}}if(!0===warp){let t=R.next()>.5?1:-1;parts.forEach(((e,n)=>{for(let r in e)rotateShape(e[r],pv(localSpace.mp.x,localSpace.p3.y),map(n,0,parts.length,40*t,10*t))}))}let t=[];parts.forEach((e=>{t.push(getBB(e.fullStack)),t.push(getBB(e.fullCap))})),t=combineBB(t);let e,n,r=motherGloveScalar(t,{mother:getCanvasAsBB(),padding:.05*width});parts.forEach(((e,n)=>{for(let n in e)scaleArr(e[n],t.mp,r),translateArr(e[n],t.mp,pv(width/2,height/2)),rotateShape(e[n],pv(width/2,height/2),map(cilAng,0,1,0,0))}));let s=!0===fullSat?0:R.next(0,4,!0);if(0===s?(e=0,n=49):1===s?(e=49,n=49):2===s&&(e=99,n=49),cob=new COB(0,{hue:hue,saturation:n,brightness:e,length:stretch}),0===primaryColorStyle){let t=R.next(2,5,!0);colors=cob.getColorCount(Math.floor(parts.length/t))}else 1===primaryColorStyle&&(colors=cob.getColorCount(parts.length+2));colors.reverse(),cob2=new COB(0,{hue:hue,saturation:n,brightness:e,length:stretch/4}),colors2=cob2.getColorCount(R.next(10,10,!0)),colors2.reverse(),colorIndex=R.next(0,colors.length,!0)}function drawTheBackground(){noStroke(),svgAll.push({shape:getCanvasAsArray(),rgb_color:[204,196,175]}),fill(colors2[(0+colorIndex)%colors2.length]),drawArr(bounds),svgAll.push({shape:bounds,rgb_color:colors2[(0+colorIndex)%colors2.length]});let t=getBB(parts[0].fullCap),e=[pv(bounds[0].x,min(height-height/3,t.p1.y)),pv(bounds[1].x,min(height-height/3,t.p1.y)),bounds[2],bounds[3]];fill(colors2[(1+colorIndex)%colors2.length]),drawArr(e),svgAll.push({shape:e,rgb_color:colors2[(1+colorIndex)%colors2.length]})}function drawTheStack(){noStroke(),parts.forEach(((t,e)=>{if(0===spireStyle){let n=[colors[(e+2+colorIndex)%colors.length][0]-10,colors[(e+2+colorIndex)%colors.length][1]-10,colors[(e+2+colorIndex)%colors.length][2]-10];fill(n),drawArr(t.fullStack),svgAll.push({shape:t.fullStack,rgb_color:n}),n=colors[(e+2+colorIndex)%colors.length],fill(n),drawArr(t.fullCap),svgAll.push({shape:t.fullCap,rgb_color:n})}else if(1===spireStyle){let n=[colors[(e+2+colorIndex)%colors.length][0]-10,colors[(e+2+colorIndex)%colors.length][1]-10,colors[(e+2+colorIndex)%colors.length][2]-10];fill(n),drawArr(t.halfStack),svgAll.push({shape:t.halfStack,rgb_color:n}),n=colors[(e+2+colorIndex)%colors.length],fill(n),drawArr(t.halfCap),svgAll.push({shape:t.halfCap,rgb_color:n}),n=[colors[(e+2+colorIndex)%colors.length][0]-10,colors[(e+2+colorIndex)%colors.length][1]-20,colors[(e+2+colorIndex)%colors.length][2]-20],fill(n),drawArr(t.halfStackFace),svgAll.push({shape:t.halfStackFace,rgb_color:n})}}))}function makeCylinder(t,e,n){let r=e*cilAng,s=[];for(let n=270;n<=450;n+=2)s.push(pv(t.x+sin(radians(n))*e,t.y+cos(radians(n))*r));s.push(pv(s[s.length-1].x,s[s.length-1].y-n)),s.unshift(pv(s[0].x,s[0].y-n));for(let o=450;o>=270;o-=2)s.push(pv(t.x+sin(radians(o))*e,t.y-n+cos(radians(o))*r));let o=[];for(let s=0;s<=360;s+=2)o.push(pv(t.x+sin(radians(s))*e,t.y-n+cos(radians(s))*r));let i=[];for(let n=30;n<=90;n+=2)i.push(pv(t.x+sin(radians(n))*e,t.y+cos(radians(n))*r));for(let s=90;s>=30;s-=2)i.push(pv(t.x+sin(radians(s))*e,t.y-n+cos(radians(s))*r));i.unshift(pv(i[0].x,i[0].y-n)),halfStackFace=[pv(i[0].x,i[0].y),pv(i[1].x,i[1].y)],halfStackFace.push(pv(t.x+sin(radians(210))*e,t.y+cos(radians(210))*r)),halfStackFace.push(pv(t.x+sin(radians(210))*e,t.y-n+cos(radians(210))*r));let a=[];for(let s=30;s<=210;s+=2)a.push(pv(t.x+sin(radians(s))*e,t.y-n+cos(radians(s))*r));let l={fullStack:s,fullCap:o,halfStack:i,halfStackFace:halfStackFace,halfCap:a};return[pv(t.x,t.y-n),l]}
ZENTRUM is a dynamic, endlessly running abstract animation made of structural elements and random codes. The random generator ensures that each endless loop is unique. For ZENTRUM, Franke had to make do with the limited computing capacity that a home computer offered at the time. Despite this limitation, it was important to him to develop moving sequences even in his first programs for the Apple II. He considered the movement to be a pioneering digital innovation. The combination of dynamic image sequences and music, as well as the interactivity, were already groundbreaking in his MONDRIAN program code, developed in 1979 for the Texas Instruments home computer. License: https://quantum.mypinata.cloud/ipfs/QmUnSepLccUajd2kJi3hX7bFvzUuFHr39UUP1TTk9yHaaq
ZENTRUM is a dynamic, endlessly running abstract animation made of structural elements and random codes. The random generator ensures that each endless loop is unique. For ZENTRUM, Franke had to make do with the limited computing capacity that a home computer offered at the time. Despite this limitation, it was important to him to develop moving sequences even in his first programs for the Apple II. He considered the movement to be a pioneering digital innovation. The combination of dynamic image sequences and music, as well as the interactivity, were already groundbreaking in his MONDRIAN program code, developed in 1979 for the Texas Instruments home computer.
/* Zentrum by Herbert W. Franke Written in BASIC in 1982 Translated to JavaScript by Aaron Penne 2023 50 REM PROGRAMM "ZENTRUM" 80 HOME 90 W = - 16336 100 HGR2 110 HCOLOR= 2: GOTO 125 120 HCOLOR= INT ( RND (1) * 5) + 1 125 FOR M = 1 TO 50 126 SOUND = PEEK (W) 127 FOR PAUSE = 1 TO 10: NEXT PAUSE 128 NEXT M 130 N = 0 150 A = INT ( RND (1) * 279) 160 B = INT ( RND (1) * 279) 260 E = INT ( RND (1) * 2) + 2 262 X1 = A + N * E 263 Y1 = 279 - A - N * E 264 Z1 = 95 + N * E 265 Z2 = 95 - N * E 350 IF X1 > 278 THEN GOTO 120 355 IF X1 < 1 THEN GOTO 120 360 IF Y1 > 278 THEN GOTO 120 365 IF Y1 < 1 THEN GOTO 120 370 IF Z1 > 190 THEN GOTO 120 375 IF Z1 < 1 THEN GOTO 120 380 IF Z2 > 190 THEN GOTO 120 385 IF Z2 < 1 THEN GOTO 120 400 HPLOT X1,Z1 TO Y1,Z1 TO Y1,Z2 TO X1,Z2 TO X1,Z1 405 N = N + 1 410 SOUND = PEEK (W) 420 GOTO 262 */ const urlParams=new URLSearchParams(window.location.search);"undefined"==typeof tokenData&&(tokenData={hash:"0x"+Math.floor(1e11*Math.random()+1e11),tokenId:"18000199"}),urlParams.has("hash")&&(tokenData.hash=urlParams.get("hash"));let seed=gs(tokenData.hash);function getDim(){var e=windowWidth,n=windowHeight;return e/appW<n/appH?(cnvW=e,cnvH=e*(appH/appW)):(cnvH=n,cnvW=n*(appW/appH)),[cnvW,cnvH]}function download(){var e=`${document.title.replace(/\s+/g,"_").replace(/[^a-zA-Z0-9_]/g,"")}_${getTimestamp()}_${tokenData.hash}.png`;save(e)}function getTimestamp(){return(new Date).toISOString().replace(/[^T0-9]/g,"").replace("T","_")}function gs(e){return parseInt(tokenData.hash.slice(0,16),16)}function rd(){return seed^=seed<<13,seed^=seed>>17,seed^=seed<<5,(seed<0?1+~seed:seed)%1e3/1e3}function rb(e,n){return e+(n-e)*rd()}function rj(e,n){return rb(e-n,e+n)}function rc(e){return e[Math.floor(rb(0,.99*e.length))]}function rco(e){let t=[];return e.forEach((n,e)=>{for(let e=0;e<n.w;e++)t.push(n)}),rc(t)}function shuffle(n){for(let e=n.length-1;0<e;e--){var t=Math.floor(rd()*(e+1));[n[e],n[t]]=[n[t],n[e]]}}function gj(e,n,t=!1){let o=e.filter(({n:e})=>e==n);return t?(o=o.map(({v:e})=>e),[...o]):o[0]}function hex3to6(e){return 7<=(e="#"!=e[0]?"#"+e:e).length?e:e=e.split("").map(e=>"#"==e?e:e+e).join("")}let cnvW,cnvH,gW,gH,gC;const appW=280,appH=192,gB=.03;let offX,offY,go=!0,toggleIntro=!0,pp={pal:[{w:10,n:"Apple ][",v:["#2A6838","#7F6FFC","#ACBCDE","#111414","#B56742","#3994EE"]},{w:1,n:"Graustufe",v:["#111414","#4F4F4F","#F9F9F9","#808080","#B0B0B0","#D6D6D6"]}]},p={};for(let e in pp)p[e]=rco(pp[e]);for(let e=0;e<p.pal.v.length;e++)p.pal.v[e]=hex3to6(p.pal.v[e]);console.log("Zentrum\nby Herbert W. Franke\n\nWritten in BASIC in 1982\nTranslated to JavaScript by Aaron Penne 2023"),console.log("Token Hash:",tokenData.hash),console.log("Palette: ",p.pal.n),"Apple ]["==p.pal.n?(cG="#2A6838",cP="#7F6FFC",cT="#ACBCDE"):"Graustufe"==p.pal.n&&(cG="#111414",cP="#ffffff",cT="#F9F9F9");let flagsp=[{w:10,n:"Norm",v:!0},{w:8,n:"FS",v:!0},{w:6,n:"Alt OO",v:!0},{w:3,n:"Alt C",v:!0},{w:3,n:"GS",v:!0},{w:3,n:"PS",v:!0},{w:4,n:"FGS",v:!0},{w:4,n:"FPS",v:!0},{w:2,n:"FPG",v:!0},{w:1,n:"Hz Only",v:!0}],flags={w:1,n:"Norm",v:!0},n,a,e,c;rst(),c=p.pal.v[2];let vert=` attribute vec3 aPosition; attribute vec2 aTexCoord; varying vec2 vTexCoord; void main() { vTexCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y); vec4 positionVec4 = vec4(aPosition, 1.0); positionVec4.xy = positionVec4.xy * 2.0 - 1.0; gl_Position = positionVec4; } `,frag=` #ifdef GL_ES precision mediump float; #endif const float PI = 3.14159; const float MM = 2000.; varying vec2 vTexCoord; uniform sampler2D texture; uniform vec2 iResolution; void main() {vec2 uv = vTexCoord;vec3 c = texture2D(texture, uv).rgb; float sf = cos(PI * (uv.y + 0.008) * MM / 8.); float sc = clamp(0.05 * sf + 0.95, 0.0, 1.0) * 1.2; float sd = cos(PI * uv.x * MM / 3.); float ss = 0.85 + 0.15 * clamp(1.5 * sd, 0.0, 1.0); float cc = sc * ss; c *= cc; gl_FragColor = vec4(c, 1.); } `;function setup(){[cnvW,cnvH]=getDim(),gW=cnvW*(1-2*gB),gH=cnvH*(1-2*gB),gC=Math.round(gW/appW),gW=gC*appW,gH=gC*appH,cnvW=gW+2*gB*cnvW,cnvH=gH+2*gB*cnvH,offX=Math.round((cnvW-gW)/2),offY=Math.round((cnvH-gH)/2),createCanvas(cnvW,cnvH,WEBGL),sh=createShader(vert,frag),shader(sh),pg=createGraphics(cnvW,cnvH),pg.noStroke(),pg.rectMode(CORNERS),pg.strokeCap(PROJECT),frameRate(10),go||noLoop(),background("#111414"),pg.background("#111414"),document.body.style.backgroundColor="#111414",pg.textFont("monospace"),pg.textSize(8*gC),pg.textAlign(CENTER,CENTER);var e=appW/appH,n=innerWidth/innerHeight;let t=document.querySelector("canvas").style;e<n?(t.width=innerHeight*e+"px",t.height=innerHeight+"px"):(t.width=innerWidth+"px",t.height=innerWidth/e+"px")}function draw(){var t,o,g;toggleIntro&&frameCount<40?(pg.push(),pg.fill(cT),pg.text("RUN ZENTRUM",.5*width,.5*height),g=pg.textWidth("RUN ZENTRUM"),frameCount%10<5?(t=.5*width+g/2+5*gC,o=.5*height,pg.fill(cT),pg.rect(t,o-4.2*gC,t+6*gC,o+3*gC)):(o=.5*width+g/2+5*gC,g=.5*height,pg.fill("#111414"),pg.rect(o,g-4.2*gC,o+6*gC,g+3*gC)),pg.pop()):toggleIntro&&40==frameCount&&frameCount<50?pg.background("#111414"):(x1=a+n*e,y1=appH/2-1+n*e,x2=appW-1-a-n*e,y2=appH/2-1-n*e,push(),drawRectangle(x1,y1,x2,y2),pop(),n++,(x1>appW-2||x1<1||y1>appH-2||y1<1||x2>appW-2||x2<1||y2>appH-2||y2<1)&&rst()),sh.setUniform("texture",pg),sh.setUniform("iResolution",[width,height]),rect(0,0,width,height)}function drawRectangle(n,t,o,a){if(n*=gC,t*=gC,o*=gC,a*=gC,pg.push(),pg.translate(offX,offY),pg.noFill(),pg.stroke(c),pg.strokeWeight(1.01*gC),pg.line(n,t,o,t),pg.line(n,a,o,a),"Norm"==flags.n)pg.line(n,t,n,a),pg.line(o,t,o,a);else if("FS"==flags.n){for(let e=0;e<=3;e+=.5)pg.line(n+e*gC,t,n+e*gC,a);pg.line(o,t,o,a)}else if("Alt OO"==flags.n)frameCount%2==0&&pg.line(n,t,n,a),frameCount%2!=0&&pg.line(o,t,o,a);else if("Alt C"==flags.n)frameCount%2==0?(pg.stroke(cP),pg.line(n,t,n,a),pg.stroke(cG)):(pg.stroke(cG),pg.line(n,t,n,a),pg.stroke(cP)),pg.line(o,t,o,a);else if("GS"==flags.n)pg.stroke(cG),pg.line(n,t,n,a),pg.line(o,t,o,a);else if("PS"==flags.n)pg.stroke(cP),pg.line(n,t,n,a),pg.line(o,t,o,a);else if("FGS"==flags.n){pg.stroke(cG);for(let e=0;e<=3;e+=.5)pg.line(n+e*gC,t,n+e*gC,a);pg.line(o,t,o,a)}else if("FPS"==flags.n){pg.stroke(cP);for(let e=0;e<=3;e+=.5)pg.line(n+e*gC,t,n+e*gC,a);pg.line(o,t,o,a)}else if("FPG"==flags.n)for(let e=0;e<=3;e+=.5)pg.stroke(cP),pg.line(n+e*gC,t,n+e*gC,a),pg.stroke(cG),pg.line(o+e*gC,t,o+e*gC,a);else flags.n;pg.pop()}function rst(){n=0,a=Math.floor(279*rd()),e=Math.floor(2*rd())+2,c=rc(p.pal.v),flags=rco(flagsp)}function keyPressed(){"s"==key?download():"r"==key?window.location.reload():"p"==key&&(go=((go?noLoop:loop)(),!go))}function mouseClicked(){mouseY<.5*height?go=((go?noLoop:loop)(),!go):mouseY>.5*height&&download()}
"Receive Transmission" embodies the echoes of Peter Saville's iconic album cover, of Jocelyn Bell Burnell’s discovery of pulsars, and the powerful vibrations of Joy Division's music. Ripples radiate from the central core channeling the spinning pulsar. These stars exhibit symmetry, with two beams extending on either side, similar to a lighthouse's sweep. The composition follows a bending grid, similar to the paper that aided Jocelyn's work. Occasionally this grid is exposed as an overlay, a testament to the barriers confronting women and their ability to overcome them. There is a rhythmic cadence to the artwork, sometimes steady like Stephen Morris' drums or jagged and spontaneous like Ian Curtis' dance. From the distant pulses of a dying star to the timeless grooves on a vinyl record, the artwork encapsulates the endless ripples through time. A transmission received by all who look for it. -- Dame Jocelyn Bell Burnell, the pioneering scientist who discovered pulsars, was the sole woman radio astronomer at Cambridge University in 1967. She helped build a satellite and operated it alone, carefully studying the marks made by a pen across thousands of feet of graph paper. Jocelyn uncovered a mark that should not have been there. This signal, a transmission received from a perished star, continues to traverse time and space to wash our world in radio waves for eons to come. Her discovery was initially overshadowed by her professor's skepticism, who attributed the anomaly to interference or faulty wiring. To validate her intuition that this was a new celestial entity, Jocelyn continued working and discovered a second pulsar. Her work earned a Nobel Prize; however that prize was given to the male heads of her program. In 2018 when Jocelyn was awarded the Special Breakthrough Prize in Fundamental Physics for her pulsar discovery. She promptly donated the $3 million award to the Institute of Physics (IoP) to propel women and other underrepresented groups toward earning PhDs in physics. Her impact as a role model will carry on for generations.
const urlParams=new URLSearchParams(window.location.search);function download(){var e=`receive_transmission_${tokenData.tokenId}_${tokenData.hash}.png`;save(e)}function getTimestamp(){return(new Date).toISOString().replace(/[^T0-9]/g,"").replace("T","_")}"undefined"==typeof tokenData&&(tokenData={hash:"0x"+Math.round(1e12*Math.random()+1e12),tokenId:"18000199"});let debug=!1;urlParams.has("debug")&&(debug=!0),urlParams.has("hash")&&(tokenData.hash=urlParams.get("hash"));let seed=gs(tokenData.hash),aspect=16/9,fill=!1;if(urlParams.has("aspect")){let e=urlParams.get("aspect"),t=parseFloat(e);isNaN(t)||0===t?"fill"===e?fill=!0:console.warn("Invalid aspect ratio provided. Using default ",aspect):aspect=t}function getDim(e=1,t=!1){let n,r;return innerWidth/innerHeight>e?(r=innerHeight,n=r*e):(n=innerWidth,r=n/e),t&&(n=innerWidth,r=innerHeight),{w:n,h:r}}function lerpHex(e,t,n){var r=+e.replace("#","0x"),a=r>>16,e=r>>8&255,r=255&r,t=+t.replace("#","0x");return"#"+((1<<24)+(a+n*((t>>16)-a)<<16)+(e+n*((t>>8&255)-e)<<8)+(r+n*((255&t)-r))|0).toString(16).slice(1)}function hex3to6(e){return 7<=(e="#"!=e[0]?"#"+e:e).length?e:e=e.split("").map(e=>"#"==e?e:e+e).join("")}function lerp(e,t,n){return e*(1-n)+t*n}function mapRng(e,t,n,r,a){return(e-t)/(n-t)*(a-r)+r}function titleCase(t){t=t.toLowerCase().split(" ");for(let e=0;e<t.length;e++)t[e]=t[e].charAt(0).toUpperCase()+t[e].slice(1);return t.join(" ")}function urlP(e){return urlParams.get(e)?lower(urlParams.get(e)):""}function gs(e){return parseInt(tokenData.hash.slice(0,16),16)}function rd(){return seed^=seed<<13,seed^=seed>>17,seed^=seed<<5,(seed<0?1+~seed:seed)%1e3/1e3}function rb(e,t){return e+(t-e)*rd()}function rj(e,t){return rb(e-t,e+t)}function rc(e){return e[Math.floor(rb(0,.99*e.length))]}function rco(e){let n=[];return e.forEach((t,e)=>{for(let e=0;e<t.w;e++)n.push(t)}),rc(n)}function shuffle(t){for(let e=t.length-1;0<e;e--){var n=Math.floor(rd()*(e+1));[t[e],t[n]]=[t[n],t[e]]}}function gj(e,t,n=!1){let r=e.filter(({n:e})=>e==t);return n?(r=r.map(({v:e})=>e),[...r]):r[0]}function linGrad(e,t,n,r,a,o,s=drawingContext){let c=s.createLinearGradient(e,t,n,r);c.addColorStop(0,a),c.addColorStop(1,o),s.fillStyle=c}function mapEase(e,t,n,r,a,o){let s=(e-t)/(n-t);switch(o){case"linear":return r+s*(a-r);case"sineIn":return r+(1-cos(s*PI/2))*(a-r);case"sineOut":return r+sin(s*PI/2)*(a-r);case"sineInOut":return r+(1-cos(PI*s))/2*(a-r);case"quadIn":return r+s*s*(a-r);case"quadOut":return r+s*(2-s)*(a-r);case"quadInOut":return s<.5?r+2*s*s*(a-r):r+(4-2*s)*s*(a-r);case"cubicIn":return r+s*s*s*(a-r);case"cubicOut":return r+--s*s*s*(a-r);case"c":return s<.5?r+4*s*s*s*(a-r):r+--s*s*s*4*(a-r);case"expoIn":return 0===s?r:r+pow(2,10*(s-1))*(a-r);case"expoOut":return 1===s?r+(a-r):r+(1-pow(2,-10*s))*(a-r);case"expoInOut":return 0===s?r:1===s?r+(a-r):(s*=2)<1?r+pow(2,10*(s-1))/2*(a-r):r+(2-pow(2,-10*--s))/2*(a-r);case"expoOutIn":return s<.5?0===s?r:r+(1-pow(2,2*s*-10))/2*(a-r):(s=2*(s-.5),1===s?r+(a-r)/2:r+(pow(2,10*(s-1))/2+.5)*(a-r));default:return r+s*(a-r)}}function rgbToHsl(e,t,n){e/=255,t/=255,n/=255;var r=Math.max(e,t,n),a=Math.min(e,t,n);let o,s,c=(r+a)/2;if(r==a)o=s=0;else{var i=r-a;switch(s=.5<c?i/(2-r-a):i/(r+a),r){case e:o=(t-n)/i+(t<n?6:0);break;case t:o=(n-e)/i+2;break;case n:o=(e-t)/i+4}o/=6}return[o,s,c]}function hslToRgb(e,t,n){let r,a,o;function s(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}return 0==t?r=a=o=n:(t=2*n-(n=n<.5?n*(1+t):n+t-n*t),r=s(t,n,e+1/3),a=s(t,n,e),o=s(t,n,e-1/3)),[255*r,255*a,255*o]}function findLum(e,t=255){var n=e.width,r=e.height;let a=createGraphics(n,r);a.image(e,0,0,n,r);let o=255,s=0;a.loadPixels();for(let e=0;e<a.pixels.length;e+=4){var c=.299*a.pixels[e]+.587*a.pixels[e+1]+.114*a.pixels[e+2];c<o&&(o=c),c>s&&(s=c)}return o=map(o,0,255,0,t),s=map(s,0,255,0,t),a.remove(),{min:o,max:s}}function keyPressed(){"s"==key?download():"r"==key?window.location.reload():"d"==key&&showcaseDebug()}function mouseClicked(){(mouseX<width/2&&mouseY>height/2?download:showcaseDebug)()}function showcaseDebug(){pad=.003,showcase=(showcase+1)%showcaseMax,1===showcase?image(texC,0,0,width,height):image(sA,0,0,width,height,width*pad,height*pad,width*(1-2*pad),height*(1-2*pad))}function varyHSL(e,t,n,r,a="exact"){var o=color(e),s=hue(o),e=saturation(o),o=lightness(o);"jitter"==a&&(t=rj(0,t),n=rj(0,n),r=rj(0,r)),s=(s+t)%360,e=constrain(e+n,0,100),o=constrain(o+r,0,100),push(),colorMode(HSL,360,100,100);o=color(s,e,o);return pop(),o}let cw="#F5F8F8",cb="#050505",zephyrPal=["#4E6E61","#365","#4C3F5D","#336","#358","#45A","#576","#5493B6","#7AC","#89292D","#87A","#8F3935","#A33","#B8513B","#B78","#C54","#C95","#D57C30","#D94","#DA9","#C99","#DEC254"],palette=[{w:5,n:"Cat's Cradle",v:["#45A","#336","#358","#5493B6",cw,cb]},{w:20,n:"Jocelyn",v:[cw,cb,cw]},{w:15,n:"Zephyr",v:zephyrPal},{w:60,n:"Oracle",v:[cb,cw,rc(zephyrPal)],cb:cb,cw:cw},{w:3,n:"Halcyon",v:["#756485","#835061","#9A95A0","#B6A5C8","#9B85A2","#835061","#C58FAD","#BC849E","#883E3F","#BD636E","#CF707D","#703946","#8C495C","#B9627D","#683D4D","#3F2D39","#7F4364","#5E3750","#252830","#4A354F","#3A2D3E","#1E231D","#242525","#212322","#1C211E","#2E272D","#42303D","#26262D","#482F37","#7B4048","#4C3037","#442F35","#A9554E","#9C4E47","#4E282B","#B26A53","#CE7C5D","#884331","#9A605B","#C48A8C","#A06B6A","#714A4F","#A88DB1","#A38AAE","#594662","#B1A9B4","#242525","#212322","#1C211E"]},{w:10,n:"Ian",v:["#000000","#000102","#010101","#020202","#030302","#030303","#040302","#060504","#070707","#080808","#090A08","#0B0D11","#0D0E10","#0E0F10","#0F0E0D","#0F0F0E","#110C05","#111110","#141313","#161616","#171717","#191816","#1A1919","#1A1A1B","#1F2021","#202020","#212021","#23211D","#252424","#2B2522","#2F2D2D","#322E2D","#393633","#3C3837","#3F3C3B","#52504E","#544E4A","#615E5A","#6F6962","#706D67","#786D65","#7F746B","#96958F","#9F9B94","#A09990","#EEE4D9","#EEEAE2","#F4EBE1","#FAF3E8","#FCF6EE","#FDF5EA","#FFFAEF","#060506"]},{w:10,n:"Basil Gogos",v:["#823d65","#83ABAB",cb,"#7A4280",cb,cw]},{w:2,n:"Young Again",v:["#a36aa5","#006eb8","#fcb315","#e31f26",cw,cb]}];baseVertShader=` attribute vec3 aPosition; attribute vec2 aTexCoord; varying vec2 vTexCoord; void main() { vTexCoord = aTexCoord; vec4 positionVec4 = vec4(aPosition, 1.0); positionVec4.xy = positionVec4.xy * 2.0 - 1.0; gl_Position = positionVec4; }`,blurFragShader=` #ifdef GL_ES precision highp float; precision highp int; #endif varying vec2 vTexCoord; uniform sampler2D tex0; uniform vec2 direction; // https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms vec3 gaussianBlur( sampler2D t, vec2 texUV, vec2 stepSize ){ vec3 colOut = vec3( 0.0 ); const int stepCount = 9; float gWeights[stepCount]; gWeights[0] = 0.10855; gWeights[1] = 0.13135; gWeights[2] = 0.10406; gWeights[3] = 0.07216; gWeights[4] = 0.04380; gWeights[5] = 0.02328; gWeights[6] = 0.01083; gWeights[7] = 0.00441; gWeights[8] = 0.00157; float gOffsets[stepCount]; gOffsets[0] = 0.66293; gOffsets[1] = 2.47904; gOffsets[2] = 4.46232; gOffsets[3] = 6.44568; gOffsets[4] = 8.42917; gOffsets[5] = 10.41281; gOffsets[6] = 12.39664; gOffsets[7] = 14.38070; gOffsets[8] = 16.36501; vec2 maxCoord = vec2(1.0, 1.0) - stepSize; vec2 minCoord = stepSize; for( int i = 0; i < stepCount; i++ ){ vec2 texCoordOffset = gOffsets[i] * stepSize; vec2 clampedPos = clamp(texUV + texCoordOffset, minCoord, maxCoord); vec2 clampedNeg = clamp(texUV - texCoordOffset, minCoord, maxCoord); vec3 col = texture2D( t, clampedPos ).xyz + texture2D( t, clampedNeg ).xyz; col *= gWeights[i]; colOut += col; } return colOut; } void main() { vec2 uv = vTexCoord; uv = 1.0 - uv; vec3 blur = gaussianBlur(tex0, uv, .0015 * direction); gl_FragColor = vec4(blur, 1.0); }`,addFragShader=` precision highp float; varying vec2 vTexCoord; uniform sampler2D tex0; uniform sampler2D tex1; void main() { vec4 color0 = texture2D(tex0, vTexCoord); vec4 color1 = texture2D(tex1, vTexCoord); vec4 outputColor = color0 + color1; gl_FragColor = outputColor; } `,subtractFragShader=` precision highp float; varying vec2 vTexCoord; uniform sampler2D tex0; uniform sampler2D tex1; void main() { vec4 color0 = texture2D(tex0, vTexCoord); vec4 color1 = texture2D(tex1, vTexCoord); vec4 outputColor = color1 - color1; gl_FragColor = outputColor; } `,snapFragShader=` precision highp float; varying vec2 vTexCoord; uniform sampler2D tex; uniform float minLum, maxLum; float map(float value, float min1, float max1, float min2, float max2) { return min2 + (value - min1) * (max2 - min2) / (max1 - min1); } void main() { vec2 uv = vTexCoord; uv.y = 1.0 - uv.y; vec3 c = texture2D(tex, uv).rgb; float lum = dot(c, vec3(0.299, 0.587, 0.114)); lum = map(lum, minLum, maxLum, 0., 1.); c = vec3(lum); gl_FragColor = vec4(c, 1.0); }`,colorizeFragShader=` #ifdef GL_ES precision highp float; precision highp int; #endif varying vec2 vTexCoord; uniform sampler2D texA, texB, texC; uniform float fc; float map(float value, float min1, float max1, float min2, float max2) { return min2 + (value - min1) * (max2 - min2) / (max1 - min1); } void main() { vec2 uv = vTexCoord; uv.y = 1.0 - uv.y; vec3 c = vec3(0.); vec3 cA = texture2D(texA, uv).rgb; vec3 cB = texture2D(texB, uv).rgb; float lumA = dot(cA, vec3(0.299, 0.587, 0.114)); float lumB = dot(cB, vec3(0.299, 0.587, 0.114)); float x, y; x = lumA + lumB; y = lumB - lumA; c = texture2D(texC, vec2(lumA, lumB)).rgb; gl_FragColor = vec4(c, 1.0); } `;let showcase=1,showcaseMax=2,dim,dimFixedMin,shBlurHor,shBlurVer,shBlurHorB,shBlurVerB,shColorize,shCombine,shSnapA,shSnapB,s,texC,sA,sB,rrr=rd(),pp={dirHA:[{w:4,n:"XS",v:[0,1]},{w:5,n:"S",v:[0,1.3]},{w:7,n:"M",v:[0,1.6]},{w:8,n:"L",v:[0,2]},{w:2,n:"XL",v:[0,10]},{w:1,n:"XXL",v:[0,20]}],dirVA:[{w:4,n:"XS",v:[1,0]},{w:4,n:"S",v:[1.3,0]}],dirHB:[{w:4,n:"0 Degrees",v:[0,1]},{w:5,n:"30 Degrees",v:[0,1.3]},{w:7,n:"60 Degrees",v:[0,1.6]},{w:8,n:"90 Degrees",v:[0,2]},{w:2,n:"120 Degrees",v:[0,10]},{w:1,n:"180 Degrees",v:[0,20]}],dirVB:[{w:4,n:"30 Degrees",v:[1,0]},{w:4,n:"60 Degrees",v:[1.3,0]}],blurPassesA:[{w:0,n:"None",v:0},{w:6,n:"Light",v:4},{w:3,n:"Medium",v:5},{w:2,n:"Heavy",v:6},{w:1,n:"Extra Heavy",v:8}],blurPassesB:[{w:0,n:"None",v:0},{w:6,n:"Out of Phase",v:4},{w:3,n:"Incremental",v:5},{w:2,n:"In Phase",v:6},{w:1,n:"Locked",v:8}],bands:[{w:1,n:"AM",v:0},{w:50,n:"FM",v:1}],imgAType:[{w:30,n:"Stable",v:"gridWithOffsetCircles"},{w:1,n:"Interference",v:"drawConcentricRects"}],imgBType:[{w:20,n:"Stable",v:"gridWithOffsetCircles"},{w:1,n:"Interference",v:"drawConcentricRects"}],imgCType:[{w:1,n:"Kelly",v:"randomGrid"}],gridded:[{w:10,n:"No",v:!1},{w:1,n:"Yes",v:!0}],pal:palette},p={};for(let e in pp)p[e]=rco(pp[e]);for(let e=0;e<p.pal.v.length;e++)p.pal.v[e]=hex3to6(p.pal.v[e]);function setup(){switch(pixelDensity(2),dim=getDim(aspect,fill),dimFixed={w:800,h:round(800/aspect)},dimFixedMin=min(dimFixed.w,dimFixed.h),createCanvas(dim.w,dim.h),noStroke(),colorMode(HSL,360,100,100,100),rr=rb(9,16),cc=rb(9,26),debug&&console.log("drawing A"),p.imgAType.v){case"gridWithOffsetCircles":sA=drawGridWithOffsetCircles(rr,cc);break;case"drawConcentricRects":sA=drawConcentricRects(rr,cc);break;case"draw3Rects":sA=draw3Rects()}switch(sA.noStroke(),debug&&console.log("drawing B"),p.imgBType.v){case"gridWithOffsetCircles":sB=drawGridWithOffsetCircles(rr,cc);break;case"drawConcentricRects":sB=drawConcentricRects(rr,cc);break;case"draw3Rects":sB=draw3Rects()}sB.noStroke(),debug&&console.log("drawing C"),"randomGrid"===p.imgCType.v&&(texC=drawC_randomGrid()),debug&&(img_a=createGraphics(dim.w/2,dim.h/2),img_b=createGraphics(dim.w/2,dim.h/2),img_a_blur=createGraphics(dim.w/2,dim.h/2),img_b_blur=createGraphics(dim.w/2,dim.h/2),img_a.background(cb),img_b.background(cb),img_a_blur.background(cb),img_b_blur.background(cb)),img_out=createGraphics(dim.w,dim.h),img_out.background(cb),document.body.style.backgroundColor="black",debug&&(console.log("img_a and img_b"),img_a.image(sA,0,0,dim.w/2,dim.h/2),img_b.image(sB,0,0,dim.w/2,dim.h/2));for(let e=0;e<p.blurPassesA.v;e++)sA=blur(sA,shBlurHor,shBlurVer,p.dirHA.v,p.dirVA.v);for(let e=0;e<p.blurPassesB.v;e++)sB=blur(sB,shBlurHorB,shBlurVerB,p.dirHB.v,p.dirVB.v);lumA=findLum(sA,1),sA=snap(sA,shSnapA,lumA.min,lumA.max),lumB=findLum(sB,1),sB=snap(sB,shSnapB,lumB.min,lumB.max),debug&&(img_a_blur.image(sA,0,0,dim.w/2,dim.h/2),img_b_blur.image(sB,0,0,dim.w/2,dim.h/2)),sAFull=createGraphics(dim.w,dim.h,WEBGL),sAFull.translate(-dim.w/2,-dim.h/2),sAFull.image(sA,0,0,dim.w,dim.h),sBFull=createGraphics(dim.w,dim.h,WEBGL),sBFull.translate(-dim.w/2,-dim.h/2),sBFull.image(sB,0,0,dim.w,dim.h),sA=colorize(sAFull,sBFull,texC),img_out.image(sA,0,0,dim.w,dim.h)}function draw(){showcaseDebug(),noLoop()}function drawGridWithOffsetCircles(r,i){var a=dimFixed.w,s=dimFixed.h;let e=createGraphics(a,s,WEBGL);e.colorMode(HSL,360,100,100,100),e.translate(-a/2,-s/2);let t=createGraphics(a,s);t.colorMode(HSL,360,100,100,100),t.background("black"),t.rectMode(CORNERS),t.noStroke(),t.fill("black"),t.rect(0,0,a,s);var n=a/r,d=s/i;let o=0,l=0;rd()<.5&&(t.fill("red"),t.rect(.4*a,0,.6*a,s));for(let e=0;e<r;e++){l=0;var c=n*e/(r-1);for(let e=0;e<i;e++){var h=d*e/(i-1);t.fill("white"),t.triangle(o,l,o,l+h,o+c,l),t.triangle(a-o,l,a-o,l+h,a-o-c,l),t.triangle(o,s-l,o,s-l-h,o+c,s-l),t.triangle(a-o,s-l,a-o,s-l-h,a-o-c,s-l),l+=h}o+=c}return rd()<.5&&(t.fill("blue"),t.rectMode(CENTER),t.rect(a/2,s/2,.02*a,.1*s)),e.image(t,0,0),t.remove(),e}function drawConcentricRects(r,i){var a=dimFixed.w,s=dimFixed.h;let e=createGraphics(a,s,WEBGL);e.colorMode(HSL,360,100,100,100),e.translate(-a/2,-s/2);let t=createGraphics(a,s);t.colorMode(HSL,360,100,100,100),t.background("black"),t.rectMode(CORNERS),t.noStroke(),t.fill("black"),t.rect(0,0,a,s),sw=.001*dimFixedMin*rb(5,10),shadowOffset=.5*sw;var n=a/r,d=s/i;let o=0,l=0;for(let e=0;e<=r;e++){l=0;var c=n*e/(r-1);for(let e=0;e<=i;e++){var h=d*e/(i-1);t.stroke("gray"),t.strokeWeight(sw),t.line(o+shadowOffset,0,o+shadowOffset,s),t.line(a-o-shadowOffset,0,a-o-shadowOffset,s),t.line(0,l+shadowOffset,a,l+shadowOffset),t.line(0,s-l-shadowOffset,a,s-l-shadowOffset),l+=h}o+=c}o=0;for(let e=l=0;e<=r;e++){l=0;var m=n*e/(r-1);for(let e=0;e<=i;e++){var g=d*e/(i-1);t.stroke("white"),t.strokeWeight(sw),t.line(o,0,o,s),t.line(a-o,0,a-o,s),t.line(0,l,a,l),t.line(0,s-l,a,s-l),l+=g}o+=m}return e.image(t,0,0,a,s),t.remove(),e}function drawC_randomGrid(){var e=dimFixed.w,r=dimFixed.h;g3=createGraphics(e,r,WEBGL),g3.colorMode(HSL,360,100,100,100),g3.translate(-e/2,-r/2),g=createGraphics(e,r),g.colorMode(HSL,360,100,100,100),g.background(255),g.noStroke();for(var i=floor(rb(30,50)),a=floor(i*(r/e)),s=e/i,t=r/a,n=i/2,d=a/2,o=0;o<i;o++)for(var l=0;l<a;l++){var c=o*s,h=l*t,m=dist(o,l,n,d),w=Math.min(i,a)/3,w=exp(-.5*pow(m/w,2));p.gridded.v&&(w=.8),col=rd()<w?varyHSL(rc(p.pal.v),5,10,5,"jitter"):varyHSL(cb,0,10,5,"jitter"),g.fill(col),g.rect(c,h,1.1*s,1.1*t)}return g3.image(g,0,0,e,r),g.remove(),g3}function blur(e,r,i,a,s){var t=e.width,n=e.height;return e.shader(r),r.setUniform("tex0",e),r.setUniform("direction",a),r.setUniform("resolution",[t,n]),e.rect(0,0,t,n),e.resetShader(),e.shader(i),i.setUniform("tex0",e),i.setUniform("direction",s),i.setUniform("resolution",[t,n]),e.rect(0,0,t,n),e.resetShader(),e}function snap(e,r,i=0,a=1){var s=e.width,t=e.height;return g=createGraphics(s,t,WEBGL),g.translate(-s/2,-t/2),g.image(e,0,0),g.shader(r),r.setUniform("tex",g),r.setUniform("minLum",i),r.setUniform("maxLum",a),g.rect(0,0,s,t),g.resetShader(),g.remove(),g}function colorize(e,r,i,a=0,s){var t=e.width,n=e.height;return e.shader(shColorize),shColorize.setUniform("texA",e),shColorize.setUniform("texB",r),shColorize.setUniform("texC",i),shColorize.setUniform("fc",frameCount),e.rect(0,0,t,n),e.resetShader(),e}"Oracle"==p.pal.n?p.prophecy={w:1,n:`${p.pal.v[2].replace("#","")}`,v:!0}:p.prophecy={w:1,n:"None",v:!1},p.gridded.v&&(p.imgAType=gj(pp.imgAType,"Interference"),p.blurPassesA=gj(pp.blurPassesA,"None")),console.table("Receive Transmission by Aaron Penne (2023)"),console.log("token id: ",tokenData.tokenId),console.log("token hash: ",tokenData.hash),console.table({Colors:p.pal.n,Bands:p.bands.n,"Data Refinement":p.blurPassesA.n,"Radio Tuning":p.blurPassesB.n,"Horizontal Calibration":p.dirHA.n,"Vertical Calibration":p.dirVA.n,Azimuth:p.dirHB.n,Declination:p.dirVB.n,"Signal A":p.imgAType.n,"Signal B":p.imgBType.n,"Palette Structure":p.imgCType.n,"Graph Paper":p.gridded.n,Prophecy:p.prophecy.n}),shBlurHor=new p5.Shader(this._renderer,baseVertShader,blurFragShader),shBlurVer=new p5.Shader(this._renderer,baseVertShader,blurFragShader),shBlurHorB=new p5.Shader(this._renderer,baseVertShader,blurFragShader),shBlurVerB=new p5.Shader(this._renderer,baseVertShader,blurFragShader),shAdd=new p5.Shader(this._renderer,baseVertShader,addFragShader),shSubtract=new p5.Shader(this._renderer,baseVertShader,subtractFragShader),shSnapA=new p5.Shader(this._renderer,baseVertShader,snapFragShader),shSnapB=new p5.Shader(this._renderer,baseVertShader,snapFragShader),shColorize=new p5.Shader(this._renderer,baseVertShader,colorizeFragShader);
const urlParams=new URLSearchParams(window.location.search);function download(){var e=`receive_transmission_${tokenData.tokenId}_${tokenData.hash}.png`;save(e)}function getTimestamp(){return(new Date).toISOString().replace(/[^T0-9]/g,"").replace("T","_")}"undefined"==typeof tokenData&&(tokenData={hash:"0x"+Math.round(1e12*Math.random()+1e12),tokenId:"18000199"});let debug=!1;urlParams.has("debug")&&(debug=!0),urlParams.has("hash")&&(tokenData.hash=urlParams.get("hash"));let seed=gs(tokenData.hash),aspect=16/9,fill=!1;if(urlParams.has("aspect")){let e=urlParams.get("aspect"),t=parseFloat(e);isNaN(t)||0===t?"fill"===e?fill=!0:console.warn("Invalid aspect ratio provided. Using default ",aspect):aspect=t}function getDim(e=1,t=!1){let n,r;return innerWidth/innerHeight>e?(r=innerHeight,n=r*e):(n=innerWidth,r=n/e),t&&(n=innerWidth,r=innerHeight),{w:n,h:r}}function lerpHex(e,t,n){var r=+e.replace("#","0x"),a=r>>16,e=r>>8&255,r=255&r,t=+t.replace("#","0x");return"#"+((1<<24)+(a+n*((t>>16)-a)<<16)+(e+n*((t>>8&255)-e)<<8)+(r+n*((255&t)-r))|0).toString(16).slice(1)}function hex3to6(e){return 7<=(e="#"!=e[0]?"#"+e:e).length?e:e=e.split("").map(e=>"#"==e?e:e+e).join("")}function lerp(e,t,n){return e*(1-n)+t*n}function mapRng(e,t,n,r,a){return(e-t)/(n-t)*(a-r)+r}function titleCase(t){t=t.toLowerCase().split(" ");for(let e=0;e<t.length;e++)t[e]=t[e].charAt(0).toUpperCase()+t[e].slice(1);return t.join(" ")}function urlP(e){return urlParams.get(e)?lower(urlParams.get(e)):""}function gs(e){return parseInt(tokenData.hash.slice(0,16),16)}function rd(){return seed^=seed<<13,seed^=seed>>17,seed^=seed<<5,(seed<0?1+~seed:seed)%1e3/1e3}function rb(e,t){return e+(t-e)*rd()}function rj(e,t){return rb(e-t,e+t)}function rc(e){return e[Math.floor(rb(0,.99*e.length))]}function rco(e){let n=[];return e.forEach((t,e)=>{for(let e=0;e<t.w;e++)n.push(t)}),rc(n)}function shuffle(t){for(let e=t.length-1;0<e;e--){var n=Math.floor(rd()*(e+1));[t[e],t[n]]=[t[n],t[e]]}}function gj(e,t,n=!1){let r=e.filter(({n:e})=>e==t);return n?(r=r.map(({v:e})=>e),[...r]):r[0]}function linGrad(e,t,n,r,a,o,s=drawingContext){let c=s.createLinearGradient(e,t,n,r);c.addColorStop(0,a),c.addColorStop(1,o),s.fillStyle=c}function mapEase(e,t,n,r,a,o){let s=(e-t)/(n-t);switch(o){case"linear":return r+s*(a-r);case"sineIn":return r+(1-cos(s*PI/2))*(a-r);case"sineOut":return r+sin(s*PI/2)*(a-r);case"sineInOut":return r+(1-cos(PI*s))/2*(a-r);case"quadIn":return r+s*s*(a-r);case"quadOut":return r+s*(2-s)*(a-r);case"quadInOut":return s<.5?r+2*s*s*(a-r):r+(4-2*s)*s*(a-r);case"cubicIn":return r+s*s*s*(a-r);case"cubicOut":return r+--s*s*s*(a-r);case"c":return s<.5?r+4*s*s*s*(a-r):r+--s*s*s*4*(a-r);case"expoIn":return 0===s?r:r+pow(2,10*(s-1))*(a-r);case"expoOut":return 1===s?r+(a-r):r+(1-pow(2,-10*s))*(a-r);case"expoInOut":return 0===s?r:1===s?r+(a-r):(s*=2)<1?r+pow(2,10*(s-1))/2*(a-r):r+(2-pow(2,-10*--s))/2*(a-r);case"expoOutIn":return s<.5?0===s?r:r+(1-pow(2,2*s*-10))/2*(a-r):(s=2*(s-.5),1===s?r+(a-r)/2:r+(pow(2,10*(s-1))/2+.5)*(a-r));default:return r+s*(a-r)}}function rgbToHsl(e,t,n){e/=255,t/=255,n/=255;var r=Math.max(e,t,n),a=Math.min(e,t,n);let o,s,c=(r+a)/2;if(r==a)o=s=0;else{var i=r-a;switch(s=.5<c?i/(2-r-a):i/(r+a),r){case e:o=(t-n)/i+(t<n?6:0);break;case t:o=(n-e)/i+2;break;case n:o=(e-t)/i+4}o/=6}return[o,s,c]}function hslToRgb(e,t,n){let r,a,o;function s(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}return 0==t?r=a=o=n:(t=2*n-(n=n<.5?n*(1+t):n+t-n*t),r=s(t,n,e+1/3),a=s(t,n,e),o=s(t,n,e-1/3)),[255*r,255*a,255*o]}function findLum(e,t=255){var n=e.width,r=e.height;let a=createGraphics(n,r);a.image(e,0,0,n,r);let o=255,s=0;a.loadPixels();for(let e=0;e<a.pixels.length;e+=4){var c=.299*a.pixels[e]+.587*a.pixels[e+1]+.114*a.pixels[e+2];c<o&&(o=c),c>s&&(s=c)}return o=map(o,0,255,0,t),s=map(s,0,255,0,t),a.remove(),{min:o,max:s}}function keyPressed(){"s"==key?download():"r"==key?window.location.reload():"d"==key&&showcaseDebug()}function mouseClicked(){(mouseX<width/2&&mouseY>height/2?download:showcaseDebug)()}function showcaseDebug(){pad=.003,showcase=(showcase+1)%showcaseMax,1===showcase?image(texC,0,0,width,height):image(sA,0,0,width,height,width*pad,height*pad,width*(1-2*pad),height*(1-2*pad))}function varyHSL(e,t,n,r,a="exact"){var o=color(e),s=hue(o),e=saturation(o),o=lightness(o);"jitter"==a&&(t=rj(0,t),n=rj(0,n),r=rj(0,r)),s=(s+t)%360,e=constrain(e+n,0,100),o=constrain(o+r,0,100),push(),colorMode(HSL,360,100,100);o=color(s,e,o);return pop(),o}let cw="#F5F8F8",cb="#050505",zephyrPal=["#4E6E61","#365","#4C3F5D","#336","#358","#45A","#576","#5493B6","#7AC","#89292D","#87A","#8F3935","#A33","#B8513B","#B78","#C54","#C95","#D57C30","#D94","#DA9","#C99","#DEC254"],palette=[{w:5,n:"Cat's Cradle",v:["#45A","#336","#358","#5493B6",cw,cb]},{w:20,n:"Jocelyn",v:[cw,cb,cw]},{w:15,n:"Zephyr",v:zephyrPal},{w:60,n:"Oracle",v:[cb,cw,rc(zephyrPal)],cb:cb,cw:cw},{w:3,n:"Halcyon",v:["#756485","#835061","#9A95A0","#B6A5C8","#9B85A2","#835061","#C58FAD","#BC849E","#883E3F","#BD636E","#CF707D","#703946","#8C495C","#B9627D","#683D4D","#3F2D39","#7F4364","#5E3750","#252830","#4A354F","#3A2D3E","#1E231D","#242525","#212322","#1C211E","#2E272D","#42303D","#26262D","#482F37","#7B4048","#4C3037","#442F35","#A9554E","#9C4E47","#4E282B","#B26A53","#CE7C5D","#884331","#9A605B","#C48A8C","#A06B6A","#714A4F","#A88DB1","#A38AAE","#594662","#B1A9B4","#242525","#212322","#1C211E"]},{w:10,n:"Ian",v:["#000000","#000102","#010101","#020202","#030302","#030303","#040302","#060504","#070707","#080808","#090A08","#0B0D11","#0D0E10","#0E0F10","#0F0E0D","#0F0F0E","#110C05","#111110","#141313","#161616","#171717","#191816","#1A1919","#1A1A1B","#1F2021","#202020","#212021","#23211D","#252424","#2B2522","#2F2D2D","#322E2D","#393633","#3C3837","#3F3C3B","#52504E","#544E4A","#615E5A","#6F6962","#706D67","#786D65","#7F746B","#96958F","#9F9B94","#A09990","#EEE4D9","#EEEAE2","#F4EBE1","#FAF3E8","#FCF6EE","#FDF5EA","#FFFAEF","#060506"]},{w:10,n:"Basil Gogos",v:["#823d65","#83ABAB",cb,"#7A4280",cb,cw]},{w:2,n:"Young Again",v:["#a36aa5","#006eb8","#fcb315","#e31f26",cw,cb]}];baseVertShader=` attribute vec3 aPosition; attribute vec2 aTexCoord; varying vec2 vTexCoord; void main() { vTexCoord = aTexCoord; vec4 positionVec4 = vec4(aPosition, 1.0); positionVec4.xy = positionVec4.xy * 2.0 - 1.0; gl_Position = positionVec4; }`,blurFragShader=` #ifdef GL_ES precision highp float; precision highp int; #endif varying vec2 vTexCoord; uniform sampler2D tex0; uniform vec2 direction; // https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms vec3 gaussianBlur( sampler2D t, vec2 texUV, vec2 stepSize ){ vec3 colOut = vec3( 0.0 ); const int stepCount = 9; float gWeights[stepCount]; gWeights[0] = 0.10855; gWeights[1] = 0.13135; gWeights[2] = 0.10406; gWeights[3] = 0.07216; gWeights[4] = 0.04380; gWeights[5] = 0.02328; gWeights[6] = 0.01083; gWeights[7] = 0.00441; gWeights[8] = 0.00157; float gOffsets[stepCount]; gOffsets[0] = 0.66293; gOffsets[1] = 2.47904; gOffsets[2] = 4.46232; gOffsets[3] = 6.44568; gOffsets[4] = 8.42917; gOffsets[5] = 10.41281; gOffsets[6] = 12.39664; gOffsets[7] = 14.38070; gOffsets[8] = 16.36501; vec2 maxCoord = vec2(1.0, 1.0) - stepSize; vec2 minCoord = stepSize; for( int i = 0; i < stepCount; i++ ){ vec2 texCoordOffset = gOffsets[i] * stepSize; vec2 clampedPos = clamp(texUV + texCoordOffset, minCoord, maxCoord); vec2 clampedNeg = clamp(texUV - texCoordOffset, minCoord, maxCoord); vec3 col = texture2D( t, clampedPos ).xyz + texture2D( t, clampedNeg ).xyz; col *= gWeights[i]; colOut += col; } return colOut; } void main() { vec2 uv = vTexCoord; uv = 1.0 - uv; vec3 blur = gaussianBlur(tex0, uv, .0015 * direction); gl_FragColor = vec4(blur, 1.0); }`,addFragShader=` precision highp float; varying vec2 vTexCoord; uniform sampler2D tex0; uniform sampler2D tex1; void main() { vec4 color0 = texture2D(tex0, vTexCoord); vec4 color1 = texture2D(tex1, vTexCoord); vec4 outputColor = color0 + color1; gl_FragColor = outputColor; } `,subtractFragShader=` precision highp float; varying vec2 vTexCoord; uniform sampler2D tex0; uniform sampler2D tex1; void main() { vec4 color0 = texture2D(tex0, vTexCoord); vec4 color1 = texture2D(tex1, vTexCoord); vec4 outputColor = color1 - color1; gl_FragColor = outputColor; } `,snapFragShader=` precision highp float; varying vec2 vTexCoord; uniform sampler2D tex; uniform float minLum, maxLum; float map(float value, float min1, float max1, float min2, float max2) { return min2 + (value - min1) * (max2 - min2) / (max1 - min1); } void main() { vec2 uv = vTexCoord; uv.y = 1.0 - uv.y; vec3 c = texture2D(tex, uv).rgb; float lum = dot(c, vec3(0.299, 0.587, 0.114)); lum = map(lum, minLum, maxLum, 0., 1.); c = vec3(lum); gl_FragColor = vec4(c, 1.0); }`,colorizeFragShader=` #ifdef GL_ES precision highp float; precision highp int; #endif varying vec2 vTexCoord; uniform sampler2D texA, texB, texC; uniform float fc; float map(float value, float min1, float max1, float min2, float max2) { return min2 + (value - min1) * (max2 - min2) / (max1 - min1); } void main() { vec2 uv = vTexCoord; uv.y = 1.0 - uv.y; vec3 c = vec3(0.); vec3 cA = texture2D(texA, uv).rgb; vec3 cB = texture2D(texB, uv).rgb; float lumA = dot(cA, vec3(0.299, 0.587, 0.114)); float lumB = dot(cB, vec3(0.299, 0.587, 0.114)); float x, y; x = lumA + lumB; y = lumB - lumA; c = texture2D(texC, vec2(lumA, lumB)).rgb; gl_FragColor = vec4(c, 1.0); } `;let showcase=1,showcaseMax=2,dim,dimFixedMin,shBlurHor,shBlurVer,shBlurHorB,shBlurVerB,shColorize,shCombine,shSnapA,shSnapB,s,texC,sA,sB,pp={dirHA:[{w:4,n:"XS",v:[0,1]},{w:5,n:"S",v:[0,1.3]},{w:7,n:"M",v:[0,1.6]},{w:8,n:"L",v:[0,2]},{w:2,n:"XL",v:[0,10]},{w:1,n:"XXL",v:[0,20]}],dirVA:[{w:4,n:"XS",v:[1,0]},{w:4,n:"S",v:[1.3,0]}],dirHB:[{w:4,n:"0 Degrees",v:[0,1]},{w:5,n:"30 Degrees",v:[0,1.3]},{w:7,n:"60 Degrees",v:[0,1.6]},{w:8,n:"90 Degrees",v:[0,2]},{w:2,n:"120 Degrees",v:[0,10]},{w:1,n:"180 Degrees",v:[0,20]}],dirVB:[{w:4,n:"30 Degrees",v:[1,0]},{w:4,n:"60 Degrees",v:[1.3,0]}],blurPassesA:[{w:0,n:"None",v:0},{w:6,n:"Light",v:4},{w:3,n:"Medium",v:5},{w:2,n:"Heavy",v:6},{w:1,n:"Extra Heavy",v:8}],blurPassesB:[{w:0,n:"None",v:0},{w:6,n:"Out of Phase",v:4},{w:3,n:"Incremental",v:5},{w:2,n:"In Phase",v:6},{w:1,n:"Locked",v:8}],bands:[{w:1,n:"AM",v:0},{w:50,n:"FM",v:1}],imgAType:[{w:30,n:"Stable",v:"gridWithOffsetCircles"},{w:1,n:"Interference",v:"drawConcentricRects"}],imgBType:[{w:20,n:"Stable",v:"gridWithOffsetCircles"},{w:1,n:"Interference",v:"drawConcentricRects"}],imgCType:[{w:1,n:"Kelly",v:"randomGrid"}],gridded:[{w:10,n:"No",v:!1},{w:1,n:"Yes",v:!0}],pal:palette},p={};for(let e in pp)p[e]=rco(pp[e]);for(let e=0;e<p.pal.v.length;e++)p.pal.v[e]=hex3to6(p.pal.v[e]);function setup(){switch(pixelDensity(2),dim=getDim(aspect,fill),dimFixed={w:800,h:round(800/aspect)},dimFixedMin=min(dimFixed.w,dimFixed.h),createCanvas(dim.w,dim.h),noStroke(),colorMode(HSL,360,100,100,100),rr=rb(9,16),cc=rb(9,26),debug&&console.log("drawing A"),p.imgAType.v){case"gridWithOffsetCircles":sA=drawGridWithOffsetCircles(rr,cc);break;case"drawConcentricRects":sA=drawConcentricRects(rr,cc);break;case"draw3Rects":sA=draw3Rects()}switch(sA.noStroke(),debug&&console.log("drawing B"),p.imgBType.v){case"gridWithOffsetCircles":sB=drawGridWithOffsetCircles(rr,cc);break;case"drawConcentricRects":sB=drawConcentricRects(rr,cc);break;case"draw3Rects":sB=draw3Rects()}sB.noStroke(),debug&&console.log("drawing C"),"randomGrid"===p.imgCType.v&&(texC=drawC_randomGrid()),debug&&(img_a=createGraphics(dim.w/2,dim.h/2),img_b=createGraphics(dim.w/2,dim.h/2),img_a_blur=createGraphics(dim.w/2,dim.h/2),img_b_blur=createGraphics(dim.w/2,dim.h/2),img_a.background(cb),img_b.background(cb),img_a_blur.background(cb),img_b_blur.background(cb)),img_out=createGraphics(dim.w,dim.h),img_out.background(cb),document.body.style.backgroundColor="black",debug&&(console.log("img_a and img_b"),img_a.image(sA,0,0,dim.w/2,dim.h/2),img_b.image(sB,0,0,dim.w/2,dim.h/2));for(let e=0;e<p.blurPassesA.v;e++)sA=blur(sA,shBlurHor,shBlurVer,p.dirHA.v,p.dirVA.v);for(let e=0;e<p.blurPassesB.v;e++)sB=blur(sB,shBlurHorB,shBlurVerB,p.dirHB.v,p.dirVB.v);lumA=findLum(sA,1),sA=snap(sA,shSnapA,lumA.min,lumA.max),lumB=findLum(sB,1),sB=snap(sB,shSnapB,lumB.min,lumB.max),debug&&(img_a_blur.image(sA,0,0,dim.w/2,dim.h/2),img_b_blur.image(sB,0,0,dim.w/2,dim.h/2)),sAFull=createGraphics(dim.w,dim.h,WEBGL),sAFull.translate(-dim.w/2,-dim.h/2),sAFull.image(sA,0,0,dim.w,dim.h),sBFull=createGraphics(dim.w,dim.h,WEBGL),sBFull.translate(-dim.w/2,-dim.h/2),sBFull.image(sB,0,0,dim.w,dim.h),sA=colorize(sAFull,sBFull,texC),img_out.image(sA,0,0,dim.w,dim.h)}function draw(){showcaseDebug(),noLoop()}function drawGridWithOffsetCircles(r,i){var a=dimFixed.w,s=dimFixed.h;let e=createGraphics(a,s,WEBGL);e.colorMode(HSL,360,100,100,100),e.translate(-a/2,-s/2);let t=createGraphics(a,s);t.colorMode(HSL,360,100,100,100),t.background("black"),t.rectMode(CORNERS),t.noStroke(),t.fill("black"),t.rect(0,0,a,s);var n=a/r,d=s/i;let o=0,l=0;rd()<.5&&(t.fill("red"),t.rect(.4*a,0,.6*a,s));for(let e=0;e<r;e++){l=0;var c=n*e/(r-1);for(let e=0;e<i;e++){var h=d*e/(i-1);t.fill("white"),t.triangle(o,l,o,l+h,o+c,l),t.triangle(a-o,l,a-o,l+h,a-o-c,l),t.triangle(o,s-l,o,s-l-h,o+c,s-l),t.triangle(a-o,s-l,a-o,s-l-h,a-o-c,s-l),l+=h}o+=c}return rd()<.5&&(t.fill("blue"),t.rectMode(CENTER),t.rect(a/2,s/2,.02*a,.1*s)),e.image(t,0,0),t.remove(),e}function drawConcentricRects(r,i){var a=dimFixed.w,s=dimFixed.h;let e=createGraphics(a,s,WEBGL);e.colorMode(HSL,360,100,100,100),e.translate(-a/2,-s/2);let t=createGraphics(a,s);t.colorMode(HSL,360,100,100,100),t.background("black"),t.rectMode(CORNERS),t.noStroke(),t.fill("black"),t.rect(0,0,a,s),sw=.001*dimFixedMin*rb(5,10),shadowOffset=.5*sw;var n=a/r,d=s/i;let o=0,l=0;for(let e=0;e<=r;e++){l=0;var c=n*e/(r-1);for(let e=0;e<=i;e++){var h=d*e/(i-1);t.stroke("gray"),t.strokeWeight(sw),t.line(o+shadowOffset,0,o+shadowOffset,s),t.line(a-o-shadowOffset,0,a-o-shadowOffset,s),t.line(0,l+shadowOffset,a,l+shadowOffset),t.line(0,s-l-shadowOffset,a,s-l-shadowOffset),l+=h}o+=c}o=0;for(let e=l=0;e<=r;e++){l=0;var m=n*e/(r-1);for(let e=0;e<=i;e++){var g=d*e/(i-1);t.stroke("white"),t.strokeWeight(sw),t.line(o,0,o,s),t.line(a-o,0,a-o,s),t.line(0,l,a,l),t.line(0,s-l,a,s-l),l+=g}o+=m}return e.image(t,0,0,a,s),t.remove(),e}function drawC_randomGrid(){var e=dimFixed.w,r=dimFixed.h;g3=createGraphics(e,r,WEBGL),g3.colorMode(HSL,360,100,100,100),g3.translate(-e/2,-r/2),g=createGraphics(e,r),g.colorMode(HSL,360,100,100,100),g.background(255),g.noStroke();for(var i=floor(rb(30,50)),a=floor(i*(r/e)),s=e/i,t=r/a,n=i/2,d=a/2,o=0;o<i;o++)for(var l=0;l<a;l++){var c=o*s,h=l*t,m=dist(o,l,n,d),w=Math.min(i,a)/3,w=exp(-.5*pow(m/w,2));p.gridded.v&&(w=.8),col=rd()<w?varyHSL(rc(p.pal.v),5,10,5,"jitter"):varyHSL(cb,0,10,5,"jitter"),g.fill(col),g.rect(c,h,1.1*s,1.1*t)}return g3.image(g,0,0,e,r),g.remove(),g3}function blur(e,r,i,a,s){var t=e.width,n=e.height;return e.shader(r),r.setUniform("tex0",e),r.setUniform("direction",a),r.setUniform("resolution",[t,n]),e.rect(0,0,t,n),e.resetShader(),e.shader(i),i.setUniform("tex0",e),i.setUniform("direction",s),i.setUniform("resolution",[t,n]),e.rect(0,0,t,n),e.resetShader(),e}function snap(e,r,i=0,a=1){var s=e.width,t=e.height;return g=createGraphics(s,t,WEBGL),g.translate(-s/2,-t/2),g.image(e,0,0),g.shader(r),r.setUniform("tex",g),r.setUniform("minLum",i),r.setUniform("maxLum",a),g.rect(0,0,s,t),g.resetShader(),g.remove(),g}function colorize(e,r,i,a=0,s){var t=e.width,n=e.height;return e.shader(shColorize),shColorize.setUniform("texA",e),shColorize.setUniform("texB",r),shColorize.setUniform("texC",i),shColorize.setUniform("fc",frameCount),e.rect(0,0,t,n),e.resetShader(),e}"Oracle"==p.pal.n?p.prophecy={w:1,n:`${p.pal.v[2].replace("#","")}`,v:!0}:p.prophecy={w:1,n:"None",v:!1},p.gridded.v&&(p.imgAType=gj(pp.imgAType,"Interference"),p.blurPassesA=gj(pp.blurPassesA,"None")),console.table("Receive Transmission by Aaron Penne (2023)"),console.log("token id: ",tokenData.tokenId),console.log("token hash: ",tokenData.hash),console.table({Colors:p.pal.n,Bands:p.bands.n,"Data Refinement":p.blurPassesA.n,"Radio Tuning":p.blurPassesB.n,"Horizontal Calibration":p.dirHA.n,"Vertical Calibration":p.dirVA.n,Azimuth:p.dirHB.n,Declination:p.dirVB.n,"Signal A":p.imgAType.n,"Signal B":p.imgBType.n,"Palette Structure":p.imgCType.n,"Graph Paper":p.gridded.n,Prophecy:p.prophecy.n}),shBlurHor=new p5.Shader(this._renderer,baseVertShader,blurFragShader),shBlurVer=new p5.Shader(this._renderer,baseVertShader,blurFragShader),shBlurHorB=new p5.Shader(this._renderer,baseVertShader,blurFragShader),shBlurVerB=new p5.Shader(this._renderer,baseVertShader,blurFragShader),shAdd=new p5.Shader(this._renderer,baseVertShader,addFragShader),shSubtract=new p5.Shader(this._renderer,baseVertShader,subtractFragShader),shSnapA=new p5.Shader(this._renderer,baseVertShader,snapFragShader),shSnapB=new p5.Shader(this._renderer,baseVertShader,snapFragShader),shColorize=new p5.Shader(this._renderer,baseVertShader,colorizeFragShader);
ATOM is a way of thinking about digital images. The pixel is the atomic unit of every digital image — each pixel is three numbers that define the intensity of red, green, and blue light sources. Every digital image has two representations, a linear sequence of numbers and those numbers converted into a grid of lights that form an image. ATOM is the collision of the objective and subjective, it’s a space to explore. An early version of ATOM, called ORA, was written in C++ in 2003. It was the first time I thought precisely about images as data and data as images. At that time, I was loading photographs into the system to “see” them in different ways, to look at their data through other representations. ATOM, created from scratch in 2023, is completely generative and synthesized. The static gooey color patterns are the core of ATOM. They are generated with code that combines sine waves. These patterns are the data sources that drive three other diagrammatic representations of each pattern image: color blocks, RGB signals, extruded terrain. ATOM is my Rosetta Stone. It’s the foundation for ""An Empty Room,"" my work exhibited at the Los Angeles County Museum of Art (LACMA) in Spring 2023, and also ""923 Empty Rooms,"" a long-form generative art release with Bright Moments and Art Blocks in August 2023. This work all builds on my ""Still Life"" series, first exhibited at the bitforms gallery in New York in 2016 and concluding there with the final ""Still Life"" exhibition in November 2023. Press “spacebar” to keep exploring the “space” of possibilities within the features of each mint. The ‘B’ key changes the background value.
Gone are their worlds. Actions taken that silenced these places for a thousand years. The echo of distant cannons forgotten, the souls of their victims evaporated, claimed by the void. A new epoch now, a different era. Long after the cold and the dark came to claim everything, smoldering under the ashes of memory, we find the veins and arteries of their civilization. Clusters of roots, cavernous extensions of what they lost, that drive themselves deep into the earth. Potent icons of existential dread, of what is gone. Their meaning is unknown, but not unknowable. These RELICS will bring to light what we have forgotten, ancient memories of their catastrophe, so we can learn how not to replicate it.
Upon encountering Matisse's ""Blue Nudes"" series, I found myself intrigued by the photograph of a room adorned with these simple yet evocative depictions of the human form. At first glance the figures appeared as harmonious abstractions, each embodying a shared pose while subtly diverging in unique ways upon closer inspection. This experience ignited my fascination with the artistic endeavor to recreate the same essence through multiple iterations, prompting a contemplation on the role of variations in a generative art series in an era often fixated on extravagant algorithmic diversity. Here we aim to celebrate subtlety. This project employs not only the randomness inherent to algorithms but also the serendipity of human intervention. Anchored in my own hand-drawn inputs, the process intertwines organic paths with algorithmic automation, generating polygons that exude the beauty of nuanced distinctions. Beyond technique, this endeavor mirrors an autobiographical passage — a celebration of my evolution from functional coder to constructor of pure form. Matisse's iconic method of composing with cut paper — initially a preparatory ritual — mirrors my own journey. What once served utilitarian software now finds purpose in artistry, code morphing into my chosen medium of artistic expression. This metamorphosis, a kinship to Matisse's transformation, is my homage to the creative odyssey that beckons when code transcends its pragmatic origins.
let REF_CANVAS_SIZE = 1024; let REF_BUFFER_SIZE = 512; let REF_STROKE_HALF = 0.5; let REF_STROKE_FULL = 1.0; let STROKE_QUART = 0.0; let STROKE_HALF = 0.0; let STROKE_FULL = 0.0; let CANVAS_SIZE = 0; let BUFFER_SIZE = 0; let BG = "#090809"; let BLACK = "#000000"; let LIME = "#cccc66"; let TURQ = "#04edcd"; let WHITE = "#FFFFFF"; let ORANGE = "#FF9900"; let ORANGE_RED = "#cc6600"; let RED_ORANGE = "#ff4800" let MID_GREY = "#CCCCCC"; let DRK_GREY = "#333333"; let RED_PINK = "#ff003c"; let GREEN = "#c5cd7a"; let PINK = "#c90a48"; let FRAME_COL = MID_GREY; let SYSTEM_COL = WHITE; let SEED; let RES_MULTI; let RES_REDUC; let ROOT_DATA = []; let HASH_DATA = []; let BLUR; let palettes_start = [ ["#cccc66", "#999933", "#999966", "#04edcd"], ["#3d2ba5", "#2b53a5", "#2b4ba5", "#04edcd"], ["#cc3300", "#cc6600", "#cc9933", "#04edcd"], ["#ff003c", "#89223b", "#93237d", "#04edcd"] ]; let palettes_stop = [ ["#cdb966", "#9a8637", "#8d8371", "#88b4a1"], ["#773f61", "#5c5286", "#8d4b4d", "#88b4a1"], ["#cd4a28", "#b36347", "#cd6a31", "#88b4a1"], ["#ed3c34", "#7e264a", "#5c358a", "#88b4a1"] ]; function setup() { SEED = parseInt(tokenData.hash.slice(0, 16), 16); randomSeed(SEED); noiseSeed(SEED); noiseDetail(8); let ss = min(windowWidth, windowHeight); RES_MULTI = ss / REF_CANVAS_SIZE; RES_REDUC = REF_CANVAS_SIZE / ss; CANVAS_SIZE = rm(REF_CANVAS_SIZE); BUFFER_SIZE = rm(REF_BUFFER_SIZE); STROKE_HALF = rm(REF_STROKE_HALF); STROKE_FULL = rm(REF_STROKE_FULL); STROKE_QUART = STROKE_HALF / 2.0; createCanvas(CANVAS_SIZE, CANVAS_SIZE, WEBGL); BLUR = new p5.Shader(this._renderer, blur_vertex, blur_fragment); shader(BLUR); set_relicdata(); let MAIN_BUFFER = comp(); fill("#FF9900"); BLUR.setUniform('tex0', MAIN_BUFFER); BLUR.setUniform('blur_amount', rm(8)); BLUR.setUniform('blur_curve', 1); BLUR.setUniform('texelSize', [1 / width, 1 / height]); rect(0, 0, CANVAS_SIZE, CANVAS_SIZE); } function set_relicdata() { function lerp(start, end, amt) { return (1 - amt) * start + amt * end } let hashdata = []; for (let j = 0; j < 32; j++) { let pair = tokenData.hash.slice(2 + (j * 2), 4 + (j * 2)); let npair = parseInt(pair, 16) / 255.0; hashdata.push(npair); } let val_count = hashdata[0]; let val_age = hashdata[1]; let val_pallete = hashdata[2]; let val_creep = hashdata[3]; let val_chaos = hashdata[4]; let val_size = hashdata[5]; let min_core_radius = 30; let max_core_radius = 60; let min_root_radius = 30; let max_root_radius = 30; let min_root_count = 3; let max_root_count = 8; let min_age = 10.0; let max_age = 30.0; let min_taper = 0.0; let min_chaos = 1.0; let max_chaos = 1.5; let min_creep = 0.0; let max_creep = max_core_radius; let min_offset = min_core_radius; let max_offset = max_core_radius; let environment_buffer = 10; let relic_origin = createVector(REF_BUFFER_SIZE / 2, REF_BUFFER_SIZE / 2); let core_radius = round(lerp(min_core_radius, max_core_radius, val_size)); let root_count = Math.round(lerp(min_root_count, max_root_count, val_count)); let root_nodes = root_count - 2; let chaos = round(lerp(min_chaos, max_chaos, val_chaos)); let creep = round(lerp(min_creep, max_creep, val_creep)); let greatest_root_radius = 0; let greatest_offset = 0; let pallete = Math.round(lerp(0, 3, val_pallete)); for (let i = root_count - 1; i >= 0; i--) { let col = rint(2); let angle = TWO_PI / root_nodes; let offset = round(lerp(min_offset, max_offset, random(1.0))); let overlaps = BLACK; let root_radius = round(lerp(min_root_radius, max_root_radius, random(1.0))); greatest_root_radius = (root_radius > greatest_root_radius) ? root_radius : greatest_root_radius; greatest_offset = (offset > greatest_offset) ? offset : greatest_offset; let max_taper = (root_radius / 2); let taper = round(lerp(min_taper, max_taper, random(1.0))); let env_radius = (greatest_root_radius + core_radius + greatest_offset + environment_buffer); let colour_index = col; let strength = 120; let age = round(lerp(min_age, max_age, val_age)); let env_root = (i == 0); let core_root = (i == 1); if (env_root) { offset = 0.0; overlaps = -1; colour_index = 3; strength = 20; age = 50; root_radius = env_radius; creep = 0; } if (core_root) { offset = 0.0; root_radius = core_radius; strength = 120; } ROOT_DATA[i] = get_rootdata(relic_origin, root_radius, angle * (i - 2), age, taper, chaos, creep, offset, overlaps, strength, pallete, colour_index, i); } } function get_rootdata(relic_origin, root_radius, angle, age, taper, chaos, creep, offset, overlaps, strength, pallete, colour_index, no) { let root_data = { relic_origin: relic_origin, root_radius: root_radius, angle: angle, age: age, taper: taper, chaos: chaos, creep: creep, offset: offset, overlaps: overlaps, pallete: pallete, colour_index: colour_index, strength: strength, no: no }; return root_data; } function comp() { let layer_composite = create_layer(CANVAS_SIZE); layer_composite.background(BG); let layer_gradient = create_layer(CANVAS_SIZE); gradient(layer_gradient, 0, 0, CANVAS_SIZE, CANVAS_SIZE, color(BLACK), color(PINK), Axis.y); render_layer(layer_gradient, layer_composite, ADD, 10, Axis.none); let layer_holo = create_layer(CANVAS_SIZE); let layer_basesystem = generate(systems_arrays, Axis.y, BUFFER_SIZE); render_layer(layer_basesystem, layer_holo, ADD, 40, Axis.y); render_layer(layer_basesystem, layer_holo, ADD, 10, Axis.x); render_layer(layer_basesystem, layer_holo, ADD, 10, Axis.z); let layer_relics = generate(draw_relics, Axis.y, rm(1)); render_layer(layer_relics, layer_holo, ADD, 100, Axis.y, false); render_layer(layer_relics, layer_holo, ADD, 100, Axis.y, false); let layer_frame = generate(frame, Axis.x, BUFFER_SIZE / 8); render_layer(layer_frame, layer_holo, ADD, 80, Axis.x); render_layer(layer_frame, layer_holo, ADD, 40, Axis.y); let layer_gradients = generate(grads, Axis.x, BUFFER_SIZE); render_layer(layer_gradients, layer_holo, ADD, 60, Axis.x); render_layer(layer_gradients, layer_holo, ADD, 60, Axis.y); render_layer(layer_gradients, layer_holo, ADD, 60, Axis.z); render_layer(layer_holo, layer_composite, ADD, 100, Axis.none, CANVAS_SIZE / 2, CANVAS_SIZE / 2, CANVAS_SIZE * 0.9, CANVAS_SIZE * 0.9, CENTER); render_layer(layer_holo, layer_composite, ADD, 20, Axis.none, CANVAS_SIZE / 2, CANVAS_SIZE / 2, CANVAS_SIZE * 0.9, CANVAS_SIZE * 0.9, CENTER, true, BUFFER_SIZE * 0.9); return layer_composite; } function draw_indicator(surface, x, y, rad, strk) { surface.strokeWeight(STROKE_QUART); surface.stroke(strk); surface.noFill(); surface.circle(x, y, rad); let s = rad / 4; surface.line(x - (s), y, x + s, y); surface.line(x, y - (s), x, y + (s)); } function draw_relics(graphics, surface, i, axis) { surface.push(); let norm_inc = i / BUFFER_SIZE; let inc = (axis == Axis.none) ? 0 : i; surface.translate(inc, inc); graphics.background("#000000"); graphics.fill(0); let overall_rotational_increment = PI / BUFFER_SIZE; let vertex_arrays = []; let drawn = 0; for (let j = 0; j < ROOT_DATA.length; j++) { let root = ROOT_DATA[j]; let overall_rotation = overall_rotational_increment * i; let radial_offset = (root.offset + (-1.0 * root.creep * norm_inc) * root.chaos); let root_angle = root.angle * root.chaos; let root_origin_x = root.relic_origin.x + (sin(root_angle + overall_rotation) * radial_offset); let root_origin_y = root.relic_origin.y + (cos(root_angle + overall_rotation) * radial_offset); let root_origin = createVector(root_origin_x, root_origin_y); let root_age = root.age; let root_radius = (root.root_radius - (norm_inc * root.taper) * root.chaos); let color_start = color(palettes_start[root.pallete][root.colour_index]); let color_stop = color(palettes_stop[root.pallete][root.colour_index]); let root_colour = lerpColor(color_start, color_stop, norm_inc); root_colour.setAlpha(root.strength); if (noise(rr(i)) > 0.875 && (j % 3 == 0) && (j > 1)) { draw_indicator(surface, rm(root_origin_x), rm(root_origin_y), rm(root_radius + root_age), 150); } vertex_arrays[j] = contour_plot(i, root_origin, root_age, root_radius, root.no); contour_draw(graphics, vertex_arrays[j], STROKE_HALF, root_colour); if (i == BUFFER_SIZE) { surface.noFill(); surface.strokeWeight(rm(0.05)); surface.stroke(DRK_GREY); surface.circle(BUFFER_SIZE / 2, BUFFER_SIZE / 2, (ROOT_DATA[0].root_radius * 2 + 20)); } } for (let j = 0; j < ROOT_DATA.length; j++) { let root = ROOT_DATA[j]; contour_draw(graphics, vertex_arrays[j], STROKE_HALF, -1, root.overlaps); } commit(surface, ADD, graphics, axis, 100); surface.pop(); return surface; } function contour_plot(i, origin, age, radius, root_no) { let reduced_i = rr(i); let radial_steps = 50; let points = []; let ang = TWO_PI / radial_steps; let frequency = 0.015; let affected_radius = radius - abs(sin(reduced_i * 0.01) * radius / 8); for (let j = 0; j <= radial_steps; j++) { let theta = ang * j; let ct = cos(theta); let st = sin(theta); let sample_x = (ct); let sample_y = (st); let sample_z = reduced_i * frequency; let ken = noise(sample_x, sample_y, sample_z); let noise_offset = ken * age; let final_radius = ((affected_radius - noise_offset) + noise(reduced_i * 0.1) * 3.0); let x = rm(origin.x + (final_radius * ct)); let y = rm(origin.y + (final_radius * st)); points.push(createVector(x, y)); } return points; } function contour_draw(surface, vert_array, stroke_weight, stroke_colour = -1, fill_color = -1) { if (fill_color == -1) surface.noFill(); else { surface.fill(fill_color); } if (stroke_colour == -1) surface.noStroke(); else { surface.stroke(stroke_colour); surface.strokeWeight(stroke_weight); } surface.beginShape(); for (let k = 1; k < vert_array.length; k++) { let x = (vert_array[k].x); let y = (vert_array[k].y); surface.vertex(x, y); } surface.endShape(CLOSE); } function grads(graphics, surface, i, axis) { surface.push(); let offset = get_offset_for_axis(axis); surface.translate(offset.x * i, offset.y * i); graphics.background("#000000"); graphics.noFill(); gradient(graphics, 0, graphics.height / 2, graphics.width, graphics.height / 2, color(BLACK), color(GREEN), Axis.y); commit(surface, ADD, graphics, axis, 7); surface.pop(); return surface; } function gradient(surface, x, y, w, h, col_start, col_finish, axis) { let col = 0; surface.strokeWeight(STROKE_FULL); surface.noFill(); if (axis == Axis.x) { for (let i = 0; i < w; i++) { col = lerpColor(col_start, col_finish, i / w); surface.stroke(col); surface.line(x + i, y, x + i, y + h); } } else { for (let i = 0; i < h; i++) { col = lerpColor(col_start, col_finish, i / h); surface.stroke(col); surface.line(x, y + i, x + w, y + i); } } } function systems_arrays(graphics, surface, i, axis) { surface.push(); let offset = get_offset_for_axis(axis); surface.translate(offset.x * i, offset.y * i); graphics.background("#000000"); graphics.noFill(); system(graphics) commit(surface, ADD, graphics, axis, 100); surface.pop(); return surface; } function system(srf) { let w = srf.width / 2; let h = ((srf.width - w) / 2); srf.background(BLACK); let cell_size = rm(16); for (let y = h; y < (BUFFER_SIZE - h); y += cell_size) { srf.stroke(64); srf.strokeWeight(STROKE_FULL); for (let x = h; x < (BUFFER_SIZE - h); x += cell_size) { srf.noStroke(); srf.fill(MID_GREY); srf.circle(x, y, rm(2)); } } let s = subsystem(w, h); srf.push(); srf.translate(srf.width / 2, srf.height / 2); for (let i = 0; i < 4; i++) { srf.rotate(i * HALF_PI); srf.imageMode(CORNER); srf.image(s, -(s.width / 2), -(srf.height / 2)); } srf.pop(); } function subsystem(w, h) { let surf = createGraphics(w, h); let remains = surf.height; function draw_row(row_width, cell_y, cell_h) { let divisions = rint(5) + 1; let row = row_width; for (let i = 0; i < divisions; i++) row /= 2; let cell_width = row; let count = row_width / cell_width; let stroke_color = color(SYSTEM_COL); stroke_color.setAlpha(rint(255)); for (let i = 0; i < count; i++) { draw_cell(i * cell_width, cell_y, cell_width, cell_h, stroke_color) } } function draw_cell(cx, cy, cw, ch, strk) { surf.stroke(strk); surf.strokeWeight(STROKE_HALF); surf.fill(BLACK); surf.rect(cx, cy, cw, ch); } while (true) { let remove = (128 >> rint(5)); if ((remains - remove) < 0) { let r = remains; remove = r; remains = 0; draw_row(surf.width, remains, remove); break; } else { remains -= remove; draw_row(surf.width, remains, remove); if (remains == 0) break; } } return surf; } function generate(draw_function, axis, step_size, iterations = BUFFER_SIZE, surface_size = CANVAS_SIZE, buffer_size = BUFFER_SIZE) { let surface = create_layer(surface_size); let graphics = create_layer(buffer_size); for (let i = 0; i <= iterations; i += step_size) { draw_function(graphics, surface, i, axis); } return surface; } function get_offset_for_axis(axis) { return (axis == Axis.none) ? createVector(0, 0) : createVector(1, 1); } function create_layer(dim) { let layer = createGraphics(dim, dim); layer.imageMode(CORNERS); return layer; } function commit(surface, blend_mode, image, axis, opacity_percentage) { surface.blendMode(blend_mode); let opacity = map(opacity_percentage, 0, 100, 0, 255); if (axis == Axis.x) { surface.push(); surface.scale(-0.5, 1); surface.translate(-image.width, 0); surface.tint(255, opacity); surface.image(image, -image.width, 0); surface.pop(); } else { surface.tint(255, opacity); surface.image(image, 0, 0); } } function frame(graphics, surface, i, axis) { surface.push(); let offset = get_offset_for_axis(axis); surface.translate(offset.x * i, offset.y * i); graphics.background("#000000"); graphics.noFill(); graphics.strokeWeight(STROKE_HALF); graphics.stroke(FRAME_COL); let b = rm(6); let s = BUFFER_SIZE; graphics.line(0, 0, b, 0); graphics.line(0, 0, 0, b); graphics.line(s, 0, s, b); graphics.line(s, 0, s - b, 0); graphics.line(s, s, s, s - b); graphics.line(s, s, s - b, s); graphics.line(0, s, b, s); graphics.line(0, s, 0, s - b); graphics.stroke(FRAME_COL); graphics.strokeWeight(STROKE_HALF); graphics.rect(0, 0, s, s); commit(surface, ADD, graphics, axis, rint(75) + 25); surface.pop(); return surface; } function orth(index, layer) { let base_x = createVector(rm(1024 - 68), rm(259)); let base_y = createVector(rm(509), rm(1)); let base_z = createVector(rm(68), rm(259)); switch (index) { case 0: layer.translate(base_x.x, base_x.y); layer.rotate(radians(30.0)); layer.shearX(radians(30.0)); layer.scale(-1.0, 0.86062); break; case 1: layer.translate(base_y.x, base_y.y); layer.rotate(radians(30.0)); layer.shearX(radians(-30.0)); layer.scale(1.0, 0.86062); break; case 2: layer.translate(base_z.x, base_z.y); layer.rotate(radians(-30.0)); layer.shearX(radians(-30.0)); layer.scale(1.0, 0.86062); break; } } function rint(x) { return round(random(x)); } function render_layer(layer, target, blend_mode, opacity_percentage, axis, x = 0, y = 0, w = CANVAS_SIZE, h = CANVAS_SIZE, mode = CORNER, reflect = false, offset_y = 0) { target.push(); if (axis != Axis.none) orth(axis, target); if (reflect) { target.scale(1, -1); target.translate(0, -(CANVAS_SIZE + offset_y)); } target.imageMode(mode); target.blendMode(blend_mode); target.tint(255, map(opacity_percentage, 0, 100, 0, 255)); target.image(layer, x, y, w, h); target.pop(); } const Axis = { x: 0, y: 1, z: 2, none: 3 }; let blur_vertex = ` attribute vec3 aPosition; attribute vec2 aTexCoord; varying vec2 vTexCoord; void main() { vTexCoord = aTexCoord; vec4 positionVec4 = vec4(aPosition, 1.0); positionVec4.xy = positionVec4.xy * 2.0 - 1.0; gl_Position = positionVec4; } `; let blur_fragment = ` precision mediump float; varying vec2 vTexCoord; uniform sampler2D tex0; uniform float blur_amount; uniform float blur_curve; uniform vec2 texelSize; float gamma = 2.2; vec3 tone_mapping(vec3 color) { color = max(vec3(0.), color - vec3(0.004)); color = (color * (6.2 * color + .5)) / (color * (6.2 * color + 1.7) + 0.06); return color; } void main() { vec2 uv = vTexCoord; uv.y = 1.0 - uv.y; float x = uv.y; float curve = (blur_curve==1.0) ? (max(abs( ((x - 0.289) / 0.428 - 0.504) / 0.5 ), (x - 0.289) / 0.428 / 1.085 * -0.056 + 0.5) * 0.533 + -0.247) : 1.0; float spread = curve * blur_amount; vec2 offset = texelSize * spread; vec4 tex = texture2D(tex0, uv); tex += texture2D(tex0, uv + vec2(-offset.x, -offset.y)); tex += texture2D(tex0, uv + vec2(0.0, -offset.y)); tex += texture2D(tex0, uv + vec2(offset.x, -offset.y)); tex += texture2D(tex0, uv + vec2(-offset.x, 0.0)); tex += texture2D(tex0, uv + vec2(offset.x, 0.0)); tex += texture2D(tex0, uv + vec2(-offset.x, offset.y)); tex += texture2D(tex0, uv + vec2(0.0, offset.y)); tex += texture2D(tex0, uv + vec2(offset.x, offset.y)); tex /= 9.0; vec3 mapped = tone_mapping(tex.xyz); float grain = 0.05; float noise = (fract(sin(dot(uv, vec2(12.9898,78.233)*2.0)) * 43758.5453)); vec3 final = mix(mapped, tex.xyz, 0.71); vec2 st = vec2(uv.x-0.5, uv.t-0.5) * 2.0; float vignette = 1.0 - (0.35*length(st)); vec3 col = final - noise * grain; vec2 bl = step(vec2(0.016),uv); vec2 tr = step(vec2(0.016),1.0-uv); vec3 border = vec3(bl.x * bl.y * tr.x * tr.y); gl_FragColor = vec4(col * vignette * border, 1.0); } `; function rm(value) { return RES_MULTI * value; } function rr(value) { return RES_REDUC * value; }
let REF_CANVAS_SIZE = 1024; let REF_BUFFER_SIZE = 512; let REF_STROKE_HALF = 0.5; let REF_STROKE_FULL = 1.0; let STROKE_HALF = 0.0; let STROKE_FULL = 0.0; let CANVAS_SIZE = 0; let BUFFER_SIZE = 0; let BG = "#090809"; let BLACK = "#000000"; let LIME = "#cccc66"; let TURQ = "#04edcd"; let WHITE = "#FFFFFF"; let ORANGE = "#FF9900"; let ORANGE_RED = "#cc6600"; let RED_ORANGE = "#ff4800" let MID_GREY = "#CCCCCC"; let DRK_GREY = "#333333"; let RED_PINK = "#ff003c"; let GREEN = "#c5cd7a"; let PINK = "#c90a48"; let FRAME_COL = MID_GREY; let SYSTEM_COL = WHITE; let SEED; let RES_MULTI; let RES_REDUC; let ROOT_DATA = []; let HASH_DATA = []; let BLUR; function setup() { SEED = parseInt(tokenData.hash.slice(0, 16), 16); randomSeed(SEED); noiseSeed(SEED); noiseDetail(8); let ss = min(windowWidth, windowHeight); RES_MULTI = ss / REF_CANVAS_SIZE; RES_REDUC = REF_CANVAS_SIZE / ss; CANVAS_SIZE = rm(REF_CANVAS_SIZE); BUFFER_SIZE = rm(REF_BUFFER_SIZE); STROKE_HALF = rm(REF_STROKE_HALF); STROKE_FULL = rm(REF_STROKE_FULL); createCanvas(CANVAS_SIZE, CANVAS_SIZE, WEBGL); BLUR = new p5.Shader(this._renderer, blur_vertex, blur_fragment); shader(BLUR); set_relicdata(); let MAIN_BUFFER = comp(); fill("#FF9900"); BLUR.setUniform('tex0', MAIN_BUFFER); BLUR.setUniform('blur_amount', rm(8)); BLUR.setUniform('blur_curve', 1); BLUR.setUniform('texelSize', [1 / width, 1 / height]); rect(0, 0, CANVAS_SIZE, CANVAS_SIZE); } function set_relicdata() { function lerp(start, end, amt) { return (1 - amt) * start + amt * end } let hashdata = []; for (let j = 0; j < 32; j++) { let pair = tokenData.hash.slice(2 + (j * 2), 4 + (j * 2)); let npair = parseInt(pair, 16) / 255.0; hashdata.push(npair); } let val_count = hashdata[0]; let val_age = hashdata[1]; let val_pallete = hashdata[2]; let val_creep = hashdata[3]; let val_chaos = hashdata[4]; let val_size = hashdata[5]; let palettes = [ ["#cccc66", "#999933", "#999966", "#04edcd"], ["#3d2ba5", "#2b53a5", "#2b4ba5", "#04edcd"], ["#cc3300", "#cc6600", "#cc9933", "#04edcd"], ["#ff003c", "#89223b", "#93237d", "#04edcd"] ]; let min_core_radius = 30; let max_core_radius = 60; let min_root_radius = 30; let max_root_radius = 30; let min_root_count = 3; let max_root_count = 8; let min_age = 10.0; let max_age = 30.0; let min_taper = 0.0; let min_chaos = 1.0; let max_chaos = 1.5; let min_creep = 0.0; let max_creep = max_core_radius; let min_offset = min_core_radius; let max_offset = max_core_radius; let environment_buffer = 10; let relic_origin = createVector(REF_BUFFER_SIZE / 2, REF_BUFFER_SIZE / 2); let core_radius = round(lerp(min_core_radius, max_core_radius, val_size)); let root_count = Math.round(lerp(min_root_count, max_root_count, val_count)); let root_nodes = root_count - 2; let chaos = round(lerp(min_chaos, max_chaos, val_chaos)); let creep = round(lerp(min_creep, max_creep, val_creep)); let greatest_root_radius = 0; let greatest_offset = 0; let pallete = Math.round(lerp(0, 3, val_pallete)); for (let i = root_count - 1; i >= 0; i--) { let col = rint(2); let angle = TWO_PI / root_nodes; let offset = round(lerp(min_offset, max_offset, random(1.0))); let overlaps = BLACK; let root_radius = round(lerp(min_root_radius, max_root_radius, random(1.0))); greatest_root_radius = (root_radius > greatest_root_radius) ? root_radius : greatest_root_radius; greatest_offset = (offset > greatest_offset) ? offset : greatest_offset; let max_taper = (root_radius / 2); let taper = round(lerp(min_taper, max_taper, random(1.0))); let env_radius = (greatest_root_radius + core_radius + greatest_offset + environment_buffer); let colour = palettes[pallete][col]; let strength = 120; let age = round(lerp(min_age, max_age, val_age)); let env_root = (i == 0); let core_root = (i == 1); if (env_root) { offset = 0.0; overlaps = -1; colour = palettes[pallete][3]; strength = 20; age = 50; root_radius = env_radius; creep = 0; } if (core_root) { offset = 0.0; root_radius = core_radius; strength = 120; } ROOT_DATA[i] = get_rootdata(relic_origin, root_radius, angle * (i - 2), age, taper, chaos, creep, colour, offset, overlaps, strength, i); } } function get_rootdata(relic_origin, root_radius, angle, age, taper, chaos, creep, colour, offset, overlaps, strength, no) { let root_data = { relic_origin: relic_origin, root_radius: root_radius, angle: angle, age: age, taper: taper, chaos: chaos, creep: creep, colour: colour, offset: offset, overlaps: overlaps, strength: strength, no: no }; return root_data; } function comp() { let layer_composite = create_layer(CANVAS_SIZE); layer_composite.background(BG); let layer_gradient = create_layer(CANVAS_SIZE); gradient(layer_gradient, 0, 0, CANVAS_SIZE, CANVAS_SIZE, color(BLACK), color(PINK), Axis.y); render_layer(layer_gradient, layer_composite, ADD, 10, Axis.none); let layer_holo = create_layer(CANVAS_SIZE); let layer_basesystem = generate(systems_arrays, Axis.y, BUFFER_SIZE); render_layer(layer_basesystem, layer_holo, ADD, 40, Axis.y); render_layer(layer_basesystem, layer_holo, ADD, 10, Axis.x); render_layer(layer_basesystem, layer_holo, ADD, 10, Axis.z); let layer_relics = generate(draw_relics, Axis.y, rm(1)); render_layer(layer_relics, layer_holo, ADD, 100, Axis.y, false); render_layer(layer_relics, layer_holo, ADD, 100, Axis.y, false); let layer_frame = generate(frame, Axis.x, BUFFER_SIZE / 8); render_layer(layer_frame, layer_holo, ADD, 80, Axis.x); render_layer(layer_frame, layer_holo, ADD, 40, Axis.y); let layer_gradients = generate(grads, Axis.x, BUFFER_SIZE); render_layer(layer_gradients, layer_holo, ADD, 60, Axis.x); render_layer(layer_gradients, layer_holo, ADD, 60, Axis.y); render_layer(layer_gradients, layer_holo, ADD, 60, Axis.z); render_layer(layer_holo, layer_composite, ADD, 100, Axis.none, CANVAS_SIZE / 2, CANVAS_SIZE / 2, CANVAS_SIZE * 0.9, CANVAS_SIZE * 0.9, CENTER); render_layer(layer_holo, layer_composite, ADD, 20, Axis.none, CANVAS_SIZE / 2, CANVAS_SIZE / 2, CANVAS_SIZE * 0.9, CANVAS_SIZE * 0.9, CENTER, true, BUFFER_SIZE * 0.9); return layer_composite; } function draw_relics(graphics, surface, i, axis) { surface.push(); let norm_inc = i / BUFFER_SIZE; let inc = (axis == Axis.none) ? 0 : i; surface.translate(inc, inc); graphics.background("#000000"); graphics.fill(0); let overall_rotational_increment = PI / BUFFER_SIZE; let vertex_arrays = []; for (let j = 0; j < ROOT_DATA.length; j++) { let root = ROOT_DATA[j]; let overall_rotation = overall_rotational_increment * i; let radial_offset = (root.offset + (-1.0 * root.creep * norm_inc) * root.chaos); let root_angle = root.angle * root.chaos; let root_origin_x = root.relic_origin.x + (sin(root_angle + overall_rotation) * radial_offset); let root_origin_y = root.relic_origin.y + (cos(root_angle + overall_rotation) * radial_offset); let root_origin = createVector(root_origin_x, root_origin_y); let root_age = root.age; let root_radius = (root.root_radius - (norm_inc * root.taper) * root.chaos); let root_colour = color(root.colour); root_colour.setAlpha(root.strength); vertex_arrays[j] = contour_plot(i, root_origin, root_age, root_radius, root.no); contour_draw(graphics, vertex_arrays[j], STROKE_HALF, root_colour); if (i == BUFFER_SIZE) { surface.noFill(); surface.strokeWeight(0.05); surface.stroke(MID_GREY); surface.circle(BUFFER_SIZE / 2, BUFFER_SIZE / 2, (ROOT_DATA[0].root_radius * 2 + 20)); } } for (let j = 0; j < ROOT_DATA.length; j++) { let root = ROOT_DATA[j]; contour_draw(graphics, vertex_arrays[j], STROKE_HALF, -1, root.overlaps); } commit(surface, ADD, graphics, axis, 100); surface.pop(); return surface; } function contour_plot(i, origin, age, radius, root_no) { let reduced_i = rr(i); let radial_steps = 50; let points = []; let ang = TWO_PI / radial_steps; let frequency = 0.015; let affected_radius = radius - abs(sin(reduced_i * 0.01) * radius / 8); let sample_offset = root_no; for (let j = 0; j <= radial_steps; j++) { let theta = ang * j; let ct = cos(theta); let st = sin(theta); let sample_x = (ct); let sample_y = (st); let sample_z = reduced_i * frequency; let ken = noise(sample_x, sample_y, sample_z); let noise_offset = ken * age; let final_radius = ((affected_radius - noise_offset) + noise(reduced_i * 0.1) * 3.0); let x = rm(origin.x + (final_radius * ct)); let y = rm(origin.y + (final_radius * st)); points.push(createVector(x, y)); } return points; } function contour_draw(surface, vert_array, stroke_weight, stroke_colour = -1, fill_color = -1) { if (fill_color == -1) surface.noFill(); else { surface.fill(fill_color); } if (stroke_colour == -1) surface.noStroke(); else { surface.stroke(stroke_colour); surface.strokeWeight(stroke_weight); } surface.beginShape(); for (let k = 1; k < vert_array.length; k++) { let x = (vert_array[k].x); let y = (vert_array[k].y); surface.vertex(x, y); } surface.endShape(CLOSE); } function grads(graphics, surface, i, axis) { surface.push(); let offset = get_offset_for_axis(axis); surface.translate(offset.x * i, offset.y * i); graphics.background("#000000"); graphics.noFill(); gradient(graphics, 0, graphics.height / 2, graphics.width, graphics.height / 2, color(BLACK), color(GREEN), Axis.y); commit(surface, ADD, graphics, axis, 7); surface.pop(); return surface; } function gradient(surface, x, y, w, h, col_start, col_finish, axis) { let col = 0; surface.strokeWeight(STROKE_FULL); surface.noFill(); if (axis == Axis.x) { for (let i = 0; i < w; i++) { col = lerpColor(col_start, col_finish, i / w); surface.stroke(col); surface.line(x + i, y, x + i, y + h); } } else { for (let i = 0; i < h; i++) { col = lerpColor(col_start, col_finish, i / h); surface.stroke(col); surface.line(x, y + i, x + w, y + i); } } } function systems_arrays(graphics, surface, i, axis) { surface.push(); let offset = get_offset_for_axis(axis); surface.translate(offset.x * i, offset.y * i); graphics.background("#000000"); graphics.noFill(); system(graphics) commit(surface, ADD, graphics, axis, 100); surface.pop(); return surface; } function system(srf) { let w = srf.width / 2; let h = ((srf.width - w) / 2); srf.background(BLACK); let cell_size = rm(16); for (let y = h; y < (BUFFER_SIZE - h); y += cell_size) { srf.stroke(64); srf.strokeWeight(STROKE_FULL); for (let x = h; x < (BUFFER_SIZE - h); x += cell_size) { srf.noStroke(); srf.fill(MID_GREY); srf.circle(x, y, rm(2)); } } let s = subsystem(w, h); srf.push(); srf.translate(srf.width / 2, srf.height / 2); for (let i = 0; i < 4; i++) { srf.rotate(i * HALF_PI); srf.imageMode(CORNER); srf.image(s, -(s.width / 2), -(srf.height / 2)); } srf.pop(); } function subsystem(w, h) { let surf = createGraphics(w, h); let remains = surf.height; function draw_row(row_width, cell_y, cell_h) { let divisions = rint(5) + 1; let row = row_width; for (let i = 0; i < divisions; i++) row /= 2; let cell_width = row; let count = row_width / cell_width; let stroke_color = color(SYSTEM_COL); stroke_color.setAlpha(rint(255)); for (let i = 0; i < count; i++) { draw_cell(i * cell_width, cell_y, cell_width, cell_h, stroke_color) } } function draw_cell(cx, cy, cw, ch, strk) { surf.stroke(strk); surf.strokeWeight(STROKE_HALF); surf.fill(BLACK); surf.rect(cx, cy, cw, ch); } while (true) { let remove = (128 >> rint(5)); if ((remains - remove) < 0) { let r = remains; remove = r; remains = 0; draw_row(surf.width, remains, remove); break; } else { remains -= remove; draw_row(surf.width, remains, remove); if (remains == 0) break; } } return surf; } function generate(draw_function, axis, step_size, iterations = BUFFER_SIZE, surface_size = CANVAS_SIZE, buffer_size = BUFFER_SIZE) { let surface = create_layer(surface_size); let graphics = create_layer(buffer_size); for (let i = 0; i <= iterations; i += step_size) { draw_function(graphics, surface, i, axis); } return surface; } function get_offset_for_axis(axis) { return (axis == Axis.none) ? createVector(0, 0) : createVector(1, 1); } function create_layer(dim) { let layer = createGraphics(dim, dim); layer.imageMode(CORNERS); return layer; } function commit(surface, blend_mode, image, axis, opacity_percentage) { surface.blendMode(blend_mode); let opacity = map(opacity_percentage, 0, 100, 0, 255); if (axis == Axis.x) { surface.push(); surface.scale(-0.5, 1); surface.translate(-image.width, 0); surface.tint(255, opacity); surface.image(image, -image.width, 0); surface.pop(); } else { surface.tint(255, opacity); surface.image(image, 0, 0); } } function frame(graphics, surface, i, axis) { surface.push(); let offset = get_offset_for_axis(axis); surface.translate(offset.x * i, offset.y * i); graphics.background("#000000"); graphics.noFill(); graphics.strokeWeight(STROKE_FULL); graphics.stroke(FRAME_COL); let b = rm(6); let s = BUFFER_SIZE; graphics.line(0, 0, b, 0); graphics.line(0, 0, 0, b); graphics.line(s, 0, s, b); graphics.line(s, 0, s - b, 0); graphics.line(s, s, s, s - b); graphics.line(s, s, s - b, s); graphics.line(0, s, b, s); graphics.line(0, s, 0, s - b); graphics.stroke(FRAME_COL); graphics.strokeWeight(STROKE_HALF); graphics.rect(0, 0, s, s); commit(surface, ADD, graphics, axis, rint(75) + 25); surface.pop(); return surface; } function orth(index, layer) { let base_x = createVector(rm(1024 - 68), rm(259)); let base_y = createVector(rm(509), rm(1)); let base_z = createVector(rm(68), rm(259)); switch (index) { case 0: layer.translate(base_x.x, base_x.y); layer.rotate(radians(30.0)); layer.shearX(radians(30.0)); layer.scale(-1.0, 0.86062); break; case 1: layer.translate(base_y.x, base_y.y); layer.rotate(radians(30.0)); layer.shearX(radians(-30.0)); layer.scale(1.0, 0.86062); break; case 2: layer.translate(base_z.x, base_z.y); layer.rotate(radians(-30.0)); layer.shearX(radians(-30.0)); layer.scale(1.0, 0.86062); break; } } function rint(x) { return round(random(x)); } function render_layer(layer, target, blend_mode, opacity_percentage, axis, x = 0, y = 0, w = CANVAS_SIZE, h = CANVAS_SIZE, mode = CORNER, reflect = false, offset_y = 0) { target.push(); if (axis != Axis.none) orth(axis, target); if (reflect) { target.scale(1, -1); target.translate(0, -(CANVAS_SIZE + offset_y)); } target.imageMode(mode); target.blendMode(blend_mode); target.tint(255, map(opacity_percentage, 0, 100, 0, 255)); target.image(layer, x, y, w, h); target.pop(); } const Axis = { x: 0, y: 1, z: 2, none: 3 }; let blur_vertex = ` attribute vec3 aPosition; attribute vec2 aTexCoord; varying vec2 vTexCoord; void main() { vTexCoord = aTexCoord; vec4 positionVec4 = vec4(aPosition, 1.0); positionVec4.xy = positionVec4.xy * 2.0 - 1.0; gl_Position = positionVec4; } `; let blur_fragment = ` precision mediump float; varying vec2 vTexCoord; uniform sampler2D tex0; uniform float blur_amount; uniform float blur_curve; uniform vec2 texelSize; float gamma = 2.2; vec3 tone_mapping(vec3 color) { color = max(vec3(0.), color - vec3(0.004)); color = (color * (6.2 * color + .5)) / (color * (6.2 * color + 1.7) + 0.06); return color; } void main() { vec2 uv = vTexCoord; uv.y = 1.0 - uv.y; float x = uv.y; float curve = (blur_curve==1.0) ? (max(abs( ((x - 0.289) / 0.428 - 0.504) / 0.5 ), (x - 0.289) / 0.428 / 1.085 * -0.056 + 0.5) * 0.533 + -0.247) : 1.0; float spread = curve * blur_amount; vec2 offset = texelSize * spread; vec4 tex = texture2D(tex0, uv); tex += texture2D(tex0, uv + vec2(-offset.x, -offset.y)); tex += texture2D(tex0, uv + vec2(0.0, -offset.y)); tex += texture2D(tex0, uv + vec2(offset.x, -offset.y)); tex += texture2D(tex0, uv + vec2(-offset.x, 0.0)); tex += texture2D(tex0, uv + vec2(offset.x, 0.0)); tex += texture2D(tex0, uv + vec2(-offset.x, offset.y)); tex += texture2D(tex0, uv + vec2(0.0, offset.y)); tex += texture2D(tex0, uv + vec2(offset.x, offset.y)); tex /= 9.0; vec3 mapped = tone_mapping(tex.xyz); float grain = 0.05; float noise = (fract(sin(dot(uv, vec2(12.9898,78.233)*2.0)) * 43758.5453)); vec3 final = mix(mapped, tex.xyz, 0.71); vec2 st = vec2(uv.x-0.5, uv.t-0.5) * 2.0; float vignette = 1.0 - (0.35*length(st)); vec3 col = final - noise * grain; vec2 bl = step(vec2(0.016),uv); vec2 tr = step(vec2(0.016),1.0-uv); vec3 border = vec3(bl.x * bl.y * tr.x * tr.y); gl_FragColor = vec4(col * vignette * border, 1.0); } `; function rm(value) { return RES_MULTI * value; } function rr(value) { return RES_REDUC * value; }
var seed = parseInt(tokenData.hash.slice(0, 16), 16); p5.disableFriendlyErrors = true; let pg; let A, B; let A1, A2, A3, A4; let B1, B2, B3, B4; let D1, D2; let xx, yy; let imageDim = 400; let imageLength = imageDim * imageDim; let signalHeight; let numBlocks = imageDim/4; let lastBlockTime = 0; let blockDelay = 375; let dotsDensity = 36; let signalIndex = imageDim * 4; let blockIndex = 0; let drawSignals = true; let drawImage = true; let drawBlocks = true; let drawDots = true; let angle = 0.0; let angleSpeed = 0.01; let newImgData = []; let boff = 0; let ratio = 0.0; // Features let weirdo = false; let doubleWaves = false; let wave1 = -1; let wave2 = -1; function setup() { createCanvas(windowWidth, windowHeight, WEBGL); colorMode(HSB, 360, 100, 100); r = new RND(seed); // BEGIN features if (r.rb(0, 1) > 0.95) { weirdo = true; } if (r.rb(0, 1) > 0.6) { doubleWaves = true; } wave1 = int(r.rb(1, 3)); wave2 = int(r.rb(1, 3)); // END features generateRandImage(); rectMode(CENTER); imageMode(CENTER); setDimensions(); frameRate(30); } function draw() { if (weirdo) { background(newImgData[blockIndex], 80, 100); } else { background(6, 15, 23+boff); } if (drawBlocks) { blocks(); } if (drawSignals) { signals(); } if (drawDots) { dots(); } if (drawImage) { image(pg, A2, B2, D1, D1); } signalIndex += 4; blockIndex += 2; if (signalIndex > pg.pixels.length) { signalIndex = imageDim * 4; } if (blockIndex > newImgData.length) { blockIndex = 0; } } function generateRandImage() { pg = createGraphics(imageDim, imageDim); pg.colorMode(HSB, 360, 100, 100); pg.loadPixels(); waves(pg, wave1, 1); if (doubleWaves) { waves(pg, wave2, 2); } pg.updatePixels(); } function waves(p, wtype, round) { let speed1 = r.rb(0.00001, 0.0005); let angle1 = 0; let speed2 = r.rb(0.00001, 0.0005); let angle2 = 0; let s = 80.0; let b = 100.0; let wscale = r.rb(0.5, 2.0); let imgIndexTemp = 0; p.colorMode(HSB, 360, 100, 100); p.loadPixels(); for (let x = 0; x < p.width; x++) { for (let y = 0; y < p.height; y++) { let angle3 = map(y, 0, p.height, 0, TWO_PI*wscale); if (wtype == 1) { let h1 = map(sin(angle1), -1, 1, 0, 1); let h2 = map(sin(angle2+angle3), -1, 1, 0, 1); let hc = (h1 * h2) * 360; if (round == 1) { newImgData[imgIndexTemp] = hc; p.set(x, y, color(hc, s, b)); } else { let w = (newImgData[imgIndexTemp] + hc)/2; newImgData[imgIndexTemp] = w; p.set(x, y, color(w, s, b)); } } else if (wtype == 2) { let h1 = map(sin(angle1+angle3), -1, 1, 0, 1); let h2 = map(sin(angle2)+sin(angle3), -1, 1, 0, 1); let hc = (h1 * h2) * 360; if (round == 1) { newImgData[imgIndexTemp] = hc; p.set(x, y, color(hc, s, b)); } else { let w = (newImgData[imgIndexTemp] + hc)/2; newImgData[imgIndexTemp] = w; p.set(x, y, color(w, s, b)); } } imgIndexTemp++; angle1 += speed1; angle2 += speed2; } } p.updatePixels(); } function dots() { let rr = D1/imageDim; push(); translate(A1, B1); scale(rr); rotateY(angle); let yyy = 0; let xx = -imageDim/2; let yy = -imageDim/2 for (let i = 0; i < imageLength; i += dotsDensity) { stroke(119, 100, 100); if (i % imageDim == 0) { yyy += dotsDensity/2; } if (i > 0) { point(xx + (i%imageDim), yy + i/imageDim, newImgData[i] - 180); } } pop(); angle += angleSpeed; } function signals() { if (height < width) { push(); translate(0, B2); stroke(255); strokeWeight(1); for (let i = 0; i < pg.width; i++) { let curr = signalIndex - (i*4); let x = map(i, 0, pg.width, -width / 2, width / 2); let ry = map(pg.pixels[curr], 0, 255, -signalHeight/2, signalHeight/2); let gy = map(pg.pixels[curr+1], 0, 255, -signalHeight/2, signalHeight/2); let by = map(pg.pixels[curr+2], 0, 255, -signalHeight/2, signalHeight/2); if (i > 0) { point(x*2, ry-signalHeight); point(x*2, gy); point(x*2, by+signalHeight); } } pop(); } else { push(); translate(A2, 0); stroke(255); strokeWeight(1); for (let i = 0; i < pg.height; i++) { let curr = signalIndex - (i*4); let y = map(i, 0, pg.height, -height / 2, height / 2); let ry = map(pg.pixels[curr], 0, 255, -signalHeight/2, signalHeight/2); let gy = map(pg.pixels[curr+1], 0, 255, -signalHeight/2, signalHeight/2); let by = map(pg.pixels[curr+2], 0, 255, -signalHeight/2, signalHeight/2); if (i > 0) { point(ry-signalHeight, y*2); point(gy, y*2); point(by+signalHeight, y*2); } } pop(); } } function blocks() { noStroke(); for (let i = 0; i < numBlocks; i+=3) { let idx = (blockIndex + ((numBlocks-1) - i)); fill(newImgData[idx], 80, 100); if (width >= height) { xx = map(i, 0, numBlocks, A4, A3); yy = map(i, 0, numBlocks, B4, B3); } else { xx = map(i, 0, numBlocks, A3, A4); yy = map(i, 0, numBlocks, B3, B4); } square(xx, yy, D2); } } function setDimensions() { A = width/2; B = height/2; ratio = A/B; //print(ratio); if (width > height) { A1 = A * -0.5625; A2 = A1; A3 = A * 0.1875; A4 = A * 0.5; B1 = B * -0.389; B2 = B * 0.389; B3 = B * 0.278; B4 = B * -0.278; D1 = B * 0.6; D2 = B * 1.1; } else { A1 = A * -0.389; A2 = A * 0.389; A3 = A * -0.278; A4 = A * 0.278; B1 = B * 0.5625; B2 = B1; B3 = B * -0.1873; B4 = B * -0.5; D1 = A * 0.6; D2 = A * 1.1; } if (ratio > 0.8 && ratio < 1.0) { let d = map(ratio, 0.8, 1.0, 1.0, 0.7) D1 = D1 * d; D2 = D2 * d; } else if (ratio >= 1.0 && ratio < 1.2) { let d = map(ratio, 1.0, 1.2, 0.7, 1.0) D1 = D1 * d; D2 = D2 * d; } signalHeight = D1 / 4.0; } function windowResized() { resizeCanvas(windowWidth, windowHeight); setDimensions(); } function keyPressed() { if (key == ' ') { generateRandImage(); } else if (key == 'b' || key == 'B') { boff += 20; if (boff > 80) { boff = -23; } } else if (key == 's' || key == 'S') { drawSignals = !drawSignals; } else if (key == 't' || key == 'T') { drawDots = !drawDots; } else if (key == 'i' || key == 'I') { drawImage = !drawImage; } } class RND { constructor(seed) { this.seed = seed; } rd() { this.seed ^= this.seed << 13; this.seed ^= this.seed >> 17; this.seed ^= this.seed << 5; return ((this.seed < 0 ? ~this.seed + 1 : this.seed) % 1000) / 1000; } rb(a, b) { return a + (b - a) * this.rd(); } }
let canvas,seed,R,S,featuresInt,featuresReadable;const ratio=.76,colVarParams={hMin:-2.5,hMax:2.5,sMin:-2.5,sMax:15,bMin:-10,bMax:5},bgVarParams={hMin:-5,hMax:5,sMin:-10,sMax:2.5,bMin:-2.5,bMax:5},thicknessDivFactorLowRangeMin=1.75,thicknessDivFactorLowRangeMax=2,thicknessDivFactorHiRangeMin=.5,thicknessDivFactorHiRangeMax=.75,textureSoftLightAlpha=8,textureOverlayAlpha=10,paths=[[{x:.7,y:.07},{x:.59,y:.04},{x:.22,y:.09},{x:.14,y:.16},{x:.23,y:.21},{x:.57,y:.18},{x:.51,y:.12},{x:.54,y:.05},{x:.64,y:.08},{x:.59,y:.18},{x:.7,y:.2},{x:.87,y:.3},{x:.9,y:.59},{x:.81,y:.7},{x:.89,y:.85},{x:.74,y:.66},{x:.8,y:.4},{x:.72,y:.24},{x:.58,y:.19},{x:.5,y:.27},{x:.6,y:.3},{x:.63,y:.24},{x:.61,y:.31},{x:.74,y:.33},{x:.61,y:.54},{x:.07,y:.61},{x:.16,y:.78},{x:.6,y:.81},{x:.92,y:.91},{x:.55,y:.65},{x:.38,y:.34},{x:.22,y:.29},{x:.16,y:.38},{x:.21,y:.66},{x:.27,y:.77},{x:.19,y:.86},],[{x:.71,y:.1},{x:.54,y:.03},{x:.27,y:.06},{x:.08,y:.09},{x:.07,y:.16},{x:.23,y:.23},{x:.64,y:.21},{x:.68,y:.14},{x:.55,y:.06},{x:.43,y:.09},{x:.47,y:.16},{x:.64,y:.2},{x:.8,y:.2},{x:.87,y:.34},{x:.89,y:.57},{x:.81,y:.83},{x:.9,y:.95},{x:.67,y:.78},{x:.79,y:.5},{x:.63,y:.22},{x:.48,y:.3},{x:.53,y:.38},{x:.6,y:.37},{x:.65,y:.3},{x:.6,y:.37},{x:.72,y:.41},{x:.65,y:.51},{x:.1,y:.65},{x:.07,y:.79},{x:.14,y:.88},{x:.5,y:.91},{x:.84,y:.94},{x:.59,y:.83},{x:.45,y:.6},{x:.32,y:.39},{x:.13,y:.29},{x:.1,y:.34},{x:.11,y:.43},{x:.16,y:.73},{x:.2,y:.9},{x:.12,y:.94},],[{x:.69,y:.09},{x:.56,y:.03},{x:.26,y:.07},{x:.16,y:.09},{x:.14,y:.16},{x:.26,y:.21},{x:.56,y:.21},{x:.67,y:.13},{x:.54,y:.06},{x:.43,y:.1},{x:.56,y:.21},{x:.76,y:.19},{x:.89,y:.29},{x:.91,y:.55},{x:.75,y:.82},{x:.89,y:.91},{x:.7,y:.82},{x:.77,y:.64},{x:.71,y:.55},{x:.76,y:.23},{x:.67,y:.21},{x:.64,y:.27},{x:.6,y:.22},{x:.51,y:.31},{x:.62,y:.34},{x:.67,y:.34},{x:.68,y:.44},{x:.64,y:.62},{x:.14,y:.63},{x:.07,y:.72},{x:.31,y:.78},{x:.67,y:.85},{x:.69,y:.73},{x:.69,y:.61},{x:.6,y:.56},{x:.39,y:.42},{x:.26,y:.29},{x:.16,y:.29},{x:.17,y:.43},{x:.25,y:.69},{x:.23,y:.82},{x:.12,y:.91},],[{x:.75,y:.04},{x:.63,y:.03},{x:.31,y:.07},{x:.32,y:.12},{x:.55,y:.14},{x:.77,y:.17},{x:.75,y:.12},{x:.78,y:.06},{x:.89,y:.04},{x:.95,y:.1},{x:.91,y:.17},{x:.79,y:.2},{x:.88,y:.27},{x:.85,y:.53},{x:.87,y:.71},{x:.83,y:.79},{x:.71,y:.78},{x:.65,y:.62},{x:.69,y:.43},{x:.79,y:.23},{x:.61,y:.21},{x:.56,y:.26},{x:.62,y:.31},{x:.69,y:.28},{x:.62,y:.34},{x:.62,y:.59},{x:.23,y:.64},{x:.12,y:.71},{x:.14,y:.79},{x:.51,y:.79},{x:.71,y:.71},{x:.6,y:.62},{x:.49,y:.45},{x:.32,y:.25},{x:.19,y:.23},{x:.16,y:.35},{x:.25,y:.76},{x:.21,y:.86},{x:.16,y:.88},],[{x:.61,y:.06},{x:.27,y:.07},{x:.11,y:.12},{x:.11,y:.17},{x:.24,y:.17},{x:.55,y:.19},{x:.67,y:.21},{x:.73,y:.16},{x:.59,y:.08},{x:.55,y:.19},{x:.67,y:.21},{x:.87,y:.27},{x:.88,y:.43},{x:.87,y:.71},{x:.7,y:.93},{x:.68,y:.64},{x:.79,y:.35},{x:.66,y:.26},{x:.51,y:.32},{x:.57,y:.37},{x:.64,y:.3},{x:.6,y:.37},{x:.72,y:.39},{x:.64,y:.49},{x:.33,y:.54},{x:.1,y:.63},{x:.1,y:.74},{x:.23,y:.86},{x:.8,y:.93},{x:.59,y:.82},{x:.48,y:.6},{x:.36,y:.38},{x:.19,y:.3},{x:.15,y:.38},{x:.1,y:.45},{x:.18,y:.73},{x:.2,y:.89},{x:.12,y:.93},],[{x:.76,y:.07},{x:.16,y:.07},{x:.16,y:.17},{x:.76,y:.17},{x:.76,y:.11},{x:.67,y:.11},{x:.67,y:.17},{x:.91,y:.17},{x:.91,y:.81},{x:.8,y:.81},{x:.8,y:.22},{x:.55,y:.22},{x:.56,y:.32},{x:.64,y:.32},{x:.64,y:.26},{x:.67,y:.26},{x:.67,y:.32},{x:.74,y:.32},{x:.74,y:.48},{x:.12,y:.48},{x:.12,y:.81},{x:.71,y:.81},{x:.71,y:.61},{x:.37,y:.61},{x:.37,y:.24},{x:.23,y:.24},{x:.23,y:.87},{x:.11,y:.87},],[{x:.42,y:.2},{x:.29,y:.15},{x:.16,y:.17},{x:.09,y:.23},{x:.15,y:.29},{x:.33,y:.31},{x:.43,y:.27},{x:.39,y:.22},{x:.33,y:.26},{x:.39,y:.31},{x:.42,y:.41},{x:.5,y:.58},{x:.52,y:.73},{x:.46,y:.84},{x:.15,y:.74},{x:.16,y:.61},{x:.28,y:.51},{x:.43,y:.38},{x:.5,y:.3},{x:.46,y:.29},{x:.55,y:.46},{x:.51,y:.42},{x:.54,y:.29},{x:.61,y:.26},{x:.66,y:.28},{x:.68,y:.33},{x:.66,y:.4},{x:.67,y:.35},{x:.76,y:.31},{x:.84,y:.35},{x:.84,y:.43},{x:.76,y:.62},{x:.81,y:.69},{x:.93,y:.71},],],blue="#0a4f9c",red="#de1215",green="#1aa588",black="#181617",paper="#FBF9EA",classicPalettes=[[green,red,blue],[red],[blue],],colorPalette=[blue,red,green,black,"#ede5d8","#ac1972","#ebca49","#e98110"];let points=[],colors=[];function calculateFeatures($){switch((featuresInt={}).style=[0,1,2][R.weighted_index([.5,.2,.3])],featuresInt.style){case 0:colors=classicPalettes[R.weighted_index([.1,.2,.7])],featuresInt.bg=getColorVariation(paper,bgVarParams);break;case 1:colors=[...colorPalette],featuresInt.bg=colors.splice(colors.indexOf(black),1),colors=R.random_bool(.8)?[paper]:colors.splice(R.random_int(0,colors.length-1),1);break;case 2:colors=[...colorPalette],featuresInt.bg=colors.splice(R.random_int(0,colors.length-1),1)}featuresInt.pathIndex=R.weighted_index([.1,.1,.1,.1,.1,.1,.02]),featuresInt.minSegmentSize=R.random_int(3,7),featuresInt.probSegment=R.random_num(0,.25),featuresInt.probSmooth=R.random_num(.5,1),featuresInt.erraticness=R.random_num(.1,.5),points=paths[featuresInt.pathIndex],featuresReadable={};let e;switch(featuresInt.style){case 0:e="Classic";break;case 1:e="Lino";break;case 2:e="Cut Color"}return featuresReadable.Style=e,featuresReadable.Line=featuresInt.pathIndex<6?numberToRoman(featuresInt.pathIndex+1):"GM",console.log("featuresReadable:",featuresReadable),featuresReadable}function setup(){init(),noLoop()}function draw(){render()}function init(){console.log(`tokenData.hash: ${tokenData.hash}`);let $,e;window.innerHeight<=window.innerWidth/.76?($=.76*Math.max(window.innerHeight,1),e=Math.max(window.innerHeight,1)):($=Math.max(window.innerWidth),e=Math.max(window.innerWidth,1)/.76),console.log(`Canvas w:${$} h:${e}`),createCanvas($,e),pixelDensity(2*displayDensity()),seed=parseInt(tokenData.hash.slice(0,16),16),R=new Random,S=new SimplexNoise(seed),calculateFeatures(tokenData)}function render(){background(featuresInt.bg);let $=segmentPath(points,featuresInt.probSegment,featuresInt.minSegmentSize),e=[];for(let n=0;n<$.length;n++){let r={points:$[n],thickness:R.random_num(.04,.06),erraticness:R.random_dec(),col:0==featuresInt.style?getColorVariation(R.random_choice(colors),colVarParams):R.random_choice(colors)};r.poly=getPolyFromStroke(r.points,r.thickness,r.erraticness),r.poly=smoothPoly(r.poly,3,!0,featuresInt.probSmooth),e.push(r),r.strokePoly=getPolyFromStroke(r.poly,.004,.1);let _=[];for(let t=0;t<R.random_int(5,15);t++){let o={};o.col=getColorVariation(R.random_choice(colors),colVarParams),o.highlightCol=getColorVariation(R.random_choice(["#ffffff","#000000"]),bgVarParams);let a=R.random_num(.1,.25),y=R.random_num(0,TAU),x=R.random_dec(),l=R.random_dec(),s=[];for(let i=y;i<TAU+y;i+=TAU/R.random_int(3,10)){let u=a*R.random_num(.5,1),m=x+u*Math.cos(i),d=l+u*Math.sin(i);s.push({x:m,y:d})}s=smoothPoly(s,3,!0,.75),o.poly=s,o.expandedPoly=scalePoly(s,R.random_num(.002,.004)),o.expandedPolyAlpha=R.random_num(90,120),_.push(o)}r.patches=_}featuresInt.segments=e,console.log("featuresInt:",featuresInt);for(let h=0;h<featuresInt.segments.length;h++){let c=featuresInt.segments[h],f=createGraphics(width,height),g=f.canvas.getContext("2d");for(let p of(g.clearRect(0,0,width,height),g.globalCompositeOperation="destination-over",f.beginShape(),f.fill(1!=featuresInt.style?featuresInt.bg:R.random_choice(colors)),f.noStroke(),c.strokePoly))f.vertex(p.x*width,p.y*height);if(f.endShape(CLOSE),1!=featuresInt.style){for(let b of(f.beginShape(),f.fill(c.col),f.noStroke(),c.poly))f.vertex(b.x*width,b.y*height);f.endShape(CLOSE),g.globalCompositeOperation="source-over",g.clip(),2!=featuresInt.style&&(drawPatches(f,c.patches),drawTexture(f))}image(f,0,0)}0==featuresInt.style&&drawGlobalDiscoloration(),drawGlobalNoiseGrain()}function segmentPath($,e,n){let r=[],_=[];for(let t=0;t<$.length;t++)_.push($[t]),_.length>=n&&t<$.length-n&&R.random_bool(e)&&(_.push($[t+1]),r.push([..._]),_.length=0);return r.push([..._]),r}function getPolyFromStroke($,e,n){let r=[];if($.length>1){for(let _=0;_<$.length-1;_++){let t={x:$[_].x+R.random_num(-.02,.02)*n,y:$[_].y+R.random_num(-.02,.02)*n},o={x:$[_+1].x+R.random_num(-.02,.02)*n,y:$[_+1].y+R.random_num(-.02,.02)*n};0==_&&r.push(getPerpendicularPoint(t,o,0,e/map(t.y,0,1,R.random_num(1.75,2),R.random_num(.5,.75)))),r.push(getPerpendicularPoint(t,o,R.random_num(.4,.6),e/map(t.y,0,1,R.random_num(1.75,2),R.random_num(.5,.75)))),r.push(getPerpendicularPoint(t,o,1,e/map(t.y,0,1,R.random_num(1.75,2),R.random_num(.5,.75))))}for(let a=$.length-1;a>0;a--){let y={x:$[a].x+R.random_num(-.02,.02)*n,y:$[a].y+R.random_num(-.02,.02)*n},x={x:$[a-1].x+R.random_num(-.02,.02)*n,y:$[a-1].y+R.random_num(-.02,.02)*n};r.push(getPerpendicularPoint(y,x,0,e/map(y.y,0,1,R.random_num(1.75,2),R.random_num(.5,.75)))),r.push(getPerpendicularPoint(y,x,R.random_num(.4,.6),e/map(y.y,0,1,R.random_num(1.75,2),R.random_num(.5,.75)))),a==$.length-2&&r.push(getPerpendicularPoint(y,x,1,e/map(y.y,0,1,R.random_num(1.75,2),R.random_num(.5,.75))))}}return r.push(r[0]),r}function getPerpendicularPoint($,e,n,r){let _=atan2(e.y-$.y,e.x-$.x),t=getMidPoint($,e,n);return{x:t.x+r*Math.cos(_-HALF_PI),y:t.y+r*Math.sin(_-HALF_PI)}}function getMidPoint($,e,n){return{x:$.x*(1-n)+e.x*n,y:$.y*(1-n)+e.y*n}}function smoothPoly($,e,n,r){let _=[],t=$.length-1;n&&(t+=2);for(let o=0;o<t;o++){let a=$[o%$.length],y=$[(o+1)%$.length];o!=$.length-1&&(R.random_bool(r)?(_.push({x:.75*a.x+.25*y.x,y:.75*a.y+.25*y.y}),_.push({x:.25*a.x+.75*y.x,y:.25*a.y+.75*y.y})):_.push(a)),o==t-1&&_.push(y)}for(let x=1;x<e;x++)_=smoothPoly([..._],1);return _}function scalePoly($,e){let n=getPolyCentroid($),r=[];for(let _ of $){let t=_,o={x:n.x,y:n.y};r.push({x:t.x*(1+e)+-(o.x*e),y:t.y*(1+e)+-(o.y*e)})}return r}function getPolyCentroid($){let e=0,n=0;for(let r=0;r<$.length;r++){let _=$[r],t=$[(r+1)%$.length],o=_.x*t.y-t.x*_.y;e+=(_.x+t.x)*o,n+=(_.y+t.y)*o}let a=calculatePolygonArea($),y=1/(6*a),x=y*e,l=y*n;return{x:x,y:l}}function calculatePolygonArea($){let e=0;for(let n=0;n<$.length;n++){let r=$[n],_=$[(n+1)%$.length];e+=r.x*_.y-_.x*r.y}return Math.abs(e/=2)}function drawTexture($){let e=R.random_int(0,99999),n=width/10,r=height/100;$.rectMode(CENTER);for(let _=0;_<2;_++)for(let t=-50;t<150;t++)for(let o=-5;o<15;o++){$.push(),$.translate(n*(o+.5),r*(t+.5));let a,y;0==_?(a=.4,y=.01):1==_&&(a=.005,y=.2);let x=map(S.noise3D(e,t*a,o*y),0,1,150,190),l;x>160?($.blendMode(SOFT_LIGHT),l=8):($.blendMode(OVERLAY),l=10),$.fill(x,l),$.noStroke();let s=map(S.noise3D(e,.001*t,.005*o),0,1,-5*r,5*r),i=map(S.noise3D(e,.005*t,.001*o),0,1,-2*n,2*n),u=R.random_num(0,TAU);$.beginShape();for(let m=u;m<TAU+u;m+=TAU/R.random_int(3,10)){let d=i+n*R.random_num(2,4)*Math.cos(m),h=s+r*R.random_num(2,4)*Math.sin(m);$.vertex(d,h)}$.endShape(CLOSE),$.pop()}}function drawPatches($,e){for(let n=0;n<e.length;n++){let r=e[n],_=color(r.highlightCol);for(let t of(_.setAlpha(r.expandedPolyAlpha),$.fill(_),$.beginShape(),r.expandedPoly))$.vertex(t.x*width,t.y*height);for(let o of($.endShape(CLOSE),(_=color(r.col)).setAlpha(255),$.beginShape(),$.fill(_),$.noStroke(),r.poly))$.vertex(o.x*width,o.y*height);$.endShape(CLOSE)}}function drawGlobalDiscoloration(){drawingContext.save();let $=drawingContext.createLinearGradient(width/2,height*R.random_num(-.1,-.2),width/2,1*height),e=drawingContext.createLinearGradient(width/2,height*R.random_num(1.1,1.2),width/2,0*height),n=drawingContext.createLinearGradient(width*R.random_num(-.1,-.2),height/2,1*width,height/2),r=drawingContext.createLinearGradient(width*R.random_num(1.1,1.2),height/2,0*width,height/2);for(let _ of(drawingContext.globalCompositeOperation="color-burn",[$,e,n,r]))_.addColorStop(0,"rgba(0,0,0,0.25)"),_.addColorStop(.5,"rgba(255,255,255,0.05)"),drawingContext.fillStyle=_,drawingContext.fillRect(0,0,width,height);drawingContext.restore()}function drawGlobalNoiseGrain(){drawingContext.save(),drawingContext.globalCompositeOperation="multiply";for(let $=0;$<5e4;$++){push();let e=R.random_dec()*width,n=R.random_dec()*height,r=1==featuresInt.style?color(255):color(R.random_bool(.9)?R.random_num(50,80):featuresInt.bg);r.setAlpha(R.random_bool(.999)?map(S.noise2D(.0025*e,.0025*n),0,1,20,40):R.random_num(80,120)),fill(r),noStroke();let _=width*(R.random_bool(.999)?R.random_num(.001,.003):R.random_num(.004,.006)),t=R.random_num(0,TAU);beginShape();for(let o=t;o<TAU+t;o+=TAU/R.random_int(3,10)){let a=e+(_/2+width*R.random_num(-.001,.001))*Math.cos(o),y=n+(_/2+width*R.random_num(-.001,.001))*.6*Math.sin(o);curveVertex(a,y)}endShape(CLOSE),pop()}drawingContext.restore()}function getColorVariation($,e){let n=color($);if(!R.random_bool(.8))return n.toString("#rrggbb");{let r=R.random_num(e.hMin,e.hMax),_=R.random_num(e.sMin,e.sMax),t=R.random_num(e.bMin,e.bMax),o=hexToHSB($);return o[0]=Math.round((o[0]+r)%360),o[1]=Math.max(Math.min(o[1]+_,100),0),o[2]=Math.max(Math.min(o[2]+t,100),0),color(`hsb(${o[0]}, ${o[1]}%, ${o[2]}%)`).toString("#rrggbb")}}function hexToHSB($){$=$.replace("#","");let e=parseInt($.substring(0,2),16)/255,n=parseInt($.substring(2,4),16)/255,r=parseInt($.substring(4,6),16)/255,_=Math.max(e,n,r),t=Math.min(e,n,r),o;return(o=Math.round(60*(o=_===t?0:_===e?(n-r)/(_-t)%6:_===n?(r-e)/(_-t)+2:(e-n)/(_-t)+4)))<0&&(o+=360),[o,0===_?0:Math.round((_-t)/_*100),Math.round(100*_)]}function numberToRoman($){let e="";for(let n of[{value:1e3,numeral:"M"},{value:900,numeral:"CM"},{value:500,numeral:"D"},{value:400,numeral:"CD"},{value:100,numeral:"C"},{value:90,numeral:"XC"},{value:50,numeral:"L"},{value:40,numeral:"XL"},{value:10,numeral:"X"},{value:9,numeral:"IX"},{value:5,numeral:"V"},{value:4,numeral:"IV"},{value:1,numeral:"I"}])for(;$>=n.value;)e+=n.numeral,$-=n.value;return e}class Random{constructor(){this.useA=!1;let $=function($){let e=parseInt($.substring(0,8),16),n=parseInt($.substring(8,16),16),r=parseInt($.substring(16,24),16),_=parseInt($.substring(24,32),16);return function(){r|=0;let $=((e|=0)+(n|=0)|0)+(_|=0)|0;return _=_+1|0,e=n^n>>>9,n=r+(r<<3)|0,r=(r=r<<21|r>>>11)+$|0,($>>>0)/4294967296}};this.prngA=new $(tokenData.hash.substring(2,34)),this.prngB=new $(tokenData.hash.substring(34,66));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){return $+(e-$)*this.random_dec()}random_int($,e){return Math.floor(this.random_num($,e+1))}random_bool($){return this.random_dec()<$}random_choice($){return $[this.random_int(0,$.length-1)]}weighted_index($){let e=0;for(let n=0;n<$.length;n++)e+=$[n];let r=e*this.random_dec();for(let _=0;_<$.length;_++){if(r<$[_])return _;r-=$[_]}return $.length-1}}!function(){"use strict";var $=.5*(Math.sqrt(3)-1),e=(3-Math.sqrt(3))/6,n=1/3,r=1/6,_=(Math.sqrt(5)-1)/4,t=(5-Math.sqrt(5))/20;function o($){var e;e="function"==typeof $?$:$?function $(){var e,n=0,r=0,_=0,t=1,o=(e=4022871197,function($){$=$.toString();for(var n=0;n<$.length;n++){var r=.02519603282416938*(e+=$.charCodeAt(n));e=r>>>0,r-=e,r*=e,e=r>>>0,r-=e,e+=4294967296*r}return(e>>>0)*23283064365386963e-26});n=o(" "),r=o(" "),_=o(" ");for(var a=0;a<arguments.length;a++)n-=o(arguments[a]),n<0&&(n+=1),r-=o(arguments[a]),r<0&&(r+=1),_-=o(arguments[a]),_<0&&(_+=1);return o=null,function(){var $=2091639*n+23283064365386963e-26*t;return n=r,r=_,_=$-(t=0|$)}}($):Math.random,this.p=a(e),this.perm=new Uint8Array(512),this.permMod12=new Uint8Array(512);for(var n=0;n<512;n++)this.perm[n]=this.p[255&n],this.permMod12[n]=this.perm[n]%12}function a($){var e,n=new Uint8Array(256);for(e=0;e<256;e++)n[e]=e;for(e=0;e<255;e++){var r=e+~~($()*(256-e)),_=n[e];n[e]=n[r],n[r]=_}return n}o.prototype={grad3:new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),grad4:new Float32Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]),noise2D:function(n,r){var _,t,o=this.permMod12,a=this.perm,y=this.grad3,x=0,l=0,s=0,i=(n+r)*$,u=Math.floor(n+i),m=Math.floor(r+i),d=(u+m)*e,h=n-(u-d),c=r-(m-d);h>c?(_=1,t=0):(_=0,t=1);var f=h-_+e,g=c-t+e,p=h-1+2*e,b=c-1+2*e,v=255&u,P=255&m,I=.5-h*h-c*c;if(I>=0){var M=3*o[v+a[P]];I*=I,x=I*I*(y[M]*h+y[M+1]*c)}var w=.5-f*f-g*g;if(w>=0){var C=3*o[v+_+a[P+t]];w*=w,l=w*w*(y[C]*f+y[C+1]*g)}var k=.5-p*p-b*b;if(k>=0){var A=3*o[v+1+a[P+1]];k*=k,s=k*k*(y[A]*p+y[A+1]*b)}return 70*(x+l+s)},noise3D:function($,e,_){var t,o,a,y,x,l,s,i,u,m,d=this.permMod12,h=this.perm,c=this.grad3,f=($+e+_)*n,g=Math.floor($+f),p=Math.floor(e+f),b=Math.floor(_+f),v=(g+p+b)*r,P=$-(g-v),I=e-(p-v),M=_-(b-v);P>=I?I>=M?(x=1,l=0,s=0,i=1,u=1,m=0):P>=M?(x=1,l=0,s=0,i=1,u=0,m=1):(x=0,l=0,s=1,i=1,u=0,m=1):I<M?(x=0,l=0,s=1,i=0,u=1,m=1):P<M?(x=0,l=1,s=0,i=0,u=1,m=1):(x=0,l=1,s=0,i=1,u=1,m=0);var w=P-x+r,C=I-l+r,k=M-s+r,A=P-i+2*r,D=I-u+2*r,V=M-m+2*r,F=P-1+3*r,G=I-1+3*r,L=M-1+3*r,H=255&g,T=255&p,B=255&b,O=.6-P*P-I*I-M*M;if(O<0)t=0;else{var q=3*d[H+h[T+h[B]]];O*=O,t=O*O*(c[q]*P+c[q+1]*I+c[q+2]*M)}var X=.6-w*w-C*C-k*k;if(X<0)o=0;else{var N=3*d[H+x+h[T+l+h[B+s]]];X*=X,o=X*X*(c[N]*w+c[N+1]*C+c[N+2]*k)}var W=.6-A*A-D*D-V*V;if(W<0)a=0;else{var z=3*d[H+i+h[T+u+h[B+m]]];W*=W,a=W*W*(c[z]*A+c[z+1]*D+c[z+2]*V)}var E=.6-F*F-G*G-L*L;if(E<0)y=0;else{var j=3*d[H+1+h[T+1+h[B+1]]];E*=E,y=E*E*(c[j]*F+c[j+1]*G+c[j+2]*L)}return 32*(t+o+a+y)},noise4D:function($,e,n,r){var o,a,y,x,l,s,i,u,m,d,h,c,f,g,p,b,v,P=this.perm,I=this.grad4,M=($+e+n+r)*_,w=Math.floor($+M),C=Math.floor(e+M),k=Math.floor(n+M),A=Math.floor(r+M),D=(w+C+k+A)*t,V=$-(w-D),F=e-(C-D),G=n-(k-D),L=r-(A-D),H=0,T=0,B=0,O=0;V>F?H++:T++,V>G?H++:B++,V>L?H++:O++,F>G?T++:B++,F>L?T++:O++,G>L?B++:O++,s=H>=3?1:0,i=T>=3?1:0,u=B>=3?1:0,m=O>=3?1:0,d=H>=2?1:0,h=T>=2?1:0,c=B>=2?1:0,f=O>=2?1:0,g=H>=1?1:0,p=T>=1?1:0,b=B>=1?1:0;var q=V-s+t,X=F-i+t,N=G-u+t,W=L-m+t,z=V-d+2*t,E=F-h+2*t,j=G-c+2*t,J=L-f+2*t,K=V-g+3*t,Q=F-p+3*t,U=G-b+3*t,Y=L-(v=O>=1?1:0)+3*t,Z=V-1+4*t,$$=F-1+4*t,$e=G-1+4*t,$n=L-1+4*t,$r=255&w,$_=255&C,$t=255&k,$o=255&A,$a=.6-V*V-F*F-G*G-L*L;if($a<0)o=0;else{var $y=P[$r+P[$_+P[$t+P[$o]]]]%32*4;$a*=$a,o=$a*$a*(I[$y]*V+I[$y+1]*F+I[$y+2]*G+I[$y+3]*L)}var $x=.6-q*q-X*X-N*N-W*W;if($x<0)a=0;else{var $l=P[$r+s+P[$_+i+P[$t+u+P[$o+m]]]]%32*4;$x*=$x,a=$x*$x*(I[$l]*q+I[$l+1]*X+I[$l+2]*N+I[$l+3]*W)}var $s=.6-z*z-E*E-j*j-J*J;if($s<0)y=0;else{var $0=P[$r+d+P[$_+h+P[$t+c+P[$o+f]]]]%32*4;$s*=$s,y=$s*$s*(I[$0]*z+I[$0+1]*E+I[$0+2]*j+I[$0+3]*J)}var $i=.6-K*K-Q*Q-U*U-Y*Y;if($i<0)x=0;else{var $u=P[$r+g+P[$_+p+P[$t+b+P[$o+v]]]]%32*4;$i*=$i,x=$i*$i*(I[$u]*K+I[$u+1]*Q+I[$u+2]*U+I[$u+3]*Y)}var $3=.6-Z*Z-$$*$$-$e*$e-$n*$n;if($3<0)l=0;else{var $m=P[$r+1+P[$_+1+P[$t+1+P[$o+1]]]]%32*4;$3*=$3,l=$3*$3*(I[$m]*Z+I[$m+1]*$$+I[$m+2]*$e+I[$m+3]*$n)}return 27*(o+a+y+x+l)}},o._buildPermutationTable=a,window.SimplexNoise=o}();
var seed = parseInt(tokenData.hash.slice(0, 16), 16); p5.disableFriendlyErrors = true; let pg; let A, B; let A1, A2, A3, A4; let B1, B2, B3, B4; let D1, D2; let xx, yy; let imageDim = 400; let imageLength = imageDim * imageDim; let signalHeight; let numBlocks = imageDim/4; let lastBlockTime = 0; let blockDelay = 375; let dotsDensity = 36; let signalIndex = imageDim * 4; let blockIndex = 0; let drawSignals = true; let drawImage = true; let drawBlocks = true; let drawDots = true; let angle = 0.0; let angleSpeed = 0.01; let newImgData = []; let boff = 0; let ratio = 0.0; // Features let weirdo = false; let doubleWaves = false; let wave1 = -1; let wave2 = -1; function setup() { createCanvas(windowWidth, windowHeight, WEBGL); colorMode(HSB, 360, 100, 100); r = new RND(seed); // BEGIN features if (r.rb(0, 1) > 0.95) { weirdo = true; } if (r.rb(0, 1) > 0.6) { doubleWaves = true; } wave1 = int(r.rb(1, 3)); wave2 = int(r.rb(1, 3)); // END features generateRandImage(); rectMode(CENTER); imageMode(CENTER); setDimensions(); frameRate(30); } function draw() { if (weirdo) { background(newImgData[blockIndex], 80, 100); } else { background(6, 15, 23+boff); } if (drawBlocks) { blocks(); } if (drawSignals) { signals(); } if (drawDots) { dots(); } if (drawImage) { image(pg, A2, B2, D1, D1); } signalIndex += 4; blockIndex += 2; if (signalIndex > pg.pixels.length) { signalIndex = imageDim * 4; } if (blockIndex > newImgData.length) { blockIndex = 0; } } function generateRandImage() { pg = createGraphics(imageDim, imageDim); pg.colorMode(HSB, 360, 100, 100); pg.loadPixels(); waves(pg, wave1, 1); if (doubleWaves) { waves(pg, wave2, 2); } pg.updatePixels(); } function waves(p, wtype, round) { let speed1 = r.rb(0.00001, 0.0005); let angle1 = 0; let speed2 = r.rb(0.00001, 0.0005); let angle2 = 0; let s = 80.0; let b = 100.0; let wscale = r.rb(0.5, 2.0); let imgIndexTemp = 0; p.colorMode(HSB, 360, 100, 100); p.loadPixels(); for (let x = 0; x < p.width; x++) { for (let y = 0; y < p.height; y++) { let angle3 = map(y, 0, p.height, 0, TWO_PI*wscale); if (wtype == 1) { let h1 = map(sin(angle1), -1, 1, 0, 1); let h2 = map(sin(angle2+angle3), -1, 1, 0, 1); let hc = (h1 * h2) * 360; if (round == 1) { newImgData[imgIndexTemp] = hc; p.set(x, y, color(hc, s, b)); } else { let w = (newImgData[imgIndexTemp] + hc)/2; newImgData[imgIndexTemp] = w; p.set(x, y, color(w, s, b)); } } else if (wtype == 2) { let h1 = map(sin(angle1+angle3), -1, 1, 0, 1); let h2 = map(sin(angle2)+sin(angle3), -1, 1, 0, 1); let hc = (h1 * h2) * 360; if (round == 1) { newImgData[imgIndexTemp] = hc; p.set(x, y, color(hc, s, b)); } else { let w = (newImgData[imgIndexTemp] + hc)/2; newImgData[imgIndexTemp] = w; p.set(x, y, color(w, s, b)); } } imgIndexTemp++; angle1 += speed1; angle2 += speed2; } } p.updatePixels(); } function dots() { let rr = D1/imageDim; push(); translate(A1, B1); scale(rr); rotateY(angle); let yyy = 0; let xx = -imageDim/2; let yy = -imageDim/2 for (let i = 0; i < imageLength; i += dotsDensity) { stroke(119, 100, 100); if (i % imageDim == 0) { yyy += dotsDensity/2; } if (i > 0) { point(xx + (i%imageDim), yy + i/imageDim, newImgData[i] - 180); } } pop(); angle += angleSpeed; } function signals() { if (height < width) { push(); translate(0, B2); stroke(255); strokeWeight(1); for (let i = 0; i < pg.width; i++) { let curr = signalIndex - (i*4); let x = map(i, 0, pg.width, -width / 2, width / 2); let ry = map(pg.pixels[curr], 0, 255, -signalHeight/2, signalHeight/2); let gy = map(pg.pixels[curr+1], 0, 255, -signalHeight/2, signalHeight/2); let by = map(pg.pixels[curr+2], 0, 255, -signalHeight/2, signalHeight/2); if (i > 0) { point(x*2, ry-signalHeight); point(x*2, gy); point(x*2, by+signalHeight); } } pop(); } else { push(); translate(A2, 0); stroke(255); strokeWeight(1); for (let i = 0; i < pg.height; i++) { let curr = signalIndex - (i*4); let y = map(i, 0, pg.height, -height / 2, height / 2); let ry = map(pg.pixels[curr], 0, 255, -signalHeight/2, signalHeight/2); let gy = map(pg.pixels[curr+1], 0, 255, -signalHeight/2, signalHeight/2); let by = map(pg.pixels[curr+2], 0, 255, -signalHeight/2, signalHeight/2); if (i > 0) { point(ry-signalHeight, y*2); point(gy, y*2); point(by+signalHeight, y*2); } } pop(); } } function blocks() { noStroke(); for (let i = 0; i < numBlocks; i+=3) { let idx = (blockIndex + ((numBlocks-1) - i)); fill(newImgData[idx], 80, 100); if (width >= height) { xx = map(i, 0, numBlocks, A4, A3); yy = map(i, 0, numBlocks, B4, B3); } else { xx = map(i, 0, numBlocks, A3, A4); yy = map(i, 0, numBlocks, B3, B4); } square(xx, yy, D2); } } function setDimensions() { A = width/2; B = height/2; ratio = A/B; //print(ratio); if (width > height) { A1 = A * -0.5625; A2 = A1; A3 = A * 0.1875; A4 = A * 0.5; B1 = B * -0.389; B2 = B * 0.389; B3 = B * 0.278; B4 = B * -0.278; D1 = B * 0.6; D2 = B * 1.1; } else { A1 = A * -0.389; A2 = A * 0.389; A3 = A * -0.278; A4 = A * 0.278; B1 = B * 0.5625; B2 = B1; B3 = B * -0.1873; B4 = B * -0.5; D1 = A * 0.6; D2 = A * 1.1; } if (ratio > 0.8 && ratio < 1.0) { let d = map(ratio, 0.8, 1.0, 1.0, 0.7) D1 = D1 * d; D2 = D2 * d; } else if (ratio >= 1.0 && ratio < 1.2) { let d = map(ratio, 1.0, 1.2, 0.7, 1.0) D1 = D1 * d; D2 = D2 * d; } signalHeight = D1 / 4.0; } function windowResized() { resizeCanvas(windowWidth, windowHeight); setDimensions(); } function keyPressed() { if (key == ' ') { generateRandImage(); } else if (key == 'b' || key == 'B') { boff += 20; if (boff > 80) { boff = 0; } } else if (key == 's' || key == 'S') { drawSignals = !drawSignals; } else if (key == 't' || key == 'T') { drawDots = !drawDots; } else if (key == 'i' || key == 'I') { drawImage = !drawImage; } } class RND { constructor(seed) { this.seed = seed; } rd() { this.seed ^= this.seed << 13; this.seed ^= this.seed >> 17; this.seed ^= this.seed << 5; return ((this.seed < 0 ? ~this.seed + 1 : this.seed) % 1000) / 1000; } rb(a, b) { return a + (b - a) * this.rd(); } }
!function(){"use strict";function t(){let t="0x";for(let e=64;0<e;--e)t+="0123456789abcdef"[~~(16*Math.random())];return t}function e(t,e,n){const r=n/180*h;return a=(([t,e,n])=>{let r=o(t+.3963377774*e+.2158037573*n,3),a=o(t-.1055613458*e-.0638541728*n,3),i=o(t-.0894841775*e-1.291485548*n,3);return[k(~~(255*M(4.0767245293*r-3.3072168827*a+.2307590544*i)),0,255),k(~~(255*M(-1.2681437731*r+2.6093323231*a-.341134429*i)),0,255),k(~~(255*M(-.0041119885*r-.7034763098*a+1.7068625689*i)),0,255)]})([t/=100,(e/=100)?e*s(r):0,e?e*i(r):0]),l=k(~~a[0],0,255),c=k(~~a[1],0,255),"#"+(k(~~a[2],0,255)|c<<8|l<<16|16777216).toString(16).slice(1);var a,l,c}var n=Math.round,r=Math.min,a=Math.floor,o=Math.pow,i=Math.sin,s=Math.cos,l=Math.sqrt,h=Math.PI;const c=o(2,-32),d=32557,g=19605,u=new Uint16Array(4),f=new DataView(u.buffer);let v=null,b=!1;const m=()=>{const t=u[0],e=u[1],n=u[2],r=u[3],a=0|33103+d*t,o=0|63335+d*e+(g*t+(a>>>16)),i=0|31614+d*n+g*e+(62509*t+(o>>>16));u[0]=a,u[1]=o,u[2]=i,u[3]=5125+d*r+(g*n+62509*e)+(22609*t+(i>>>16));const s=(r<<21)+((r>>2^n)<<5)+((n>>2^e)>>11);return c*((s>>>(r>>11)|s<<(31&-(r>>11)))>>>0)},p=(t,e=0)=>{const n=16,r=65535,a=255;for(var o,i=1540483477,s=t.length,l=e^s,h=0;4<=s;)o=((o=t[h]&a|(t[++h]&a)<<8|(t[++h]&a)<<16|(t[++h]&a)<<24)&r)*i+(((o>>>n)*i&r)<<n),l=(l&r)*i+(((l>>>n)*i&r)<<n)^(o=((o^=o>>>24)&r)*i+(((o>>>n)*i&r)<<n)),s-=4,++h;switch(s){case 3:l^=(t[h+2]&a)<<n;case 2:l^=(t[h+1]&a)<<8;case 1:l=((l^=t[h]&a)&r)*i+(((l>>>n)*i&r)<<n)}return l=((l^=l>>>13)&r)*i+(((l>>>16)*i&r)<<16),(l^=l>>>15)>>>0},y=t=>{b=!1,v=null;const e=~~((t.length-2)/2),n=[];for(let r=0;r<e;r++){const e=2+2*r;n.push(parseInt(t.slice(e,e+2),16))}const r=p(n,1690382925),a=p(n,72970470);f.setUint32(0,r),f.setUint32(4,a)},x=(t,e)=>(void 0===e&&(e=t,t=0),m()*(e-t)+t),w=(t,e)=>a(x(t,e)),P=t=>t.length?t[w(t.length)]:void 0;var C=Object.freeze({__proto__:null,value:m,set_seed:y,boolean:()=>.5<m(),chance:(t=.5)=>m()<t,range:x,rangeFloor:w,pick:P,shuffle:t=>{for(var e,n,r=t.length,a=[...t];r;)e=~~(m()*r--),n=a[r],a[r]=a[e],a[e]=n;return a},insideCircle:(t=1,e=[])=>{var n=2*m()*h,r=t*l(m());return e[0]=r*s(n),e[1]=r*i(n),e},weighted:t=>{var e,n=0;for(e=0;e<t.length;e++)n+=t[e];var r=m()*n;for(e=0;e<t.length;e++){if(r<t[e])return e;r-=t[e]}return 0},gaussian:(t=0,e=1)=>{var n=Math.log;if(b){b=!1;var r=v;return v=null,t+e*r}var a=0,o=0,i=0;do{i=(a=2*m()-1)*a+(o=2*m()-1)*o}while(1<=i||0===i);var s=l(-2*n(i)/i);return v=o*s,b=!0,t+e*(a*s)},getRandomHash:t});const k=(t,e,n)=>Math.max(r(t,n),e),M=t=>.0031308<t?1.055*o(t,1/2.4)-.055:12.92*t;class W{constructor({random:t,brushHeight:e,lineWidth:n,baseColor:r}){this.random=t,this.brushHeight=e,this.baseColor=r,this.lineWidth=.0015,this.linePaths=this.generateLinePaths()}getAngle=()=>n(180*this.random.value()*h)/180;generateLinePaths(){const t=this.random,n=t.range(.1,.26),r=1-n;this.lineWidth=r*this.lineWidth;const o=a(t.range(20,90));return Array(o).fill().map((()=>{let a=0+t.range(n,n+.4*n),o=1-t.range(n,n+.4*n),i=t.range(.45+.05*r,.55-.05*r),s=t.pick([-1,1]),l=t.range(o-a,.75*o),h=-1==s?i-.003*r:i+.003*r,c=t.pick([-1,1]),d=[],g=this.getAngle();for(let n=0;n<this.brushHeight;n++)d.push({x1Padding:t.range(a,a+.01*r),x2Padding:t.range(o,o+.01*r),yInc:t.range(.0015*r,.0017*r),color:e(t.range(this.baseColor[0],this.baseColor[0]+10),this.baseColor[1],this.baseColor[2])});return[a,o,i,l,h,c,d,g]}))}draw({context:t,scale:e,dim:n,tx:r,ty:a}){t.lineWidth=n*this.lineWidth,this.linePaths.forEach((([n,o,i,s,l,h,c,d])=>{t.translate(r+.5*e,a+.5*e),t.rotate(d),t.translate(-(r+.5*e),-(a+.5*e)),c.forEach((n=>{t.strokeStyle=n.color,t.beginPath(),t.moveTo(r+n.x1Padding*e,a+i*e),t.quadraticCurveTo(r+s*e,a+l*e,r+n.x2Padding*e,a+i*e),t.stroke(),i=-1==h?i-n.yInc:i+n.yInc,l=-1==h?l-n.yInc:l+n.yInc})),t.setTransform(devicePixelRatio,0,0,devicePixelRatio,0,0)}))}}let I="undefined"==typeof tokenData?t():"string"==typeof tokenData?tokenData:tokenData.hash;(()=>{let t=window,n=document;const o=n.body.appendChild(n.createElement("canvas")),i=o.getContext("2d");let s,l,h,c,d;const g=()=>{i.save(),i.scale(d,d),s(i,h,c),i.restore()},u=()=>{l=r(t.innerWidth,t.innerHeight),h=l,c=l,d=t.devicePixelRatio||1,o.width=~~(h*d),o.height=~~(c*d),o.style.width=`${h}px`,o.style.height=`${c}px`,s&&g()};t.addEventListener("resize",u),u(),s=(t=>{y(t);let n=0;const o=P([0,5,10,30,50,80,180]),i=[x(35,90),x(10,30),x(0,360)],s=P([e(100,0,0)]),l=e(0,0,0),h=x(50,90),c=P([1,.5,.25,.125,.0625]),d=1/c*(1/c);let g=[];for(let t=0;t<d;t++)g.push(new W({random:C,brushHeight:h,baseColor:(u=void 0,n+=o,[i[0],i[1],(u=i[2]+n,0>(u%=360)?u+360:u)])}));var u;let f=[];for(let t=0;1e4>t;t++)f.push(m());const v=(t,e,n,r,o,i)=>{for(let s=0;s<e;s++)for(let l=0;l<e;l++){let e;o<f.length||(o=0),e=f[o];const h=a(40*e);t.fillStyle=`rgba(${200+h}, ${200+h}, ${200+h}, ${i})`,t.fillRect(n+s,r+l,1,1),o++}};return(t,e,n)=>{const a=r(e,n);let o=1>=e/n?e:n,i=.5*(e-o),h=.5*(n-o),u=.05*a,f=i+u,b=h+u;const m=c*(o-2*u);((t,e)=>{t.fillStyle=e})(t,s),t.fillRect(i,h,a,a),t.strokeColor=l,t.lineWidth=5,t.rect(i+u,h+u,a-2*u,a-2*u);for(let e=1;e<d-1;e++)t.moveTo(i+u+e*m,h+u),t.lineTo(i+u+e*m,h+u+(a-2*u));for(let e=1;e<d-1;e++)t.moveTo(i+u,h+u+e*m),t.lineTo(i+u+(a-2*u),h+u+e*m);t.stroke(),v(t,a,i,h,0,.4),g.forEach((e=>{e.draw({context:t,scale:m,dim:a,tx:f,ty:b}),f+=m,f>=a-2*u&&(f=i+u,b+=m)})),v(t,a,i,h,0,.1)}})(I),g()})()}();