memoscan
← all memos

Memo 0xd2d28584…5d2a88 on Ethereum

const hash=tokenData.hash,ID=parseFloat(tokenData.tokenId)%1e3,initPRNG=()=>Uint32Array.from([0,0,0,0].map(((e,n)=>parseInt(hash.substr(8*n+2,8),16))));let xS=initPRNG();const prng=e=>{let n,r=xS[3];return xS[3]=xS[2],xS[2]=xS[1],xS[1]=n=xS[0],r^=r<<11,r^=r>>>8,xS[0]=r^n^n>>>19,Math.floor(e*(xS[0]/4294967296))},prand=(e,n)=>e+prng(n-e),fract=e=>e-Math.floor(e),PI=Math.PI,D2G=Math.PI/180,G2D=180/Math.PI,RATIO=9/16,DW=2400,DH=Math.round(1350);let WIDTH,HEIGHT,scene,graphics,graphics2,decals,ani,LW,PD=1,F=setF(),NX=0,stop=!1,initTime=0;function setup(){createCanvas(DW,DH),noiseSeed(1),PD=pixelDensity(1),colorMode(HSB,360,100,100,100),canvasResize(),scene=makeGraphics(DW,DH),sc2=makeGraphics(1584,.66*DH),graphics=makeGraphics(DW,DH),graphics2=makeGraphics(DW,DH),decals=makeGraphics(DW,DH),ani=makeGraphics(DW,DH),resetScene(),document.addEventListener("dblclick",(e=>{ndv()}))}function draw(){drawingContext.imageSmoothingEnabled=!0,background(F.HUE,20,100);for(let e=0;e<10;e++)LW.move(),LW.display(),addNoise();scene.background(F.HUE,20,F.BW||F.BBG?0:100),scene.image(graphics,0,0),F.burn?(scene.blendMode(BURN),scene.image(graphics2,0,0)):(scene.blendMode(MULTIPLY),scene.image(graphics,0,0)),scene.blendMode(SOFT_LIGHT),scene.image(decals,0,0),scene.blendMode(BLEND),imageMode(CENTER),rectMode(CENTER),push(),translate(width/2,height/2),image(scene,0,0,1.1*WIDTH,1.1*HEIGHT),F.BW&&(noStroke(),blendMode(OVERLAY),fill(0,0,100,80),rect(0,0,width,height)),pop(),stop||0!=LW.walkers.length||(stop=!0)}function ndv(){noiseSeed(floor(1e8*Math.random())),resetScene()}function keyPressed(){if(stop&&("s"==key||"S"==key)){let e=makeGraphics(DW,DH);e.imageMode(CENTER),e.push(),e.translate(1200,DH/2),e.image(scene,0,0,2640,1.1*DH),F.BW&&(e.noStroke(),e.blendMode(OVERLAY),e.fill(0,0,100,80),e.rect(0,0,e.width,e.height)),e.pop(),e.save("renaissance.png")}"r"!=key&&"R"!=key||ndv()}function windowResized(){canvasResize()}function setF(){for(let e=0;e<500;e++)prng(2);let e=1200+prand(-1,2)*DW*.66,n=DH/2+prand(-1,2)*DH*.66;prng(5)||(e=1200,n=DH/2);let r=1200==e&&n==DH/2,a=0,t=0;prng(3)||(prng(2)||(a=prand(-5,6)/10),prng(2)||(t=prand(-5,6)/5));let i=Math.PI/prand(2,6);return{density:prand(3,7),sides:[2,2,3,3,4,4,6,8,60][prng(9)],branchAngleA:i,branchAngleB:-i,vgiro:(prng(2),.1),rotation:prng(9)*Math.PI/4,offset:!prng(10),shadow:1.5,nz:1e-4*(r?10:prand(1,11)),zoom:[15,30,45][prng(3)],vgGradient:prng(10),cooldown:[0,10,50,150][prng(4)],RAG:prng(2)?5e4:50,BBG:prng(3),BW:!prng(20),HUE:prng(360),HUE2:(250+prng(100))%360,polygon:4,burn:!prng(3),stripe:[10,60,90][prng(3)],hasCenter:prng(5),centerX:e,centerY:n,centerAngle:prand(0,5)*Math.PI/8,centerSides:300,gravityX:a,gravityY:t}}function resetScene(){xS=initPRNG(),NX=0,F=setF(),initTime=millis(),stop=!1,ani.clear(),decals.clear(),graphics2.clear(),graphics.clear(),ani.background(F.HUE,14,100),LW=new NWList(graphics);for(let e=0;e<DW;e+=60){let n=prng(DH);LW.add(e,n,-1)}if(1200==F.centerX&&F.centerY==DH/2)for(let e=0;e<10;e++)LW.add(1200,DH/2,-1)}function canvasResize(){let e=window.innerWidth,n=window.innerHeight;e<n/RATIO?(HEIGHT=n,WIDTH=n/RATIO):(WIDTH=e,HEIGHT=e*RATIO),resizeCanvas(window.innerWidth,window.innerHeight)}function makeGraphics(e,n){let r=createGraphics(e,n);return r.drawingContext.imageSmoothingEnabled=!0,r.pixelDensity(1),r.colorMode(HSB,360,100,100,100),r.clear(),r.rectMode(CENTER),r}function drawLights(){decals.rectMode(CENTER),decals.noStroke(),decals.fill(F.HUE2,10,100,15);for(let e=0;e<50;e++){let e=prand(50,200),n=(prand(50,500),prng(DW)),r=prng(DH);decals.rect(n,r,e,DH)}}function addNoise(){let e=NX,n=0;for(decals.strokeWeight(1.5);n<DH;)prng(5)&&(bri=100*noise(.01*e,.01*n),decals.stroke(F.HUE,0,10,70),decals.point(e,n)),n+=12*noise(.01*e,.01*n);NX+=2}class NWList{constructor(s){this.g=s,this.walkers=[],this.w=DW,this.h=DH}add(s,t,e=-1){-1==e&&(e=prng(360)*Math.PI/180);let l=new NoiseWalker(this,this.g,s,t,e);this.walkers.push(l)}move(){for(let s=0;s<this.walkers.length;s++)this.walkers[s].move();for(let s=this.walkers.length-1;s>=0;s--)this.walkers[s].alive||this.walkers.splice(s,1)}display(){for(let s=0;s<this.walkers.length;s++)this.walkers[s].display()}}class NoiseWalker{constructor(s,i,t,h,e=-1){this.swarm=s,this.g=i,this.x=t,this.y=h,this.W=i.width,this.H=i.height,this.speed=1,this.angle=e,this.targetAngle=e,this.life=0,this.lifespan=F.density*prand(100,500),this.alive=!0,this.offset=F.offset?prng(1e5):0,this.nz=F.nz,this.vgiro=F.vgiro,this.sides=F.sides,this.rot=F.rotation,this.gx=F.gravityX,this.gy=F.gravityY,this.grow=.6,this.cooldown=F.cooldown}move(){switch(this.life++,this.x+=cos(this.angle)*this.speed,this.y+=sin(this.angle)*this.speed,this.x+=this.gx*this.speed,this.y+=this.gy*this.speed,(this.x>this.W||this.x<0)&&(this.x=(this.x+this.W)%this.W,this.y=prng(this.H)),(this.y>this.H||this.y<0)&&(this.x=prng(this.W),this.y=(this.y+this.H)%this.H),F.vgGradient){case 1:this.vgiro=max(0,map(abs(this.x-DW/2),0,.5*DW,.1,-.1));break;case 2:this.vgiro=max(0,map(abs(this.x-DW/2),0,.5*DW,-.1,.1));break;case 3:this.vgiro=max(0,map(this.x,0,DW,-.05,.1));break;case 4:this.vgiro=max(0,map(this.x,0,DW,.1,-.05));break;case 5:this.vgiro=max(0,map(this.y,0,DH,-.05,.1));break;case 6:this.vgiro=max(0,map(this.y,0,DH,.1,-.05));break;case 7:this.vgiro=max(.01,map(dist(this.x,this.y,DW/2,DH/2),0,.8*DH,.1,-.1));break;case 8:this.vgiro=max(.01,map(dist(this.x,this.y,DW/2,DH/2),0,.8*DH,-.1,.1));break;default:break}if(F.hasCenter){if(dist(this.x,this.y,F.centerX,F.centerY)>200){let s=G2D*(atan2(this.y-F.centerY,this.x-F.centerX)+F.centerAngle);s=floor(s/(360/F.centerSides))*(360/F.centerSides),this.rot=s*D2G}}if(!prng(200)&&this.lifespan-this.life>10&&this.swarm.walkers.length<200){let s=new NoiseWalker(this.swarm,this.g,this.x,this.y,this.angle+F.branchAngleA);s.lifespan=(this.lifespan-this.life)*this.grow,this.swarm.walkers.push(s),s=new NoiseWalker(this.swarm,this.g,this.x,this.y,this.angle+F.branchAngleB),s.lifespan=(this.lifespan-this.life)*this.grow,this.swarm.walkers.push(s);let i=floor(100*noise(.006*this.x,.006*this.y)+F.HUE)%360,t=450;this.g.blendMode(F.BW?HARD_LIGHT:ADD),this.g.noStroke(),F.BW?this.g.fill(i,0,0,2):this.g.fill(i,60,50,3),this.g.ellipse(this.x,this.y,t,t),this.g.blendMode(BLEND)}if(this.cooldown<=0){let s=this.sides;this.targetAngle=this.rot+floor(map(noise((this.life+this.offset)*this.nz),0,1,0,2*s))*TWO_PI/s,this.targetAngle>TWO_PI?this.targetAngle-=TWO_PI:this.targetAngle<0&&(this.targetAngle+=TWO_PI),this.angle>TWO_PI?this.angle-=TWO_PI:this.angle<0&&(this.angle+=TWO_PI),this.targetAngle-this.angle>PI?this.targetAngle-=TWO_PI:this.targetAngle-this.angle<-PI&&(this.targetAngle+=TWO_PI),abs(this.targetAngle-this.angle)<=this.vgiro?this.angle=this.targetAngle:this.angle+=Math.sign(this.targetAngle-this.angle)*this.vgiro}else this.cooldown--}display(){let s=min(350,map(max(this.life,0),0,this.lifespan,10+this.lifespan/F.zoom,1));if(this.life<this.lifespan){if(this.g.push(),this.g.translate(this.x,this.y),this.g.strokeWeight(4),this.g.stroke(F.HUE,F.BW?0:100,prand(15,30),F.BW?30:20),this.life%2==0&&this.g.line(0,0,0,10+s*F.shadow),s>F.RAG&&this.g.scale(map(floor(this.life)%s,0,s-1,.75,1)),this.life%1==0){this.g.fill(F.HUE2,0,F.BW?0:min(F.stripe,map(this.life,0,100,0,F.stripe))),this.g.noStroke();let i=1.1,t=.3;this.g.rect(0,0,s*i,s*t),this.g.rect(0,0,s*t,s*i)}this.g.stroke(F.HUE,90,0,F.BW?5:10),this.g.strokeWeight(4),this.g.fill(F.HUE,0,200),this.g.rect(0,0,s,s),this.g.noStroke(),this.g.fill(F.HUE,0,10),this.g.rect(0,0,s-4,s-4),this.g.pop(),graphics2.push(),graphics2.translate(this.x,this.y),graphics2.stroke(F.HUE2+40*noise(.01*this.life),F.BW?0:35,F.BW?60:100,100),graphics2.strokeWeight(2),graphics2.noFill(),graphics2.rect(0,0,s-4,s-4),graphics2.pop()}else this.alive=!1}}