0x3942c585…919esent to0x99a9b7c1…b069·#19,275,697·view on Etherscan
roup),A.add(this.fragment.group),A.add(this.cone.group)):1==this.mode?(this.bubble=new M(30),this.star=new c(180),A.add(this.bubble.mesh),A.add(this.star.mesh)):2==this.mode?(this.twinkle=new h(300),A.add(this.twinkle.mesh)):3==this.mode?(this.heart=new C(120),A.add(this.heart.mesh)):4==this.mode?(this.lightning=new i(16,56),A.add(this.lightning.group)):5==this.mode&&(this.circle=new w(24),A.add(this.circle.mesh))}set(A){if(0==this.mode){this.explosion.set(A),this.fragment.set(A),this.cone.set(A);for(let B=0;B<4;B++){const I=A.rand(-4,4),Q=A.rand(-4,4),Y=A.rand(-10,0);this.explosion.meshes[B].position.set(I,Q,Y),this.fragment.meshes[B].position.set(I,Q,Y),this.cone.meshes[B].position.set(I,Q,Y)}this.count=-1}else if(1==this.mode){const B=A.rand(-3,3),I=A.rand(-3,3);this.bubble.set(A,B,I),this.star.set(A,B,I)}else 2==this.mode?this.twinkle.set(A):3==this.mode?this.heart.set(A):4==this.mode?this.lightning.set(A):5==this.mode&&this.circle.set(A)}setDisplayScale(A){1==this.mode?(this.bubble.mesh.material.uniforms.displayScale.value=A,this.star.mesh.material.uniforms.displayScale.value=A):2==this.mode&&(this.twinkle.mesh.material.uniforms.displayScale.value=A)}update(B,I,Q){if(0==this.mode){const Y=new A.Object3D;for(;Math.min(4,Q/2)>this.count;)this.count++,this.explosion.setDisplacenment(B,I,this.count);for(let A=0;A<4;A++){const B=Math.atan(2*Math.max(0,Math.floor(12*Q)/12-1*A))/(.5*Math.PI);B<1e-5?(this.explosion.meshes[A].visible=!1,this.fragment.meshes[A].visible=!1,this.cone.meshes[A].visible=!1):(this.explosion.meshes[A].visible=!0,this.fragment.meshes[A].visible=!0,this.cone.meshes[A].visible=!0,this.explosion.update(Y,B,A),this.fragment.update(Y,B,A),this.cone.update(Y,B,A))}}else if(1==this.mode){const A=Math.floor(24*Q)/24;this.bubble.update(A),this.star.update(A)}else if(2==this.mode){const A=Math.floor(24*Q)/24;this.twinkle.update(A)}else if(3==this.mode){const B=new A.Object3D,I=Math.floor(24*Q)/24;this.heart.update(B,I)}else if(4==this.mode)Q-Math.floor(12*Q)/12<.02&&this.lightning.update(Q,I);else if(5==this.mode){const A=Math.floor(24*Q)/24;this.circle.update(A)}}}const U={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"};class y{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const N=new A.OrthographicCamera(-1,1,1,-1,0,1),s=new A.BufferGeometry;s.setAttribute("position",new A.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),s.setAttribute("uv",new A.Float32BufferAttribute([0,2,0,0,2,0],2));class R{constructor(B){this._mesh=new A.Mesh(s,B)}dispose(){this._mesh.geometry.dispose()}render(A){A.render(this._mesh,N)}get material(){return this._mesh.material}set material(A){this._mesh.material=A}}class j extends y{constructor(B,I){super(),this.textureID=void 0!==I?I:"tDiffuse",B instanceof A.ShaderMaterial?(this.uniforms=B.uniforms,this.material=B):B&&(this.uniforms=A.UniformsUtils.clone(B.uniforms),this.material=new A.ShaderMaterial({defines:Object.assign({},B.defines),uniforms:this.uniforms,vertexShader:B.vertexShader,fragmentShader:B.fragmentShader})),this.fsQuad=new R(this.material)}render(A,B,I){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=I.texture),this.fsQuad.material=this.material,this.renderToScreen?(A.setRenderTarget(null),this.fsQuad.render(A)):(A.setRenderTarget(B),this.clear&&A.clear(A.autoClearColor,A.autoClearDepth,A.autoClearStencil),this.fsQuad.render(A))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class D extends y{constructor(A,B){super(),this.scene=A,this.camera=B,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(A,B,I){const Q=A.getContext(),Y=A.state;let F,M;Y.buffers.color.setMask(!1),Y.buffers.depth.setMask(!1),Y.buffers.color.setLocked(!0),Y.buffers.depth.setLocked(!0),this.inverse?(F=0,M=1):(F=1,M=0),Y.buffers.stencil.setTest(!0),Y.buffers.stencil.setOp(Q.REPLACE,Q.REPLACE,Q.REPLACE),Y.buffers.stencil.setFunc(Q.ALWAYS,F,4294967295),Y.buffers.stencil.setClear(M),Y.buffers.stencil.setLocked(!0),A.setRenderTarget(I),this.clear&&A.clear(),A.render(this.scene,this.camera),A.setRenderTarget(B),this.clear&&A.clear(),A.render(this.scene,this.camera),Y.buffers.color.setLocked(!1),Y.buffers.depth.setLocked(!1),Y.buffers.stencil.setLocked(!1),Y.buffers.stencil.setFunc(Q.EQUAL,1,4294967295),Y.buffers.stencil.setOp(Q.KEEP,Q.KEEP,Q.KEEP),Y.buffers.stencil.setLocked(!0)}}class e extends y{constructor(){super(),this.needsSwap=!1}render(A){A.state.buffers.stencil.setLocked(!1),A.state.buffers.stencil.setTest(!1)}}class G{constructor(B,I){if(this.renderer=B,void 0===I){const Q=B.getSize(new A.Vector2);this._pixelRatio=B.getPixelRatio(),this._width=Q.width,this._height=Q.height,(I=new A.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=I.width,this._height=I.height;this.renderTarget1=I,this.renderTarget2=I.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new j(U),this.clock=new A.Clock}swapBuffers(){const A=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=A}addPass(A){this.passes.push(A),A.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(A,B){this.passes.splice(B,0,A),A.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(A){const B=this.passes.indexOf(A);-1!==B&&this.passes.splice(B,1)}isLastEnabledPass(A){for(let B=A+1;B<this.passes.length;B++)if(this.passes[B].enabled)return!1;return!0}render(A){void 0===A&&(A=this.clock.getDelta());const B=this.renderer.getRenderTarget();let I=!1;for(let B=0,Q=this.passes.length;B<Q;B++){const Q=this.passes[B];if(!1!==Q.enabled){if(Q.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(B),Q.render(this.renderer,this.writeBuffer,this.readBuffer,A,I),Q.needsSwap){if(I){const B=this.renderer.getContext(),I=this.renderer.state.buffers.stencil;I.setFunc(B.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,A),I.setFunc(B.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==D&&(Q instanceof D?I=!0:Q instanceof e&&(I=!1))}}this.renderer.setRenderTarget(B)}reset(B){if(void 0===B){const I=this.renderer.getSize(new A.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=I.width,this._height=I.height,(B=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=B,this.renderTarget2=B.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(A,B){this._width=A,this._height=B;const I=this._width*this._pixelRatio,Q=this._height*this._pixelRatio;this.renderTarget1.setSize(I,Q),this.renderTarget2.setSize(I,Q);for(let A=0;A<this.passes.length;A++)this.passes[A].setSize(I,Q)}setPixelRatio(A){this._pixelRatio=A,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class n extends y{constructor(B,I,Q,Y,F){super(),this.scene=B,this.camera=I,this.overrideMaterial=Q,this.clearColor=Y,this.clearAlpha=void 0!==F?F:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new A.Color}render(A,B,I){const Q=A.autoClear;let Y,F;A.autoClear=!1,void 0!==this.overrideMaterial&&(F=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(A.getClearColor(this._oldClearColor),Y=A.getClearAlpha(),A.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&A.clearDepth(),A.setRenderTarget(this.renderToScreen?null:I),this.clear&&A.clear(A.autoClearColor,A.autoClearDepth,A.autoClearStencil),A.render(this.scene,this.camera),this.clearColor&&A.setClearColor(this._oldClearColor,Y),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=F),A.autoClear=Q}}const z={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new A.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};class o extends y{constructor(B,I,Q,Y){super(),this.strength=void 0!==I?I:1,this.radius=Q,this.threshold=Y,this.resolution=void 0!==B?new A.Vector2(B.x,B.y):new A.Vector2(256,256),this.clearColor=new A.Color(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let F=Math.round(this.resolution.x/2),M=Math.round(this.resolution.y/2);this.renderTargetBright=new A.WebGLRenderTarget(F,M),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let B=0;B<this.nMips;B++){const I=new A.WebGLRenderTarget(F,M);I.texture.name="UnrealBloomPass.h"+B,I.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(I);const Q=new A.WebGLRenderTarget(F,M);Q.texture.name="UnrealBloomPass.v"+B,Q.texture.generateMipmaps=!1,this.renderTargetsVertical.push(Q),F=Math.round(F/2),M=Math.round(M/2)}const E=z;this.highPassUniforms=A.UniformsUtils.clone(E.uniforms),this.highPassUniforms.luminosityThreshold.value=Y,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new A.ShaderMaterial({uniforms:this.highPassUniforms,vertexShader:E.vertexShader,fragmentShader:E.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const g=[3,5,7,9,11];F=Math.round(this.resolution.x/2),M=Math.round(this.resolution.y/2);for(let B=0;B<this.nMips;B++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(g[B])),this.separableBlurMaterials[B].uniforms.texSize.value=new A.Vector2(F,M),F=Math.round(F/2),M=Math.round(M/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=I,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new A.Vector3(1,1,1),new A.Vector3(1,1,1),new A.Vector3(1,1,1),new A.Vector3(1,1,1),new A.Vector3(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const c=U;this.copyUniforms=A.UniformsUtils.clone(c.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new A.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,blending:A.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new A.Color,this.oldClearAlpha=1,this.basic=new A.MeshBasicMaterial,this.fsQuad=new R(null)}dispose(){for(let A=0;A<this.renderTargetsHorizontal.length;A++)this.renderTargetsHorizontal[A].dispose();for(let A=0;A<this.renderTargetsVertical.length;A++)this.renderTargetsVertical[A].dispose();this.renderTargetBright.dispose();for(let A=0;A<this.separableBlurMaterials.length;A++)this.separableBlurMaterials[A].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(B,I){let Q=Math.round(B/2),Y=Math.round(I/2);this.renderTargetBright.setSize(Q,Y);for(let B=0;B<this.nMips;B++)this.renderTargetsHorizontal[B].setSize(Q,Y),this.renderTargetsVertical[B].setSize(Q,Y),this.separableBlurMaterials[B].uniforms.texSize.value=new A.Vector2(Q,Y),Q=Math.round(Q/2),Y=Math.round(Y/2)}render(A,B,I,Q,Y){A.getClearColor(this._oldClearColor),this.oldClearAlpha=A.getClearAlpha();const F=A.autoClear;A.autoClear=!1,A.setClearColor(this.clearColor,0),Y&&A.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=I.texture,A.setRenderTarget(null),A.clear(),this.fsQuad.render(A)),this.highPassUniforms.tDiffuse.value=I.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,A.setRenderTarget(this.renderTargetBright),A.clear(),this.fsQuad.render(A);let M=this.renderTargetBright;for(let B=0;B<this.nMips;B++)this.fsQuad.material=this.separableBlurMaterials[B],this.separableBlurMaterials[B].uniforms.colorTexture.value=M.texture,this.separableBlurMaterials[B].uniforms.direction.value=o.BlurDirectionX,A.setRenderTarget(this.renderTargetsHorizontal[B]),A.clear(),this.fsQuad.render(A),this.separableBlurMaterials[B].uniforms.colorTexture.value=this.renderTargetsHorizontal[B].texture,this.separableBlurMaterials[B].uniforms.direction.value=o.BlurDirectionY,A.setRenderTarget(this.renderTargetsVertical[B]),A.clear(),this.fsQuad.render(A),M=this.renderTargetsVertical[B];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,A.setRenderTarget(this.renderTargetsHorizontal[0]),A.clear(),this.fsQuad.render(A),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,Y&&A.state.buffers.stencil.setTest(!0),this.renderToScreen?(A.setRenderTarget(null),this.fsQuad.render(A)):(A.setRenderTarget(I),this.fsQuad.render(A)),A.setClearColor(this._oldClearColor,this.oldClearAlpha),A.autoClear=F}getSeperableBlurMaterial(B){return new A.ShaderMaterial({defines:{KERNEL_RADIUS:B,SIGMA:B},uniforms:{colorTexture:{value:null},texSize:{value:new A.Vector2(.5,.5)},direction:{value:new A.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}getCompositeMaterial(B){return new A.ShaderMaterial({defines:{NUM_MIPS:B},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}o.BlurDirectionX=new A.Vector2(1,0),o.BlurDirectionY=new A.Vector2(0,1);class H{constructor(B,Q,Y,F,M,E,g){this.effectComposer=new G(B),this.effectComposer.setSize(Q.width,Q.height),this.effectComposer.setPixelRatio(2),this.renderPass=new n(Y,F),this.effectComposer.addPass(this.renderPass),this.properties=g,this.colorPalette=[{color:[13796541,9527225,0,0],mode:0},{color:[5617833,4364224,0,0],mode:0},{color:[13922004,14984935,0,0],mode:0},{color:[16778,2010052,0,0],mode:0},{color:[12698453,4306065,0,0],mode:0},{color:[11545367,7085070,0,0],mode:0},{color:[14714278,14466180,0,0],mode:0},{color:[14142816,13667365,0,0],mode:0},{color:[7379489,4353064,0,0],mode:0},{color:[8605922,12867027,0,0],mode:0},{color:[13521959,11629605,7483671,0],mode:1},{color:[14457040,12476567,14141802,0],mode:1},{color:[13000034,12204859,7409166,0],mode:1},{color:[10390730,13206453,9421511,0],mode:1},{color:[15092945,9317056,4172761,0],mode:1},{color:[7514325,9617603,10672077,0],mode:1},{color:[10005623,2709056,6718031,0],mode:1},{color:[12656415,13122716,12870785,13801661],mode:2},{color:[14780205,10054590,15055186,13194564],mode:2},{color:[4033935,9225659,1205102,6266277],mode:2}],this.setIndex(this.colorPalette[this.properties.colorPalette].mode,this.properties.colorFlip),this.firstShader={uniforms:{tDiffuse:{value:null},textTexture:{value:M},motifTexture:{value:E},resolution:{value:[Q.width,Q.height]},time:{value:0},color1:{value:new A.Color(this.colorPalette[this.properties.colorPalette].color[this.colorIndex[0]]).toArray()},color2:{value:new A.Color(this.colorPalette[this.properties.colorPalette].color[this.colorIndex[1]]).toArray()},color3:{value:new A.Color(this.colorPalette[this.properties.colorPalette].color[this.colorIndex[2]]).toArray()},color4:{value:new A.Color(this.colorPalette[this.properties.colorPalette].color[this.colorIndex[3]]).toArray()},colorFlip:{value:this.properties.colorFlip},colorMode:{value:this.colorPalette[this.properties.colorPalette].mode},waveORdot:{value:this.properties.waveORdot},scale:{value:this.properties.scale},flowSpeed:{value:this.properties.flowSpeed},pulseSpeed:{value:this.properties.pulseSpeed},p1:{value:this.properties.p1},p2:{value:this.properties.p2},p3:{value:this.properties.p3},p4:{value:this.properties.p4},seed:{value:this.properties.seed},mode:{value:this.properties.mode}},vertexShader:I,fragmentShader:"precision highp float;\r\n\r\nvarying vec2 vUv;\r\n\r\nuniform sampler2D tDiffuse;\r\nuniform sampler2D textTexture;\r\nuniform sampler2D motifTexture;\r\nuniform vec2 resolution;\r\nuniform float time;\r\n\r\nuniform vec3 color1;\r\nuniform vec3 color2;\r\nuniform vec3 color3;\r\nuniform vec3 color4;\r\nuniform int colorFlip;\r\nuniform int colorMode;\r\nuniform int waveORdot;\r\nuniform float scale;\r\nuniform float flowSpeed;\r\nuniform float pulseSpeed;\r\nuniform float p1;\r\nuniform float p2;\r\nuniform float p3;\r\nuniform float p4;\r\nuniform float seed;\r\nuniform int mode;\r\n\r\n#define S smoothstep\r\n#define PI 3.14159265359\r\n\r\nmat2 rotmat(float a) {\r\n return mat2(cos(a), -sin(a), sin(a), cos(a));\r\n}\r\n\r\nfloat rand(float n){return fract(sin(n) * seed);}\r\n\r\nfloat rand21(vec2 p){return fract(sin(dot(p,vec2(221.9119, 101.2148))) * seed);}\r\n\r\nvec3 rand13(float n) {\r\n return fract((vec3(sin(n * 23.12), sin(n * 18.12), sin(n * 9.21)) + 21.15) * seed);\r\n}\r\n\r\nfloat noise(float x) {\r\n float i = floor(x);\r\n float f = fract(x);\r\n float u = f * f * (3.0 - 2.0 * f);\r\n return mix(rand(i), rand(i + 1.0), u);\r\n}\r\n\r\nfloat point(vec2 p, float f1, float f2, float f3, float f4, float f5, float s) {\r\n p += f2 * cos(p.x * f3) * noise(p.x * f4) * noise(p.y * f5) / f1;\r\n return S(.25 - s, .75 - s, abs(sin(p.x * f1 * PI) * sin(p.y * f1 * PI)));\r\n}\r\n\r\nfloat wave(vec2 p, float f1, float f2, float f3, float f4, float f5, float s) {\r\n p += f2 * cos(p.x * f3) * noise(p.x * f4) * noise(p.y * f5) / f1;\r\n return S(.25 - s, .75 - s, abs(fract(p.y * f1) * 2. - 1.));\r\n}\r\n\r\nfloat point(vec2 p, float f1, float f2, float f3, float f4, float f5, float s1, float s2) {\r\n p += f2 * cos(p.x * f3) * noise(p.x * f4) * noise(p.y * f5) / f1;\r\n return S(s1, s2, abs(sin(p.x * f1 * PI) * sin(p.y * f1 * PI)));\r\n}\r\n\r\nfloat wave(vec2 p, float f1, float f2, float f3, float f4, float f5, float s1, float s2) {\r\n p += f2 * cos(p.x * f3) * noise(p.x * f4) * noise(p.y * f5) / f1;\r\n return S(s1, s2, abs(fract(p.y * f1) * 2. - 1.));\r\n}\r\n\r\nvec4 moirepoint(vec2 p) {\r\n float c1 = point(p, scale, p1, p2, p3, p4, -0.18);\r\n\r\n vec2 q = p + rand(.11) + time * pulseSpeed;\r\n float c2 = point(q, scale, p1, p2, p3, p4, 0.1);\r\n\r\n q = p + rand(.23) + time * pulseSpeed;\r\n float c3 = point(q, scale, p1, p2, p3, p4, 0.1);\r\n\r\n q = p + rand(.35) + time * pulseSpeed;\r\n float c4 = point(q, scale, p1, p2, p3, p4, 0.1);\r\n\r\n return vec4(c1, c2, c3, c4);\r\n}\r\n\r\nvec4 moirewave(vec2 p) {\r\n float c1 = wave(p, scale, p1, p2, p3, p4, -0.3);\r\n\r\n vec2 q = p + rand(.11) + time * pulseSpeed;\r\n float c2 = wave(q, scale, p1, p2, p3, p4, 0.0);\r\n\r\n q = p + rand(.23) + time * pulseSpeed;\r\n float c3 = wave(q, scale, p1, p2, p3, p4, 0.0);\r\n\r\n q = p + rand(.35) + time * pulseSpeed;\r\n float c4 = wave(q, scale, p1, p2, p3, p4, 0.0);\r\n\r\n return vec4(c1, c2, c3, c4);\r\n}\r\n\r\nfloat moirepoint1(vec2 p, float a) {\r\n return point(p, scale, p1, p2, p3, p4, -0.4 + a * 0.4, 1.0 + a * 0.2);\r\n}\r\n\r\nfloat moirewave1(vec2 p, float a) {\r\n return wave(p, scale, p1, p2, p3, p4, -0.3 + a * 0.4, 1.1 + a * 0.2);\r\n}\r\n\r\nvoid main() {\r\n vec2 uv = vUv;\r\n\r\n // Texture\r\n vec3 col0 = texture2D(tDiffuse, uv).rgb * 4.0;\r\n\r\n // Moire\r\n vec2 p = uv - time * flowSpeed;\r\n vec4 moire = moirewave(p);\r\n if (waveORdot == 1) moire = moirepoint(p);\r\n\r\n vec3 col1 = color1;\r\n vec3 co