0x792654e8…f200sent to0x99a9b7c1…b069·#18,928,916·view on Etherscan
///10
case ST2:if(2==this.pIs.length){const e=this.pIs[0],p=this.pIs[1],l=myPs[e].p.x,h=myPs[e].p.y,y=myPs[p].p.x,i=myPs[p].p.y;if(T){TMP>0&&(this.history.shift(),this.history.push(CV(y,i)));let s=[];for(let t=this.history.length-1;t>=0;t--)s.push(this.history[t]);t.push(new StyPl(s,F,T,T,F,STR_BK,FIL_NO,W0,0,0)),s=null}if(s||0==this.STID){let s=[];s.push(CV(l,h)),s.push(CV(y,i)),t.push(new StyPl(s,F,T,F,F,STR_NO,FIL_BK,W1,0,0)),s=null}else if(1==this.STID){let s,p=(y-l)/2,n=(i-h)/2,P=Math.sqrt(p*p+n*n),I=myPs[e].v.x,u=myPs[e].v.y,S=Math.sqrt(I*I+u*u);for(let e=0;e<8;e++){let e=Math.atan2(u,I),p=(.25+S)*myRGauss(0,P),l=abs(p)<P?W2:W1,h=y+.33*p*Math.cos(e),n=i+.33*p*Math.sin(e);s=[],s.push(CV(h,n)),t.push(new StyPl(s,F,F,F,T,STR_NO,FIL_BK,l,0,0))}s=null}else if(2==this.STID){let s,e=(y-l)/2,p=(i-h)/2,n=(y+l)/2,P=(i+h)/2,I=5,u=.125;for(let l=0;l<I;l++){let h=u*map(l,0,I-1,-1,1),y=Math.sin(map(l,0,I-1,.3,PI-.3)),i=y*myRAB(.8,1),S=n-p*h+i*e,a=P+e*h+i*p,o=y*myRAB(.5,.9),r=n-p*h-o*e,m=P+e*h-o*p;s=[],s.push(CV(S,a)),s.push(CV(r,m)),t.push(new StyPl(s,F,T,F,F,STR_NO,FIL_BK,W1,0,0))}s=null}else if(3==this.STID){let s=[],e=map(Math.sin(this.id+myMillis/500),-1,1,.25,.75);s=this.createWedgePolyline(l,h,y,i,W2,3,e),t.push(new StyPl(s,F,F,F,F,STR_BK,FIL_NO,W0,0,0)),s=[],s.push(CV(l,h)),t.push(new StyPl(s,F,F,F,T,STR_NO,FIL_BK,W2,0,0)),s=null}}break;
case ST0:{let s=F,p=F,l=F,y=F,i=W1,n=W0,P=.45,I=3,u=F,S=F;switch(this.STID){case 0:i=(W1+W2)/2,S=T;break;case 1:S=T,s=T,p=T;break;case 2:s=T,l=T,i=W0;break;case 3:l=T,p=T,i=W0,n=W1,y=T,P=.3;break;case 4:i=0,n=W1,y=T,u=T,P=.3;break;case 5:l=T,s=T,u=T,P=.45;break;case 6:l=T,i=W1}let a=FIL_BK,o=STR_BK;h&&(a=FIL_WH,o=STR_WH);const r=this.pIs.length;if(i>0){for(let s=0;s<r;s++){const t=this.pIs[s];e.push(myPs[t].p)}t.push(new StyPl(e,F,T,l,F,o,FIL_NO,i,0,0,S)),e=null}if(u){const s=(r-1)*I;let e=[],p=0,l=y?.1:1;for(let h=0;h<r-1;h++){const y=this.pIs[h],i=this.pIs[h+1],n=myPs[y].p.x,u=myPs[y].p.y,S=myPs[i].p.x,o=myPs[i].p.y,m=(S-n)*P,_=(o-u)*P;p=l*(1-h/r);let f=p*m,c=p*_;for(let p=0;p<I;p++){let l=lerp(n,S,p/I),y=lerp(u,o,p/I),i=Math.sin(map(h*I+p,0,s,0,PI));e=[],e.push(CV(l,y)),e.push(CV(l+i*_+f,y-i*m+c)),t.push(new StyPl(e,F,F,T,F,STR_NO,a,W0,0,0)),e=[],e.push(CV(l,y)),e.push(CV(l-i*_+f,y+i*m+c)),t.push(new StyPl(e,F,F,T,F,STR_NO,a,W0,0,0))}}e=null}if(y){const s=2;let e,p,l,h,y=F;for(let i=0;i<s;i++){let I=[],u=map(i,0,s-1,-1,1);for(let s=0;s<r-1;s++){const t=this.pIs[s],y=this.pIs[s+1];e=myPs[t].p.x,p=myPs[t].p.y,l=myPs[y].p.x,h=myPs[y].p.y;const i=(l-e)*P,n=(h-p)*P;let F=Math.sin(map(s,0,r-1,0,PI));F=u*Math.pow(F,.5),I.push(CV(e+F*n,p-F*i))}I.push(CV(l,h)),i>0&&(n=W2,y=T),t.push(new StyPl(I,F,T,y,F,o,FIL_NO,n,0,0)),I=null}}if(this.pIs.length>=2){let e,l,h,y,i,n=!S&&R20K[7]<.2,P=R20K[3]<.4?W1:W2;if(s){const s=this.pIs[0],p=this.pIs[1];l=myPs[s].p.x,h=myPs[s].p.y,y=myPs[p].p.x,i=myPs[p].p.y,e=[],e=this.createWedgePolyline(l,h,y,i,W3,4,.5),t.push(new StyPl(e,F,F,F,F,o,FIL_NO,W0,0,0)),e=[],e.push(myPs[s].p),t.push(new StyPl(e,F,F,F,T,STR_NO,a,W3,0,0)),n&&(e=[],e.push(myPs[s].p),t.push(new StyPl(e,F,F,F,T,STR_NO,1-a,P,0,0))),e=null}if(p){const s=this.pIs[this.pIs.length-2],p=this.pIs[this.pIs.length-1];l=myPs[p].p.x,h=myPs[p].p.y,y=myPs[s].p.x,i=myPs[s].p.y,e=[],e=this.createWedgePolyline(l,h,y,i,W3,4,.5),t.push(new StyPl(e,F,F,F,F,o,FIL_NO,W0,0,0)),e=[],e.push(myPs[p].p),t.push(new StyPl(e,F,F,F,T,STR_NO,a,W3,0,0)),n&&(e=[],e.push(myPs[p].p),t.push(new StyPl(e,F,F,F,T,STR_NO,1-a,P,0,0))),e=null}}}break;
case ST3:{let p=T,l=F,h=F,y=F,i=F,n=F,P=F,I=F,u=FIL_WH,S=STR_BK,a=W2,o=this.pIs.length;if(s);else switch(this.STID){case 0:P=T;break;case 1:h=T;break;case 2:I=T,P=T,l=T;break;case 3:h=T,y=T,l=T,P=T;break;case 4:n=T,P=T;break;case 5:i=T;break;case 6:u=FIL_BK,S=STR_WH,a=W1;break;case 7:p=F}if(p){if(I){const s=PI2*o/6,p=myMillis/100,l=.1*fadeInPhysics;for(let t=0;t<=o-2;t+=2){let h=this.pIs[t],y=this.pIs[t+1],i=1+l*Math.sin(p+map(t,0,o,0,s)),n=1-i,F=i*myPs[h].p.x+n*myPs[y].p.x,T=i*myPs[h].p.y+n*myPs[y].p.y;e.push(CV(F,T))}for(let t=o-1;t>1;t-=2){let h=this.pIs[t],y=this.pIs[t-1],i=1+l*Math.sin(p+map(t-1,0,o,0,s)),n=1-i,F=i*myPs[h].p.x+n*myPs[y].p.x,T=i*myPs[h].p.y+n*myPs[y].p.y;e.push(CV(F,T))}let h=this.pIs[1];e.push(myPs[h].p),t.push(new StyPl(e,T,T,F,F,S,u,W2,0,0,P))}else{for(let s=0;s<o;s+=2){const t=this.pIs[s];e.push(myPs[t].p)}for(let s=o-1;s>0;s-=2){const t=this.pIs[s];e.push(myPs[t].p)}t.push(new StyPl(e,T,T,F,F,S,u,a,0,0,P))}}if(e=null,h||y){const s=[h,y],e=[[0,1,2,3],[o-4,o-3,o-2,o-1]];for(let p=0;p<s.length;p++)if(s[p]&&o>=4){let s=e[p],l=this.pIs[s[0]],h=this.pIs[s[1]],y=this.pIs[s[2]],i=this.pIs[s[3]],n=myPs[l].p.x,P=myPs[l].p.y,I=myPs[h].p.x,u=myPs[h].p.y,S=myPs[y].p.x,a=myPs[y].p.y,o=(n+I+S+myPs[i].p.x)/4,r=(P+u+a+myPs[i].p.y)/4,m=n-I,_=P-u,f=sqrt(m*m+_*_),c=noise(this.id+myFrmCnt/100),x=f*map(c,0,1,.1,.5),W=[];W.push(CV(o,r)),t.push(new StyPl(W,F,F,F,T,STR_BK,FIL_NO,x,0,0)),W=null}}if(i){let s=o-2;for(let e=2;e<s;e+=2){let s=this.pIs[e],p=this.pIs[e+1],l=myPs[s].p.x,h=myPs[s].p.y,y=myPs[p].p.x,i=myPs[p].p.y,n=[];n.push(CV(l,h)),n.push(CV(y,i)),t.push(new StyPl(n,F,F,F,F,STR_BK,FIL_BK,W0,0,0)),n=null}}if((l||n)&&o>4){let s=o-2,e=[];for(let t=2;t<s;t+=2){let s=this.pIs[t],p=this.pIs[t+1],l=myPs[s].p.x,h=myPs[s].p.y,y=(l+myPs[p].p.x)/2,i=(h+myPs[p].p.y)/2;e.push(CV(y,i))}l?t.push(new StyPl(e,F,T,F,F,STR_BK,FIL_NO,W0,0,0)):n&&t.push(new StyPl(e,F,T,F,F,STR_BK,FIL_NO,W3,1,4)),e=null}}break;
case ST4:{let l=T,h=T,y=0,i=F,n=F,P=0,I=F,u=F,S=F,a=F,o=F,r=0,m=3,_=F,f=W2,c=W2,x=STR_BK,W=STR_BK,R=FIL_NO,L=FIL_NO,B=T,K=T,k=F,w=F,b=F,N=F,C=F,g=T,M=StSh.scrunchTickProbabilities[this.STID]/100,O=R20K[this.STID]<M;if(s)h=T,l=F;else switch(this.STID){case 0:l=F,P=this.bShowEnclBl?1:2;break;case 1:y=1,u=T,S=T,K=F,f=W1;break;case 2:y=StSh.nWheelRadialBands,g=StSh.bDrawAllRadialLines,this.bShowEnclBl&&(f=W1);break;case 3:y=1,I=T,u=T,f=W1;break;case 4:P=StSh.nWheelAnnularLoops,f=W1,K=F,C=T;break;case 5:h=F,y=3,i=T,u=T,S=F;break;case 6:l=F,y=3,i=T,n=T;break;case 7:resetRnd(CHASH),l=F,P=2,a=T,o=T,r=1,m=3,B=T;break;case 8:resetRnd(CHASH),P=3,r=1,m=5,f=W1,B=T;break;case 9:l=F,h=F,B=F,k=T,c=W0;break;case 10:h=F,y=this.id%4==3?2:1,_=T;break;case 11:l=T,h=T,f=(W1+W2)/2,c=W2;break;case 12:c=W1,l=F,h=T,B=F,W=STR_NO,L=FIL_BK;break;case 13:l=F,h=T,L=FIL_WH,W=STR_NO,B=F;break;case 14:break;case 15:l=T,h=T,R=FIL_NO,L=FIL_NO,f=W2,c=W2,w=T,B=F,K=F;break;case 16:l=T,h=T,R=FIL_NO,L=FIL_NO,f=W2,c=W2,b=T,B=F,K=F;break;case 17:N=T,l=F,h=T,R=FIL_NO,L=FIL_NO,f=W1,c=W2,B=T}const V=this.pIs.length;if(this.bShowEnclBl){let s=PINF,t=NINF,y=PINF,i=NINF;for(let n=0;n<V;n+=2){const F=this.pIs[n],T=this.pIs[n]+1;l&&e.push(myPs[F].p),h&&p.push(myPs[T].p);let P=myPs[F].p;P.x<s&&(s=P.x),P.x>t&&(t=P.x),P.y<y&&(y=P.y),P.y>i&&(i=P.y)}this.boundingBox={L:s,T:y,R:t,B:i}}else for(let s=0;s<V;s+=2){const t=this.pIs[s],y=this.pIs[s]+1;l&&e.push(myPs[t].p),h&&p.push(myPs[y].p)}if(h&&(t.push(new StyPl(p,T,T,F,F,W,L,c,0,0,B)),p=null),l&&(t.push(new StyPl(e,T,T,F,F,x,R,f,0,0,K)),e=null),O){const s=1,e=.75;let p=0,l=0,h=0,y=0,i=0,n=0,P=0,I=0,u=W1,S=F,a=R20K[123]<.3;((this.STID=11)||(this.STID=14))&&(R20K[3]<.22||R20K[this.id]<.125)&&(S=T);for(let o=0;o<V+1;o++){const r=this.pIs[(o-2+V)%V],m=this.pIs[o%V],_=this.pIs[(o+2)%V],f=myPs[r].p,c=myPs[m].p,x=myPs[_].p,W=f.x-c.x,R=f.y-c.y,L=x.x-c.x;let B=W*(x.y-c.y)-R*L,K=(f.x+2*c.x+x.x)/4,k=(f.y+2*c.y+x.y)/4,w=o%2==0?o+1:o-1,b=this.pIs[(w+V)%V],N=myPs[b].p,C=N.x-c.x,g=N.y-c.y,M=Math.pow(map(Math.abs(B),0,35,0,1,T),e);S&&(M*=.6),C*=M,g*=M;let O=K+C,d=k+g,E=o%2==0?B<0-s:B>s;if(E|=S,E&&M>.1){let s=[];s.push(CV(K,k)),s.push(CV(O,d));let e=new StyPl(s,F,F,T,F,STR_BK,FIL_BK,u,0,0,F);t.push(e),0!=i&&(s=[],s.push(CV((K+i)/2,(k+n)/2)),s.push(CV((O+P)/2,(d+I)/2)),e=new StyPl(s,F,F,T,F,STR_BK,FIL_BK,u,0,0,F),t.push(e)),a&&0!=i&&(s=[],s.push(CV(.75*K+.25*i,.75*k+.25*n)),s.push(CV(.75*O+.25*P,.75*d+.25*I)),e=new StyPl(s,F,F,T,F,STR_BK,FIL_BK,u,0,0,F),t.push(e),s=[],s.push(CV(.25*K+.75*i,.25*k+.75*n)),s.push(CV(.25*O+.75*P,.25*d+.75*I)),e=new StyPl(s,F,F,T,F,STR_BK,FIL_BK,u,0,0,F),t.push(e)),e=null,s=null}i=p,n=l,P=h,I=y,p=K,l=k,h=O,y=d}}if(N){let s=[],e=map(R20K[this.id],0,1,.16,.33);const p=map(R20K[0],0,1,.666,1.333),l=1-p;for(let h=0;h<V;h+=2){const y=this.pIs[h],i=this.pIs[(h+2)%V];let n=myPs[y].p.x,T=myPs[y].p.y,P=myPs[i].p.x,I=myPs[i].p.y;if(!this.bShoVorCls){const s=this.pIs[h]+1,t=this.pIs[(h+2)%V]+1;n=n*p+myPs[s].p.x*l,T=T*p+myPs[s].p.y*l,P=P*p+myPs[t].p.x*l,I=I*p+myPs[t].p.y*l}const u=e+map(R20K[h],0,1,-.03,.03),S=1-u,a=P*u+n*S,o=I*u+T*S,r=P*S+n*u,m=I*S+T*u;s=[],s.push(CV(r,m)),s.push(CV(a,o)),t.push(new StyPl(s,F,F,F,F,STR_BK,FIL_BK,f,0,0))}s=null}if(k){let s=[];for(let e=0;e<V;e+=2){const p=this.pIs[e]+1,l=this.pIs[(e+2)%V]+1,h=myPs[p].p.x,y=myPs[p].p.y,i=myPs[l].p.x,n=myPs[l].p.y;for(let e=0;e<3;e++){let p=e/3,l=i*p+h*(1-p),P=n*p+y*(1-p);s=[],s.push(CV(l,P)),t.push(new StyPl(s,F,F,F,T,STR_BK,FIL_NO,c,0,0))}}s=null}if(S||u){const s=.333,e=1-s;let p;for(let l=0;l<V;l+=2){let h=this.pIs[l],y=this.pIs[l]+1,i=myPs[h].p,n=myPs[y].p;if(u){let l=n.x*s+i.x*e,h=n.y*s+i.y*e;p=[],p=this.createWedgePolyline(i.x,i.y,l,h,W2,3,.9),t.push(new StyPl(p,F,F,F,F,STR_BK,FIL_NO,W0,0,0))}if(S){let l=n.x*e+i.x*s,h=n.y*e+i.y*s;p=[],p=this.createWedgePolyline(n.x,n.y,l,h,W3,3,.9),t.push(new StyPl(p,F,F,F,F,STR_BK,FIL_NO,W0,0,0))}}p=null}if(_)for(let s=0;s<V;s+=2){let e=this.pIs[s],p=this.pIs[s]+1,l=myPs[e].p,h=myPs[p].p,y=h.x,i=h.y,n=y-l.x,P=i-l.y,I=Math.sqrt(n*n+P*P);if(I>0){let e=Math.sin(s+myMillis/400);n/=I,P/=I;let p=[];p.push(CV(y-e*n,i-e*P)),t.push(new StyPl(p,F,F,F,T,STR_NO,FIL_BK,W2,0,0)),p=null}}if(y>0){let s=0,e=1;if(n&&(s=1,e=0),1==y)for(let p=0;p<V;p+=2){const l=this.pIs[p]+s,h=this.pIs[p]+e;let y=[];y.push(myPs[l].p),y.push(myPs[h].p),t.push(new StyPl(y,F,F,i,F,STR_NO,FIL_BK,W0,0,0)),y=null}else{let p=20*this.id;const l=StSh.drawRadialLinePercent;for(let h=0;h<V;h+=2){const n=this.pIs[h]+s,T=this.pIs[h]+e,P=this.pIs[(h+2)%V]+s,I=this.pIs[(h+2)%V]+e,u=myPs[n].p,S=myPs[P].p,a=myPs[T].p,o=myPs[I].p;for(let s=0;s<y;s++){if(g||R20K[p]<l){const e=s/y,p=1-e,l=u.x*p+S.x*e,h=u.y*p+S.y*e,n=a.x*p+o.x*e,T=a.y*p+o.y*e;let P=[];P.push(CV(l,h)),P.push(CV(n,T)),t.push(new StyPl(P,F,F,i,F,STR_NO,FIL_BK,W0,0,0)),P=null}p++}}}}if(P>0)if(C&&1==P&&!O){const s=map(R20K[this.id],0,1,.48,.42),e=1-s;let p=[],l=this.pIs[V-2],h=this.pIs[V-2]+1;for(let t=0;t<V;t+=2){const y=this.pIs[t],i=this.pIs[t]+1,n=myPs[y].p,F=myPs[i].p,T=n.x*e+F.x*s,P=n.y*e+F.y*s,I=myPs[l].p,u=myPs[h].p,S=.5*((I.x+n.x)*s+(u.x+F.x)*e),a=.5*((I.y+n.y)*s+(u.y+F.y)*e);p.push(CV(S,a)),p.push(CV(T,P)),l=y,h=i}t.push(new StyPl(p,T,T,F,F,STR_BK,FIL_NO,W0,0,0)),p=null}else for(let s=1;s<P+1;s++){let e=s/(P+1);a&&(e=Math.pow(e,.8));let p=1-e,l=[];for(let s=0;s<V;s+=2){const t=this.pIs[s],h=this.pIs[s]+1,y=myPs[t].p,i=myPs[h].p;let n=y.x*p+i.x*e,F=y.y*p+i.y*e,T=CV(n,F);l.push(T)}let h=r,y=m;o&&(h+=P-s,y+=s),t.push(new StyPl(l,T,T,F,F,STR_BK,FIL_NO,W0,h,y)),l=null}if(w){const s=4,e=s-1;for(let p=0;p<V;p+=2){let l=(p+2)%V;const h=this.pIs[p],y=this.pIs[p]+1,i=this.pIs[l],n=this.pIs[l]+1,P=myPs[h].p,I=myPs[i].p,u=myPs[y].p,S=myPs[n].p;let a=[];a.push(CV((e*P.x+u.x)/s,(e*P.y+u.y)/s)),a.push(CV((P.x+u.x)/2,(P.y+u.y)/2)),a.push(CV((P.x+e*u.x)/s,(P.y+e*u.y)/s)),a.push(CV((e*u.x+S.x)/s,(e*u.y+S.y)/s)),a.push(CV((u.x+S.x)/2,(u.y+S.y)/2)),a.push(CV((u.x+e*S.x)/s,(u.y+e*S.y)/s)),a.push(CV((e*S.x+I.x)/s,(e*S.y+I.y)/s)),a.push(CV((S.x+I.x)/2,(S.y+I.y)/2)),a.push(CV((S.x+e*I.x)/s,(S.y+e*I.y)/s)),a.push(CV((e*I.x+P.x)/s,(e*I.y+P.y)/s)),a.push(CV((I.x+P.x)/2,(I.y+P.y)/2)),a.push(CV((I.x+e*P.x)/s,(I.y+e*P.y)/s)),t.push(new StyPl(a,T,T,F,F,STR_BK,FIL_WH,W0,0,0)),a=null}}else if(b){const s=6,e=s-1;for(let p=0;p<V;p+=4){let l=(p+2)%V,h=(p+4)%V;const y=this.pIs[p],i=this.pIs[p]+1,n=this.pIs[l],P=this.pIs[l]+1,I=this.pIs[h],u=this.pIs[h]+1,S=myPs[y].p,a=myPs[n].p,o=myPs[I].p,r=myPs[i].p,m=myPs[P].p,_=myPs[u].p;let f=[];f.push(a),f.push(CV((e*o.x+_.x)/s,(e*o.y+_.y)/s)),f.push(CV((o.x+_.x)/2,(o.y+_.y)/2)),f.push(CV((o.x+e*_.x)/s,(o.y+e*_.y)/s)),f.push(m),f.push(CV((S.x+e*r.x)/s,(S.y+e*r.y)/s)),f.push(CV((S.x+r.x)/2,(S.y+r.y)/2)),f.push(CV((e*S.x+r.x)/s,(e*S.y+r.y)/s)),t.push(new StyPl(f,T,T,F,F,STR_BK,FIL_WH,W0,0,0)),f=null}}if(I)for(let s=0;s<V;s+=2){let e=(s+2)%V;const p=this.pIs[s],l=this.pIs[s]+1,h=this.pIs[e],y=this.pIs[e]+1,i=myPs[p].p,n=myPs[h].p,P=myPs[l].p,I=myPs[y].p;let u=(i.x+I.x+P.x+n.x)/4,S=(i.y+I.y+P.y+n.y)/4,a=[];a.push(CV(u,S)),t.push(new StyPl(a,F,F,F,T,STR_NO,FIL_BK,W2,0,0)),a=null}}break;
case ST8:{let s=F,p=F,l=F,h=F,y=T,i=F;switch(this.STID){case 0:h=T,i=T;break;case 1:p=T;break;case 2:s=T,p=T,h=T;break;case 3:s=T,l=T;break;case 4:s=T,p=T,i=T,l=T}for(let s=0;s<this.pIs.length;s+=4){const t=this.pIs[s];e.push(myPs[t].p)}for(let s=this.pIs.length-1;s>0;s-=4){const t=this.pIs[s];e.push(myPs[t].p)}if(t.push(new StyPl(e,T,T,F,F,STR_BK,FIL_WH,W2,0,0,y)),e=null,s)for(let s=4;s<this.pIs.length-4;s+=4){let e,p=myPs[this.pIs[s]].p,l=myPs[this.pIs[s+1]].p,h=myPs[this.pIs[s+2]].p,y=myPs[this.pIs[s+3]].p;e=[],e.push(p),e.push(h),t.push(new StyPl(e,F,T,T,F,STR_NO,FIL_BK,W0,0,0)),e=[],e.push(l),e.push(y),t.push(new StyPl(e,F,T,T,F,STR_NO,FIL_BK,W0,0,0)),e=null}if(p||l||h)for(let s=0;s<this.pIs.length-6;s+=4){let e,y=myPs[this.pIs[s]].p,i=myPs[this.pIs[s+1]].p,n=myPs[this.pIs[s+2]].p,P=myPs[this.pIs[s+3]].p,I=myPs[this.pIs[s+4]].p,u=myPs[this.pIs[s+5]].p,S=myPs[this.pIs[s+6]].p,a=myPs[this.pIs[s+7]].p,o=(y.x+I.x)/2,r=(y.y+I.y)/2,m=(n.x+S.x)/2,_=(n.y+S.y)/2,f=(i.x+u.x)/2,c=(i.y+u.y)/2,x=(P.x+a.x)/2,W=(P.y+a.y)/2;p&&s>0&&(e=[],e.push(CV(o,r)),e.push(CV(m,_)),t.push(new StyPl(e,F,T,T,F,STR_NO,FIL_BK,W1,0,0)),e=[],e.push(CV(f,c)),e.push(CV(x,W)),t.push(new StyPl(e,F,T,T,F,STR_NO,FIL_BK,W1,0,0)),e=null),h&&0==s&&(e=[],e.push(CV((o+f)/2,(r+c)/2)),t.push(new StyPl(e,F,F,F,T,STR_NO,FIL_BK,W2,0,0)),e=null),l&&s>0&&(e=[],e.push(CV((o+f)/2,(r+c)/2)),t.push(new StyPl(e,F,F,F,T,STR_NO,FIL_BK,W1,0,0)),e=null)}if(i){const s=this.pIs[this.pIs.length-1],e=this.pIs[this.pIs.length-2],p=this.pIs[this.pIs.length-3],l=this.pIs[this.pIs.length-4],h=myPs[s].p.x,y=myPs[s].p.y,i=myPs[e].p.x,n=myPs[e].p.y,P=myPs[p].p.x,I=myPs[p].p.y,u=.925,S=1-u;let a=u*(h+i)*.5+S*(P+myPs[l].p.x)*.5,o=u*(y+n)*.5+S*(I+myPs[l].p.y)*.5;TMP>0&&(this.history.shift(),this.history.push(CV(a,o)));let r=[];for(let s=this.history.length-1;s>=0;s--)r.push(this.history[s]);t.push(new StyPl(r,F,T,T,F,STR_BK,FIL_NO,W2,0,0)),r=null}}break;
case ST7:{let l=this.PRPA,h=2+l,y=this.pIs.length/h,i=T,n=T,P=T,I=T,u=F,S=W2,a=W2,o=0,r=T,m=0,_=0;if(s)I=T,P=F,i=4!=this.STID,n=F,u=F;else switch(this.STID){case 0:S=W1;break;case 1:u=T,S=W1;break;case 2:S=W0,m=1,_=max(2,~~(y/3));break;case 3:o=3,S=W0}if(I||P){for(let s=0;s<this.pIs.length;s+=h){const t=this.pIs[s]+0,l=this.pIs[s]+1;P&&e.push(myPs[t].p),I&&p.push(myPs[l].p)}if(I&&(t.push(new StyPl(p,T,T,F,F,STR_BK,FIL_NO,a,0,0,r)),p=null),P){let s=0==m?r:F;t.push(new StyPl(e,T,T,F,F,STR_BK,FIL_NO,S,m,_,s)),e=null}}if(i){for(let s=0;s<y;s++){let e=[];for(let t=1;t<h;t++){const p=s*h+t,l=this.pIs[p];e.push(myPs[l].p)}1==l?t.push(new StyPl(e,F,T,T,F,STR_NO,FIL_BK,W0,0,0)):t.push(new StyPl(e,F,T,T,F,STR_BK,FIL_NO,W0,0,0)),e=null}if(n&&l>1){let s=[];for(let e=0;e<y;e++){const p=e*h+1,l=e*h+2,y=this.pIs[p],i=this.pIs[l],n=myPs[y].p,T=myPs[i].p;let P=n.x,I=n.y,u=(n.x+T.x)/2,S=(n.y+T.y)/2;s=this.createWedgePolyline(P,I,u,S,W2,3,.5),t.push(new StyPl(s,F,F,F,F,STR_BK,FIL_NO,W0,0,0))}s=null}}if(o>0)for(let s=1;s<o+1;s++){let e=s/(o+1);e=Math.pow(e,.8);let p=1-e,l=[];for(let s=0;s<this.pIs.length;s+=h){const t=this.pIs[s]+0,h=this.pIs[s]+1,y=myPs[t].p,i=myPs[h].p;let n=y.x*p+i.x*e,F=y.y*p+i.y*e,T=CV(n,F);l.push(T)}t.push(new StyPl(l,T,T,F,F,STR_BK,FIL_NO,W0,0,0,r)),l=null}if(u){let s;W2;for(let e=0;e<this.pIs.length;e+=h){let p=(e+h)%this.pIs.length;const l=this.pIs[e],y=this.pIs[e]+1,i=this.pIs[p],n=this.pIs[p]+1,P=myPs[l].p,I=myPs[i].p,u=myPs[y].p,S=myPs[n].p;let a=(P.x+S.x+u.x+I.x)/4,o=(P.y+S.y+u.y+I.y)/4;s=[],s.push(CV((P.x+u.x)/2,(P.y+u.y)/2)),t.push(new StyPl(s,F,F,F,T,STR_NO,FIL_BK,W2,0,0)),s=[],s.push(CV(a,o)),t.push(new StyPl(s,F,F,F,T,STR_NO,FIL_BK,W2,0,0))}s=null}}}return t}
createWedgePolyline(t,e,s,n,u,h,l){let o=[];const c=s-t,p=n-e,r=c*c+p*p;if(r>0){const C=2*Math.sqrt(r),V=c/C,f=p/C;let i=-1;for(let r=h;r>0;r--){const C=r/h,a=C*l,d=i*C*u;let g=t+d*f,q=e-d*V,y=s-a*c,M=n-a*p,P=t-d*f,W=e+d*V;o.push(CV(g,q)),o.push(CV(y,M)),o.push(CV(P,W)),i*=-1}o.push(CV(t,e)),o.push(CV(s,n))}return o}
pointInside(t,s){let e=F;if(this.bLoop){let n=[],i=1,h=0;switch(this.type){case ST4:i=2;break;case ST9:h=1;break;case ST7:i=2+this.PRPA}for(let t=h;t<this.pIs.length;t+=i){const s=this.pIs[t];n.push(myPs[s].p)}const o=n.length;for(let i=0,h=o-1;i<o;h=i++){const o=n[i].x,c=n[i].y,l=n[h].x,p=n[h].y;c>s!=p>s&&t<(l-o)*(s-c)/(p-c)+o&&(e=!e)}n=null}return e}
getCentroidWhichpass(t){const s=this.pIs.length;let e=0,i=0;if(s>0){if(1==t)for(let t=0;t<s;t++){let s=this.pIs[t],l=myPs[s].p0;e+=l.x,i+=l.y}else for(let t=0;t<s;t++){let s=this.pIs[t],l=myPs[s].pE;e+=l.x,i+=l.y}e/=s,i/=s}return CV(e,i)}
getCentroid(){const t=this.pIs.length;let e=0,n=0;if(t>0){for(let s=0;s<t;s++){let t=this.pIs[s],i=myPs[t].p;e+=i.x,n+=i.y}e/=t,n/=t}return CV(e,n)}
getIdOfKink(e){let t=-1,s=-1,i=0,n=PINF;const c=this.pIs.length;let r=1;switch(this.type){case ST3:case ST4:r=2;break;case ST0:case ST1:r=1;break;default:return}let a=this.bLoop?0:r,h=this.bLoop?c:c-r;for(let e=a;e<h;e++){const a=(e-r+c)%c,h=(e+r)%c;let l=this.getAbsAngleBetweenParticlesWithIndices(a,e,h);l>i&&(t=e,i=l),l<n&&(s=e,n=l)}return e?t:s}
getAbsAngleBetweenParticlesWithIndices(s,t,e){const p=this.pIs[s],i=this.pIs[t],n=this.pIs[e];let r=myPs[p],c=myPs[i],o=myPs[n],a=Sb(r.p0,c.p0).normalize(),h=Sb(o.p0,c.p0).normalize();return Math.abs(p5.Vector.cross(a,h).z)}
getEnclosingStructureId(){return this.isEnclosedByStructureID;}
setEnclosingStructureId(sid){this.isEnclosedByStructureID=sid;}
getFull(){return this.bFull;}
setFull(f){this.bFull=f;}
addInitialParticleAtLocation(t,s){let i=new Particle;i.set(t,s,this.MASSMULT),i.setIsPartOfStructure(this.id),myPs.push(i);let e=myPs.length-1;this.pIs.push(e)}
insertExistingParticleIntoSpringChainAtIndex(s,t){let i=s;this.bLoop?i%=this.springs.length:i=Cs(i,0,this.springs.length-1);let e=this.springs[i].getIP(),n=this.springs[i].getIQ();this.springs.splice(i,1);let r=t;myPs[r].setIsPartOfStructure(this.id),myPs[r].mass=this.MASSMULT,this.pIs.splice(i+1,0,r);let g=new Spring(myPs),h=new Spring(myPs);g.setParticleIndicesAndRestLength(e,r,REST_L,SPR_K),h.setParticleIndicesAndRestLength(r,n,REST_L,SPR_K),this.springs.splice(i+0,0,g),this.springs.splice(i+1,0,h)}
insertNewParticleIntoLoopStructureAtIndex(s){let t=s;this.bLoop?t%=this.springs.length:t=Cs(t,0,this.springs.length-1);let e=this.springs[t].getIP(),i=this.springs[t].getIQ(),n=myPs[e],p=myPs[i];this.springs.splice(t,1);let r=myRAB(-1,1)*NUDGE,h=myRAB(-1,1)*NUDGE,g=(n.p.x+p.p.x)/2+r,l=(n.p.y+p.p.y)/2+h,P=new Particle;P.set(g,l,this.MASSMULT),P.setIsPartOfStructure(this.id),this.type==ST1&&(P.damping=.85),myPs.push(P);let c=myPs.length-1;this.pIs.splice(t+1,0,c);let y=new Spring(myPs),S=new Spring(myPs);y.setParticleIndicesAndRestLength(e,c,REST_L,SPR_K),S.setParticleIndicesAndRestLength(c,i,REST_L,SPR_K),this.springs.splice(t+0,0,y),this.springs.splice(t+1,0,S)}
getGlobalIndexOfParticleClosestTo(t,s){const e=this.pIs.length;let l=PINF,n=-1;for(let o=0;o<e;o++){let e=this.pIs[o],r=t-myPs[e].p.x,h=s-myPs[e].p.y,i=Math.sqrt(r*r+h*h);i<l&&(l=i,n=e)}return n}
setSmoothing(sm){this.SMOOTHING=sm;}
clearForces(){for(let s=0;s<this.pIs.length;s++){const e=this.pIs[s];myPs[e].clearForcesAndVelocities()}}
applySiteForce(t){if(!StSh.bUseAmoCnt&&this.siteAttachId>-1){let s=sitePs[this.siteAttachId],e=1==t?s.p0:s.pE,i=e.x,h=e.y,n=this.getCentroidWhichpass(t),o=i-n.x,p=h-n.y,c=Math.sqrt(o*o+p*p);if(c>0){const s=1,e=REST_L*BDM/4;let i=min(1,c/e),h=s*sq(1-i),n=o/c*h,l=p/c*h;for(let s=0;s<this.pIs.length;s++){const e=this.pIs[s];myPs[e].addF(n,l,t)}}}}
applyForceTowardsTarget(t,s,e,i){let o=this.getCentroid(),r=t-o.x,a=s-o.y,h=Math.sqrt(r*r+a*a);if(h>0){let t=r/h*i,s=a/h*i;for(let i=0;i<this.pIs.length;i++){const o=this.pIs[i];myPs[o].addF(t,s,e)}}}
renderLetterForSVG(){let e=[];if(this.type==ST12){let t=!0,l=this.pIs[0],i=myPs[l].p,s=i.x,r=i.y,g=myFrmCnt-this.lastAddSegmentTime,m=Math.pow(map(g,0,30,0,1,T),.5);if(m>0){let l=m*asmImg.height,i=m*glyCW,g=this.PRPA,h=Cs(g.charCodeAt()-65,0,21),o=glyphSet[h],y=o.code,x=0-(i/2+m*(o.L+(o.R-o.L)/2))/2,a=0-l/2,f=.54;for(let l=0;l<nGlyCs;l++)if(1<<l&y){glyImgs[l].loadPixels();for(let i=0;i<glyImgs[l].height;i++){let g=[],m=0,h=glyImgs[l].width;for(let o=0;o<h;o++){let y=.18*(o+x)+s,n=.18*(i+a)+r,p=4*(i*h+o)+3,c=glyImgs[l].pixels[p]>127?1:0;if(0==m&&1==c&&(g=[],g[0]=createVector(y,n)),1==m&&(0==c||o==h-1)){if(g[1]=createVector(y,n),t){let e=(g[0].x+g[1].x)/2;g[0].x=min(e,g[0].x+f),g[1].x=max(e,g[1].x-f)}e.push(g),m=0}m=c}}}}}return e}
renderLetter(){if(this.type==ST12){let e=this.pIs[0],t=myPs[e].p,s=t.x,P=t.y,a=myFrmCnt-this.lastAddSegmentTime,i=Math.pow(map(a,0,30,0,1,T),.5);if(i>0){let e=i*asmImg.height,t=i*glyCW,a=this.PRPA,n=Cs(a.charCodeAt()-65,0,21),l=glyphSet[n],g=l.code,m=0-(t/2+i*(l.L+(l.R-l.L)/2))/2,r=0-e/2;GFXP5.push(),GFXP5.translate(s,P),GFXP5.scale(.18),GFXP5.translate(m,r);for(let s=0;s<nGlyCs;s++)1<<s&g&&(this.PRPB?(renderMode==RENDER_MODE_CANVAS&&GFXP5.tint(avgPapCol),GFXP5.image(glyImgsInv[s],0,0,t,e),renderMode==RENDER_MODE_CANVAS&&GFXP5.noTint()):GFXP5.image(glyImgs[s],0,0,t,e));GFXP5.pop()}}}
renderStructure(){GFXP5.stroke(0),GFXP5.noFill();let e,t=this.getContours(),i=map(StSh.amoMaskWrinkle,1.05,5,.25,.45,T),s=[1,1],l=[15,5],r=Rd(40),n=i,o=[0,0],d=T,h=T,S=this.type==ST12;for(let i=0;i<t.length;i++){const a=t[i],y=a.verts,P=a.bSmooth,c=a.bClosed,w=a.bIsDot,V=a.strokeStyle,b=a.fillStyle,f=a.dashGap,m=a.bVertexShade,u=a.thickness,C=u<=W1?2:1;if(!S||0!=i)if(w)this.drawVertexAsDot(y,u,V,b);else if(f>0){this.type==ST10&&4==this.STID&&(StSh.bOrientationSensitiveDashedContours=T);let e=a.dashLen;this.drawVerticesRandomlyDashed(y,P,c,V,b,u,f,e),StSh.bOrientationSensitiveDashedContours=F}else if(c)P?StSh.bUseVSh&&m?(this.drawVsBzClosed(y,STR_NO,b,u),e=new ofPolyline,e.setFromStyledPolyline(a),myStyPolyl.drawStyledPolyline(e,u,s,l,C,1,.65,r,n,o,1,2,h,d,c)):this.drawVsBzClosed(y,V,b,u):this.drawVsPolyl(y,c,V,b,u);else{a.bTapered?this.drawVerticesTapering(y,u,V,b):P||2==y.length?StSh.bUseVSh&&m&&V!=STR_WH?(e=new ofPolyline,e.setFromStyledPolyline(a),myStyPolyl.drawStyledPolyline(e,u,s,l,C,1,.65,r,n,o,1,2,h,d,c)):this.drawVerticesUnclosedContour(y,V,b,u):this.drawVsPolyl(y,c,V,b,u)}}GFXP5.strokeWeight(1),GFXP5.noFill(),e=null}
drawVertexAsDot(_,e,s,F){switch(s){case STR_NO:GFXP5.noStroke();break;case STR_BK:GFXP5.stroke(0);break;case STR_WH:GFXP5.stroke(designBgCol)}switch(F){case FIL_BK:GFXP5.fill(0);break;case FIL_WH:GFXP5.fill(designBgCol);break;case FIL_NO:GFXP5.noFill()}const X=e/2;GFXP5C.beginPath(),GFXP5C.ellipse(_[0].x,_[0].y,X,X,0,0,PI2),s!=STR_NO&&GFXP5C.stroke(),F!=FIL_NO&&GFXP5C.fill()}
drawVerticesTapering(e,t,_,l){const i=e.length;if(!(i<2))if(2==i){let _=e[1].x-e[0].x,i=e[1].y-e[0].y,s=Math.sqrt(_*_+i*i);if(s>0){_/=s,i/=s;let F=t/2,r=e[0].x+i*F,a=e[0].y-_*F,o=e[0].x-i*F,x=e[0].y+_*F,n=e[1].x,y=e[1].y;switch(l){case FIL_BK:GFXP5.fill(0);break;case FIL_WH:GFXP5.fill(designBgCol);break;case FIL_NO:GFXP5.noFill()}GFXP5.noStroke(),GFXP5.triangle(r,a,o,x,n,y)}}else{let l,s,F,r,a,o,x,n,y,G,P,X;const c=.2,f=3;switch(_){case STR_NO:GFXP5.noStroke();break;case STR_BK:GFXP5.stroke(0);break;case STR_WH:GFXP5.stroke(designBgCol)}if(GFXP5.noFill(),_!=STR_NO)for(let _=1;_<i;_++){1==_?(x=e[1].x,n=e[1].y,l=e[0].x,s=e[0].y,P=e[2].x,X=e[2].y,y=l-(x-l)*c,G=s-(n-s)*c):_==i-1?(x=e[_].x,n=e[_].y,l=e[_-1].x,s=e[_-1].y,y=e[_-2].x,G=e[_-2].y,P=x,X=n):(x=e[_].x,n=e[_].y,l=e[_-1].x,s=e[_-1].y,y=e[_-2].x,G=e[_-2].y,P=e[_+1].x,X=e[_+1].y),F=l+(x-y)*c,r=s+(n-G)*c,a=x-(P-l)*c,o=n-(X-s)*c,GFXP5.strokeWeight(t*(1-_/i)),GFXP5.beginShape();for(let e=0;e<=f;e++){let t=e/f,_=t*t,i=t*_,y=1-t,G=y*y,P=y*G,X=3*t*G,c=3*_*y,g=P*l+X*F+c*a+i*x,k=P*s+X*r+c*o+i*n;GFXP5.vertex(g,k)}GFXP5.endShape()}}}