0x51664b04…8e63sent to0x14578924…b707·#16,694,027·view on Etherscan
const t3=THREE;class e{constructor(){this.useA=!1;let e=function(e){let t=parseInt(e.substr(0,8),16),r=parseInt(e.substr(8,8),16),n=parseInt(e.substr(16,8),16),o=parseInt(e.substr(24,8),16);return function(){t|=0,r|=0,n|=0,o|=0;let e=(t+r|0)+o|0;return o=o+1|0,t=r^r>>>9,r=n+(n<<3)|0,n=n<<21|n>>>11,n=n+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()}}class t{constructor(e,t={}){this.uniforms=t,this.material=new t3.ShaderMaterial({fragmentShader:e,vertexShader:pe,uniforms:t}),this.scene=new t3.Scene,this.scene.add(new t3.Mesh(new t3.PlaneBufferGeometry(2*G,2*b),this.material))}}class r{constructor(e,t){this.renderer=e,this.readBuffer=new t3.WebGLRenderTarget(t.width,t.height,{minFilter:t3.LinearFilter,magFilter:t3.LinearFilter,format:t3.RGBAFormat,type:t3.HalfFloatType,encoding:t3.sRGBEncoding,samples:0,anisotropy:0,stencilBuffer:!1}),this.writeBuffer=this.readBuffer.clone()}swap(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}render(e,t,r=!1){r?this.renderer.render(e,t):(this.renderer.setRenderTarget(this.writeBuffer),this.renderer.clear(),this.renderer.render(e,t),this.renderer.setRenderTarget(null)),this.swap()}dispose(){this.readBuffer.dispose(),this.writeBuffer.dispose()}}class n{constructor(e,t,r){this.cPos=hr(-100,-100),this.pPos=hr(-101,-101),this.cVel=hr(),this.cType=t,this.segQueue=new Hr,this.pQueue=new Hr,this.color1=r[0],this.color2=r[1],this.poly=e,this.bufferObjects=null,this.bufferManager=null,this.polyDataTex=T,this.bL=D,this.tR=_,this.rV=hr(lr(),lr()),this.recalculateOptions(this.cType),this.finished=!1}update(){let e=q;if(this.pQueue.getCount()>0)e=this.pQueue.dequeue();else{this.getNewSegment()?this.pQueue.getCount()>0&&(e=this.pQueue.dequeue()):this.finished=!0}this.pPos.set(this.cPos.x,this.cPos.y),this.cPos.set(e.x,e.y),this.cVel.set(this.cPos.x-this.pPos.x,this.cPos.y-this.pPos.y),this.cVel.normalize()}getNewSegment(){if(this.segQueue.getCount()>0){let e=this.segQueue.dequeue();return this.processSegment(e.a,e.b,e.d,e.end),!0}return!1}processSegment(e,t,r,n){let o=r/K;for(let r=0;r<o;r++){let n=e.clone().lerp(t,r/o);n=bt(n),isNaN(n.x)||isNaN(n.x)||yt(n)&&this.pQueue.enqueue(n)}n&&0!=r&&yt(t)&&this.pQueue.enqueue(t.clone())}recalculateOptions(e){let t=j[e];this.rA=t.randomAmount,this.width=t.brushWidth,this.frequency=t.brushFrequency,this.offsetSpeed=t.offsetSpeed}dispose(){null!=this.bufferManager&&(this.bufferManager.dispose(),this.bufferManager=null)}createBufferObjects(){let e=0,n=2,o=0,l=!0,a=this.poly.brushVars;null!=a&&(e=a.borderPosition,o=a.borderThickness,n=a.fillPosition,l=null==a.enableShading||a.enableShading),this.bufferObjects=function(e,n,o,l,a,u){let h=e.tR.x-e.bL.x,c=e.tR.y-e.bL.y,f=.75*h,d=.75*c,p=cr().clamp(Math.ceil(f*y),0,1800),g=cr().clamp(Math.ceil(d*v),0,2700);if(p<2||g<2)return{bufferManager:null,dataTex:k,flagged:!0};const x=0;let b=p,m=g,w=new r(s,{width:b,height:m}),P=e.verts[0][0]==e.verts[e.verts.length-1][0]&&e.verts[0][1]==e.verts[e.verts.length-1][1],R=0;P&&(R=-1);let C=e.verts,B=C.length+R;const L=new Float32Array(1*B*4);let S=0;for(let e=0;e<B;e++)L[S++]=C[e][0],L[S++]=C[e][1],L[S++]=0,L[S++]=0;let M=e.bL.clone().sub(hr(.25*h,.25*c));if(n){const e=new t3.DataTexture(L,B,1);e.type=t3.FloatType,e.format=t3.RGBAFormat,e.wrapS=t3.ClampToEdgeWrapping,e.wrapT=t3.ClampToEdgeWrapping,e.minFilter=t3.NearestFilter,e.magFilter=t3.NearestFilter,e.needsUpdate=!0;let r=new t(ve,{iResolution:{value:hr(b,m)},polygon:{value:e},dataMax:{value:B},numVerts:{value:C.length},polyWidth:{value:h},polyHeight:{value:c},padding:{value:x},polyBL:{value:M},randomOffset:{value:hr(lr(0,1),lr(0,1))},resFactor:{value:Y},outlinePosition:{value:l},outlineThickness:{value:a},fillPosition:{value:o},enableShading:{value:u},softenEdges:{value:E.uniforms.softenEdges.value}});w.render(r.scene,i),e.dispose()}let A=new t(xe,{iResolution:{value:hr(b,m)},iChannel0:{value:n?w.readBuffer.texture:T},randomOffset:{value:hr(lr(0,1),lr(0,1))},polyWidth:{value:h},polyHeight:{value:c},polyBL:{value:M},resFactor:{value:Y}});return w.render(A.scene,i),{bufferManager:w,dataTex:w.readBuffer.texture,flagged:!1}}(this.poly,a.shapeMask,n,e,o,l),this.bufferManager=this.bufferObjects.bufferManager,this.polyDataTex=this.bufferObjects.dataTex,this.skipRendering=this.bufferObjects.flagged,this.bL=hr(this.poly.bL.x,this.poly.bL.y),this.tR=hr(this.poly.tR.x,this.poly.tR.y)}}class o{constructor(e,t,r,n){this.verts=e,this.dataTex=null,this.shapeMask=n,this.eraseMaskTex=null,this.tL,this.tR,this.bR,this.bL,this.circle=[],this.center,this.bbCenter,this.height,this.width,this.colors=null==t?[x.getRandomColor(),x.getRandomColor()]:t,this.localIncrement=K,this.randomAngle=ir(0,8)*(N/4),this.brushVars=r,this.area<P||(this.recomputeBoundsReal(),X<H&&X++,this.draw(r,this.colors))}draw(e,t){let r,o;switch(r=new n(this,e.brushType,t),p.enqueue(r),e.fillMode){case"trisFull":o=this.computeTris(this.verts);for(let t=0;t<o.length;t++)this.queueOffset(o[t],r,e.offset,e.initOffset,e.max);break;case"lines":let t=0;t="noise"==e.angle?pr(this.center,.1,1,O)*N:e.angle,this.lineFill(r,e.offset,t),this.computePointsOnPoly(this.verts,r);break;case"offset":this.queueOffset(this.verts,r,e.offset,e.initOffset,e.max),"thin"==e.brushType&&this.computePointsOnPoly(this.verts,r);break;case"path":this.computePointsOnPoly(this.verts,r)}}drawPath(e,t,r){let o;switch("false"!=e&&(o=new n(this,t,r),p.enqueue(o)),e){case"false":break;case"true":this.computePointsOnPoly(this.verts,o)}}drawOL(e,t,r,o,i){let l=parseInt(e);if(l>0){let s;"none"!=e&&(s=new n(this,t,r),p.enqueue(s)),this.queueOffset(this.verts,s,o,i,l)}}queueOffset(e,t,r,n,o){let i=e;this.recursiveOffset(i,t,r,n,0,o)}recursiveOffset(e,t,r,n,o,i){if(o>=i)return;let l=r,s=!1;0==o&&(0==n&&(s=!0),l=n);let a=s?[e]:this.offsetPoly(e,l);if(o++,null!=a)for(let e=0;e<a.length;e++)if(a[e].length>2)if(a[e].length>10){let l=Tr(a[e],.002);this.computePointsOnPoly(l,t),this.recursiveOffset(l,t,r,n,o,i)}else this.computePointsOnPoly(a[e],t),this.recursiveOffset(a[e],t,r,n,o,i)}offsetPoly(e,t){let r=null;if(rr(e),t<0)try{r=h.data(e).arcSegments(3).padding(Math.abs(t))}catch(e){}else try{r=h.data(e).arcSegments(3).margin(t)}catch(e){}return r}computeLineSegments(){let e=this.verts,t=[];for(let r=0;r<e.length-1;r++){let n=r+1,o=[e[r][0],e[r][1]],i=[e[n][0],e[n][1]];t.push([o,i])}return t}recomputeBoundsReal(){let e=kt(this.verts);this.tL=e[0],this.tR=e[1],this.bR=e[2],this.bL=e[3];let t=this.bL.x,r=this.tR.x,n=this.bL.y,o=this.tR.y;this.width=r-t,this.height=o-n,this.bbCenter=hr(.5*(r-t)+t,.5*(o-n)+n),this.center=this.bbCenter}computeTris(e,t){}lineFill(e,t,r=0,n=null){this.lS=this.computeLineSegments();let o=t,i=st(this.verts,r),l=(rt(i),hr(i[1][0],i[1][1])),s=hr(i[2][0],i[2][1]),a=hr(i[0][0]-i[1][0],i[0][1]-i[1][1]),u=dr(i[1][0],i[1][1],i[2][0],i[2][1])/o,h=hr(),c=hr(),f=!1,d=[];for(let e=0;e<=u;e++){h.set(s.x,s.y).lerp(l,e/u),c.set(h.x,h.y).add(a);let t=[],r=[er(h),er(c)];for(let e=0;e<this.lS.length;e++){let n=Qt(r[0],r[1],this.lS[e][0],this.lS[e][1]);n&&t.push(n)}if(t.length>0&&t.length%2==0){f=!0;for(let e=0;e<t.length;e+=2){let r=[t[e],t[e+1]];d.push(r)}}else if(0==t.length&&f)break;0}nr(d);for(let t=0;t<d.length;t++)this.computePointsOnPoly(d[t],e)}computePointsOnPoly(e,t){let r=hr(),n=hr(),o=(e[0][0]==e[e.length-1][0]&&(e[0][1],e[e.length-1][1]),null),i=0;for(;i<e.length-1;){let l=i+1;if(r.set(e[i][0],e[i][1]),n.set(e[l][0],e[l][1]),o=n.clone().sub(r).length(),0==o){i++;continue}i++;let s=i>=e.length-1;t.segQueue.enqueue({a:r.clone(),b:n.clone(),d:o,end:s})}}}let i,l,s,a,u,h,c=!1,f=!1,d=!1;t3.Cache.enabled=!0;let p,g,y,v,x,b,m,w,P,R,C,E,B,L,S,T,k,M,A,I,W,F,N=Math.PI,O=hr(),_=hr(1,1),D=hr(-1,-1),q=hr(100,100),V=hr(),z=ur(),j=(hr(),[]),U=[],H=3,X=0,Y=1,J=0,G=1,subIdInt=0,Q=[],$=3,K=.02,Z=.0025,ee=4e-5,te=[],re=!1,ne=1,oe=45,ie=30,le=0,se=.016667,ae=30,ue=!1,he="",ce="",fe=0,de="Low";const pe="\n precision highp float; \n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n }\n",ge="\nprecision highp sampler2D;precision highp float;\n#define NUM_OCTAVES 3\n#define H(p)fract(sin(mod(dot(p,vec2(12.9898,78.233)),6.283))*43758.5453)\n#define NUM_BRUSHES 3\n#define PI 3.14159265359\nuniform float resFactor;uniform sampler2D iChannel0;uniform vec2 iResolution;uniform float iFrame;varying vec2 vUv;uniform sampler2D iChannel2,posNoiseTexture;uniform float isWaterColor,isSig,uvFlip,softenEdges;struct Brush{vec2 sCurrent;vec2 sPrevious;vec2 sVel;vec3 sColor1;vec3 sColor2;int dataTexIndex;float randomAmount;float brushWidth;float brushFrequency;float offsetSpeed;vec2 bL;vec2 tR;vec2 rV;};uniform Brush brushes[3];uniform sampler2D dataTex0,dataTex1,dataTex2;float hd(vec2 from,vec2 to){float dx=abs(to.x-from.x),dy=abs(to.y-from.y),md=max(dy,dx);return.394*(dx+dy)+.554*md;}float hd(vec3 from,vec3 to){float dx=abs(to.x-from.x),dy=abs(to.y-from.y),dz=abs(to.z-from.z),md=max(dz,max(dy,dx));return.394*(dx+dy+dz)+.554*md;}float gt(float x,float y){return max(sign(x-y),0.);}float pN(vec2 p,float t){float result=0.,amplitude=.5,falloff=.5,lucunarity=.5;p=p+.5+vec2(t);for(float index=0.;index<3.;++index)result+=texture(iChannel2,p).x*amplitude,p*=lucunarity,amplitude*=falloff;return result;}float random(vec2 st){return fract(sin(dot(st.xy,vec2(12.9898,78.233)))*43758.5453123);}float distSquare(vec2 A,vec2 B){vec2 C=A-B;return dot(C,C);}float nDLS(vec2 v,vec2 w,vec2 p){float l2=distSquare(v,w),t;if(l2==0.)return hd(p,v);t=max(0.,min(1.,dot(p-v,w-v)/l2));vec2 projection=v+t*(w-v);return hd(p,projection);}float eq(float xx,float yy){return 1.-abs(sign(xx-yy));}void main(){float tt=floor(iFrame/15.)*12.69,totalPaint,colorCount,mixed,blendInclude,blendMax,blendFactor,threshold;vec2 uv=(gl_FragCoord.xy-iResolution.xy/2.)/iResolution.x*2.,uv2,totalOffset;uv.x*=uvFlip;uv2=gl_FragCoord.xy/iResolution.xy;vec3 totalColor=vec3(0);totalPaint=0.;totalOffset=vec2(0);colorCount=0.;for(int i=0;i<NUM_BRUSHES;i++){Brush cBrush=brushes[i];vec2 bLo=cBrush.bL,tRo=cBrush.tR;float pWidth=tRo.x-bLo.x,pHeight=tRo.y-bLo.y,nX,nY,xR,yR,maskThreshold,picker;bLo-=vec2(pWidth*.25,pHeight*.25);tRo+=vec2(pWidth*.25,pHeight*.25);nX=(uv.x-bLo.x)/(tRo.x-bLo.x);nY=(uv.y-bLo.y)/(tRo.y-bLo.y);xR=random(vec2(nX,nY))*6e-4*softenEdges;yR=random(vec2(nY,nX))*6e-4*softenEdges;nX=nX+(xR,yR);nY=nY+(yR,xR);vec4 dataT0=texture(dataTex0,vec2(nX,nY)),dataT1=texture(dataTex1,vec2(nX,nY)),dataT2=texture(dataTex2,vec2(nX,nY)),dataT=dataT0*eq(float(cBrush.dataTexIndex),0.)+dataT1*eq(float(cBrush.dataTexIndex),1.)+dataT2*eq(float(cBrush.dataTexIndex),2.);maskThreshold=mix(gt(cBrush.rV.x,.666),0.,isWaterColor);picker=mix(dataT.w,dataT0.w+dataT1.w+dataT2.w,maskThreshold);if(picker>0.){float masked=gt(dataT.w,0.),dd,lP,mL,brightnessNoise,isBorder,paint,paintFactor,brushWidthFactor,intensifyInside,featherOutside,brush,factor,push,potentialColorCount;vec2 current=cBrush.sCurrent,prev=cBrush.sPrevious,velocity=cBrush.sVel,pos,offset;velocity.x*=uvFlip;pos=uv-current;dd=nDLS(prev,current,uv);lP=hd(pos,vec2(0));mL=mix(dd,lP,gt(hd(current,prev),.1));brightnessNoise=round(dataT.x)-.5;vec3 currentColor=mix(cBrush.sColor2,cBrush.sColor1,pow(dataT.y,1.)),outlineColor;currentColor+=vec3(brightnessNoise*.015);currentColor+=.05*pow(dataT.z,1.)-.025;isBorder=gt(dataT.w,.5)*(1.-eq(dataT.w,.5));outlineColor=mix(clamp(currentColor-.2,0.,1.),clamp(currentColor-.5,0.,1.),isWaterColor);outlineColor*=1.2;currentColor=mix(currentColor,outlineColor,isBorder);paint=pN(vec2(pos.xy*cBrush.brushFrequency),tt);paintFactor=1.-clamp(mL*.75,0.,cBrush.brushWidth)/cBrush.brushWidth;brushWidthFactor=1.-gt(cBrush.brushWidth,.04);intensifyInside=pow(paintFactor,2.)*brushWidthFactor*.2;featherOutside=pow(paintFactor,.2);paint+=mix(intensifyInside,0.,isWaterColor);paint*=mix(featherOutside,.98,isWaterColor);paint+=mix(0.,1.,isSig);paint*=mix(1.,pow(paintFactor,.5),isSig);brush=1.-gt(mL,cBrush.brushWidth)+mix(0.,random(uv)*.01,isSig);factor=pow(clamp(mL*.5,0.,cBrush.brushWidth)/cBrush.brushWidth,3.);brush*=1.-factor;paint*=brush;paint*=masked;push=smoothstep(.35,.5,paint);push*=smoothstep(.4,1.,brush)*(1.-isBorder*.75);offset=cBrush.offsetSpeed*push*-velocity/(iResolution.xy/resFactor);totalOffset+=offset*brush;totalPaint=max(totalPaint,paint);totalColor+=currentColor*ceil(brush);potentialColorCount=colorCount+1.;colorCount=mix(colorCount,potentialColorCount,ceil(brush));}}colorCount=clamp(colorCount,1.,100.);totalColor/=colorCount;vec4 frame=texture(iChannel0,uv2+totalOffset);mixed=max(totalPaint,frame.w);mixed=clamp(mixed,0.,1.);blendInclude=mix(gt(brushes[0].rV.y,.25),1.,isWaterColor);blendMax=mix(.08,.25,isWaterColor);blendFactor=mix(.04,blendMax,blendInclude);threshold=max(frame.w-blendFactor,0.);if(totalPaint>threshold)totalColor*=1.;else totalColor=frame.xyz;gl_FragColor=vec4(clamp(totalColor.x,0.,1.),clamp(totalColor.y,0.,1.),clamp(totalColor.z,0.,1.),mixed);}\n",ye="\nprecision highp sampler2D;precision highp float;uniform sampler2D iChannel0,posNoiseTexture;uniform vec3 iResolution;varying vec2 vUv;uniform vec3 bgCol;uniform float blackAndWhite,blackPaper,randomTime,randomRot,isWaterColor,resFactor,isDone;\n#define TEX0(uv)texture(iChannel0,uv).w\n#define TEX1(uv)texture(iChannel1,uv).r\n#define PI 3.1415926538\nfloat hash(vec2 p){vec3 p3=fract(p.xyx*.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float noise(vec2 p){vec4 w=vec4(floor(p),ceil(p));float _00=hash(w.xy),_01=hash(w.xw),_10=hash(w.zy),_11=hash(w.zw),_0=mix(_00,_01,fract(p.y)),_1=mix(_10,_11,fract(p.y));return mix(_0,_1,fract(p.x));}float fbm(vec2 p){float o=0.;for(float i=0.;i<3.;i++)o+=noise(.1*p)/3.,o+=.2*exp(-2.*abs(sin(.02*p.x+.01*p.y)))/3.,p*=2.;return o;}vec2 grad(vec2 p){float n=fbm(p+vec2(0,1)),e=fbm(p+vec2(1,0)),s=fbm(p-vec2(0,1)),w=fbm(p-vec2(1,0));return vec2(e-w,n-s);}float hd(vec2 from,vec2 to){float dx=abs(to.x-from.x),dy=abs(to.y-from.y),md=max(dy,dx);return.394*(dx+dy)+.554*md;}float hd(vec3 from,vec3 to){float dx=abs(to.x-from.x),dy=abs(to.y-from.y),dz=abs(to.z-from.z),md=max(dz,max(dy,dx));return.394*(dx+dy+dz)+.554*md;}vec2 hn(vec2 o){float m=hd(o,vec2(0));return o/m;}vec3 hn(vec3 o){float m=hd(o,vec3(0));return o/m;}vec2 rotate(vec2 v,float a){float s=sin(a),c=cos(a);mat2 m=mat2(c,-s,s,c);return m*v;}float gt(float x,float y){return max(sign(x-y),0.);}float lt(float x,float y){return max(sign(y-x),0.);}mat4 brightnessMatrix(float brightness){return mat4(1,0,0,0,0,1,0,0,0,0,1,0,brightness,brightness,brightness,1);}mat4 contrastMatrix(float contrast){float t=(1.-contrast)/2.;return mat4(contrast,0,0,0,0,contrast,0,0,0,0,contrast,0,t,t,t,1);}mat4 saturationMatrix(float saturation){vec3 luminance=vec3(.3086,.6094,.082),red,green,blue;float oneMinusSat=1.-saturation;red=vec3(luminance.x*oneMinusSat);red+=vec3(saturation,0,0);green=vec3(luminance.y*oneMinusSat);green+=vec3(0,saturation,0);blue=vec3(luminance.z*oneMinusSat);blue+=vec3(0,0,saturation);return mat4(red,0,green,0,blue,0,0,0,0,1);}float rand(float x){return fract(sin(x)*43758.5453);}float triangle(float x){return abs(1.-mod(abs(x),2.))*2.-1.;}float getHatch(vec2 p){float diffuse=1.,xs=rand(randomTime*6.6)*.1+.9,ys=rand(randomTime*6.6)*.1+.9,hatching=max(clamp(sin(p.x*xs*(170.+rand(randomTime)*30.1)+p.y*ys*(110.1+rand(randomTime*1.92)*30.1))*.5+.5-1.+diffuse,0.,1.),clamp(sin(p.x*xs*(-110.1+rand(randomTime*4.75)*30.)+p.y*ys*(170.1+rand(randomTime*3.91)*30.1))*.5+.5-1.+diffuse-.4,0.,1.));return hatching;}void main(){vec3 color=vec3(0),preColor,unit,normal,dir,tint,paperColor,bumpedColor;vec2 uv=gl_FragCoord.xy/iResolution.xy,q=gl_FragCoord.xy/iResolution.xy,p,fadeUV,paintSwitch;q=rotate(q,randomRot*2.*PI);p=-1.+10.*q;p.x*=-iResolution.x/iResolution.y;p+=vec2(triangle(p.y*rand(randomTime)*4.)*rand(randomTime*1.9)*.15,triangle(p.x*rand(randomTime*3.4)*4.)*rand(randomTime*2.1)*.15);p+=vec2(rand(p.x*3.1+p.y*8.7)*.01,rand(p.x*1.1+p.y*6.7)*.01);float hatch=mix(round(getHatch(p)),0.,isWaterColor),bump,gray,edgeX,edgeY,edges,specular,average,mx,saturationFactor;vec4 baseTex=texture(iChannel0,uv).xyzw,finalColor;preColor=baseTex.xyz;bump=grad(gl_FragCoord.xy).x;gray=baseTex.w;if(isDone>0.&&gray<=0.){float inside=gt(uv.x,.02)*gt(uv.y,.015)*lt(uv.x,.98)*lt(uv.y,.985);inside=1.-inside;vec2 newUV=vec2(mod(uv.x+.5,1.),mod(uv.y+.5,1.));newUV=vec2(clamp(newUV.x,.02,.98),clamp(newUV.y,.015,.985));vec4 newColor=texture(iChannel0,newUV).xyzw;gray=mix(newColor.w,gray,inside);preColor=mix(newColor.xyz,preColor,inside);}gray=mix(clamp(gray-.03,0.,1.)+hatch*.06,gray,isWaterColor);fadeUV=(uv-.5)*2.;edgeX=pow(abs(fadeUV.x),8.);edgeY=pow(abs(fadeUV.y),9.);edges=clamp(edgeX+edgeY,0.,1.);unit=mix(mix(vec3(resFactor/iResolution.xy,0),vec3(0),edges),vec3(.5*resFactor/iResolution.xy,0),isWaterColor);normal=normalize(vec3(TEX0(uv+unit.xz)-TEX0(uv-unit.xz),TEX0(uv-unit.zy)-TEX0(uv+unit.zy),pow(gray,3.)));dir=hn(vec3(0,1,2));specular=pow(dot(normal,dir)*.5+.5,16.);tint=vec3(1);dir=normalize(vec3(uv-.5,0));color+=tint*pow(dot(normal,-dir)*.5+.5,.5)*.5+.5;color*=preColor;color+=vec3(.3)*specular;color*=1.-pow(edges,1.35)*.065;paperColor=bgCol;bumpedColor=(vec3(.98)+hatch*.02)*.925+bump*.075;paintSwitch=mix(vec2(.3,.5),vec2(.35,.7),isWaterColor);color=mix((paperColor+hatch*.03)*.925+bump*.075,clamp(color,0.,1.5)*bumpedColor,smoothstep(paintSwitch.x,paintSwitch.y,gray));color*=mix(1.01,.85,pow(hd(uv-.666,vec2(0)),1.2));color=clamp(color,0.,1.);finalColor=vec4(color,1);finalColor=mix(finalColor,color.yyyy,blackAndWhite);average=(finalColor.x+finalColor.y+finalColor.z)/3.;mx=max(finalColor.x,max(finalColor.y,finalColor.z));finalColor=finalColor-(mx-finalColor)*((mx-average)*.01*3.*5.);saturationFactor=mix(1.,1.35,pow(edges,1.35));gl_FragColor=brightnessMatrix(.01)*contrastMatrix(1.05)*saturationMatrix(1.01*saturationFactor)*finalColor;}\n",ve="\nprecision highp sampler2D;precision highp float;varying vec2 vUv;uniform int numVerts;uniform sampler2D polygon,posNoiseTexture;uniform vec2 iResolution;uniform float polyWidth,polyHeight;uniform vec2 polyBL;uniform float dataMax;uniform vec2 randomOffset;uniform float padding,resFactor;uniform bool enableShading;uniform float softenEdges,fillPosition,outlinePosition,outlineThickness;float random(vec2 _st){return fract(sin(dot(_st.xy,vec2(12.9898,78.233)))*43758.5453123);}\n#define NUM_OCTAVES 3\n#define PI 3.1415926538\nfloat distSquare(vec2 A,vec2 B){vec2 C=A-B;return dot(C,C);}float nDLS(vec2 v,vec2 w,vec2 p){float l2=distSquare(v,w),t;if(l2==0.)return distance(p,v);t=max(0.,min(1.,dot(p-v,w-v)/l2));vec2 projection=v+t*(w-v);return distance(p,projection);}vec2 sdPolygon(vec2 p){vec2 iUV=vec2(0,.5);float pIX=texture2D(polygon,iUV).x,pIY=texture2D(polygon,iUV).y,d=dot(p-vec2(pIX,pIY),p-vec2(pIX,pIY)),s=1.,nearest=1e3;for(int i=0,j=numVerts-1;i<numVerts;j=i,i++){iUV=vec2(float(i)/(dataMax-1.),.5);vec2 jUV=vec2(float(j)/(dataMax-1.),.5),pJ,pI,e,w,b;pIX=texture2D(polygon,iUV).x;pIY=texture2D(polygon,iUV).y;float pJX=texture2D(polygon,jUV).x,pJY=texture2D(polygon,jUV).y,nd;pJ=vec2(pJX,pJY);pI=vec2(pIX,pIY);nd=nDLS(pI,pJ,p);nearest=min(nearest,nd);e=pJ-pI;w=p-pI;b=w-e*clamp(dot(w,e)/dot(e,e),0.,1.);d=min(d,dot(b,b));bvec3 cond=bvec3(p.y>=pIY,p.y<pJY,e.x*w.y>e.y*w.x);if(all(cond)||all(not(cond)))s=-s;}return vec2(s*sqrt(d),nearest);}void main(){vec2 uv=gl_FragCoord.xy/iResolution.xy;float edgeLX=1./iResolution.x,edgeBY=1./iResolution.y,edgeRX=1.-edgeLX,edgeTY=1.-edgeBY;if(uv.x<edgeLX||uv.x>edgeRX||uv.y<edgeBY||uv.y>edgeTY)gl_FragColor=vec4(0);else{float pX=uv.x*1.5*polyWidth+polyBL.x,pY=uv.y*1.5*polyHeight+polyBL.y,xR=random(vec2(pX,pY))*6e-4*softenEdges,yR=random(vec2(pY,pX))*6e-4*softenEdges,relativeRes,edge,inside,d;vec2 offset=vec2(0),insideVars=sdPolygon(vec2(pX+offset.x+xR,pY+offset.y+yR));relativeRes=1./(iResolution.x/(1800.*resFactor));edge=insideVars.x*iResolution.x*relativeRes;inside=0.;if(edge<outlinePosition*resFactor+outlineThickness*resFactor*.5&&edge>outlinePosition*resFactor-outlineThickness*resFactor*.5)inside=1.;else if(edge>fillPosition*resFactor)inside=0.;else inside=.5;d=enableShading?insideVars.y:1e3;gl_FragColor=vec4(inside,d,0,0);}}\n",xe="\nprecision highp sampler2D;precision highp float;\n#define NUM_OCTAVES 2\n#define PI 3.1415926538\nvarying vec2 vUv;uniform sampler2D iChannel0;uniform vec2 iResolution;uniform float polyWidth,polyHeight;uniform vec2 polyBL,randomOffset;uniform float resFactor;float random(vec2 _st){return fract(sin(dot(_st.xy,vec2(12.9898,78.233)))*43758.5453123);}float noise(vec2 _st){vec2 i=floor(_st),f=fract(_st),u;float a=random(i),b=random(i+vec2(1,0)),c=random(i+vec2(0,1)),d=random(i+vec2(1));u=f*f*(3.-2.*f);return mix(a,b,u.x)+(c-a)*u.y*(1.-u.x)+(d-b)*u.x*u.y;}vec2 rotate(vec2 v,float a){float s=sin(a),c=cos(a);mat2 m=mat2(c,-s,s,c);return m*v;}void main(){vec2 uv=gl_FragCoord.xy/iResolution.xy,worldPos,strokeOffset,bNCoord;vec4 polygonTexture=texture2D(iChannel0,uv);worldPos=vec2(uv.x*polyWidth+polyBL.x,uv.y*polyHeight+polyBL.y);float strokeOffsetAmount=random(vec2(round(worldPos.y*200.),0)),bN,dToEdge,uvN;strokeOffset=vec2(strokeOffsetAmount,0);bNCoord=vec2(worldPos.x*4.,worldPos.y*2.)*4.-strokeOffset;bNCoord=rotate(bNCoord,randomOffset.y*2.*PI);bN=1.-noise(bNCoord-randomOffset.x*2334.21);dToEdge=clamp(polygonTexture.y*15.,0.,1.);uvN=clamp(pow(uv.y*2.-.5,2.),0.,1.);gl_FragColor=vec4(bN,uvN,dToEdge,polygonTexture.x);}\n",be="\nprecision highp sampler2D;precision highp float;\n#define BLOOM_THRESHOLD 0.1\n#define BLOOM_INTENSITY 1.04\n#define BLUR_ITERATIONS 8\n#define BLUR_SIZE.045\n#define BLUR_SUBDIVISIONS 32\nvarying vec2 vUv;uniform sampler2D iChannel0;uniform vec2 iResolution,randomPos;uniform float blackAndWhite,intensityBoost,clampBloom;vec3 getHDR(vec3 tex){return max((tex-BLOOM_THRESHOLD)*(BLOOM_INTENSITY+intensityBoost),0.);}vec3 gaussian(sampler2D sampler,vec2 uv){vec3 sum=vec3(0);for(int i=1;i<=BLUR_ITERATIONS;i++){float angle=360./float(BLUR_SUBDIVISIONS);for(int j=0;j<BLUR_SUBDIVISIONS;j++){float dist=BLUR_SIZE*(float(i+1)/float(BLUR_ITERATIONS)),s=sin(angle*float(j)),c=cos(angle*float(j));sum+=getHDR(texture(sampler,uv+vec2(c,s)*dist).xyz);}}sum/=float(BLUR_ITERATIONS*BLUR_SUBDIVISIONS);return sum*(BLOOM_INTENSITY+intensityBoost);}void main(){vec2 uv=gl_FragCoord.xy/iResolution.xy;vec4 tx=texture(iChannel0,uv);vec3 color=gaussian(iChannel0,uv);float average=(color.x+color.y+color.z)/3.,mx=max(color.x,max(color.y,color.z)),vignette;color=color-(mx-color)*((mx-average)*.105*3.*5.);color=vec3(clamp(color.x,0.,clampBloom),clamp(color.y,0.,clampBloom),clamp(color.z,0.,clampBloom));vignette=clamp(pow(clamp(distance(vec2(uv.x+randomPos.x,uv.y+randomPos.y)*1.6,vec2(.5)),0.,1.),1.),0.,.925);color=mix(color*.35+tx.xyz,tx.xyz,vignette);gl_FragColor=vec4(color,1);}\n";let me=[{name:"Monotone",colors:[2236962,4473924,8947848,13421772,15658734]},{name:"Ack",colors:[5675672,3177090,928091,14279104,13598336,8443030,4946087,9135450,3429742,12375967,4790554,992057]},{name:"Yun",colors:[15658725,14339229,8818016,14060145,9662823,6972245,10332020,12498312,11521493,4144691]},{name:"Kindergarten",colors:[16183272,16305814,15519056,16348235,12887162,14734274,7515757,7840654,3246250,15322017]},{name:"Burgundy",colors:[7279122,5704716,9240583,10553617,5112073]},{name:"Picnic",colors:[15053076,3887715,12100731,13184023,12499112,2454943,7167538,2829348,15590597,5915176]},{name:"Serpent",colors:[1133407,1741679,8967320,13032127,15985106]},{name:"Powder",colors:[12179186,1256019,218020,28074,13657]},{name:"Karat",colors:[16768417,16763730,16559902,16097312,15371554]},{name:"Animation",colors:[3158064,6578775,9540237,14453136,5151883,15979386,3438760,12956833,14472135,15524565]},{name:"Guernica",colors:[15395562,11378848,12300721,12895949,8159634,13944002,6844029,10586499,11249068,6183005]},{name:"Mariposa",colors:[1054513,3558760,16113858,14103090,15836789,15841184,13552584,11844541,8424590]},{name:"Vermeer",colors:[143687,862241,4477527,3089692,1582637,14402990,12689789,6180927,8287077,12554843]},{name:"Spearmint",colors:[10386257,5935017,5584184,14459553,15195354,1185853,10664625,15228993,15716557,16771287]}],