0xa0154806…bb3asent to0xa7d8d9ef…d270·#15,297,802·view on Etherscan
function draw(){if(tik>0&&tik<NA-es-1){let e=buf?ob:this,t=tik%NA,n=[A[t].r[0],A[t].r[1]];e.fill(0,0,100,1),e.blendMode(ADD),pc.blendMode(BLEND);let l=255*clamp(Math.exp(10/JN*log(.85))*(1-kblk)+.3*clamp((n[0]-.5)*(n[0]-.5)-(n[1]-.5)*(n[1]-.5),0,1),0,1);pc.fill(l),pc.stroke(l),pc.strokeWeight(.6),0&&e.circle(1.1*Lx*A[t].r[0]-.05,1.1*Ly*A[t].r[1]-.05,2*Lx*A[t].R*1);let o=[a[t].x[a[t].x.length-1],a[t].y[a[t].x.length-1]];o=sumArrays(vecscl(n,1-lamr),vecscl(o,lamr));if(dist)for(let e=0;e<a[t].x.length;e++){let l=mod(e,a[t].x.length);pc.triangle(Lx*str(ox+scx*n[0]),Ly*str(oy+scy*n[1]),Lx*str(ox+scx*o[0]),Ly*str(oy+scy*o[1]),Lx*str(ox+scx*a[t].x[l]),Ly*str(oy+scy*a[t].y[l])),o=[a[t].x[l],a[t].y[l]],o=sumArrays(vecscl(n,1-lamr),vecscl(o,lamr))}else pc.circle(Lx*str(ox+scx*n[0]),Ly*str(oy+scy*n[1]),lamr*.99*scx*Lx*2*A[t].R);if(outline){e.noFill(),e.stroke(0,0,100*(1-night),1);let n=.5*dc*.5/2/tan(ang);e.strokeWeight(Lx*min(max(.2*dc,scx*n),.6*dc)),e.beginShape();let l,o,r,s,i=[],c=1;for(let n=0;n<a[t].x.length;n++)i=[a[t].x[n],a[t].y[n]],l=ox+scx*i[0],o=oy+scy*i[1],r=10*floor(l)+floor(o),n>0&&r!=s&&(e.endShape(),e.beginShape(),c=0),s=r,c&&l<2&&l>-2&&o<2&&o>-2&&e.curveVertex(Lx*l,Ly*o);e.endShape()}e.blendMode(BLEND)}let e=0;for(;tik<NA-es&&e<step;)drawk(tik),tik++,e++;if(buf){let e=tik/step0*TWO_PI;fill(360*e/TWO_PI,90,100),circle(Lx/2+60*dx*cos(e),Ly/2+60*dx*sin(e),3*dx)}if(buf&&tik>=step0&&(image(ob,0,0,Lx,Ly,Lx*xb/3,Ly*xb/3,Lx,Ly),t0=millis(),step=1,buf=0),tik>=NA-es&&(1==kand||emboss)){image(ob,0,0,Lx,Ly,Lx*xb/3,Ly*xb/3,Lx,Ly);let e=JN;JN>2&&(e+=6*kand);let t=tphase+(millis()-t0)/3e5*PI;if(kand)for(let n=1;n<e;n++)blend(pc,blsh*Lx*xb/3*n/e*cos(t),blsh*Ly*xb/3*n/e*sin(t),width*pd,height*pd,0,0,width*pd,height*pd,MULTIPLY);else for(let n=1;n<e;n++)blend(pc,blsh*Lx*xb/3*n/e*cos(t),blsh*Ly*xb/3*n/e*sin(t),width*pd,height*pd,0,0,width*pd,height*pd,SCREEN);if(vred||(fill(hx,bsat,255,.1),rect(0,0,Lx,Ly)),!kand&&contr){loadPixels();let e=4*(width*pd)*(height*pd);for(let t=0;t<e;t+=4){let e=[pixels[t],pixels[t+1],pixels[t+2]],n=color(e[0],e[1],e[2]),l=brightness(n)/100,o=1.2*(.4+.6*fblend(l*l));contr_x>0&&(o*=1.4*o);let r=1+vred*(l-1);pixels[t+0]=r*(o*(e[0]-128)+v0),pixels[t+1]=r*(o*(e[1]-128)+v0),pixels[t+2]=r*(o*(e[2]-128)+v0)}updatePixels()}}tik>=NA-es&&(tik++,bor&&drawbord(),head&&noLoop())}function drawk(e){let t=max(.01,1-e/(.1+NA-atten*es)),n=dx/Lx,l=mod(hx+5*(e-NA)*coltik,360),o=(2-bsat/20)*t*.1*rndv[e%NRND]/2,r=buf?ob:this;if(e%20==0&&(r.blendMode(SCREEN),r.fill(l,bsat,100-3*(2*t-1)*1.5*(1+fade)*dlum,1*(1+fade)*max(0,o)),r.rect(0,0,Lxb,Lyb),r.blendMode(BLEND)),e<NA){let l=rlight.slice();l=rot3d(l,[0,0,1],t*PI);let o=[120,30,10];col=[];let s=0,i=1,c=pal[pal.length-1][0],x=0,d=0;for(let p=0;p<a[e].x.length;p++){let y=1,h=(dx,5*(2+fade)*min(.1,1.3*y)*pd/2/2*.1*lnwght);x=0,d=0,lo=1,lo*=lsw,h*=1+4*bw,lo?r.stroke(c,100,.2*lightness,h):r.noStroke();let b=1.3*max(.1,1.3*y)*2/pd*dx/14;r.strokeWeight(b);let f=[a[e].x[p],a[e].y[p],a[e].z[p]],u=.6*a[e].R,L=a[e].v[0];i*=y;let m,k,g,w,D,M,N,v=rr0;for(let c=0;c<Nrad0;c++){s++,i=min(.15*n,i),i=max(.7*n,i);let y=pinch*a[e].t1[p];hatch&&(y=floor(y*hatchn/TWO_PI)*TWO_PI/hatchn),y=phase,y+=flow*a[e].RR[p]/2;let b=rot3d([cos(y),sin(y),0],a[e].v[p],c/Nrad0*TWO_PI),P=sumArrays(vecscl(b,1-lam),vecscl(L,lam));L=P,k=clarity+(1-clarity)*(.2+.8*rndv[mod(s,NRND)]),g=k;let R=mod(237*k,1),S=mod(191*k,1),z=mod(257*k,1);fac=.01*brr*Math.exp(R)*Math.exp(a[e].RR[p]);let I=sumArrays(f,vecscl(b,i*n*fac*k*u));xxx=f[0],yyy=f[1],xxx=ox+scx*f[0],yyy=oy+scy*f[1];let _=scx*a[e].R*2*(2-clarity)*v*k,B=4*aa0/Nrad0/(1+2*lgfac*(.05+S)*_);if(_>5&&(B=min(B,.1)),M=_,N=B,wild){let e=2.5*mod(57*g,1);_*=.5*Math.exp(e),B*=2*Math.exp(-1.5*e)}w=sumArrays(l,[xe,ye,ze],neg(I)),D=.39+dot(P,w)/norm3(w)/norm3(P)-.03+.03*Math.exp(2*z),focus&&(D+=phase+atan2(a[e].x[p]-.4-.2*rndv[0],a[e].y[p]-.4-.2*rndv[1])),D-=rbow*a[e].RR[p],D+=300*A[e].cf,D=sin(D*PI),D!=D&&(D=0);let J=abs(D);J=clamp(J,.001,.999);let E=pallerp(J);o=[0,0,100],E&&(o=E.slice()),D<0&&(o[0]=(o[0]-120*mono+180-50+100*g)%360,o[1]*=.4+S,o[2]*=.9+.2*z,B*=.5),B*=1+min(3,(1/_)**2),x>Nrad0/4*min(1,_)&&lo&&(lo=0,d=0),d>8*(1+echo)*lfac&&!lo&&(lo=1,x=0),x++,d++,dt=ang,_=min(_,1/n/7),m=4*o[2],vred&&(m*=m/100),lo&&(m*=1.1,B*=.6),m=min(100,m),lightness=m/2;let W=0;W=y+dt,y-=dt,rain&&D>0&&(_*=Math.exp(z));let q=clamp(1-10*a[e].z[p],-3,3);_*=Math.exp(2*clamp(a[e].z[p],-2,2)),q=0;let T=(1-buf)*Lx/2,O=(1-buf)*Ly/2;T=0,O=0,!clean&&t>.6&&1==a[e].open&&p==a[e].x.length-1&&(_=1*Lx/dx,R<pblk?(B=1,m=0):(B=.8,o[1]=0,m=100*(1-night)),r.noStroke()),xxx=str(floor(1e3*xxx)/1e3),yyy=str(floor(1e3*yyy)/1e3),r.fill(o[0],min(100,.95*(1-bw)*o[1]),bfac*m,2*min(1,B));let C=T/Lx+xxx,H=O/Ly+yyy;r.noStroke();let j=max(.8,dx*_);ccircle(Lx*C,Ly*H,j,y,W,q,r),r.stroke(mod(180+o[0],360),2*o[1],.5*o[2],1.4*1.4*h),j*=1.4,r.line(Lx*C,Ly*H,Lx*C+j*cos(y),Ly*H+j*sin(y)),r.line(Lx*C,Ly*H,Lx*C+j*cos(W),Ly*H+j*sin(W))}}}}function str(e){return(1+2*xb)*e}function inscr(e,t){return e>-0&&e<1&&t>-0&&t<1}function inbdy(e,t){return e>-.1&&e<.2||e>.8&&e<1.1||t>-.1&&t<.2||t<1.1&&t>.8}function clamp(e,t,n){return Math.max(t,Math.min(n,e))}let SQ3=Math.sqrt(3);function ccircle(e,t,n,l,o,r,s){let a=1.4*n;s.triangle(e,t,e+a*Math.cos(l),t+a*Math.sin(l),e+a*Math.cos(o),t+a*Math.sin(o))}function proj(e){let t=e[0],n=e[1],l=e[2];return[(t-xe+c1*l)*ze/(ze+l),(n-ye+s1*l)*ze/(ze+l)]}function norm3(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])}function vecscl(e,t){let n=[];for(let l=0;l<e.length;l++)n[l]=e[l]*t;return n}function neg(e){return vecscl(e,-1)}function cross(e,t){let n=[];return n[0]=e[1]*t[2]-t[1]*e[2],n[1]=e[2]*t[0]-t[2]*e[0],n[2]=e[0]*t[1]-t[0]*e[1],n}function dot(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function rot3d(e,t,n){return sumArrays(vecscl(e,Math.cos(n)),vecscl(cross(t,e),sin(n)),vecscl(t,dot(t,e)*(1-Math.cos(n))))}function sumArrays(...e){const t=e.reduce(((e,t)=>Math.max(e,t.length)),0);return Array.from({length:t}).map(((t,n)=>e.map((e=>e[n]||0)).reduce(((e,t)=>e+t),0)))}function mod(e,t){return(e%t+t)%t}function rnd(){return R.random_dec()}function pallerp(e){let t=floor(e*JJ),n=e*JJ-t;return sincol&&(n=fblend(n)),sumArrays(vecscl(pal[t],n),vecscl(pal[mod(t+1,JJ)],1-n))}function unit(e){return vecscl(e,1/norm3(e))}function hlp(e){let t=sqrt(e[0]*e[0]+e[1]*e[1]),n=atan2(e[1],e[0]),l=[ac[0][0]*t,ac[0][1]*t];for(let e=1;e<na;e++)l[0]+=pow(t,e)*(ac[e][0]*cos(e*n)-ac[e][1]*sin(e*n)),l[1]+=pow(t,e)*(ac[e][0]*sin(e*n)+ac[e][1]*cos(e*n));let o=[bc[0][0]*t,bc[0][1]*t];for(let e=1;e<nb;e++)o[0]+=pow(t,e)*(bc[e][0]*cos(e*n)-bc[e][1]*sin(e*n)),o[1]+=pow(t,e)*(bc[e][0]*sin(e*n)+bc[e][1]*cos(e*n));return[t,n,l,o]}function imzeta(e){let t,n,l,o;[t,n,l,o]=hlp(e);let r=o[0]*o[0]+o[1]*o[1];return atan2((l[1]*o[0]-l[0]*o[1])/r,(l[0]*o[0]+l[1]*o[1])/r)}function rezeta(e){let t,n,l,o;[t,n,l,o]=hlp(e);o[0],o[0],o[1],o[1];return.5*log((l[0]*l[0]+l[1]*l[1])/(o[0]*o[0]+o[1]*o[1]))}function gradimzeta(e){let t,n,l,o;[t,n,l,o]=hlp(e);let r=[0,0];for(let e=1;e<na;e++)r[0]+=e*pow(t,e-1)*(ac[e][0]*cos(e*n-n)-ac[e][1]*sin(e*n-n)),r[1]+=e*pow(t,e-1)*(ac[e][0]*sin(e*n-n)+ac[e][1]*cos(e*n-n));let s=[0,0];for(let e=1;e<nb;e++)s[0]+=e*pow(t,e-1)*(bc[e][0]*cos(e*n-n)-bc[e][1]*sin(e*n-n)),s[1]+=e*pow(t,e-1)*(bc[e][0]*sin(e*n-n)+bc[e][1]*cos(e*n-n));let a=o[0]*o[0]+o[1]*o[1],i=l[0]*l[0]+l[1]*l[1];return 0==i&&(i=.001),0==a&&(a=.001),[(r[1]*l[0]-r[0]*l[1])/i-(s[1]*o[0]-s[0]*o[1])/a,(r[0]*l[0]+r[1]*l[1])/i-(s[0]*o[0]+s[1]*o[1])/a]}function windowResized(){resizing=1,rsz_time=millis(),!head&&loop(),0!=dpx&&(pixelDensity(max(1,pd+dpx)),ob.pixelDensity(max(1,pd+dpx)),pc.pixelDensity(max(1,pd+dpx))),dpx=0,!head&&init()}function bg(){(lamr=1-0.2*kand*(hex==0)),colorMode(HSB),angleMode(RADIANS),noStroke(),ob.colorMode(HSB),ob.angleMode(RADIANS),ob.noStroke(),begin(hx,bsat),tik=0,loop(),buf=1}function PD(e){pixelDensity(e),ob.pixelDensity(e),pc.pixelDensity(e),bg()}function drawbord(){let e=min(Lx,Ly)/40;noStroke(),fill(0,0,100*(1-kand),.85);let t=-Lx/2,n=-Ly/2;t=0,n=0,rect(0,0,e,Ly),rect(0+Lx-e,0,e,Ly),rect(0+e,0,Lx-2*e,e),rect(0+e,0+Ly-e,Lx-2*e,e),fill(0,0,100*(1-kand),1),e/=4,rect(0,0,e,Ly),rect(0+Lx-e,0,e,Ly),rect(0+e,0,Lx-2*e,e),rect(0+e,0+Ly-e,Lx-2*e,e),blendMode(BLEND)}let lsw=1,bor=1;function keyPressed(){"1"==key&&PD(1),"2"==key&&PD(2),"3"==key&&PD(3),"4"==key&&PD(4),"5"==key&&PD(5),"6"==key&&PD(6),"7"==key&&PD(7),"8"==key&&PD(8),"9"==key&&PD(9),"+"==key&&PD(pd+1),"-"==key&&PD(max(1,pd-1)),"f"==key&&(sq=!sq,sq&&(aspect=aspect0),windowResized()),"b"==key&&(bor=!bor,image(ob,0,0,Lx,Ly,Lx*xb/3,Ly*xb/3,Lx,Ly),bor&&drawbord()),"s"==key&&saveCanvas("Glass_"+tokenData.hash+".png"),"n"==key&&(kand=1-kand,kblk=1-kand,bor=0,bg()),"o"==key&&(outline=1-outline,bg()),32==keyCode&&(keyst=!keyst,keyst?noLoop():loop()),0==tik&&bg()}class Random{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),n=parseInt(e.substr(8,8),16),l=parseInt(e.substr(16,8),16),o=parseInt(e.substr(24,8),16);return function(){t|=0,n|=0,l|=0,o|=0;let e=(t+n|0)+o|0;return o=o+1|0,t=n^n>>>9,n=l+(l<<3)|0,l=l<<21|l>>>11,l=l+e|0,(e>>>0)/4294967296}};this.prngA=new e(tokenData.hash.substr(2,32)),this.prngB=new e(tokenData.hash.substr(34,32));for(let e=0;e<1e6;e+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}}