let defaultvert="\nattribute vec3 aPosition;\nvarying vec2 vTexCoord;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nvoid main() {\n gl_Position = uProjectionMatrix * uModelViewMatrix * vec4(aPosition, 1.0);\n vTexCoord = aPosition.xy;\n}\n",goffsetfrag="\nprecision highp float;\nuniform sampler2D tex0;\nvarying vec2 vTexCoord;\nuniform vec4 uRectData[4]; \nuniform float uRectDataalpha[4]; \nfloat random(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);\n}\nfloat randomBool(float probability, vec2 st) {\n float r = random(st);\n return step(probability, r);\n}\nvoid main() {\n vec2 uv = vTexCoord;\n for (int i = 0; i < 4; i++) {\n vec2 rectStart = uRectData[i].xy;\n vec2 rectSize = uRectData[i].zw;\n if (uv.x > rectStart.x && uv.x < (rectStart.x + rectSize.x) &&\n uv.y > rectStart.y && uv.y < (rectStart.y + rectSize.y)) {\n if (uv.y <= rectStart.y + rectSize.y) {\n float applyEffect = randomBool(uRectDataalpha[i], uv);\n uv.y = applyEffect == 1.0 ? rectStart.y : uv.y;\n }\n }\n }\n vec4 color = texture2D(tex0, uv);\n gl_FragColor = color;\n}\n",kakusanfrag="\nprecision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D tex0;\nuniform vec2 uResolution;\nuniform float uIntensity;\nuniform float uSeed;\nconst float radius = 2.0;\nfloat random(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123 + uSeed);\n}\nvec3 randomColor() {\n float randomValue = fract(sin(gl_FragCoord.x * gl_FragCoord.y) * 43758.5453);\n if (randomValue < 1.0 / 5.0) {\n return vec3(1.0, 0.0, 1.0);\n } else if (randomValue < 2.0 / 5.0) {\n return vec3(0.0, 1.0, 0.0);\n } else if (randomValue < 3.0 / 5.0) {\n return vec3(0.0, 0.0, 1.0);\n } else if (randomValue < 4.0 / 5.0) {\n return vec3(0.0, 1.0, 1.0);\n } else {\n return vec3(1.0, 1.0, 0.0);\n }\n}\nvoid main() {\n vec4 color = texture2D(tex0, vTexCoord);\n float minBrightness = 1.0;\n vec2 minOffset = vec2(0.0);\n for (float y = -radius; y <= radius; y++) {\n for (float x = -radius; x <= radius; x++) {\n vec2 offset = vec2(x, y) / uResolution;\n vec4 sampleColor = texture2D(tex0, vTexCoord + offset);\n float sampleBrightness = dot(sampleColor.rgb, vec3(0.299, 0.587, 0.114));\n if (sampleBrightness < minBrightness) {\n minBrightness = sampleBrightness;\n minOffset = offset;\n }\n }\n }\n vec4 darkColor = texture2D(tex0, vTexCoord + minOffset * uIntensity);\n float threshold = 0.7;\n vec3 binaryColor = (darkColor.r >= threshold) ? vec3(1.0) : vec3(0.0);\n vec3 specifiedColor = randomColor();\n float whiteThreshold = 0.14;\n float blackThreshold = 0.01;\n bool isSpecifiedColor = (darkColor.r < whiteThreshold && darkColor.r > blackThreshold) ? true : false;\n vec3 colorColor = isSpecifiedColor ? specifiedColor : vec3(0.0);\n vec3 outputColor = binaryColor + colorColor;\n gl_FragColor = vec4(outputColor.rgb, darkColor.a);\n\n}\n",convolfrag="\nprecision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D tex0;\nuniform vec2 uPixelSize;\nuniform vec3 uKernelTop;\nuniform vec3 uKernelMiddle;\nuniform vec3 uKernelBottom;\nuniform float uDivisor;\nuniform float uAmount;\nuniform float modeab;\nvoid main() {\nvec4 origin = vec4(0.0, 0.0, 0.0, 0.0);\nvec4 color = vec4(0.0, 0.0, 0.0, 0.0);\nvec4 temp;\ntemp = texture2D(tex0, vTexCoord + vec2(-uPixelSize.x, -uPixelSize.y));\ncolor += temp * uKernelTop.x;\ntemp = texture2D(tex0, vTexCoord + vec2(0.0, -uPixelSize.y));\ncolor += temp * uKernelTop.y;\ntemp = texture2D(tex0, vTexCoord + vec2(uPixelSize.x, -uPixelSize.y));\ncolor += temp * uKernelTop.z;\ntemp = texture2D(tex0, vTexCoord + vec2(-uPixelSize.x, 0.0));\ncolor += temp * uKernelMiddle.x;\norigin = texture2D(tex0, vTexCoord);\ncolor += origin * uKernelMiddle.y;\ntemp = texture2D(tex0, vTexCoord + vec2(uPixelSize.x, 0.0));\ncolor += temp * uKernelMiddle.z;\ntemp = texture2D(tex0, vTexCoord + vec2(-uPixelSize.x, uPixelSize.y));\ncolor += temp * uKernelBottom.x;\ntemp = texture2D(tex0, vTexCoord + vec2(0.0, uPixelSize.y));\ncolor += temp * uKernelBottom.y;\ntemp = texture2D(tex0, vTexCoord + vec2(uPixelSize.x, uPixelSize.y));\ncolor += temp * uKernelBottom.z;\nif (modeab==1.0) {\n\ttemp = color / uDivisor;\n\tfloat gray = (temp.r + temp.g + temp.b) / 3.0;\n\tgl_FragColor = vec4(vec3(1. -gray), 1.0 );\n} else {\n\tgl_FragColor = mix(origin, color / uDivisor, uAmount);\n}\n}\n",colormffrag="\nprecision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D tex0;\nuniform float m[20];\nuniform float ualpha;\nvoid main() {\n\tvec4 c = texture2D(tex0, vTexCoord);\n\tif (ualpha == 0.0) {\n\t\tgl_FragColor = c;\n\t\treturn;\n\t}\n\tif (c.a > 0.0) {\n\t c.rgb /= c.a;\n\t}\n\tvec4 result;\n\tresult.r = (m[0] * c.r);\n\t\tresult.r += (m[1] * c.g);\n\t\tresult.r += (m[2] * c.b);\n\t\tresult.r += (m[3] * c.a);\n\t\tresult.r += m[4];\n\n\tresult.g = (m[5] * c.r);\n\t\tresult.g += (m[6] * c.g);\n\t\tresult.g += (m[7] * c.b);\n\t\tresult.g += (m[8] * c.a);\n\t\tresult.g += m[9];\n\n\tresult.b = (m[10] * c.r);\n\t result.b += (m[11] * c.g);\n\t result.b += (m[12] * c.b);\n\t result.b += (m[13] * c.a);\n\t result.b += m[14];\n\n\tresult.a = (m[15] * c.r);\n\t result.a += (m[16] * c.g);\n\t result.a += (m[17] * c.b);\n\t result.a += (m[18] * c.a);\n\t result.a += m[19];\n\n\tvec3 rgb = mix(c.rgb, result.rgb, ualpha);\n\trgb *= result.a;\n\tgl_FragColor = vec4(rgb, result.a);\n\n}\n",blurshdfrag="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nvarying vec2 vTexCoord;\nuniform vec2 resolution;\nuniform sampler2D image;\nuniform vec2 direction;\nuniform float btype;\nuniform float ualpha;\nuniform float timee; \nuniform float noiseScale; \nuniform float unoise; \nfloat random(vec2 st) {\n float a = dot(st, vec2(127.1, 311.7));\n float b = dot(st, vec2(269.5, 183.3));\n float c = dot(st, vec2(419.2, 371.9));\n return fract(sin(a) * 43758.5453 + sin(b) * 22578.1459 + sin(c) * 78943.6591);\n}\nfloat randomf(float st) {\n return fract(sin(st * 12.9898 + 78.233) * 43758.5453123);\n}\n\nvec4 blur13(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {\n vec4 color = vec4(0.0);\n vec2 off1 = vec2(1.411764705882353) * direction;\n vec2 off2 = vec2(3.2941176470588234) * direction;\n vec2 off3 = vec2(5.176470588235294) * direction;\n color += texture2D(image, uv) * 0.1964825501511404;\n color += texture2D(image, uv + (off1 / resolution)) * 0.2969069646728344;\n color += texture2D(image, uv - (off1 / resolution)) * 0.2969069646728344;\n color += texture2D(image, uv + (off2 / resolution)) * 0.09447039785044732;\n color += texture2D(image, uv - (off2 / resolution)) * 0.09447039785044732;\n color += texture2D(image, uv + (off3 / resolution)) * 0.010381362401148057;\n color += texture2D(image, uv - (off3 / resolution)) * 0.010381362401148057;\n return color;\n}\nvec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {\n vec4 color = vec4(0.0);\n vec2 off1 = vec2(1.3846153846) * direction;\n vec2 off2 = vec2(3.2307692308) * direction;\n color += texture2D(image, uv) * 0.2270270270;\n color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;\n color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;\n color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;\n color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;\n return color;\n}\nvec4 blur5(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {\n vec4 color = vec4(0.0);\n vec2 off1 = vec2(1.3333333333333333) * direction;\n color += texture2D(image, uv) * 0.29411764705882354;\n color += texture2D(image, uv + (off1 / resolution)) * 0.35294117647058826;\n color += texture2D(image, uv - (off1 / resolution)) * 0.35294117647058826;\n return color; \n}\n\nvoid main() {\n vec2 uv = vTexCoord;\n vec4 blur_color;\n if (btype==5.0) blur_color = blur5(image, uv, resolution, direction);\n if (btype==9.0) blur_color = blur9(image, uv, resolution, direction);\n if (btype==13.0) blur_color = blur13(image, uv, resolution, direction);\n float noiseAmount = random(uv * 0.1) * 0.0021; \n vec3 colorWithNoise = blur_color.rgb + vec3(noiseAmount);\n if (unoise == 0.0) colorWithNoise = blur_color.rgb;\n gl_FragColor = vec4(colorWithNoise.rgb, 1.0);\n\n}\n",blendfrag="\nprecision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D tex0;\nuniform sampler2D tex1;\nuniform float ualpha;\nuniform float tex0scale;\nuniform float tex1scale;\nuniform float tex0rota;\nuniform float tex1rota;\nuniform float tex1x;\nuniform float tex1y;\nuniform float modeab;\nvec3 rgb2hsl(vec3 color) {\n float fmin = min(min(color.r, color.g), color.b);\n float fmax = max(max(color.r, color.g), color.b);\n float delta = fmax - fmin;\n vec3 hsl = vec3(0.0, 0.0, (fmax + fmin) / 2.0);\n if (delta != 0.0) {\n hsl.y = (hsl.z < 0.5) ? (delta / (fmax + fmin)) : (delta / (2.0 - fmax - fmin));\n float deltaR = ((fmax - color.r) / 6.0 + delta / 2.0) / delta;\n float deltaG = ((fmax - color.g) / 6.0 + delta / 2.0) / delta;\n float deltaB = ((fmax - color.b) / 6.0 + delta / 2.0) / delta;\n float hue;\n if (color.r == fmax) hue = deltaB - deltaG;\n else if (color.g == fmax) hue = (1.0 / 3.0) + deltaR - deltaB;\n else if (color.b == fmax) hue = (2.0 / 3.0) + deltaG - deltaR;\n hsl.x = hue < 0.0 ? hue + 1.0 : (hue > 1.0 ? hue - 1.0 : hue);\n }\n return hsl;\n}\nvec3 hsl2rgb(vec3 hsl) {\n if (hsl.y == 0.0) return vec3(hsl.z);\n float f2 = hsl.z < 0.5 ? hsl.z * (1.0 + hsl.y) : (hsl.z + hsl.y) - hsl.y * hsl.z;\n float f1 = 2.0 * hsl.z - f2;\n vec3 rgb;\n for (int i = 0; i < 3; i++) {\n float h = hsl.x + float(i) / 3.0;\n h = h < 0.0 ? h + 1.0 : (h > 1.0 ? h - 1.0 : h);\n float c = 6.0 * h < 1.0 ? f1 + (f2 - f1) * 6.0 * h : (2.0 * h < 1.0 ? f2 : (3.0 * h < 2.0 ? f1 + (f2 - f1) * (2.0 / 3.0 - h) * 6.0 : f1));\n rgb[i] = c;\n }\n return rgb;\n}\nvec3 subtractBlend(vec3 src, vec3 dst) {\n return max(src - dst, 0.0);\n}\nvec3 hueBlend(vec3 src, vec3 dst) {\n vec3 srcHSL = rgb2hsl(src);\n vec3 dstHSL = rgb2hsl(dst);\n return hsl2rgb(vec3(srcHSL.r, dstHSL.g, dstHSL.b));\n}\nvec3 luminosityBlend(vec3 src, vec3 dst) {\n vec3 srcHSL = rgb2hsl(src);\n vec3 dstHSL = rgb2hsl(dst);\n return hsl2rgb(vec3(dstHSL.r, dstHSL.g, srcHSL.b));\n}\nvec3 overlayBlend(vec3 src, vec3 dst) {\n return vec3(\n (dst.r <= 0.5) ? (2.0 * src.r * dst.r) : (1.0 - 2.0 * (1.0 - dst.r) * (1.0 - src.r)),\n (dst.g <= 0.5) ? (2.0 * src.g * dst.g) : (1.0 - 2.0 * (1.0 - dst.g) * (1.0 - src.g)),\n (dst.b <= 0.5) ? (2.0 * src.b * dst.b) : (1.0 - 2.0 * (1.0 - dst.b) * (1.0 - src.b))\n );\n}\nvoid main() {\nfloat scaleFactor = tex0scale; \nfloat angle = radians(tex0rota);\nfloat scaleFactor2 = tex1scale; \nfloat angle2 = radians(tex1rota);\n vec2 center = vec2(0.5, 0.5);\n vec2 center2 = vec2(tex1x, tex1y);\n mat2 rotationMatrix = mat2(\n cos(angle), -sin(angle), sin(angle), cos(angle)\n );\n mat2 rotationMatrix2 = mat2(\n cos(angle2), -sin(angle2), sin(angle2), cos(angle2)\n );\nvec2 uv = vTexCoord - center; \nuv = uv / scaleFactor; \nuv = rotationMatrix * uv; \nuv = uv + center; \nvec2 uv2 = vTexCoord - center2; \nuv2 = uv2 / scaleFactor2;\nuv2 = rotationMatrix2 * uv2;\nuv2 = uv2 + center2;\nvec4 col0 = texture2D(tex0, uv);\nvec4 col1 = texture2D(tex1, uv2);\n if (modeab==1.0) gl_FragColor = vec4(mix(col0.rgb, subtractBlend(col0.rgb, col1.rgb), ualpha), col0.a);\n else gl_FragColor = vec4(mix(col0.rgb, hueBlend(col0.rgb, col1.rgb), ualpha), col0.a);\n}\n";class blurshd{strength=1;repetitions=1;xymag=[1,1];type=13;stagewh=[500,500];myg;sendtex;myshd;noiseee=1;constructor(){}blurset(e,t,r){this.myg=e,this.sendtex=t,this.myshd=r}blurstrength(e){this.strength=e}blurrepetitions(e){2==e&&(this.noiseee=0),this.repetitions=e}blurxymag(e,t){this.xymag[0]=e,this.xymag[1]=t}blurtype(e){this.type=e}blurstagewh(e,t){this.stagewh[0]=e,this.stagewh[1]=t}update(){for(var e=0;e<this.repetitions;e++)this.myg.shader(this.myshd),this.myshd.setUniform("resolution",this.stagewh),this.myshd.setUniform("image",this.sendtex),this.myshd.setUniform("btype",this.type),this.myshd.setUniform("direction",[this.strength*this.xymag[0],0]),this.myg.rect(-.5*this.stagewh[0],-.5*this.stagewh[1],this.stagewh[0],this.stagewh[1]),this.myg.shader(this.myshd),this.myshd.setUniform("resolution",this.stagewh),this.myshd.setUniform("image",this.sendtex),this.myshd.setUniform("btype",this.type),this.myshd.setUniform("unoise",this.noiseee),this.myshd.setUniform("direction",[0,this.strength*this.xymag[1]]),this.myshd.setUniform("timee",Math.random()),this.myg.rect(-.5*this.stagewh[0],-.5*this.stagewh[1],this.stagewh[0],this.stagewh[1])}}class colormf{preHue;postHue;hueInitialized=!1;constructor(){this.LUMA_R=.212671,this.LUMA_G=.71516,this.LUMA_B=.072169,this.LUMA_R2=.3086,this.LUMA_G2=.6094,this.LUMA_B2=.082,this.RAD=Math.PI/180,this.matrix=new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0])}concat(e){let t,r,o=new Float32Array(20),n=0;for(r=0;r<4;r++){for(t=0;t<5;t++)o[n+t]=e[n]*this.matrix[t]+e[n+1]*this.matrix[t+5]+e[n+2]*this.matrix[t+10]+e[n+3]*this.matrix[t+15]+(4===t?e[n+4]:0);n+=5}this.matrix=o}reset(){for(let e=0;e<20;e++)this.matrix[e]=e%5==4?0:e%6==0?1:0}invert(){this.concat(new Float32Array([-1,0,0,0,1,0,-1,0,0,1,0,0,-1,0,1,0,0,0,1,0]))}adjustContrast(e,t=NaN,r=NaN){isNaN(t)&&(t=e),isNaN(r)&&(r=e),e+=1,t+=1,r+=1,this.concat(new Float32Array([e,0,0,0,128*(1-e)/255,0,t,0,0,128*(1-t)/255,0,0,r,0,128*(1-r)/255,0,0,0,1,0]))}adjustBrightness(e,t=NaN,r=NaN){isNaN(t)&&(t=e),isNaN(r)&&(r=e),this.concat(new Float32Array([1,0,0,0,e/255,0,1,0,0,t/255,0,0,1,0,r/255,0,0,0,1,0]))}adjustSaturation(e){let t=1-e,r=t*this.LUMA_R,o=t*this.LUMA_G,n=t*this.LUMA_B;this.concat(new Float32Array([r+e,o,n,0,0,r,o+e,n,0,0,r,o,n+e,0,0,0,0,0,1,0]))}adjustSaturationRGB(e,t=NaN,r=NaN){isNaN(t)&&(t=e),isNaN(r)&&(r=e);let o=1-t,n=1-r,i=(1-e)*this.LUMA_R,l=o*this.LUMA_G,s=n*this.LUMA_B;this.concat(new Float32Array([i+e,l,s,0,0,i,l+t,s,0,0,i,l,s+r,0,0,0,0,0,1,0]))}toGreyscale(e,t,r){this.concat(new Float32Array([e,t,r,0,0,e,t,r,0,0,e,t,r,0,0,0,0,0,1,0]))}initHue(){let e=39.182655;if(!this.hueInitialized){this.hueInitialized=!0,this.preHue=new colormf,this.preHue.rotateRed(45),this.preHue.rotateGreen(-39.182655);let t=new Float32Array([this.LUMA_R2,this.LUMA_G2,this.LUMA_B2,1]);this.preHue.transformVector(t);let r=t[0]/t[2],o=t[1]/t[2];this.preHue.shearBlue(r,o),this.postHue=new colormf,this.postHue.shearBlue(-r,-o),this.postHue.rotateGreen(e),this.postHue.rotateRed(-45)}}rotateHue(e){this.initHue(),this.concat(this.preHue.matrix),this.rotateBlue(e),this.concat(this.postHue.matrix)}rotateRed(e){this.rotateColor(e,2,1)}rotateGreen(e){this.rotateColor(e,0,2)}rotateBlue(e){this.rotateColor(e,1,0)}rotateColor(e,t,r){e*=this.RAD;let o=new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]);o[t+5*t]=o[r+5*r]=Math.cos(e),o[r+5*t]=Math.sin(e),o[t+5*r]=-Math.sin(e),this.concat(o)}shearBlue(e,t){this.shearColor(2,0,e,1,t)}shearColor(e,t,r,o,n){let i=new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]);i[t+5*e]=r,i[o+5*e]=n,this.concat(i)}transformVector(e){if(4!==e.length)return;let t=e[0]*this.matrix[0]+e[1]*this.matrix[1]+e[2]*this.matrix[2]*this.matrix[3]+e[3]*this.matrix[4],r=e[0]*this.matrix[5]+e[1]*this.matrix[6]+e[2]*this.matrix[7]+e[3]*this.matrix[8],o=e[0]*this.matrix[10]+e[1]*this.matrix[11]+e[2]*this.matrix[12]+e[3]*this.matrix[13],n=e[0]*this.matrix[15]+e[1]*this.matrix[16]+e[2]*this.matrix[17]+e[3]*this.matrix[18];e[0]=t,e[1]=r,e[2]=o,e[3]=n}}function boxblurIntegralXY(e,t,r,o){const n=e.width,i=e.height;e.loadPixels();const l=e.pixels.slice();for(let s=0;s<o;s++){const a=new Array(n*i);for(let e=0;e<i;e++)for(let t=0;t<n;t++){const r=t+e*n,o=4*r,i=l[o]+(a[r-1]&&a[r-1].r||0)+(a[r-n]&&a[r-n].r||0)-(a[r-1-n]&&a[r-1-n].r||0),s=l[o+1]+(a[r-1]&&a[r-1].g||0)+(a[r-n]&&a[r-n].g||0)-(a[r-1-n]&&a[r-1-n].g||0),c=l[o+2]+(a[r-1]&&a[r-1].b||0)+(a[r-n]&&a[r-n].b||0)-(a[r-1-n]&&a[r-1-n].b||0);a[r]={r:i,g:s,b:c}}for(let o=0;o<i;o++)for(let l=0;l<n;l++){const s=Math.max(l-t-1,0),c=Math.min(l+t,n-1),u=Math.max(o-r-1,0),h=Math.min(o+r,i-1),f=(c-s)*(h-u),m=a[c+h*n].r-a[s+h*n].r-a[c+u*n].r+a[s+u*n].r,x=a[c+h*n].g-a[s+h*n].g-a[c+u*n].g+a[s+u*n].g,v=a[c+h*n].b-a[s+h*n].b-a[c+u*n].b+a[s+u*n].b,d=4*(l+o*n);e.pixels[d]=m/f,e.pixels[d+1]=x/f,e.pixels[d+2]=v/f,e.pixels[d+3]=255}s<o-1&&l.set(e.pixels)}e.updatePixels()}function boxblurIntegral(e,t){const r=e.width,o=e.height;e.loadPixels();const n=e.pixels.slice();let i=new Array(r*o);for(let e=0;e<o;e++)for(let t=0;t<r;t++){const o=t+e*r,l=4*o,s=n[l]+(i[o-1]&&i[o-1].r||0)+(i[o-r]&&i[o-r].r||0)-(i[o-1-r]&&i[o-1-r].r||0),a=n[l+1]+(i[o-1]&&i[o-1].g||0)+(i[o-r]&&i[o-r].g||0)-(i[o-1-r]&&i[o-1-r].g||0),c=n[l+2]+(i[o-1]&&i[o-1].b||0)+(i[o-r]&&i[o-r].b||0)-(i[o-1-r]&&i[o-1-r].b||0);i[o]={r:s,g:a,b:c}}for(let n=0;n<o;n++)for(let l=0;l<r;l++){const s=Math.max(l-t-1,0),a=Math.min(l+t,r-1),c=Math.max(n-t-1,0),u=Math.min(n+t,o-1),h=(a-s)*(u-c),f=i[a+u*r].r-i[s+u*r].r-i[a+c*r].r+i[s+c*r].r,m=i[a+u*r].g-i[s+u*r].g-i[a+c*r].g+i[s+c*r].g,x=i[a+u*r].b-i[s+u*r].b-i[a+c*r].b+i[s+c*r].b,v=4*(l+n*r);e.pixels[v]=f/h,e.pixels[v+1]=m/h,e.pixels[v+2]=x/h,e.pixels[v+3]=255}e.updatePixels()}function f_saidokaitenRGB(e){let t=sssaidor,r=0+Math.round(rotarota);e.loadPixels();for(let o=0;o<e.height;o++)for(let n=0;n<e.width;n++){let i=4*(n+o*e.width),l=e.pixels[i],s=e.pixels[i+1],a=e.pixels[i+2],[c,u,h]=RGBtoHSB(l/255,s/255,a/255);u*=l/255*t+s/255*1.1+a/255*1.1,c=(c+r/360)%1;let[f,m,x]=HSBtoRGB(c,u,h);e.pixels[i]=f,e.pixels[i+1]=m,e.pixels[i+2]=x}e.updatePixels()}let akarusa=150;function f_akarusacontra(e){akarusa>80&&(akarusa+=-1);let t=concon[0],r=concon[1],o=concon[2],n=akarusa,i=n,l=n;e.loadPixels();for(let s=0;s<e.height;s++)for(let a=0;a<e.width;a++){let c=4*(a+s*e.width);e.pixels[c]=e.pixels[c]+n,e.pixels[c+1]=e.pixels[c+1]+i,e.pixels[c+2]=e.pixels[c+2]+l,e.pixels[c]=255*((e.pixels[c]/255-.5)*t+.5),e.pixels[c+1]=255*((e.pixels[c+1]/255-.5)*r+.5),e.pixels[c+2]=255*((e.pixels[c+2]/255-.5)*o+.5),e.pixels[c]=255-e.pixels[c],e.pixels[c+1]=255-e.pixels[c+1],e.pixels[c+2]=255-e.pixels[c+2]}e.updatePixels()}function RGBtoHSB(e,t,r){let o,n,i=Math.max(e,t,r),l=Math.min(e,t,r),s=i,a=i-l;if(n=0==i?0:a/i,i==l)o=0;else{switch(i){case e:o=(t-r)/a+(t<r?6:0);break;case t:o=(r-e)/a+2;break;case r:o=(e-t)/a+4}o/=6}return[o,n,s]}function HSBtoRGB(e,t,r){let o,n,i,l=Math.floor(6*e),s=6*e-l,a=r*(1-t),c=r*(1-s*t),u=r*(1-(1-s)*t);switch(l%6){case 0:o=r,n=u,i=a;break;case 1:o=c,n=r,i=a;break;case 2:o=a,n=r,i=u;break;case 3:o=a,n=c,i=r;break;case 4:o=u,n=a,i=r;break;case 5:o=r,n=a,i=c}return[Math.round(255*o),Math.round(255*n),Math.round(255*i)]}function bmpdraw(e,t,r,o){let n=createGraphics(t.width,t.height);n.image(e,0,0),n.tint(255,255,255,255*r),n.blendMode(o),n.image(t,0,0),e.clear(),e.drawingContext.drawImage(n.elt,0,0),n.clear(),n.remove(),n=null}function f_blend_diffe(e,t,r){e.loadPixels(),t.loadPixels();const o=r;for(let r=0;r<e.pixels.length;r+=4){let n=e.pixels[r],i=e.pixels[r+1],l=e.pixels[r+2],s=t.pixels[r],a=t.pixels[r+1],c=t.pixels[r+2],u=abs(n-s),h=abs(i-a),f=abs(l-c),m=o/255,x=1-m;e.pixels[r]=n*x+u*m,e.pixels[r+1]=i*x+h*m,e.pixels[r+2]=l*x+f*m}e.updatePixels()}function f_blend_alp(e,t,r){e.loadPixels(),t.loadPixels();const o=r;for(let r=0;r<e.pixels.length;r+=4){let n=e.pixels[r],i=e.pixels[r+1],l=e.pixels[r+2],s=e.pixels[r+3],a=t.pixels[r],c=t.pixels[r+1],u=t.pixels[r+2],h=t.pixels[r+3],f=o/255,m=1-f;e.pixels[r]=n*m+a*f,e.pixels[r+1]=i*m+c*f,e.pixels[r+2]=l*m+u*f,e.pixels[r+3]=s*m+h*f}e.updatePixels()}
↓ show full (19,818 bytes)