memoscan
← all memos

Memo 0x42488a97…e61dec on Ethereum

l2 = color2;\r\n vec3 col3 = color3;\r\n vec3 col4 = color4;\r\n\r\n float shadow = 1.0;\r\n vec3 col = vec3(1.0);\r\n if (colorMode == 0) {\r\n col *= mix(col1, col2, moire.y);\r\n shadow = mix(1.2, 0.8, moire.y);\r\n } else if (colorMode == 1) {\r\n col *= mix(mix(col1, col2, moire.y), col3, moire.z);\r\n shadow = mix(mix(1.2, 1.0, moire.y), 0.8, moire.z);\r\n } else if (colorMode == 2) {\r\n col *= mix(mix(mix(col1, col2, moire.y), col3, moire.z), col4, moire.w);\r\n shadow = mix(mix(mix(1.2, 1.05, moire.y), 0.95, moire.z), 0.8, moire.w);\r\n }\r\n float len = length(col) / sqrt(3.0);\r\n col *= col0 - pow(len, 3.0) * 0.16;\r\n col *= moire.x;\r\n\r\n vec4 motif = texture2D(motifTexture, uv);\r\n motif.rgb = pow(1.05 * motif.rgb, vec3(1.8)) * 0.5;\r\n if (mode == 1) {\r\n col = mix(col, motif.rgb, motif.a);\r\n } else if (mode == 2) {\r\n col = mix(col, motif.rgb * shadow, motif.a);\r\n } else if (mode == 3) {\r\n col = mix(col, motif.rgb * (col0 * 0.05 + 0.95), motif.a);\r\n } else if (mode == 4) {\r\n col = mix(col, motif.rgb / (col0 * 0.05 + 0.95), motif.a);\r\n }\r\n vec4 text = texture2D(textTexture, (uv - .5) * 1.1 + .5);\r\n if (mode > 0) {\r\n col = mix(col, 1.05 * text.rgb, text.a);\r\n }\r\n\r\n if (waveORdot == 0) {\r\n col *= moirewave1(p, mix(length(motif.rgb), length(text.rgb), text.a));\r\n } else {\r\n col *= moirepoint1(p, mix(length(motif.rgb), length(text.rgb), text.a));\r\n }\r\n \r\n gl_FragColor = vec4(col, 1.0);\r\n}"},this.firstPass=new j(this.firstShader),this.effectComposer.addPass(this.firstPass),this.secondPass=new o(new A.Vector2(Q.x,Q.y),2,0,0),this.effectComposer.addPass(this.secondPass),this.thirdShader={uniforms:{tDiffuse:{value:null},textTexture:{value:M},motifTexture:{value:E},gray:{value:1==this.properties.mono},resolution:{value:[Q.width,Q.height]},time:{value:0},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},glitchMode:{value:this.properties.glitchMode}},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 bool gray;\r\nuniform vec2 resolution;\r\nuniform float time;\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\nuniform int glitchMode;\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\nvoid main() {\r\n vec2 uv = vUv;\r\n\r\n // Distortion like TV\r\n vec2 q = uv - .5;\r\n q *= mix(1., 1.3, S(.25, 1., length(q)));\r\n\r\n // Glitch \r\n if (glitchMode == 2 || glitchMode == 3) {\r\n q.x += mix(.02 * rand(floor(time * 6.122)), .0, pow(S(-.08, .08, rand(floor(q.y * resolution.y * .08 + time * 4.214))), 8.0));\r\n q.x -= mix(.02 * rand(floor(time * 4.526)), .0, pow(S(-.08, .08, rand(floor(q.y * resolution.y * .08 + time * 5.301) + 10.421)), 8.0));\r\n q.x += mix(.01 * rand(floor(time * 5.109)), .0, pow(S(-.08, .08, rand(floor(q.y * resolution.y * .06 + time * 7.628) + 21.214)), 8.0));\r\n q.x -= mix(.01 * rand(floor(time * 3.805)), .0, pow(S(-.08, .08, rand(floor(q.y * resolution.y * .06 + time * 8.716) + 51.911)), 8.0));\r\n q.x += mix(pow((rand(floor(q.y * resolution.y * .4) * 3.1259) - .5), 3.) * .1 , 0., pow(S(-.4, .4, rand(floor(q.y * resolution.y * .04 - time * .001) - floor(time * 8.) * .412 + 13.141)), 8.0));\r\n }\r\n\r\n vec3 col = texture2D(tDiffuse, q * .82 + .5).rgb;\r\n if (glitchMode == 1 || glitchMode == 2) {\r\n col.g = texture2D(tDiffuse, q * .82 + .5 + vec2(.02 * q.x, .0)).g;\r\n col.b = texture2D(tDiffuse, q * .82 + .5 - vec2(.02 * q.x, .0)).b;\r\n }\r\n\r\n q = uv - .5;\r\n q *= mix(1., 1.3, S(.25, 1., length(q)));\r\n\r\n // Motif\r\n vec4 motif = texture2D(motifTexture, q * .82 + 0.5);\r\n vec4 text = texture2D(textTexture, q * .9 + 0.5);\r\n if (glitchMode == 1 || glitchMode == 2) {\r\n motif.g = texture2D(motifTexture, q * .82 + 0.5 + vec2(.02 * q.x,.0)).g;\r\n motif.b = texture2D(motifTexture, q * .82 + 0.5 - vec2(.02 * q.x,.0)).b;\r\n }\r\n vec2 pp = q * .82 + .5 - time * flowSpeed;\r\n pp += p1 * cos(pp.x * p2) * noise(pp.x * p3) * noise(pp.y * p4) / scale;\r\n if (mode > 0) { \r\n float black = S(0.3, 0.5, length(motif.rgb));\r\n for (float x = -0.2; x <= 0.2; x += 0.04) {\r\n for (float y = -0.2; y <= 0.2; y += 0.04) {\r\n vec4 nmotif = texture2D(motifTexture, q * .82 + 0.5 + vec2(x, y) / resolution);\r\n black *= S(0.3, 0.5, length(nmotif.rgb));\r\n }\r\n }\r\n black = (1.0 - black) * motif.a;\r\n if (waveORdot == 0) {\r\n motif.a *= S(0., .8, abs(fract(pp.y * scale) * 2. - 1.));\r\n } else {\r\n motif.a *= S(0., .8, abs(sin(pp.x * scale * PI) * sin(pp.y * scale * PI)));\r\n }\r\n motif.a = mix(motif.a, 1.0, black);\r\n }\r\n col = mix(col, motif.rgb, max(0.0, motif.a - text.a));\r\n col = pow(col * 1.05, vec3(1.8));\r\n\r\n // Text\r\n if (glitchMode == 1 || glitchMode == 2) {\r\n text.g = texture2D(textTexture, q * .9 + 0.5 + vec2(.02 * q.x, .0)).g;\r\n text.b = texture2D(textTexture, q * .9 + 0.5 - vec2(.02 * q.x, .0)).b;\r\n }\r\n if (mode > 0) {\r\n float black = S(0.7, 0.6, length(text.rgb)) * text.a;\r\n if (waveORdot == 0) {\r\n text.a *= S(-.4, .8, abs(fract(pp.y * scale) * 2. - 1.));\r\n } else {\r\n text.a *= S(-.4, .8, abs(sin(pp.x * scale * PI) * sin(pp.y * scale * PI)));\r\n }\r\n text.a = mix(text.a, 1.0, black);\r\n }\r\n col = mix(col, text.rgb, text.a);\r\n\r\n if (gray) {\r\n col = vec3(pow(length(col) / sqrt(3.0), 1.5));\r\n }\r\n\r\n col += rand21(q + time) * 0.06 - 0.03;\r\n col *= 1.1 - pow(max(0., length(q) - 0.2) * 1.6, 1.6) * 0.6;\r\n\r\n // White noise\r\n if (time > 59.8) {\r\n col = vec3(rand21(floor(q * resolution * 0.5) + time));\r\n } \r\n\r\n gl_FragColor = vec4(col, 1.0);\r\n}"},this.thirdPass=new j(this.thirdShader),this.effectComposer.addPass(this.thirdPass)}setIndex(A,B){this.colorIndex=[0,1,2,3];for(let I=A;I>=0;I--){const A=B%(I+2),Q=this.colorIndex[A];this.colorIndex[A]=this.colorIndex[I+1],this.colorIndex[I+1]=Q}}setSize(A){this.effectComposer.setSize(A.width,A.height),this.firstPass.material.uniforms.resolution.value=[A.width,A.height],this.thirdPass.material.uniforms.resolution.value=[A.width,A.height]}setTexture(A){this.firstPass.material.uniforms.textTexture.value=A,this.thirdPass.material.uniforms.textTexture.value=A}textUpdate(){this.firstPass.material.uniforms.textTexture.value.needsUpdate=!0,this.thirdPass.material.uniforms.textTexture.value.needsUpdate=!0}setTime(A){this.firstPass.material.uniforms.time.value=A,this.thirdPass.material.uniforms.time.value=A}render(){this.effectComposer.render()}}class x{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.aPass=new o(new A.Vector2(Q.x,Q.y),.5,.4,0),this.effectComposer.addPass(this.aPass),this.firstShader={uniforms:{tDiffuse:{value:null},resolution:{value:[Q.width,Q.height]},time:{value:0},style:{value:this.properties.style},mode:{value:this.properties.mode%3},seed:{value:this.properties.seed}},vertexShader:I,fragmentShader:"precision highp float;\r\n\r\nvarying vec2 vUv;\r\n\r\nuniform sampler2D tDiffuse;\r\nuniform vec2 resolution;\r\nuniform float time;\r\nuniform int style;\r\nuniform int mode;\r\nuniform float seed;\r\n\r\n#define PI 3.14159265358979323846\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\nmat2 rotmat(float a) {\r\n return mat2(cos(a), -sin(a), sin(a), cos(a));\r\n}\r\n\r\nfloat noise(vec2 p, float freq ){\r\n\tfloat unit = 1.0/freq;\r\n\tvec2 ij = floor(p/unit);\r\n\tvec2 xy = mod(p,unit)/unit;\r\n\t// xy = 3.*xy*xy-2.*xy*xy*xy;\r\n\txy = .5*(1.-cos(PI*xy));\r\n\tfloat a = rand21((ij+vec2(0.,0.)));\r\n\tfloat b = rand21((ij+vec2(1.,0.)));\r\n\tfloat c = rand21((ij+vec2(0.,1.)));\r\n\tfloat d = rand21((ij+vec2(1.,1.)));\r\n\tfloat x1 = mix(a, b, xy.x);\r\n\tfloat x2 = mix(c, d, xy.x);\r\n\treturn mix(x1, x2, xy.y);\r\n}\r\n\r\nfloat pNoise(vec2 p, int res){\r\n\tfloat persistance = .5;\r\n\tfloat n = 0.;\r\n\tfloat normK = 0.;\r\n\tfloat f = 1.;\r\n\tfloat amp = 1.;\r\n\tint iCount = 0;\r\n\tfor (int i = 0; i<100; i++){\r\n\t\tn+=amp*noise(p, f);\r\n\t\tf*=2.;\r\n\t\tnormK+=amp;\r\n\t\tamp*=persistance;\r\n\t\tif (iCount == res) break;\r\n\t\tiCount++;\r\n\t}\r\n\tfloat nf = n/normK;\r\n\treturn nf*nf*nf*nf;\r\n}\r\n\r\nvec3 sky(vec2 q) {\r\n q.x += time * 0.01;\r\n vec2 p = q * vec2(8.0, 12.0);\r\n p += noise(p * 0.314, 1.) * .6;\r\n p.x += noise(p * 0.629 + 9.123, 2.) * .3;\r\n p.y += noise(p * 0.931 + 13.151, 4.) * .1;\r\n float a1 = pNoise(p, 8);\r\n p += noise(p * 0.512 + 19.921, 4.) * .3;\r\n p += noise(p * 1.198 + 32.512, 8.) * .1;\r\n float a2 = pNoise(p + vec2(0.1, 0.3), 4);\r\n float b = smoothstep(0.2, 0.8, q.y);\r\n a1 *= (b * .4 + 0.1) * 4.;\r\n a2 *= (b * .5 + 0.2) * 2.;\r\n vec3 c1 = mix(vec3(0.08, 0.68, 0.96), vec3(0.02, 0.52, 0.85), b);\r\n vec3 c2 = mix(vec3(0.3, 0.8, 0.99), vec3(0.35, 0.72, 0.98), b);\r\n vec3 c3 = mix(vec3(0.9, 0.98, 0.98), vec3(0.9, 1.0, 1.0), b);\r\n vec3 c = mix(c1, mix(c2, c3, smoothstep(0.042, 0.2, a1)), smoothstep(0.036, 0.1, a2));\r\n return c;\r\n}\r\n\r\nvec3 smoke(vec2 q) {\r\n q.x += time * 0.01;\r\n vec2 p = q * vec2(6.0, 8.0);\r\n p += noise(p * 0.314, 1.) * .4;\r\n p.x += noise(p * 0.629 + 9.123, 2.) * .2;\r\n p.y += noise(p * 0.931 + 13.151, 4.) * .1;\r\n float a1 = pNoise(p, 8);\r\n p += noise(p * 0.512 + 19.921, 4.) * .2;\r\n p += noise(p * 1.198 + 32.512, 8.) * .1;\r\n float a2 = pNoise(p + vec2(0.1, 0.3), 4);\r\n float b = smoothstep(0.2, 0.8, q.y);\r\n a1 *= (b * .4 + 0.1) * 4.;\r\n a2 *= (b * .5 + 0.2) * 2.;\r\n vec3 c3 = mix(vec3(0.84, 0.31, 0.22), vec3(0.84, 0.22, 0.22), b);\r\n vec3 c2 = mix(vec3(0.6, 0.25, 0.2), vec3(0.6, 0.2, 0.2), b);\r\n vec3 c1 = mix(vec3(0.2, 0.18, 0.18), vec3(0.24, 0.2, 0.2), b);\r\n vec3 c = mix(c1, mix(c2, c3, smoothstep(0.1, 0.8, a1)), smoothstep(-0.3, 0.3, a2));\r\n return c;\r\n}\r\n\r\nvec3 sunset(vec2 q) {\r\n q.x += time * 0.01;\r\n vec2 p = q * vec2(3.0, 5.0);\r\n p += noise(p * 0.314, 1.) * .2;\r\n p.x += noise(p * 0.629 + 9.123, 2.) * .1;\r\n p.y += noise(p * 0.931 + 13.151, 4.) * .05;\r\n float a1 = pNoise(p, 8);\r\n float b = smoothstep(0.2, 0.8, q.y);\r\n a1 *= (b * .3 + 0.4) * 4.;\r\n vec3 c1 = mix(vec3(0.94, 0.74, 0.82), vec3(0.94, 0.72, 0.58), b);\r\n vec3 c2 = mix(vec3(0.9, 0.64, 0.76), vec3(0.9, 0.62, 0.72), b);\r\n vec3 c = mix(c1, c2, smoothstep(0.12, 0.6, a1));\r\n return c;\r\n}\r\n\r\nvec3 galaxy(vec2 p, int m) {\r\n p *= rotmat(rand(1.214) * 1.2 - 0.6);\r\n p *= vec2(1.6, 0.1);\r\n\r\n float t = floor(time * 24.) / 24.;\r\n\r\n p.y += t * 0.5142;\r\n float a = pNoise(p, 4) * 4.0;\r\n p.x += 53.516;\r\n p.x *= 1.2193;\r\n p.y += t * 0.18814;\r\n a += pNoise(p, 5) * 2.0;\r\n p.x += 31.1531;\r\n p.x *= 1.4113;\r\n p.y += t * 0.12984;\r\n a += pNoise(p, 6) * 1.0;\r\n p.x -= 61.2941;\r\n p.x *= 0.8912;\r\n p.y += t * 0.18351;\r\n a -= pNoise(p, 5) * 2.0;\r\n\r\n vec3 c;\r\n if (m == 0) {\r\n // c = mix(vec3(0.1804, 0.3569, 0.7176), vec3(0.2353, 0.7059, 0.6902), a);\r\n c = mix(vec3(0.4235, 0.0745, 0.1451), vec3(0.749, 0.298, 0.4784), a);\r\n } else if (m == 1) {\r\n // c = mix(vec3(0.6275, 0.3647, 0.7137), vec3(0.2941, 0.2902, 0.5882), a);\r\n c = mix(vec3(0.6392, 0.2471, 0.6078), vec3(0.3176, 0.302, 0.549), a);\r\n } else {\r\n c = mix(vec3(0.2471, 0.5725, 0.6314), vec3(0.5647, 0.6039, 0.1529), a);\r\n }\r\n return c;\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 * 2.0;\r\n vec3 col = col0;\r\n\r\n vec2 p = uv;\r\n p.x += time * 0.01;\r\n if (style == 1) {\r\n col *= galaxy(p, mode);\r\n } else if (style == 2) {\r\n if (mode == 0) {\r\n col = sky(p);\r\n } else if (mode == 1) {\r\n col = smoke(p);\r\n } else if (mode == 2) {\r\n col = sunset(p);\r\n }\r\n }\r\n\r\n gl_FragColor = vec4(col, 1.0);\r\n}"},this.firstPass=new j(this.firstShader),this.effectComposer.addPass(this.firstPass),this.secondShader={uniforms:{tDiffuse:{value:null},textTexture:{value:M},motifTexture:{value:E},gray:{value:1==this.properties.mono},resolution:{value:[Q.width,Q.height]},time:{value:0},transparent:{value:this.properties.transparent},seed:{value:this.properties.seed}},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 bool gray;\r\nuniform vec2 resolution;\r\nuniform float time;\r\nuniform int transparent;\r\nuniform float seed;\r\n\r\n#define S smoothstep\r\n#define PI 3.14159265359\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\n\r\nvoid main() {\r\n vec2 uv = vUv;\r\n\r\n // Distortion like TV\r\n vec2 q = uv - .5;\r\n q *= mix(1., 1.3, S(.25, 1., length(q)));\r\n\r\n vec3 col = texture2D(tDiffuse, q * .82 + .5).rgb;\r\n q = uv - .5;\r\n q *= mix(1., 1.3, S(.25, 1., length(q)));\r\n\r\n // Motif\r\n vec4 motif = texture2D(motifTexture, q * .82 + 0.5);\r\n col = mix(col, motif.rgb, motif.a * (transparent == 0 ? 1.0 : 0.75));\r\n col = pow(col * 1.05, vec3(1.8));\r\n\r\n // Text \r\n vec4 text = texture2D(textTexture, q * .9 + 0.5);\r\n col = mix(col, text.rgb, text.a);\r\n\r\n if (gray) {\r\n col = vec3(pow(length(col) / sqrt(3.0), 1.5));\r\n }\r\n\r\n col += rand21(q + time) * 0.06 - 0.03;\r\n col *= 1.1 - pow(max(0., length(q) - 0.2) * 1.6, 1.6) * 0.6;\r\n\r\n // White noise\r\n if (time > 59.8) {\r\n col = vec3(rand21(floor(q * resolution * 0.5) + time));\r\n } \r\n\r\n gl_FragColor = vec4(col, 1.0);\r\n}"},this.secondPass=new j(this.secondShader),this.effectComposer.addPass(this.secondPass)}setSize(A){this.effectComposer.setSize(A.width,A.height),this.firstPass.material.uniforms.resolution.value=[A.width,A.height],this.secondPass.material.uniforms.resolution.value=[A.width,A.height]}setTexture(A){this.secondPass.material.uniforms.textTexture.value=A}textUpdate(){this.secondPass.material.uniforms.textTexture.value.needsUpdate=!0}setTime(A){this.firstPass.material.uniforms.time.value=A,this.secondPass.material.uniforms.time.value=A}render(){this.effectComposer.render()}}class t{constructor(B){const I=document.createElement("canvas");this.ctx=I.getContext("2d"),I.width=1600,I.height=1200,this.properties=B,this.strokeColor="#000000ff",0==this.properties.mode?(this.fontSize=100,this.position=.88):(this.fontSize=86,this.position=.92),this.lineWidth=24,this.colorPalette=["#cccc00ff","#cc88ccff","#66ccccff","#ccccccff"],this.textTexture=new A.Texture(I)}draw(){if(this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),0==this.properties.mode){this.ctx.font=`${this.fontSize}px MyFont`,this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.lineJoin="round";let A=1500,B=this.properties.text.split(" "),I=[B[0]],Q=0;for(let Y=1;Y<B.length;Y++){let F=I[Q]+" "+B[Y];this.ctx.measureText(F).width<A?I[Q]=F:(I.push(B[Y]),Q++)}for(let A=0;A<I.length;A++)this.ctx.strokeStyle=this.strokeColor,this.ctx.lineWidth=this.lineWidth,this.ctx.strokeText(I[A],this.ctx.canvas.width/2,this.ctx.canvas.height*this.position-1.2*this.fontSize*(I.length-A-1)),this.ctx.fillStyle=this.colorPalette[this.properties.fillColor],this.ctx.fillText(I[A],this.ctx.canvas.width/2,this.ctx.canvas.height*this.position-1.2*this.fontSize*(I.length-A-1))}else{this.ctx.font=`${this.fontSize}px MyFont`,this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.lineJoin="round";let A=this.properties.text,B=720,I=[A[0]],Q=0,Y=0;for(let F=1;F<A.length;F++){let M=I[Q]+A[F],E=this.ctx.measureText(A[F]);Y+=E.actualBoundingBoxAscent+E.actualBoundingBoxDescent,Y<B?I[Q]=M:(/[、。?!ぁぃぅぇぉっゃゅょァィゥェォッャュョ]/.test(A[F])?(I[Q]=I[Q].slice(0,-1),I.push(A[F-1]+A[F])):I.push(A[F]),Y=0,Q++)}for(let A=0;A<I.length;A++)for(let B=0;B<I[A].length;B++)this.ctx.strokeStyle=this.strokeColor,this.ctx.lineWidth=this.lineWidth,this.ctx.strokeText(I[A][B],this.ctx.canvas.width*this.position-1.4*this.fontSize*A,this.ctx.canvas.height/2+(B-(I[A].length-1)/2)*this.fontSize);for(let A=0;A<I.length;A++)for(let B=0;B<I[A].length;B++)this.ctx.lineWidth=this.lineWidth,this.ctx.fillStyle=this.colorPalette[this.properties.fillColor],this.ctx.fillText(I[A][B],this.ctx.canvas.width*this.position-1.4*this.fontSize*A,this.ctx.canvas.height/2+(B-(I[A].length-1)/2)*this.fontSize)}}}class S{constructor(B){this.canvas=document.createElement("canvas"),this.canvas.width=1600,this.canvas.height=1200,this.draw(1600,1200,B),this.texture=new A.CanvasTexture(this.canvas),this.texture.needsUpdate=!1}draw(A,B,I){const Q=Math.floor(I.rand_rarity([.3,.15,.15,.18,.22])),Y=["#edcb09","#cccccf","#dec0ad"],F=["#967706","#77777f","#94735c"],M=["#f2edd3","#eeeeef","#f7f0eb"],E=["#e3aad5","#e3aa49","#9fcaf5","#a5d989","#c8aae3"],g=["#db88c7","#d98f11","#7ab2eb","#87c765","#af8ad1"];let c,h,C,i,w,J,U,y,N;const s=()=>{c=Math.floor(I.rand(-1,4)),h=Math.floor(I.rand(-1,2)),C=Math.floor(I.rand(0,2)),i=Math.floor(I.rand(0,2)),w=Math.floor(I.rand(0,3)),J=Math.floor(I.rand(0,9)),U=Math.floor(I.rand(0,3)),y=Math.floor(I.rand(0,5)),N=Math.floor(I.rand(0,360))},R=document.createElement("canvas");R.width=A,R.height=B;const j=this.canvas.getContext("2d"),D=R.getContext("2d");j.lineWidth=1.6,D.lineWidth=1.6;class e{constructor(A=0,B=0){this.x=A,this.y=B}dist(A){const B=this.x-A.x,I=this.y-A.y;return Math.sqrt(B*B+I*I)}lerp(A,B){return new e(this.x*(1-B)+A.x*B,this.y*(1-B)+A.y*B)}}const G=(A,B,I=!0)=>{B.beginPath();for(let I=1;I<A.length;I++){const Q=A[Math.max(0,I-2)],Y=A[I-1],F=A[I],M=A[Math.min(A.length-1,I+1)];for(let A=0;A<1;A+=.1){const E=new e(.5*(2*Y.x+(-Q.x+F.x)*A+(2*Q.x-5*Y.x+4*F.x-M.x)*A*A+(-Q.x+3*Y.x-3*F.x+M.x)*A*A*A),.5*(2*Y.y+(-Q.y+F.y)*A+(2*Q.y-5*Y.y+4*F.y-M.y)*A*A+(-Q.y+3*Y.y-3*F.y+M.y)*A*A*A));1==I&&0==A?B.moveTo(E.x,E.y):B.lineTo(E.x,E.y)}}I&&B.closePath()},n=(A,B,I,Q,Y,F,M,E)=>{let g=[];switch(F){case 0:g.push(new e(0,0)),g.push(new e(.02*Y,-.1*Y)),g.push(new e(.1*Y,-.3*Y)),g.push(new e(.35*Y,-.4*Y)),g.push(new e(.65*Y,-.38*Y)),g.push(new e(1*Y,-.5*Y)),g.push(new e(1*Y,-.35*Y)),g.push(new e(.75*Y,-.05*Y)),g.push(new e(.4*Y,.05*Y)),g.push(new e(0,0));break;case 1:g.push(new e(0,0)),g.push(new e(.02*Y,-.2*Y)),g.push(new e(.1*Y,-.4*Y)),g.push(new e(.4*Y,-.45*Y)),g.push(new e(.7*Y,-.2*Y)),g.push(new e(1*Y,-.1*Y)),g.push(new e(.95*Y,0*Y)),g.push(new e(.65*Y,.1*Y)),g.push(new e(.2*Y,.05*Y))}M.save(),M.translate(A,B),M.scale(E?-1:1,1),M.translate(I,0),M.rotate(Q),G(g,M),M.restore()},z=(A,B,I,Q)=>{Q.beginPath(),Q.arc(A,B,I,0,2*Math.PI)},o=(A,B,I,Q)=>{Q.beginPath();for(let Y=0;Y<2*Math.PI;Y+=.01){const F=A+I*(.9*Math.sin(Y)+.04*Math.sin(2*Y)-.26*Math.sin(3*Y)-.01*Math.sin(4*Y)),M=B+I*(1*Math.cos(Y)-.1+.3*Math.cos(2*Y)-.2*Math.cos(3*Y)+.01*Math.cos(4*Y));0==Y?Q.moveTo(F,M):Q.lineTo(F,M)}Q.closePath()},H=(A,B,I,Q)=>{const Y=1.4*I,F=.7*I;Q.beginPath();for(let I=0;I<10;I++){const M=I/5*Math.PI,E=A+(I%2==0?F:Y)*Math.sin(M),g=B+(I%2==0?F:Y)*Math.cos(M);0==M?Q.moveTo(E,g):Q.lineTo(E,g)}Q.closePath()},x=(A,B)=>{let I=[],Q=[],Y=[],F=[];const M=A=>A<0?Q[A+3]:I[A],E=A=>{const B=M(A[0]),I=M(A[1]),Q=M(A[2]),Y=2*(B.x*(I.y-Q.y)+I.x*(Q.y-B.y)+Q.x*(B.y-I.y)),F=((B.x*B.x+B.y*B.y)*(I.y-Q.y)+(I.x*I.x+I.y*I.y)*(Q.y-B.y)+(Q.x*Q.x+Q.y*Q.y)*(B.y-I.y))/Y,E=((B.x*B.x+B.y*B.y)*(Q.x-I.x)+(I.x*I.x+I.y*I.y)*(B.x-Q.x)+(Q.x*Q.x+Q.y*Q.y)*(I.x-B.x))/Y,g=new e(F,E),c=g.dist(B);return{index:A,center:g,r:c,g:new e((B.x+I.x+Q.x)/3,(B.y+I.y+Q.y)/3)}},g=B=>{let I=0;for(let Q=0;Q<A.length;Q++){const Y=A[Q],F=A[(Q+1)%A.length];(Y.y<B.y&&F.y>B.y||Y.y>B.y&&F.y<B.y)&&((F.y-B.y)*Y.x+(B.y-Y.y)*F.x)/(F.y-Y.y)>B.x&&I++}return I%2==1},c=A=>{Y.push(E(A))},h=A=>{Y=Y.filter((function(B){for(let I=0;I<3;I++)if(B.index[I%3]==A[0]&&B.index[(I+1)%3]==A[1]&&B.index[(I+2)%3]==A[2])return!1;return!0}))},C=(A,B)=>{const I=M(A.index[0]),Q=M(A.index[1]),Y=M(A.index[2]),F=(Q.x-I.x)*(B.y-Q.y)-(Q.y-I.y)*(B.x-Q.x)>=0,E=(Y.x-Q.x)*(B.y-Y.y)-(Y.y-Q.y)*(B.x-Y.x)>=0,g=(I.x-Y.x)*(B.y-I.y)-(I.y-Y.y)*(B.x-I.x)>=0;return F==E&&F==g},i=(A,B,I)=>{const Q=((A,B)=>{for(let I of Y)for(let Q=0;Q<3;Q++)if(I.index[Q%3]==A&&I.index[(Q+1)%3]==B)return I.index[(Q+2)%3];return null})(I,B);if(null!=Q){g=E([A,B,I]),C=M(Q),g.center.dist(C)<g.r&&!((A,B)=>{for(let I=0;I<F.length;I++){if(F[I][0]==A&&F[I][1]==B)return!0;if(F[I][1]==A&&F[I][0]==B)return!0}return!1})(B,I)?(h([I,B,Q]),i(A,B,Q),i(A,Q,I)):c([A,B,I])}else c([A,B,I]);var g,C},w=(A,B)=>{h(A.index),i(B,A.index[0],A.index[1]),i(B,A.index[1],A.index[2]),i(B,A.index[2],A.index[0])},J=A=>{I.push(A);const B=I.length-1;for(let I of Y)if(C(I,A))return w(I,B),0};let U=0;for(let B=0;B<A.length;B++)U=Math.max(U,Math.max(Math.abs(A[B].x),Math.abs(A[B].y)));Q.push(new e(3*U,0)),Q.push(new e(0,3*U)),Q.push(new e(-3*U,-3*U)),c([-3,-2,-1]);for(let Q=0;Q<A.length;Q++){const Y=A[Q],M=A[(Q+1)%A.length],E=Y.dist(M),g=Math.floor(E/B);for(let B=0;B<g;B++){const E=Y.lerp(M,B/g);I.length>1&&F.push([I.length-2,I.length-1]),Q==A.length-1&&B==g-1&&F.push([I.length-1,0]),J(E)}}return Y=Y.filter((A=>{for(let B=0;B<3;B++)if(A.index[B]<0)return!1;return g(A.g)})),(A=>{let B=0;A:for(;B<1e3;){for(let I of Y)if(I.r>A&&g(I.center)){J(I.center),B++;continue A}break}})(B),[I,Y]},t=(Q,s,t)=>{if(h>-1){let I;I=0==i?0==h?.9*t:.5*t:0==h?1*t:.8*t,((I,Q,E,g,c)=>{const h=(I,Q,E,h,C)=>{for(let i=0;i<2;i++)D.save(),n(I,Q,E,h,C,c,D,1==i),D.clip(),D.fillStyle=F[U],D.fillRect(0,0,A,B),D.fillStyle=Y[U],n(I,Q-.1*g,E,h,1.2*C,c,D,1==i),D.fill(),D.beginPath(),D.fillStyle=M[U],D.arc(I+(0==i?E:-E-.4*g),Q-.65*g,.4*g,0,2*Math.PI,!0),D.fill(),j.drawImage(R,0,0),j.save(),j.strokeStyle="#000000",n(I,Q,E,h,C,c,j,1==i),j.stroke(),D.restore(),j.restore(),D.clearRect(0,0,A,B)};h(I,Q,E,0==c?.7:.5,.4*g),h(I,Q,E,0==c?.35:.25,.55*g),h(I,Q,E,0,.7*g)})(Q,s+(0==h?0:-.6*t),I,0==h?1.8*t:1.6*t,C)}c>-1&&((I,Q,E,g)=>{const c=(A,B,I,Q,Y)=>{Y.save(),Y.translate(A,B);let F=[];switch(Q){case 0:Y.beginPath(),Y.moveTo