memoscan
← all memos

Memo 0xd1cda9b1…c571a1 on Ethereum

p5.disableFriendlyErrors=!0,document.title="Inat";const urlSearchParams=new URLSearchParams(window.location.search),params=Object.fromEntries(urlSearchParams.entries());let hash=parseInt(tokenData.hash.slice(0,16),16);var R;let aspect,w,h,bg,horiz_gradient1,horiz_gradient2,tl,tr,bl,br,gfx,gh,psp,rnd,m,vrsta,drama,plt,boje=[],gradient=[],steps=10,trake=[],pos=[],br_grana=3,index=0,rn=[],rw=[];function setup(){aspect=1.41,centerCanvas(),windowWidth<windowHeight*aspect?(w=windowWidth,h=Math.round(windowWidth/aspect),createCanvas(w,h)):(w=Math.round(windowHeight*aspect),h=windowHeight,createCanvas(w,h)),gh=createGraphics(w,h),gh.pixelDensity(2),psp=createGraphics(w,h),frameRate(60),R=new Random,setup_boje();let t=f_f(R.r(0,2));vrsta=f_f(R.r(0,4));for(let t=0;t<5;t++)rn.push(R.r(.115,.3));for(let t=0;t<7;t++)rw.push(R.r(.05,.3));m=R.r(.07,.17)*h;let s=((2*f_f(R.r(0,2))-1)*R.r(.2,.3)+.5)*w,r=R.r(.3,.7)*h,e=R.r(.4*w,.5*w),i=R.r(.3*w,.4*w),o=5*f_f(R.r(2,5));0==t?(s=((2*f_f(R.r(0,2))-1)*R.r(.2,.3)+.5)*w,r=R.r(.3,.7)*h,e=R.r(.4*w,.5*w),i=R.r(.3*w,.4*w),o=5*f_f(R.r(2,5)),gh0(60,.004*h,s,r,e,i,o),gh0(bg,.004*h,s,r,e,i,o)):(s=.5*(2*f_f(R.r(0,2))-1)*w,r=R.r(.2,.6)*h,gh1(60,.004*h,s,r),gh1(bg,.004*h,s,r));psp.noStroke(),psp.fill(bg),psp.beginShape(),psp.vertex(0,0),psp.vertex(0,h),psp.vertex(w,h),psp.vertex(w,0),psp.beginContour();for(let t=0;t<7;t++)psp.vertex(m+t*(w-2*m)/6,R.r(m-.01*w,m));for(let t=6;t>=0;t--)psp.vertex(m+t*(w-2*m)/6,h-R.r(m,m+.01*w));if(psp.vertex(m,m),psp.endContour(),psp.endShape(),drama=R.r(.6,.8),0==vrsta){br_grana=f_f(R.r(5,8));let t=R.r(4.5,4.92);for(let s=0;s<br_grana;s++){pos[s]=[],pos[s][0]=createVector(f_f(R.r(0,2)),1-.5*m/h),pos[s][1]=createVector(R.r(2*m,w-2*m)/w,1-.5*m/h);let r=map(s/(br_grana-1),0,1,.35,1-2*m/h);pos[s][2]=createVector(pos[s][1].x+f_c(t)*r,pos[s][1].y+f_s(t)*r),pos[s][3]=createVector(R.r(0,1),pos[s][2].y)}for(let t=0;t<br_grana;t++){let s=floor(30*dist(pos[t][1].x,pos[t][1].y,pos[t][2].x,pos[t][2].y));for(let r=0;r<=s;r+=1){let e=r/s,i=curvePoint(pos[t][0].x,pos[t][1].x,pos[t][2].x,pos[t][3].x,e),h=curvePoint(pos[t][0].y,pos[t][1].y,pos[t][2].y,pos[t][3].y,e),o=curveTangent(pos[t][0].x,pos[t][1].x,pos[t][2].x,pos[t][3].x,e),a=curveTangent(pos[t][0].y,pos[t][1].y,pos[t][2].y,pos[t][3].y,e),n=atan2(a,o),l=map(e,0,1,.65-t/(2*br_grana),.15),p=R.r(l/9,l/5);n-=PI/2,r%2==0&&append(trake,new Strk(index++,i,h,.5,r==s?n:n-R.r(PI/5,PI/3),l,p,1500*p,drama*l,0*l,0,.5,0)),n+=PI,r%2==1&&append(trake,new Strk(index++,i,h,.5,r==s?n:n+R.r(PI/5,PI/3),l,p,1500*p,0*l,drama*l,.5,0,1))}}}else if(1==vrsta){br_grana=f_f(R.r(4,8));let r=3*PI/2;for(let e=0;e<br_grana;e++){pos[e]=[],pos[e][0]=createVector(f_f(R.r(0,2)),1-.5*m/h);let i=R.r(1.5*m,w-1.5*m)/w;0==e&&(i=0==t?s/w:s<0?R.r(2*m,.5*w)/w:R.r(.5*w,w-2*m)/w),pos[e][1]=createVector(i,1-.5*m/h);let o=R.r(.5,1-1.25*m/h);pos[e][2]=createVector(pos[e][1].x+f_c(r)*o,pos[e][1].y+f_s(r)*o),r=R.r(4.4,5),pos[e][3]=createVector(f_f(R.r(0,2)),pos[e][2].y)}for(let t=0;t<br_grana;t++){let s=f_f(R.r(15,25));for(let r=0;r<=s;r+=1){a=R.r(0,TAU)+r%2*PI;let s=.05,e=R.r(.2,.5);r%2==0?append(trake,new Strk(index++,pos[t][2].x,pos[t][2].y,.4,a-R.r(PI/5,PI/3),e,s,1500*s,drama*e,0*e,0,.5,0)):append(trake,new Strk(index++,pos[t][2].x,pos[t][2].y,.4,a+R.r(PI/5,PI/3),e,s,1500*s,0*e,drama*e,.5,0,1))}}}else if(2==vrsta){let t=f_f(R.r(50,80));for(let s=0;s<t;s++){let t=R.r(.2,.8),r=R.r(1-m/h,1-.012*s),e=R.r(PI/2-(r<.8?PI/2:0),3*PI/2+(r<.8?PI/2:0)),i=.75*r,o=.05*r;append(trake,new Strk(index,t,r,R.r(.1,.5),e,i,o,1500*o,drama*i,.2*drama*i,.2,0,0)),index++}}else if(3==vrsta){br_grana=f_f(R.r(3,5)),background(bg);for(let r=0;r<br_grana;r++){let e=R.r(2*m,w-2*m)/w;0==r&&(e=0==t?s/w:s<0?R.r(2*m,.5*w)/w:R.r(.5*w,w-2*m)/w),grana(e,1-.5*m/h,R.r(.6,1-m/h),0,2*f_f(R.r(0,2))-1)}}}function grana(t,s,r,e,i){let o=f_c(3*PI/2+e)*r+t,a=f_s(3*PI/2+e)*r+s,n=.5*r;append(pos,new Array(createVector(t-i*f_c(e)*n,s-i*f_s(e)*n),createVector(t,s),createVector(o,a),createVector(o-i*f_c(e)*n,a-i*f_s(e)*n)));let l=R.r(1,1.4)-pos[pos.length-1][2].y,p=l/R.r(15,20);pos[pos.length-1][2].x>m/w&&pos[pos.length-1][2].x<1-m/w&&pos[pos.length-1][2].y>.8*m/h&&append(trake,new Strk(index++,pos[pos.length-1][2].x,pos[pos.length-1][2].y,.15,(2*f_f(R.r(0,2))-1)*R.r(.63,.785),l,p,1500*p,.2*drama*l,drama*l,.4,0,2));let f=pos[pos.length-1].copyWithin(0);if(r>.2)for(let t=0;t<4;t++)R.r(0,1)<.9&&(n=R.r(.3,.6),grana(curvePoint(f[0].x,f[1].x,f[2].x,f[3].x,n),curvePoint(f[0].y,f[1].y,f[2].y,f[3].y,n),r*R.r(.3,.7),e+(t%2*2-1)*R.r(PI/16,PI/8),t%2*2-1))}function gh0(t,s,r,e,i,o,a){gh.noFill(),gh.stroke(t),gh.strokeWeight(s),gh.arc(r,e,2*i,2*o,PI,2*PI),gh.arc(r,e,2.05*i,2.05*o,PI,2*PI),gh.arc(r,e,2.05*i,2.2*o,PI,2*PI);for(let t=-5;t<=5;t++)gh.line(r+t*i/5,e-Math.sqrt(Math.abs(1.21*o*o-1.21*t*t*o*o/25)),r+t*i/5,h),t>0&&gh.line(r-Math.sqrt(i*i-t*t*i*i/25),f_fs(e-t*o/5),r+Math.sqrt(i*i-t*t*i*i/25),e-t*o/5);gh.line(r-1.025*i,f_f(e-.02*e),r+1.025*i,f_f(e-.02*e)),gh.line(r-1.025*i,f_f(e),r+1.025*i,f_f(e));for(let t=-4;t<=4;t+=2)prozor(r+t*i/5,e+rn[(t+4)/2]*h,f_fs(.4*i));gh.strokeWeight(s/3);for(let t=-a;t<=a;t++)gh.line(r+t*i/a,e-Math.sqrt(o*o-t*t*o*o/(a*a)),r+t*i/a,h),t>=0&&gh.line(r-Math.sqrt(i*i-t*t*i*i/(a*a)),e-t*o/a,r+Math.sqrt(i*i-t*t*i*i/(a*a)),e-t*o/a)}function gh1(t,s,r,e){gh.noFill(),gh.stroke(t),gh.strokeWeight(s);let i,h=0,o=0,a=0;for(let t=0;t<7;t++)i=2*rw[t]*w,0==t?(a=-1,o=e+rw[0]*w):6==t?(a=1,o=e+rw[6]*w):(a=0,o=e),1==t&&(a=-1),5==t&&(a=1),2==t&&(i=2*rw[1]*w),4==t&&(i=2*rw[5]*w),prozor(r+h+rw[t]*w/2,o+rw[t]*w/2,f_fs(rw[t]*w)),polukupola(r+h+rw[t]*w/2,o,2*rw[t]*w,i,a),h+=rw[t]*w}function polukupola(t,s,r,e,i){for(let h=0;h<5;h++)-1==i||1==i?gh.arc(t-i*r/4,s,h*r/4,r,(2+.5*(i+1))*PI/2,(3+.5*(i+1))*PI/2):gh.line(t-r/4+h*r/8,s,t-r/4+h*r/8,s-e/2-r/16),h<4&&(-1==i||1==i?gh.arc(t-r/4+h*r/8+r/16,s-r/16,r/8,r/8,0,PI):gh.arc(t-r/4+h*r/8+r/16,s-e/2-r/16,r/8,r/8,0,PI));-1!=i&&1!=i&&(gh.line(t-r/4,s-e/2,t+r/4,s-e/2),gh.line(t-r/4,s-e/2-r/16,t+r/4,s-e/2-r/16))}function prozor(t,s,r){gh.arc(t,s,r,r,PI,TAU),gh.arc(t,s,.5*r,.5*r,PI,TAU);for(let e=PI+PI/6;e<=2*PI;e+=PI/6)gh.line(f_c(e)*r*.25+t,f_s(e)*r*.25+s,f_c(e)*r*.5+t,f_s(e)*r*.5+s);for(let e=0;e<6;e++)gh.line(t+.5*r,f_fs(s+e*h/8),t-.5*r,f_fs(s+e*h/8));gh.line(t+.5*r,s-.5*r,t-.5*r,s-.5*r),gh.line(t-.25*r,s,t-.25*r,h),gh.line(t+.25*r,s,t+.25*r,h),gh.line(t,s-.25*r,t,h),gh.line(t-.5*r,s-.5*r,t-.5*r,h),gh.line(t+.5*r,s-.5*r,t+.5*r,h)}function draw(){let t,s;background(bg),noStroke(),0==plt?(t=color(red(gradient[0][0]),green(gradient[0][0]),blue(gradient[0][0]),40),s=color(red(bg)-15,green(bg)-20,blue(bg)-15,40)):(t=color(red(bg)-10,green(bg)-10,blue(bg)-10,255),s=color(red(bg)+10,green(bg)+10,blue(bg)+10,255)),fill(255);let r=drawingContext.createLinearGradient(0,0,0,height);r.addColorStop(1-m/h,s),r.addColorStop(m/h,t),drawingContext.fillStyle=r,noStroke(),rect(0,0,width,height),stroke(0),strokeWeight(2e-4*w),noFill();for(let t=0;t<pos.length/3;t++)curve(pos[t][0].x*w,pos[t][0].y*h,pos[t][1].x*w,pos[t][1].y*h,pos[t][2].x*w,pos[t][2].y*h,pos[t][3].x*w,pos[t][3].y*h);for(let t=0;t<trake.length/3;t++)trake[t].move(),trake[t].display();image(gh,0,0,w,h),stroke(0),strokeWeight(3e-4*w),noFill();for(let t=floor(pos.length/3);t<pos.length;t++)curve(pos[t][0].x*w,pos[t][0].y*h,pos[t][1].x*w,pos[t][1].y*h,pos[t][2].x*w,pos[t][2].y*h,pos[t][3].x*w,pos[t][3].y*h);for(let t=floor(trake.length/3);t<trake.length;t++)trake[t].move(),trake[t].display();image(psp,0,0,w,h)}function windowResized(){windowWidth<windowHeight*aspect?(w=windowWidth,h=Math.round(windowWidth/aspect),resizeCanvas(w,h)):(w=Math.round(windowHeight*aspect),h=windowHeight,resizeCanvas(w,h))}function setup_boje(){boje[0]="rgba(37, 47, 72, 0.9)",boje[1]="rgba(80, 80, 80, 0.9)",boje[2]="rgba(143, 156, 175, 0.9)",boje[3]="rgba(234, 70, 77, 0.9)",boje[4]="rgba(199, 190, 149, 0.9)",boje[5]="rgba(253, 168, 62, 0.9)",boje[6]="rgba(97, 83, 118, 0.9)",boje[7]="rgba(213, 67, 77, 0.9)",tl=boje[f_f(R.r(0,8))],tr=boje[f_f(R.r(0,8))],bl=boje[f_f(R.r(0,8))],br=boje[f_f(R.r(0,8))],horiz_gradient1=[],horiz_gradient2=[];for(let t=0;t<steps+2;t++)gradient[t]=[];for(let t=0;t<steps+2;t++)horiz_gradient1[t]=lerpColor(color(tl),color(bl),t/(steps+1));for(let t=0;t<steps+2;t++)horiz_gradient2[t]=lerpColor(color(tr),color(br),t/(steps+1));for(let t=0;t<steps+2;t++)for(let s=0;s<steps+2;s++)gradient[s][t]=lerpColor(horiz_gradient1[t],horiz_gradient2[t],s/(steps+1));if(plt=f_f(R.r(0,2)),0==plt)bg=color(248,244,233);else{let t=R.r(0,10);bg=t<2?color(222,218,208):t<4?color(252,199,190):t<6?color(129,140,152):t<8?color(55,55,65):color(215,210,191),tl=color(248,244,233)}}function f_s(t){return Math.sin(t)}function f_f(t){return Math.floor(t)}function f_fs(t){return Math.floor(t)+.5}function f_c(t){return Math.cos(t)}function keyPressed(){if("s"==key||"S"==key){let t=hour()+""+minute()+second();save("plants"+t+".png")}}function centerCanvas(){var t=document.body.style;t.display="flex",t.overflow="hidden",t.height="100vh",t.alignItems="center",t.justifyContent="center"}class Random{constructor(){this.useA=!1;let t=function(t){let s=parseInt(t.substring(0,8),16),r=parseInt(t.substring(8,16),16),e=parseInt(t.substring(16,24),16),i=parseInt(t.substring(24,32),16);return function(){s|=0,r|=0,e|=0,i|=0;let t=(s+r|0)+i|0;return i=i+1|0,s=r^r>>>9,r=e+(e<<3)|0,e=e<<21|e>>>11,e=e+t|0,(t>>>0)/4294967296}};this.prngA=new t(tokenData.hash.substring(2,34)),this.prngB=new t(tokenData.hash.substring(34,66));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()}r(t,s){return t+(s-t)*this.random_dec()}}class Strk{constructor(t,s,r,e,i,h,o,a,n,l,p,w,f){if(this.index=t,this.posx=s,this.posy=r,this.w=e,this.alfa=i,this.alfa_orig=i,this.dir=f,1==this.dir?this.gama=-h:this.gama=0,3==vrsta&&(this.gama=-h/2),this.tx=floor(R.r(0,999)),this.tr1=R.r(0,999),this.tr2=R.r(0,999),this.beta=this.gama+h,this.k=o,this.sw=a,this.r1=n,this.r2=l,this.suz1=p,this.suz2=w,o<.008*e)this.c=color(0);else{let t=floor(map(constrain(this.posx,.2,.8),.2,.8,0,steps)),s=floor(map(constrain(this.posy,.2,.8),.2,.8,0,steps));this.c=gradient[t][s],1==plt&&(this.c=tl)}}display(){if(this.tr1=0,fill(this.c),0==plt){let t;t=drawingContext.createLinearGradient(f_c(-this.dir*this.gama-(1-this.dir)*this.beta)*this.w*w,f_s(-this.dir*this.gama-(1-this.dir)*this.beta)*this.w*w,f_c(this.dir*this.gama+(1-this.dir)*this.beta)*this.w*w,f_s(this.dir*this.gama+(1-this.dir)*this.beta)*this.w*w);let s=color(bg),r=color(this.c);this.index<index/3&&(s=color(0)),0==vrsta||1==vrsta?(t.addColorStop(.5,s),t.addColorStop(1,r)):(t.addColorStop(.3,s),t.addColorStop(.7,r)),drawingContext.fillStyle=t,strokeWeight(15e-5*w)}else this.index<index/3?fill(0):this.index<2*index/3&&fill(red(bg)-this.index/2,green(bg)-this.index/2,blue(bg)-this.index/2),strokeWeight(15e-5*w);stroke(0);let t=this.w,s=this.w-this.k,r=TAU/(this.beta-this.gama),e=4/3*Math.tan(PI/(2*r));push(),translate(this.posx*w-f_c(this.alfa)*(this.w-this.k*this.suz2-this.dir*this.k*this.suz1)*w,this.posy*h-f_s(this.alfa)*(this.w-this.k*this.suz2-this.dir*this.k*this.suz1)*w),rotate(this.alfa),noiseSeed(this.index),beginShape(),vertex(f_c(this.gama)*(this.w-this.k*this.suz2)*w,f_s(this.gama)*(this.w-this.k*this.suz2)*w),bezierVertex(f_c(this.gama)*this.w*w+f_c(this.gama+PI/2)*t*e*w,f_s(this.gama)*this.w*w+f_s(this.gama+PI/2)*t*e*w,f_c(this.beta)*this.w*w+f_c(this.beta-PI/2)*t*e*w,f_s(this.beta)*this.w*w+f_s(this.beta-PI/2)*t*e*w,f_c(this.beta)*(this.w-this.k*this.suz1)*w,f_s(this.beta)*(this.w-this.k*this.suz1)*w);let i=Math.round(this.sw-2*this.sw*this.suz1),o=Math.round(this.sw-2*this.sw*this.suz2)-1;for(let t=1;t<i;t++)rnd=map(noise(this.tr1,this.tr2),0,1,-this.r1,this.r1),this.tr1+=.5,vertex(f_c(this.beta+rnd)*(this.w-this.k*this.suz1-this.k*(1-2*this.suz1)*t/(i-1))*w,f_s(this.beta+rnd)*(this.w-this.k*this.suz1-this.k*(1-2*this.suz1)*t/(i-1))*w);vertex(f_c(this.beta)*(this.w-this.k*(1-this.suz1))*w,f_s(this.beta)*(this.w-this.k*(1-this.suz1))*w),bezierVertex(f_c(this.beta)*(this.w-this.k*(1-this.suz1))*w+f_c(this.beta-PI/2)*s*e*w,f_s(this.beta)*(this.w-this.k*(1-this.suz1))*w+f_s(this.beta-PI/2)*s*e*w,f_c(this.gama)*(this.w-this.k*(1-this.suz2))*w+f_c(this.gama+PI/2)*s*e*w,f_s(this.gama)*(this.w-this.k*(1-this.suz2))*w+f_s(this.gama+PI/2)*s*e*w,f_c(this.gama)*(this.w-this.k*(1-this.suz2))*w,f_s(this.gama)*(this.w-this.k*(1-this.suz2))*w);for(let t=o;t>0;t--)rnd=map(noise(this.tr1,this.tr2),0,1,-this.r2,this.r2),this.tr1+=.5,vertex(f_c(this.gama+rnd)*(this.w-this.k*this.suz2-this.k*(1-2*this.suz2)*t/o)*w,f_s(this.gama+rnd)*(this.w-this.k*this.suz2-this.k*(1-2*this.suz2)*t/o)*w);vertex(f_c(this.gama)*(this.w-this.k*this.suz2)*w,f_s(this.gama)*(this.w-this.k*this.suz2)*w),endShape(),this.tr2+=1e-4,pop()}move(){this.alfa=this.alfa_orig+map(noise(this.tx),0,1,-.25,.5),this.tx+=.0025}}