diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..59ae3af --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +lightward.tv \ No newline at end of file diff --git a/dist/aura.js b/dist/aura.js new file mode 100644 index 0000000..113c99e --- /dev/null +++ b/dist/aura.js @@ -0,0 +1,18 @@ +var LightwardAura=function(){"use strict"; +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */function n(n,e,t){if(t||2===arguments.length)for(var r,o=0,i=e.length;o>>0,e=(r*=e)>>>0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e>>>0)});t.next=function(){var n=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=n-(t.c=0|n)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(n),t.s0<0&&(t.s0+=1),t.s1-=r(n),t.s1<0&&(t.s1+=1),t.s2-=r(n),t.s2<0&&(t.s2+=1),r=null}function o(n,e){return e.c=n.c,e.s0=n.s0,e.s1=n.s1,e.s2=n.s2,e}function i(n,e){var t=new r(n),i=e&&e.state,a=t.next;return a.int32=function(){return 4294967296*t.next()|0},a.double=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.quick=a,i&&("object"==typeof i&&o(i,t),a.state=function(){return o(t,{})}),a}e&&e.exports?e.exports=i:t&&t.amd?t((function(){return i})):this.alea=i})(0,t,!1);var r={exports:{}};!function(n){!function(n,e,t){function r(n){var e=this,t="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var n=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^n^n>>>8},n===(0|n)?e.x=n:t+=n;for(var r=0;r>>0)/4294967296};return a.double=function(){do{var n=((t.next()>>>11)+(t.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},a.int32=t.next,a.quick=a,i&&("object"==typeof i&&o(i,t),a.state=function(){return o(t,{})}),a}e&&e.exports?e.exports=i:t&&t.amd?t((function(){return i})):this.xor128=i}(0,n,!1)}(r);var o={exports:{}};!function(n){!function(n,e,t){function r(n){var e=this,t="";e.next=function(){var n=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^n^n<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,n===(0|n)?e.x=n:t+=n;for(var r=0;r>>4),e.next()}function o(n,e){return e.x=n.x,e.y=n.y,e.z=n.z,e.w=n.w,e.v=n.v,e.d=n.d,e}function i(n,e){var t=new r(n),i=e&&e.state,a=function(){return(t.next()>>>0)/4294967296};return a.double=function(){do{var n=((t.next()>>>11)+(t.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},a.int32=t.next,a.quick=a,i&&("object"==typeof i&&o(i,t),a.state=function(){return o(t,{})}),a}e&&e.exports?e.exports=i:t&&t.amd?t((function(){return i})):this.xorwow=i}(0,n,!1)}(o);var i={exports:{}};!function(n){!function(n,e,t){function r(n){var e=this;e.next=function(){var n,t,r=e.x,o=e.i;return n=r[o],t=(n^=n>>>7)^n<<24,t^=(n=r[o+1&7])^n>>>10,t^=(n=r[o+3&7])^n>>>3,t^=(n=r[o+4&7])^n<<7,n=r[o+7&7],t^=(n^=n<<13)^n<<9,r[o]=t,e.i=o+1&7,t},function(n,e){var t,r=[];if(e===(0|e))r[0]=e;else for(e=""+e,t=0;t0;--t)n.next()}(e,n)}function o(n,e){return e.x=n.x.slice(),e.i=n.i,e}function i(n,e){null==n&&(n=+new Date);var t=new r(n),i=e&&e.state,a=function(){return(t.next()>>>0)/4294967296};return a.double=function(){do{var n=((t.next()>>>11)+(t.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},a.int32=t.next,a.quick=a,i&&(i.x&&o(i,t),a.state=function(){return o(t,{})}),a}e&&e.exports?e.exports=i:t&&t.amd?t((function(){return i})):this.xorshift7=i}(0,n,!1)}(i);var a={exports:{}};!function(n){!function(n,e,t){function r(n){var e=this;e.next=function(){var n,t,r=e.w,o=e.X,i=e.i;return e.w=r=r+1640531527|0,t=o[i+34&127],n=o[i=i+1&127],t^=t<<13,n^=n<<17,t^=t>>>15,n^=n>>>12,t=o[i]=t^n,e.i=i,t+(r^r>>>16)|0},function(n,e){var t,r,o,i,a,c=[],s=128;for(e===(0|e)?(r=e,e=null):(e+="\0",r=0,s=Math.max(s,e.length)),o=0,i=-32;i>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(t=c[127&i]^=r+a)?o+1:0);for(o>=128&&(c[127&(e&&e.length||0)]=-1),o=127,i=512;i>0;--i)r=c[o+34&127],t=c[o=o+1&127],r^=r<<13,t^=t<<17,r^=r>>>15,t^=t>>>12,c[o]=r^t;n.w=a,n.X=c,n.i=o}(e,n)}function o(n,e){return e.i=n.i,e.w=n.w,e.X=n.X.slice(),e}function i(n,e){null==n&&(n=+new Date);var t=new r(n),i=e&&e.state,a=function(){return(t.next()>>>0)/4294967296};return a.double=function(){do{var n=((t.next()>>>11)+(t.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},a.int32=t.next,a.quick=a,i&&(i.X&&o(i,t),a.state=function(){return o(t,{})}),a}e&&e.exports?e.exports=i:t&&t.amd?t((function(){return i})):this.xor4096=i}(0,n,!1)}(a);var c={exports:{}};!function(n){!function(n,e,t){function r(n){var e=this,t="";e.next=function(){var n=e.b,t=e.c,r=e.d,o=e.a;return n=n<<25^n>>>7^t,t=t-r|0,r=r<<24^r>>>8^o,o=o-n|0,e.b=n=n<<20^n>>>12^t,e.c=t=t-r|0,e.d=r<<16^t>>>16^o,e.a=o-n|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,n===Math.floor(n)?(e.a=n/4294967296|0,e.b=0|n):t+=n;for(var r=0;r>>0)/4294967296};return a.double=function(){do{var n=((t.next()>>>11)+(t.next()>>>0)/4294967296)/(1<<21)}while(0===n);return n},a.int32=t.next,a.quick=a,i&&("object"==typeof i&&o(i,t),a.state=function(){return o(t,{})}),a}e&&e.exports?e.exports=i:t&&t.amd?t((function(){return i})):this.tychei=i}(0,n,!1)}(c);var s={exports:{}};!function(n){!function(e,t,r){var o,i=256,a=r.pow(i,6),c=r.pow(2,52),s=2*c,l=255;function u(n,l,u){var p=[],y=x(v((l=1==l?{entropy:!0}:l||{}).entropy?[n,m(t)]:null==n?function(){try{var n;return o&&(n=o.randomBytes)?n=n(i):(n=new Uint8Array(i),(e.crypto||e.msCrypto).getRandomValues(n)),m(n)}catch(n){var r=e.navigator,a=r&&r.plugins;return[+new Date,e,a,e.screen,m(t)]}}():n,3),p),h=new d(p),b=function(){for(var n=h.g(6),e=a,t=0;n=s;)n/=2,e/=2,t>>>=1;return(n+t)/e};return b.int32=function(){return 0|h.g(4)},b.quick=function(){return h.g(4)/4294967296},b.double=b,x(m(h.S),t),(l.pass||u||function(n,e,t,o){return o&&(o.S&&f(o,h),n.state=function(){return f(h,{})}),t?(r.random=n,e):n})(b,y,"global"in l?l.global:this==r,l.state)}function d(n){var e,t=n.length,r=this,o=0,a=r.i=r.j=0,c=r.S=[];for(t||(n=[t++]);o0)throw new Error(`Can not guess numComponents for attribute '${n}'. Tried ${t} but ${e} values is not evenly divisible by ${t}. You should specify it.`);return t}function S(n,e){if(b(n))return n;if(b(n.data))return n.data;Array.isArray(n)&&(n={data:n});let t=n.type;return t||(t=A(e)?Uint16Array:Float32Array),new t(n.data)}function C(n,e){const t={};return Object.keys(e).forEach((function(r){if(!A(r)){const i=e[r],a=i.attrib||i.name||i.attribName||w+r;if(i.value){if(!Array.isArray(i.value)&&!b(i.value))throw new Error("array.value is not array or typedarray");t[a]={value:i.value}}else{let e,c,s,l;if(i.buffer&&i.buffer instanceof WebGLBuffer)e=i.buffer,l=i.numComponents||i.size,c=i.type,s=i.normalize;else if("number"==typeof i||"number"==typeof i.data){const t=i.data||i,a=i.type||Float32Array,u=t*a.BYTES_PER_ELEMENT;c=function(n){if(n===Int8Array)return 5120;if(n===Uint8Array)return y;if(n===Uint8ClampedArray)return y;if(n===Int16Array)return 5122;if(n===Uint16Array)return 5123;if(n===Int32Array)return 5124;if(n===Uint32Array)return 5125;if(n===Float32Array)return 5126;throw new Error("unsupported typed array type")}(a),s=void 0!==i.normalize?i.normalize:(o=a)===Int8Array||o===Uint8Array,l=i.numComponents||i.size||E(r,t),e=n.createBuffer(),n.bindBuffer(z,e),n.bufferData(z,u,i.drawType||35044)}else{const t=S(i,r);e=T(n,t,void 0,i.drawType),c=h(t),s=void 0!==i.normalize?i.normalize:function(n){return n instanceof Int8Array||n instanceof Uint8Array}(t),l=function(n,e){return n.numComponents||n.size||E(e,function(n){return n.length?n:n.data}(n).length)}(i,r)}t[a]={buffer:e,numComponents:l,type:c,normalize:s,stride:i.stride||0,offset:i.offset||0,divisor:void 0===i.divisor?void 0:i.divisor,drawType:i.drawType}}}var o})),n.bindBuffer(z,null),t}const D=["position","positions","a_position"];function F(n,e,t){const r=C(n,e),o=Object.assign({},t||{});o.attribs=Object.assign({},t?t.attribs:{},r);const i=e.indices;if(i){const e=S(i,"indices");o.indices=T(n,e,34963),o.numElements=e.length,o.elementType=h(e)}else o.numElements||(o.numElements=function(n,e){let t,r;for(r=0;r{const o=parseInt(n[1]),i=r[t+1],a=i?i.index:e.length;return[o-1,e.substring(n.index,a)]})));return n.split("\n").map(((n,e)=>{const r=o.get(e);return`${e+1+t}: ${n}${r?`\n\n^^^ ${r}`:""}`})).join("\n")}const sn=/^[ \t]*\n/;function ln(n,e,t,r){const o=r||k,i=n.createShader(t);let a=0;sn.test(e)&&(a=1,e=e.replace(sn,"")),n.shaderSource(i,e),n.compileShader(i);if(!n.getShaderParameter(i,35713)){const r=n.getShaderInfoLog(i);return o(`${cn(e,r,a)}\nError compiling ${M(n,t)}: ${r}`),n.deleteShader(i),null}return i}function un(n,e,t){let r,o;if("function"==typeof e&&(t=e,e=void 0),"function"==typeof n)t=n,n=void 0;else if(n&&!Array.isArray(n)){if(n.errorCallback)return n;const e=n;t=e.errorCallback,n=e.attribLocations,r=e.transformFeedbackVaryings,o=e.transformFeedbackMode}const i={errorCallback:t||k,transformFeedbackVaryings:r,transformFeedbackMode:o};if(n){let t={};Array.isArray(n)?n.forEach((function(n,r){t[n]=e?e[r]:r})):t=n,i.attribLocations=t}return i}const dn=["VERTEX_SHADER","FRAGMENT_SHADER"];function fn(n,e){e.forEach((function(e){n.deleteShader(e)}))}function vn(n,e,t,r,o){const i=un(t,r,o),a=[];for(let t=0;t=0?35632:s.indexOf("vert")>=0?35633:void 0)||a),r=ln(n,o,a,i.errorCallback),c.push(r)}"undefined"!=typeof WebGLShader&&r instanceof WebGLShader&&a.push(r)}var s;if(a.length!==e.length)return i.errorCallback("not enough shaders for program"),fn(n,c),null;const l=n.createProgram();a.forEach((function(e){n.attachShader(l,e)})),i.attribLocations&&Object.keys(i.attribLocations).forEach((function(e){n.bindAttribLocation(l,i.attribLocations[e],e)}));let u=i.transformFeedbackVaryings;if(u&&(u.attribs&&(u=u.attribs),Array.isArray(u)||(u=Object.keys(u)),n.transformFeedbackVaryings(l,u,i.transformFeedbackMode||35981)),n.linkProgram(l),!n.getProgramParameter(l,35714)){const e=n.getProgramInfoLog(l);return i.errorCallback(`${a.map((e=>{const t=cn(n.getShaderSource(e),"",0),r=n.getShaderParameter(e,n.SHADER_TYPE);return`${M(n,r)}\n${t}}`})).join("\n")}\nError in program linking: ${e}`),n.deleteProgram(l),fn(n,c),null}return l}(n,a,i)}function xn(n){const e=n.name;return e.startsWith("gl_")||e.startsWith("webgl_")}const mn=/(\.|\[|]|\w+)/g;function pn(n,e,t,r){const o=n.split(mn).filter((n=>""!==n));let i=0,a="";for(;;){const n=o[i++];a+=n;const s=(c=n[0])>="0"&&c<="9",l=s?parseInt(n):n;s&&(a+=o[i++]);if(i===o.length){t[l]=e;break}{const n=o[i++],e="["===n,c=t[l]||(e?[]:{});t[l]=c,t=c,r[a]=r[a]||function(n){return function(e){yn(n,e)}}(c),a+=n}}var c}function yn(n,e){for(const t in e){const r=n[t];"function"==typeof r?r(e[t]):yn(n[t],e[t])}}function hn(n,...e){const t=n.uniformSetters||n,r=e.length;for(let n=0;n> 13) ^ n;\n int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;\n return 1.0 - (float(nn) / 1073741824.0);\n }\n\n// vec4 intToSeedVec(uint seed) {\n// vec4 iSeedVec = vec4((seed / uvec4(1, 256, 65536, 16777216)) & uvec4(255));\n// return trunc(iSeedVec * (1.0 / 9.0)) * 10.0 + fract(iSeedVec * (1.0 / 9.0)) * 9.0 + 1.0; // Skip multiples of 9\n// }\n\n\n\n\n#endif\n\n#ifndef HASH_3\n#define HASH_3\n\n#define hashi(x) lowbias32(x)\n// #define hashi(x) triple32(x)\n\n #define hash(x) ( float( hashi(x) ) / float( 0xffffffffU ) )\n\nuint lowbias32(uint x)\n{\n x ^= x >> 16;\n x *= 0x7feb352dU;\n x ^= x >> 15;\n x *= 0x846ca68bU;\n x ^= x >> 16;\n return x;\n}\n\nuint triple32(uint x)\n{\n x ^= x >> 17;\n x *= 0xed5ad4bbU;\n x ^= x >> 11;\n x *= 0xac4c1b51U;\n x ^= x >> 15;\n x *= 0x31848babU;\n x ^= x >> 14;\n return x;\n}\n\n\n\n#endif\n\n",_n=`\n#version 300 es\nprecision highp float;\n\n#define linearstep(edge0, edge1, x) min(max((x - edge0)/(edge1 - edge0), 0.0), 1.0)\n\n${An}\n${`\n#ifndef LAB_COLORSPACE\n#define LAB_COLORSPACE\n\n#ifndef saturate\n#define saturate(v) clamp(v, 0.,1.)\n#endif\n\n${An}\n\n//Lifted from https://code.google.com/p/flowabs/source/browse/glsl/?r=f36cbdcf7790a28d90f09e2cf89ec9a64911f138\nvec3 lab2xyz( vec3 c ) {\n float fy = ( c.x + 16.0 ) / 116.0;\n float fx = c.y / 500.0 + fy;\n float fz = fy - c.z / 200.0;\n return vec3(\n 95.047 * (( fx > 0.206897 ) ? fx * fx * fx : ( fx - 16.0 / 116.0 ) / 7.787),\n 100.000 * (( fy > 0.206897 ) ? fy * fy * fy : ( fy - 16.0 / 116.0 ) / 7.787),\n 108.883 * (( fz > 0.206897 ) ? fz * fz * fz : ( fz - 16.0 / 116.0 ) / 7.787)\n );\n}\n\nvec3 xyz2rgb( vec3 c ) {\n vec3 v = c / 100.0 * mat3(\n 3.2406, -1.5372, -0.4986,\n -0.9689, 1.8758, 0.0415,\n 0.0557, -0.2040, 1.0570\n );\n vec3 r;\n r.x = ( v.r > 0.0031308 ) ? (( 1.055 * pow( v.r, ( 1.0 / 2.4 ))) - 0.055 ) : 12.92 * v.r;\n r.y = ( v.g > 0.0031308 ) ? (( 1.055 * pow( v.g, ( 1.0 / 2.4 ))) - 0.055 ) : 12.92 * v.g;\n r.z = ( v.b > 0.0031308 ) ? (( 1.055 * pow( v.b, ( 1.0 / 2.4 ))) - 0.055 ) : 12.92 * v.b;\n return r;\n}\n\nvec3 rgb2xyz( vec3 c ) {\n vec3 tmp;\n tmp.x = ( c.r > 0.04045 ) ? pow( ( c.r + 0.055 ) / 1.055, 2.4 ) : c.r / 12.92;\n tmp.y = ( c.g > 0.04045 ) ? pow( ( c.g + 0.055 ) / 1.055, 2.4 ) : c.g / 12.92,\n tmp.z = ( c.b > 0.04045 ) ? pow( ( c.b + 0.055 ) / 1.055, 2.4 ) : c.b / 12.92;\n return 100.0 * tmp *\n mat3( 0.4124, 0.3576, 0.1805,\n 0.2126, 0.7152, 0.0722,\n 0.0193, 0.1192, 0.9505 );\n}\n\nvec3 xyz2lab( vec3 c ) {\n vec3 n = c / vec3( 95.047, 100, 108.883 );\n vec3 v;\n v.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );\n v.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );\n v.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );\n return vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));\n}\n\nvec3 rgb2lab(vec3 c) {\n vec3 lab = xyz2lab( rgb2xyz( c ) );\n return vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));\n}\n\nvec3 lab2rgb(vec3 c) {\n return xyz2rgb( lab2xyz( vec3(100.0 * c.x, 2.0 * 127.0 * (c.y - 0.5), 2.0 * 127.0 * (c.z - 0.5)) ) );\n}\n\nvec3 lab2rgb2(vec3 c)\n{\n float l = c.r;\n float a = c.g;\n float b = c.b;\n\n vec3 rgb = vec3(0.);\n\n float y = (l+16.)/116.;\n float x = a/500. + y;\n float z = y - b/200.;\n\n y = pow(y, 3.) > 0.008856 ? pow(y,3.) : (y-16./116.)/7.787;\n x = pow(x, 3.) > 0.008856 ? pow(x,3.) : (x-16./116.)/7.787;\n z = pow(z, 3.) > 0.008856 ? pow(z,3.) : (z-16./116.)/7.787;\n\n x *= 95.047;\n y *= 100.;\n z *= 108.883;\n\n x /= 100.;\n y /= 100.;\n z /= 100.;\n\n float R = x * 3.2406 + y * -1.5372 + z * -0.4986;\n float G = x * -0.9689 + y * 1.8758 + z * 0.0415;\n float B = x * 0.0557 + y * -0.2040 + z * 1.0570;\n\n R = R > 0.0031308 ? 1.055 * pow(R , ( 1. / 2.4 )) - 0.055 : 12.92 * R;\n G = G > 0.0031308 ? 1.055 * pow(G , ( 1. / 2.4 )) - 0.055 : 12.92 * G;\n B = B > 0.0031308 ? 1.055 * pow(B , ( 1. / 2.4 )) - 0.055 : 12.92 * B;\n\n return vec3(R, G, B);\n\n}\n\nvec3 oklab_mix_2(vec3 colA, vec3 colB, float h)\n{\n return lab2rgb(mix(rgb2lab(colA), rgb2lab(colB), h));\n}\n\n// See here: https://www.shadertoy.com/view/ttcyRS\nvec3 oklab_mix( vec3 colA, vec3 colB, float h )\n{\n // https://bottosson.github.io/posts/oklab\n const mat3 kCONEtoLMS = mat3(\n 0.4121656120, 0.2118591070, 0.0883097947,\n 0.5362752080, 0.6807189584, 0.2818474174,\n 0.0514575653, 0.1074065790, 0.6302613616);\n const mat3 kLMStoCONE = mat3(\n 4.0767245293, -1.2681437731, -0.0041119885,\n -3.3072168827, 2.6093323231, -0.7034763098,\n 0.2307590544, -0.3411344290, 1.7068625689);\n\n // rgb to cone (arg of pow can't be negative)\n vec3 lmsA = pow( kCONEtoLMS*colA, vec3(1.0/3.0) );\n vec3 lmsB = pow( kCONEtoLMS*colB, vec3(1.0/3.0) );\n // lerp\n vec3 lms = mix( lmsA, lmsB, h );\n // gain in the middle (no oaklab anymore, but looks better?)\n lms *= 1.0+0.2*h*(1.0-h);\n // cone to rgb\n return kLMStoCONE*(lms*lms*lms);\n}\n#endif\n`}\nconst int MAX_COLORS = 10;\n\nuniform vec2 resolution;\nuniform vec3 color1;\nuniform vec3 color2;\nuniform vec3 color3;\nuniform vec3 color4;\nuniform vec3 color5;\n\nuniform vec3 colors[MAX_COLORS];\n\nuniform int numColors;\n\nin vec4 fragUV;\nout vec4 FragColor;\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / resolution;\n uv.x += .001*rand(uv);\n\n vec3 c1 = color1 / vec3(255.0);\n vec3 c2 = color2 / vec3(255.0);\n vec3 c3 = color3 / vec3(255.);\n vec3 c4 = color4 / vec3(255.);\n vec3 c5 = color5 / vec3(255.);\n\n vec3 lab1 = rgb2lab(colors[0]/255.);\n vec3 lab2 = rgb2lab(colors[1]/255.);\n vec3 lab3 = rgb2lab(c3);\n vec3 lab4 = rgb2lab(c4);\n vec3 lab5 = rgb2lab(c5);\n\n float nCol= float(numColors);\n float step = 1./(nCol-1.);\n\n\n\n // vec3 labOut = oklab_mix(lab1, lab2, linearstep(0.*step, 1.*step, uv.x));\n float dither = rand(uv)*.001;\n vec3 col = mix(rgb2lab(colors[0]/255.), rgb2lab(colors[1]/255.), linearstep(0.*step, 1.*step, uv.x + dither));\n\n for(int i = 2; i < MAX_COLORS; i++)\n {\n // break early when done\n if(i >= numColors) break;\n\n vec3 nextLab = rgb2lab(colors[i]/255.);\n\n col = mix(col, nextLab, linearstep(float(i-1)*step, float(i)*step, uv.x)+ dither);\n }\n\n col = lab2rgb(col);\n // linear to gamma\n col = pow( col, vec3(0.4545) );\n\n\n FragColor.rgb = (col);\n}\n`,Pn="\n#version 300 es\n\nin vec4 position;\nin vec2 texCoord;\n\n\nout vec4 fragUV;\n\nvoid main() {\n gl_Position = position;\n\n vec2 uv = position.xy;\n uv = position.xy * 0.5 + 0.5;\n// uv = vec2(position.x ,0.);\n// uv = position.xy;\n// uv = texCoord;\nuv = vec2(1.,0.);\n fragUV = vec4(uv, 0., 0.);\n}\n",En="\n#ifndef saturate\n#define saturate(v) clamp(v, 0., 1.)\n#endif\n",Sn=`\n#version 300 es\n\n#if __VERSION__ > 130\n#define texture2D texture\n#endif\n\nprecision mediump float;\n\n${`\n\n#ifndef SHAPES_GLSL\n#define SHAPES_GLSL\n\nfloat dot2( in vec2 v ) { return dot(v,v); }\nfloat ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; }\n\n#define PI 3.14159265358979323846\n#define TWOPI 2.*PI\n#define RAD2DEG (180.0/PI)\n#define DEG2RAD (PI/180.)\n\nfloat sminCubic( float a, float b, float k )\n{\n float h = max( k-abs(a-b), 0.0 )/k;\n return min( a, b ) - h*h*h*k*(1.0/6.0);\n}\n\nfloat sdCircle( vec2 p, float r )\n{\n return length(p) - r;\n}\n\nfloat sdRoundedBox( in vec2 p, in vec2 b, in vec4 r )\n{\n r.xy = (p.x>0.0)?r.xy : r.zw;\n r.x = (p.y>0.0)?r.x : r.y;\n vec2 q = abs(p)-b+r.x;\n return min(max(q.x,q.y),0.0) + length(max(q,0.0)) - r.x;\n}\n\nfloat sdBox( in vec2 p, in vec2 b )\n{\n vec2 d = abs(p)-b;\n return length(max(d,0.0)) + min(max(d.x,d.y),0.0);\n}\n\nfloat sdOrientedBox( in vec2 p, in vec2 a, in vec2 b, float th )\n{\n float l = length(b-a);\n vec2 d = (b-a)/l;\n vec2 q = (p-(a+b)*0.5);\n q = mat2(d.x,-d.y,d.y,d.x)*q;\n q = abs(q)-vec2(l,th)*0.5;\n return length(max(q,0.0)) + min(max(q.x,q.y),0.0);\n}\n\nfloat sdEquilateralTriangle( in vec2 p )\n{\n const float k = sqrt(3.0);\n p.x = abs(p.x) - 1.0;\n p.y = p.y + 1.0/k;\n if( p.x+k*p.y>0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;\n p.x -= clamp( p.x, -2.0, 0.0 );\n return -length(p)*sign(p.y);\n}\n\nfloat sdRhombus( in vec2 p, in vec2 b )\n{\n p = abs(p);\n float h = clamp( ndot(b-2.0*p,b)/dot(b,b), -1.0, 1.0 );\n float d = length( p-0.5*b*vec2(1.0-h,1.0+h) );\n return d * sign( p.x*b.y + p.y*b.x - b.x*b.y );\n}\n\nfloat sdTrapezoid( in vec2 p, in float r1, float r2, float he )\n{\n vec2 k1 = vec2(r2,he);\n vec2 k2 = vec2(r2-r1,2.0*he);\n p.x = abs(p.x);\n vec2 ca = vec2(p.x-min(p.x,(p.y<0.0)?r1:r2), abs(p.y)-he);\n vec2 cb = p - k1 + k2*clamp( dot(k1-p,k2)/dot2(k2), 0.0, 1.0 );\n float s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0;\n return s*sqrt( min(dot2(ca),dot2(cb)) );\n}\n\nfloat sdParallelogram( in vec2 p, float wi, float he, float sk )\n{\n vec2 e = vec2(sk,he);\n p = (p.y<0.0)?-p:p;\n vec2 w = p - e; w.x -= clamp(w.x,-wi,wi);\n vec2 d = vec2(dot(w,w), -w.y);\n float s = p.x*e.y - p.y*e.x;\n p = (s<0.0)?-p:p;\n vec2 v = p - vec2(wi,0); v -= e*clamp(dot(v,e)/dot(e,e),-1.0,1.0);\n d = min( d, vec2(dot(v,v), wi*he-abs(s)));\n return sqrt(d.x)*sign(-d.y);\n}\n\nvec2 translate(vec2 p, vec2 t)\n{\n\treturn p - t;\n}\n\nvec3 translate(vec3 p, vec3 t)\n{\n return p - t;\n}\n\nvec2 scale(vec2 p, float zoom)\n{\n p *= zoom;\n return p;\n}\n\nvec2 scale(vec2 p, vec2 origin, float zoom)\n{\n p -= origin;\n p *= zoom;\n p += origin;\n\n return p;\n}\n\nvec2 rotate(vec2 p, float a)\n{\n mat2 m = mat2(cos(a),sin(a),-sin(a),cos(a));\n return p*m;\n}\n\nvec2 rotate(vec2 p, vec2 origin, float a)\n{\n p -= origin;\n mat2 m = mat2(cos(a),sin(a),-sin(a),cos(a));\n return p*m + origin;\n}\n\n#endif\n\n${An}\n//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : stegu\n// Lastmod : 20201014 (stegu)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n// https://github.com/stegu/webgl-noise\n//\n\n#ifndef MOD289_3\n#define MOD289_3\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n#endif\n\n#ifndef MOD289_4\n#define MOD289_4\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n#endif\n\n#ifndef PERMUTE_4\n#define PERMUTE_4\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+10.0)*x);\n}\n#endif\n\n#ifndef TAYLORINVSQRT\n#define TAYLORINVSQRT\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n#endif\n\nfloat snoise(vec3 v, out vec3 gradient)\n{\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n// First corner\n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n\n// Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min( g.xyz, l.zxy );\n vec3 i2 = max( g.xyz, l.zxy );\n\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\n// Permutations\n i = mod289(i);\n vec4 p = permute( permute( permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\n// Gradients: 7x7 points over a square, mapped onto an octahedron.\n// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n\n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n\n//Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n// Mix final noise value\n vec4 m = max(0.5 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n vec4 m2 = m * m;\n vec4 m4 = m2 * m2;\n vec4 pdotx = vec4(dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3));\n\n// Determine noise gradient\n vec4 temp = m2 * m * pdotx;\n gradient = -8.0 * (temp.x * x0 + temp.y * x1 + temp.z * x2 + temp.w * x3);\n gradient += m4.x * p0 + m4.y * p1 + m4.z * p2 + m4.w * p3;\n gradient *= 105.0;\n\n return 105.0 * dot(m4, pdotx);\n}\n\n\n//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : stegu\n// Lastmod : 20201014 (stegu)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n// https://github.com/stegu/webgl-noise\n//\n\n#ifndef MOD289_3\n#define MOD289_3\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n#endif\n\n#ifndef MOD289_4\n#define MOD289_4\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n#endif\n\n#ifndef PERMUTE_4\n#define PERMUTE_4\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+10.0)*x);\n}\n#endif\n\n#ifndef TAYLORINVSQRT\n#define TAYLORINVSQRT\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n#endif\n\nfloat snoise(vec3 v)\n {\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n// First corner\n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n\n// Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min( g.xyz, l.zxy );\n vec3 i2 = max( g.xyz, l.zxy );\n\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\n// Permutations\n i = mod289(i);\n vec4 p = permute( permute( permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\n// Gradients: 7x7 points over a square, mapped onto an octahedron.\n// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n\n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n\n//Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n// Mix final noise value\n vec4 m = max(0.5 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 105.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),\n dot(p2,x2), dot(p3,x3) ) );\n }\n \n${En}\n\n// #version 120\n\n// Cellular noise ("Worley noise") in 3D in GLSL.\n// Copyright (c) Stefan Gustavson 2011-04-19. All rights reserved.\n// This code is released under the conditions of the MIT license.\n// See LICENSE file for details.\n// https://github.com/stegu/webgl-noise\n\n#ifndef MOD289_3\n#define MOD289_3\n// Modulo 289 without a division (only multiplications)\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n#endif\n\n#ifndef MOD289_4\n#define MOD289_4\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n#endif\n\n#ifndef MOD7_4\n#define MOD7_4\n// Modulo 7 without a division\nvec4 mod7(vec4 x) {\n return x - floor(x * (1.0 / 7.0)) * 7.0;\n}\n#endif\n\n#ifndef PERMUTE_3\n#define PERMUTE_3\n// Permutation polynomial: (34x^2 + 6x) mod 289\nvec3 permute(vec3 x) {\n return mod289((34.0 * x + 10.0) * x);\n}\n#endif\n\n#ifndef PERMUTE_4\n#define PERMUTE_4\nvec4 permute(vec4 x) {\n return mod289((34.0 * x + 10.0) * x);\n}\n#endif\n\n// Cellular noise, returning F1 and F2 in a vec2.\n// Speeded up by using 2x2x2 search window instead of 3x3x3,\n// at the expense of some pattern artifacts.\n// F2 is often wrong and has sharp discontinuities.\n// If you need a good F2, use the slower 3x3x3 version.\nvec2 cellular2x2x2(vec3 P) {\n#define K 0.142857142857 // 1/7\n#define Ko 0.428571428571 // 1/2-K/2\n#define K2 0.020408163265306 // 1/(7*7)\n#define Kz 0.166666666667 // 1/6\n#define Kzo 0.416666666667 // 1/2-1/6*2\n#define jitter 0.8 // smaller jitter gives less errors in F2\n\tvec3 Pi = mod289(floor(P));\n \tvec3 Pf = fract(P);\n\tvec4 Pfx = Pf.x + vec4(0.0, -1.0, 0.0, -1.0);\n\tvec4 Pfy = Pf.y + vec4(0.0, 0.0, -1.0, -1.0);\n\tvec4 p = permute(Pi.x + vec4(0.0, 1.0, 0.0, 1.0));\n\tp = permute(p + Pi.y + vec4(0.0, 0.0, 1.0, 1.0));\n\tvec4 p1 = permute(p + Pi.z); // z+0\n\tvec4 p2 = permute(p + Pi.z + vec4(1.0)); // z+1\n\tvec4 ox1 = fract(p1*K) - Ko;\n\tvec4 oy1 = mod7(floor(p1*K))*K - Ko;\n\tvec4 oz1 = floor(p1*K2)*Kz - Kzo; // p1 < 289 guaranteed\n\tvec4 ox2 = fract(p2*K) - Ko;\n\tvec4 oy2 = mod7(floor(p2*K))*K - Ko;\n\tvec4 oz2 = floor(p2*K2)*Kz - Kzo;\n\tvec4 dx1 = Pfx + jitter*ox1;\n\tvec4 dy1 = Pfy + jitter*oy1;\n\tvec4 dz1 = Pf.z + jitter*oz1;\n\tvec4 dx2 = Pfx + jitter*ox2;\n\tvec4 dy2 = Pfy + jitter*oy2;\n\tvec4 dz2 = Pf.z - 1.0 + jitter*oz2;\n\tvec4 d1 = dx1 * dx1 + dy1 * dy1 + dz1 * dz1; // z+0\n\tvec4 d2 = dx2 * dx2 + dy2 * dy2 + dz2 * dz2; // z+1\n\n\t// Sort out the two smallest distances (F1, F2)\n#if 0\n\t// Cheat and sort out only F1\n\td1 = min(d1, d2);\n\td1.xy = min(d1.xy, d1.wz);\n\td1.x = min(d1.x, d1.y);\n\treturn vec2(sqrt(d1.x));\n#else\n\t// Do it right and sort out both F1 and F2\n\tvec4 d = min(d1,d2); // F1 is now in d\n\td2 = max(d1,d2); // Make sure we keep all candidates for F2\n\td.xy = (d.x < d.y) ? d.xy : d.yx; // Swap smallest to d.x\n\td.xz = (d.x < d.z) ? d.xz : d.zx;\n\td.xw = (d.x < d.w) ? d.xw : d.wx; // F1 is now in d.x\n\td.yzw = min(d.yzw, d2.yzw); // F2 now not in d2.yzw\n\td.y = min(d.y, d.z); // nor in d.z\n\td.y = min(d.y, d.w); // nor in d.w\n\td.y = min(d.y, d2.x); // F2 is now in d.y\n\treturn sqrt(d.xy); // F1 and F2\n#endif\n}\n\n\n// #version 120\n\n// Cellular noise ("Worley noise") in 3D in GLSL.\n// Copyright (c) Stefan Gustavson 2011-04-19. All rights reserved.\n// This code is released under the conditions of the MIT license.\n// See LICENSE file for details.\n// https://github.com/stegu/webgl-noise\n\n#ifndef MOD289_3\n#define MOD289_3\n// Modulo 289 without a division (only multiplications)\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n#endif\n\n#ifndef MOD7_3\n#define MOD7_3\n// Modulo 7 without a division\nvec3 mod7(vec3 x) {\n return x - floor(x * (1.0 / 7.0)) * 7.0;\n}\n#endif\n\n#ifndef PERMUTE_3\n#define PERMUTE_3\n// Permutation polynomial: (34x^2 + 6x) mod 289\nvec3 permute(vec3 x) {\n return mod289((34.0 * x + 10.0) * x);\n}\n#endif\n\n// Cellular noise, returning F1 and F2 in a vec2.\n// 3x3x3 search region for good F2 everywhere, but a lot\n// slower than the 2x2x2 version.\n// The code below is a bit scary even to its author,\n// but it has at least half decent performance on a\n// modern GPU. In any case, it beats any software\n// implementation of Worley noise hands down.\n\nvec2 cellular(vec3 P) {\n#define K 0.142857142857 // 1/7\n#define Ko 0.428571428571 // 1/2-K/2\n#define K2 0.020408163265306 // 1/(7*7)\n#define Kz 0.166666666667 // 1/6\n#define Kzo 0.416666666667 // 1/2-1/6*2\n#define jitter_cell_noise 1.0 // smaller jitter_cell_noise gives more regular pattern\n\n\tvec3 Pi = mod289(floor(P));\n \tvec3 Pf = fract(P) - 0.5;\n\n\tvec3 Pfx = Pf.x + vec3(1.0, 0.0, -1.0);\n\tvec3 Pfy = Pf.y + vec3(1.0, 0.0, -1.0);\n\tvec3 Pfz = Pf.z + vec3(1.0, 0.0, -1.0);\n\n\tvec3 p = permute(Pi.x + vec3(-1.0, 0.0, 1.0));\n\tvec3 p1 = permute(p + Pi.y - 1.0);\n\tvec3 p2 = permute(p + Pi.y);\n\tvec3 p3 = permute(p + Pi.y + 1.0);\n\n\tvec3 p11 = permute(p1 + Pi.z - 1.0);\n\tvec3 p12 = permute(p1 + Pi.z);\n\tvec3 p13 = permute(p1 + Pi.z + 1.0);\n\n\tvec3 p21 = permute(p2 + Pi.z - 1.0);\n\tvec3 p22 = permute(p2 + Pi.z);\n\tvec3 p23 = permute(p2 + Pi.z + 1.0);\n\n\tvec3 p31 = permute(p3 + Pi.z - 1.0);\n\tvec3 p32 = permute(p3 + Pi.z);\n\tvec3 p33 = permute(p3 + Pi.z + 1.0);\n\n\tvec3 ox11 = fract(p11*K) - Ko;\n\tvec3 oy11 = mod7(floor(p11*K))*K - Ko;\n\tvec3 oz11 = floor(p11*K2)*Kz - Kzo; // p11 < 289 guaranteed\n\n\tvec3 ox12 = fract(p12*K) - Ko;\n\tvec3 oy12 = mod7(floor(p12*K))*K - Ko;\n\tvec3 oz12 = floor(p12*K2)*Kz - Kzo;\n\n\tvec3 ox13 = fract(p13*K) - Ko;\n\tvec3 oy13 = mod7(floor(p13*K))*K - Ko;\n\tvec3 oz13 = floor(p13*K2)*Kz - Kzo;\n\n\tvec3 ox21 = fract(p21*K) - Ko;\n\tvec3 oy21 = mod7(floor(p21*K))*K - Ko;\n\tvec3 oz21 = floor(p21*K2)*Kz - Kzo;\n\n\tvec3 ox22 = fract(p22*K) - Ko;\n\tvec3 oy22 = mod7(floor(p22*K))*K - Ko;\n\tvec3 oz22 = floor(p22*K2)*Kz - Kzo;\n\n\tvec3 ox23 = fract(p23*K) - Ko;\n\tvec3 oy23 = mod7(floor(p23*K))*K - Ko;\n\tvec3 oz23 = floor(p23*K2)*Kz - Kzo;\n\n\tvec3 ox31 = fract(p31*K) - Ko;\n\tvec3 oy31 = mod7(floor(p31*K))*K - Ko;\n\tvec3 oz31 = floor(p31*K2)*Kz - Kzo;\n\n\tvec3 ox32 = fract(p32*K) - Ko;\n\tvec3 oy32 = mod7(floor(p32*K))*K - Ko;\n\tvec3 oz32 = floor(p32*K2)*Kz - Kzo;\n\n\tvec3 ox33 = fract(p33*K) - Ko;\n\tvec3 oy33 = mod7(floor(p33*K))*K - Ko;\n\tvec3 oz33 = floor(p33*K2)*Kz - Kzo;\n\n\tvec3 dx11 = Pfx + jitter_cell_noise*ox11;\n\tvec3 dy11 = Pfy.x + jitter_cell_noise*oy11;\n\tvec3 dz11 = Pfz.x + jitter_cell_noise*oz11;\n\n\tvec3 dx12 = Pfx + jitter_cell_noise*ox12;\n\tvec3 dy12 = Pfy.x + jitter_cell_noise*oy12;\n\tvec3 dz12 = Pfz.y + jitter_cell_noise*oz12;\n\n\tvec3 dx13 = Pfx + jitter_cell_noise*ox13;\n\tvec3 dy13 = Pfy.x + jitter_cell_noise*oy13;\n\tvec3 dz13 = Pfz.z + jitter_cell_noise*oz13;\n\n\tvec3 dx21 = Pfx + jitter_cell_noise*ox21;\n\tvec3 dy21 = Pfy.y + jitter_cell_noise*oy21;\n\tvec3 dz21 = Pfz.x + jitter_cell_noise*oz21;\n\n\tvec3 dx22 = Pfx + jitter_cell_noise*ox22;\n\tvec3 dy22 = Pfy.y + jitter_cell_noise*oy22;\n\tvec3 dz22 = Pfz.y + jitter_cell_noise*oz22;\n\n\tvec3 dx23 = Pfx + jitter_cell_noise*ox23;\n\tvec3 dy23 = Pfy.y + jitter_cell_noise*oy23;\n\tvec3 dz23 = Pfz.z + jitter_cell_noise*oz23;\n\n\tvec3 dx31 = Pfx + jitter_cell_noise*ox31;\n\tvec3 dy31 = Pfy.z + jitter_cell_noise*oy31;\n\tvec3 dz31 = Pfz.x + jitter_cell_noise*oz31;\n\n\tvec3 dx32 = Pfx + jitter_cell_noise*ox32;\n\tvec3 dy32 = Pfy.z + jitter_cell_noise*oy32;\n\tvec3 dz32 = Pfz.y + jitter_cell_noise*oz32;\n\n\tvec3 dx33 = Pfx + jitter_cell_noise*ox33;\n\tvec3 dy33 = Pfy.z + jitter_cell_noise*oy33;\n\tvec3 dz33 = Pfz.z + jitter_cell_noise*oz33;\n\n\tvec3 d11 = dx11 * dx11 + dy11 * dy11 + dz11 * dz11;\n\tvec3 d12 = dx12 * dx12 + dy12 * dy12 + dz12 * dz12;\n\tvec3 d13 = dx13 * dx13 + dy13 * dy13 + dz13 * dz13;\n\tvec3 d21 = dx21 * dx21 + dy21 * dy21 + dz21 * dz21;\n\tvec3 d22 = dx22 * dx22 + dy22 * dy22 + dz22 * dz22;\n\tvec3 d23 = dx23 * dx23 + dy23 * dy23 + dz23 * dz23;\n\tvec3 d31 = dx31 * dx31 + dy31 * dy31 + dz31 * dz31;\n\tvec3 d32 = dx32 * dx32 + dy32 * dy32 + dz32 * dz32;\n\tvec3 d33 = dx33 * dx33 + dy33 * dy33 + dz33 * dz33;\n\n\t// Sort out the two smallest distances (F1, F2)\n#if 0\n\t// Cheat and sort out only F1\n\tvec3 d1 = min(min(d11,d12), d13);\n\tvec3 d2 = min(min(d21,d22), d23);\n\tvec3 d3 = min(min(d31,d32), d33);\n\tvec3 d = min(min(d1,d2), d3);\n\td.x = min(min(d.x,d.y),d.z);\n\treturn vec2(sqrt(d.x)); // F1 duplicated, no F2 computed\n#else\n\t// Do it right and sort out both F1 and F2\n\tvec3 d1a = min(d11, d12);\n\td12 = max(d11, d12);\n\td11 = min(d1a, d13); // Smallest now not in d12 or d13\n\td13 = max(d1a, d13);\n\td12 = min(d12, d13); // 2nd smallest now not in d13\n\tvec3 d2a = min(d21, d22);\n\td22 = max(d21, d22);\n\td21 = min(d2a, d23); // Smallest now not in d22 or d23\n\td23 = max(d2a, d23);\n\td22 = min(d22, d23); // 2nd smallest now not in d23\n\tvec3 d3a = min(d31, d32);\n\td32 = max(d31, d32);\n\td31 = min(d3a, d33); // Smallest now not in d32 or d33\n\td33 = max(d3a, d33);\n\td32 = min(d32, d33); // 2nd smallest now not in d33\n\tvec3 da = min(d11, d21);\n\td21 = max(d11, d21);\n\td11 = min(da, d31); // Smallest now in d11\n\td31 = max(da, d31); // 2nd smallest now not in d31\n\td11.xy = (d11.x < d11.y) ? d11.xy : d11.yx;\n\td11.xz = (d11.x < d11.z) ? d11.xz : d11.zx; // d11.x now smallest\n\td12 = min(d12, d21); // 2nd smallest now not in d21\n\td12 = min(d12, d22); // nor in d22\n\td12 = min(d12, d31); // nor in d31\n\td12 = min(d12, d32); // nor in d32\n\td11.yz = min(d11.yz,d12.xy); // nor in d12.yz\n\td11.y = min(d11.y,d12.z); // Only two more to go\n\td11.y = min(d11.y,d11.z); // Done! (Phew!)\n\treturn sqrt(d11.xy); // F1, F2\n#endif\n}\n\n\n${An}\n\n// Included to use integer seed value to generate noise\n\n// https://gist.github.com/KdotJPG/67f847a9d5c89b9ad82cab673cdf1929\n// MIT for now, will Public Domain when I post to OpenSimplex2 repo!\n\nvec4 intToSeedVec(uint seed) {\n vec4 iSeedVec = vec4((seed / uvec4(1, 256, 65536, 16777216)) & uvec4(255));\n return trunc(iSeedVec * (1.0 / 9.0)) * 10.0 + fract(iSeedVec * (1.0 / 9.0)) * 9.0 + 1.0; // Skip multiples of 9\n}\n\nvec4 permute(vec4 t, float seedPart) {\n return t * (t * 27.0 + seedPart);\n}\n\nfloat permute(float t, float seedPart) {\n return t * (t * 27.0 + seedPart);\n}\n\nvec4 mod639(vec4 t) {\n return t - floor(t * (1.0 / 639.0)) * 639.0;\n}\n\nfloat mod639(float t) {\n return t - floor(t * (1.0 / 639.0)) * 639.0;\n}\n\nvec4 pmod639(vec4 t) {\n return t - trunc(t * (1.0 / 639.0)) * 639.0;\n}\n\nfloat pmod639(float t) {\n return t - trunc(t * (1.0 / 639.0)) * 639.0;\n}\n\nvec4 grad(float index) {\n vec4 p0123 = index * (1.0 / vec4(2.0, 4.0, 8.0, 16.0));\n vec3 p4_i45 = index * (1.0 / vec3(32.0, 128.0, 640.0));\n p0123 = trunc((p0123 - trunc(p0123)) * 2.0) - 0.5;\n p4_i45 = trunc((p4_i45 - trunc(p4_i45)) * vec3(2.0, 4.0, 5.0)) - vec3(0.5, 0.0, 0.0);\n p4_i45.y += p4_i45.z;\n p4_i45.y -= step(5.0, p4_i45.y) * 5.0;\n p0123 *= vec4(equal(notEqual(vec4(p4_i45.y), vec4(0.0, 1.0, 2.0, 3.0)), notEqual(vec4(p4_i45.z), vec4(0.0, 1.0, 2.0, 3.0))));\n p4_i45.x *= float(all(notEqual(p4_i45.yz, vec2(4.0)))) * 1.2071067811865475;\n p0123 += vec4(equal(vec4(p4_i45.y), vec4(0.0, 1.0, 2.0, 3.0))) - vec4(equal(vec4(p4_i45.z), vec4(0.0, 1.0, 2.0, 3.0)));\n p4_i45.x += dot(vec2(equal(p4_i45.yz, vec2(4.0))), vec2(1.2071067811865475, -1.2071067811865475));\n return p0123 + dot(p0123, vec4(-0.138196601125011)) + p4_i45.x * 0.44721359549995793928183473374626;\n}\n\nfloat opensimplex2f(vec4 X, vec4 seedVec) {\n\tvec4 Xs = X + dot(X, vec4(-0.138196601125011));\n\n\tvec4 Xsb = floor(Xs);\n\tvec4 Xsi = Xs - Xsb;\n\n\tfloat siSum = dot(Xsi, vec4(1.0));\n\tfloat firstLattice = trunc(siSum * 1.25);\n\tvec3 startValues = firstLattice * vec3(-128.0, -0.2, -0.8);\n\n\tXsb += startValues.xxxx;\n\tXsi += startValues.yyyy;\n\tsiSum += startValues.z;\n\tvec4 latticeCoordOffsets = vec4(equal(vec4(0.0, 1.0, 2.0, 3.0), vec4(firstLattice))) * -641.0 + 128.0;\n\n\tvec4 vertex0 = vec4(greaterThanEqual(Xsi, max(max(Xsi.yzwx, Xsi.zwxy), max(Xsi.wxyz, vec4(1.0 - siSum)))));\n\tvec4 vh0 = Xsb + vertex0;\n\tXsb = vh0 + latticeCoordOffsets.xxxx; Xsi -= vertex0; siSum = dot(Xsi, vec4(1.0));\n\tvec4 d0 = Xsi + siSum * 0.309016994374947;\n\tXsi += 0.2; siSum += 0.8;\n\n\tvec4 vertex1 = vec4(greaterThanEqual(Xsi, max(max(Xsi.yzwx, Xsi.zwxy), max(Xsi.wxyz, vec4(1.0 - siSum)))));\n\tvec4 vh1 = Xsb + vertex1;\n\tXsb = vh1 + latticeCoordOffsets.yyyy; Xsi -= vertex1; siSum = dot(Xsi, vec4(1.0));\n\tvec4 d1 = Xsi + siSum * 0.309016994374947;\n\tXsi += 0.2; siSum += 0.8;\n\n\tvec4 vertex2 = vec4(greaterThanEqual(Xsi, max(max(Xsi.yzwx, Xsi.zwxy), max(Xsi.wxyz, vec4(1.0 - siSum)))));\n\tvec4 vh2 = Xsb + vertex2;\n\tXsb = vh2 + latticeCoordOffsets.zzzz; Xsi -= vertex2; siSum = dot(Xsi, vec4(1.0));\n\tvec4 d2 = Xsi + siSum * 0.309016994374947;\n\tXsi += 0.2; siSum += 0.8;\n\n\tvec4 vertex3 = vec4(greaterThanEqual(Xsi, max(max(Xsi.yzwx, Xsi.zwxy), max(Xsi.wxyz, vec4(1.0 - siSum)))));\n\tvec4 vh3 = Xsb + vertex3;\n\tXsb = vh3 + latticeCoordOffsets.wwww; Xsi -= vertex3; siSum = dot(Xsi, vec4(1.0));\n\tvec4 d3 = Xsi + siSum * 0.309016994374947;\n\tXsi += 0.2; siSum += 0.8;\n\n\tvec4 vertex4 = vec4(greaterThanEqual(Xsi, max(max(Xsi.yzwx, Xsi.zwxy), max(Xsi.wxyz, vec4(1.0 - siSum)))));\n\tvec4 vh4 = Xsb + vertex4;\n\tXsi -= vertex4; siSum = dot(Xsi, vec4(1.0));\n\tvec4 d4 = Xsi + siSum * 0.309016994374947;\n\n\tvec4 h0123 = permute(mod639(vec4(vh0.x, vh1.x, vh2.x, vh3.x)), seedVec.x);\n\th0123 = permute(mod639(h0123 + vec4(vh0.y, vh1.y, vh2.y, vh3.y)), seedVec.y);\n\th0123 = permute(mod639(h0123 + vec4(vh0.z, vh1.z, vh2.z, vh3.z)), seedVec.z);\n\th0123 = pmod639(permute(mod639(h0123 + vec4(vh0.w, vh1.w, vh2.w, vh3.w)), seedVec.w));\n\n\tfloat h4 = permute(mod639(vh4.x), seedVec.x);\n\th4 = permute(mod639(h4 + vh4.y), seedVec.y);\n\th4 = permute(mod639(h4 + vh4.z), seedVec.z);\n\th4 = pmod639(permute(mod639(h4 + vh4.w), seedVec.w));\n\n\tvec4 g0 = grad(h0123.x);\n\tvec4 g1 = grad(h0123.y);\n\tvec4 g2 = grad(h0123.z);\n\tvec4 g3 = grad(h0123.w);\n\tvec4 g4 = grad(h4);\n\n\t/*vec4 norm = inversesqrt(vec4(dot(g0, g0), dot(g1, g1), dot(g2, g2), dot(g3, g3)));\n\tg0 *= norm.x; g1 *= norm.y; g2 *= norm.z; g3 *= norm.w; g4 *= inversesqrt(dot(g4, g4));*/\n\n\t// "Proper" constant is 0.5. 0.6 produces subtle invisible discontinuities, but looks much better.\n\tvec4 a0123 = max(0.6 - vec4(dot(d0, d0), dot(d1, d1), dot(d2, d2), dot(d3, d3)), 0.0);\n\tfloat a4 = max(0.6 - dot(d4, d4), 0.0);\n\tvec4 r0123 = vec4(dot(d0, g0), dot(d1, g1), dot(d2, g2), dot(d3, g3));\n\tfloat r4 = dot(d4, g4);\n\ta0123 *= a0123; a4 *= a4;\n\treturn (dot(a0123 * a0123, r0123) + a4 * a4 * r4) * 27.0; // TODO compute tighter normalization constant.\n}\n\nfloat opensimplex2f(vec4 X) {\n return opensimplex2f(X, vec4(1.0));\n}\n\n\n#define TO_FLOAT (1./255.0)\n\n#define sin01(x) (sin(x)*.5)+.5\n\n#define disabled vec3(0.0)\n\n`}\n\n\nstruct Layer1\n{\n float brightness;\n float blobbyness;\n float blur;\n\n bool enabled;\n};\n\nstruct Layer2\n{\n float brightness;\n float cycleSpeed;\n bool enabled;\n};\n\nstruct Feedback\n{\n float amount;\n float scaleX;\n float scaleY;\n float centerX;\n float centerY;\n float dist;\n};\n\n\n\nuniform vec2 resolution;\nuniform vec4 time; // [time, time/2, time*2, time/10]\nuniform sampler2D ramp;\nuniform Layer1 layer1;\nuniform Layer2 layer2;\nuniform Feedback feedback;\n\nuniform sampler2D backBufferTex;\n\nuniform float noiseDither;\n\nuniform uint seed;\n\nout vec4 FragColor;\nin vec4 fragUV;\n\n\n\nvec3 doLayer1(in vec4 uv, in vec2 n, inout vec3 col)\n{\n vec2 st = uv.zw;\n // st *= sin(time.x);\n float p1 = hash(seed + uint(156));\n float p2 = hash(seed + uint(12355));\n float p3 = hash(seed + uint(62435));\n\n float s1 = 2.*(p1-.5);\n float s2 = 2.*(p2-.5);\n float s3 = 2.*(p3 - .5);\n\n\nst = scale(st, 2.);\n float sk = .1*sin(time.y*1.56 + p2);\n\n float d = sdParallelogram(st + vec2(sin(time.z) + s1, sin(time.y*1.4) + s2), .4, .1, sk);\n float d2 = sdRhombus(translate(rotate(scale( translate(st, vec2(s2, s3)*vec2(.5, .2)) , 4.*p1), p3*30.*DEG2RAD), vec2(0.,0.)), vec2(1.,1.));\n float d3 = sdEquilateralTriangle(rotate(scale(st,4.*p1+sin(time.x)), 90.*p2*DEG2RAD + time.z/5.));\n\n float noise = snoise(vec3(uv.xy, time.x));\n float dMix = smoothstep(.0,.2, mix(d,d2, sin01(time.y + p3*TWOPI ) ));\n\n dMix = sminCubic(d,d2,.5);\n dMix = sminCubic(sminCubic(d,d2, .5), d3, .5);\n\n dMix+=layer1.blobbyness*noise;\n d += noise*layer1.blobbyness;\n\n vec4 rampSample = texture2D(ramp, vec2(time.z *layer2.cycleSpeed + p2 + length(st)*.2 + noiseDither , .5));\n\n\n vec3 layer1Col = layer1.brightness*rampSample.rgb*saturate(1.-smoothstep(-layer1.blur,layer1.blur, dMix));//(mix(layer1.color1*TO_FLOAT, layer1.color2*TO_FLOAT, saturate(smoothstep(-layer1.blur, layer1.blur, dMix))));\n\n layer1Col = layer1.enabled ? layer1Col : disabled;\n col += layer1Col;\n\n return layer1Col;\n}\n\n\nvec3 doLayer2(in vec4 uv, in vec2 n, inout vec3 col)\n{\n float p1 = hash(seed + uint(98765));\n\n vec3 grad;\n float noise = snoise(vec3(uv.xy, time.x), grad);\n noise *= 0.4;\n noise = smoothstep(-1.,1., noise);\n vec4 rampSample = texture2D(ramp, vec2( time.z *layer2.cycleSpeed + p1 + rotate(uv.xy*.5, time.x*DEG2RAD).x + noiseDither , .5));\n\n vec3 layer2Col = rampSample.rgb*noise*layer2.brightness;\n vec3 color = layer2.enabled ? layer2Col : disabled;\n col.rgb += color;\n\n return color;\n\n}\n\n\n\nvec2 scaleUV(vec2 uv, vec2 scaleFactor, vec2 center)\n{\n return ( uv - center)*scaleFactor + center;\n}\n\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / resolution;\n vec2 uvOrig = uv;\n vec2 st = (uv*resolution - vec2(.5, .5)*resolution)/resolution.y;\n\n vec2 n = vec2(\n opensimplex2f(vec4(uv*10., time.x, time.y), intToSeedVec(uint(seed))),\n opensimplex2f(vec4(1.), intToSeedVec(uint(seed)))\n ) ;\n\n // Init output\n vec4 col = vec4(0.);\n col.a = 1.;\n\n // Calculate layers\n vec3 l1 = doLayer1(vec4(uv, st), n, col.rgb);\n vec3 l2 = doLayer2(vec4(uv, st), n, col.rgb);\n\n // Comp Layers\n col.rgb = l1 + l2;\n\n // Feedback stage\n vec3 grad;\n float noise = snoise(vec3(uv.xy, time.x)*.5, grad);\n vec4 lastFrame = texture2D(backBufferTex, uv+ grad.xy*feedback.dist);\n // col.rgb += lastFrame.rgb*feedback.amount;\n\n // trying out using the *current* frame for feedback, instead of going\n // backwards, so as to achieve always-reproducible state\n col.rgb += col.rgb*feedback.amount;\n\n // Clamp color values\n col.rgb = saturate(col.rgb);\n\n FragColor = col;\n // FragColor = lastFrame;\n}\n`,Cn=`\n#version 300 es\n\n\n#if __VERSION__ > 130\n#define texture2D texture\n#endif\n\n\nprecision mediump float;\n\nout vec4 FragColor;\n\n${En}\n${An}\n\nuniform float noiseDither;\n\nuniform vec2 resolution;\nuniform sampler2D backBuffer;\n\nuniform float saturation;\nuniform float contrast;\n\n\nuniform sampler2D ramp;\nuniform bool displayGradient;\n\nmat4 brightnessMatrix( float brightness )\n{\n return mat4( 1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n brightness, brightness, brightness, 1 );\n}\n\nmat4 contrastMatrix( float c )\n{\n\tfloat t = ( 1.0 - c ) / 2.0;\n\n return mat4( c, 0, 0, 0,\n 0, c, 0, 0,\n 0, 0, c, 0,\n t, t, t, 1 );\n\n}\n\nmat4 saturationMatrix( float s )\n{\n vec3 luminance = vec3( 0.3086, 0.6094, 0.0820 );\n\n float oneMinusSat = 1.0 - s;\n\n vec3 red = vec3( luminance.x * oneMinusSat );\n red+= vec3( s, 0, 0 );\n\n vec3 green = vec3( luminance.y * oneMinusSat );\n green += vec3( 0, s, 0 );\n\n vec3 blue = vec3( luminance.z * oneMinusSat );\n blue += vec3( 0, 0, s );\n\n return mat4( red, 0,\n green, 0,\n blue, 0,\n 0, 0, 0, 1 );\n}\n\nvoid drawRamp(inout vec4 col, vec2 uv, vec2 size)\n{\n\n uv.y = 1. - uv.y;\n vec2 rampUV = uv*(1./size);\n\n float insideRamp = displayGradient ? step(uv.x, size.x) * step(uv.y, size.y) : 0.0;\n vec4 rampSample = texture2D(ramp, rampUV*2.);\n col.rgb = mix(col.rgb, rampSample.rgb, insideRamp);// vec3(insideRamp);\n}\n\nvoid main() {\n vec2 uv = gl_FragCoord.xy / resolution;\n // uv += noiseDither*vec2(rand(uv), rand(uv + vec2(112.234,253.253)));\n\n\n vec4 lastCol = texture2D(backBuffer, uv);\n vec4 colOut;\n colOut.a = 1.;\n\n colOut = contrastMatrix(contrast)*saturationMatrix(saturation)*lastCol;\n\n // linear to gamma\n // colOut.rgb = pow( colOut.rgb, vec3(0.4545) );\n\n drawRamp(colOut, uv, vec2(.5,.2));\n FragColor = colOut;\n}\n\n`;const Dn=(n,e)=>{const t=e.width??256,r=e.height??256;let o=n.createTexture();return n.bindTexture(n.TEXTURE_2D,o),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t,r,0,n.RGBA,n.UNSIGNED_BYTE,null),o},Fn=(n,e)=>{const t=n.createFramebuffer();return n.bindFramebuffer(n.FRAMEBUFFER,t),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0),t};class Rn{constructor(n,e){this.width=e.width=e.width??256,this.height=e.height=e.height??256,this.texture1=Dn(n,e),this.texture2=Dn(n,e),this.fb1=Fn(n,this.texture1),this.fb2=Fn(n,this.texture2),this.swp=!1,this.gl=n}currentTexture=()=>this.swp?this.texture2:this.texture1;lastTexture=()=>this.swp?this.texture1:this.texture2;currentFramebuffer=()=>this.swp?this.fb2:this.fb1;swap=()=>this.swp=!this.swp;bind=()=>{this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.currentFramebuffer()),this.gl.viewport(0,0,this.width,this.height)}}var Mn=[[95,168,242],[48,64,92],[220,91,172],[111,200,111],[253,205,0]];return function(){function e(e,t){var r=t.animTime,o=t.seed,i=t.colors,a=t.layer1Params,c=t.globalParams,s=t.layer2Params,l=t.feedbackSettings,u=t.blurSettings,d=t.width,f=t.height,v=this;this.renderLoop=function(n){requestAnimationFrame(v.renderLoop),v.render(n)},this.render=function(n){var e=v,t=e.gl,r=e.ppb,o=e.globalParams,i=e.ramp,a=e.programAura,c=e.programFinal,s=e.bufferInfo;if(null!=a&&null!=c){if(v.playing){var l=n-v.prevTimestamp;if(l<=v.fixedDeltaTime)return;v.animTime+=l*v.globalParams.speed,v.prevTimestamp=n-l%v.fixedDeltaTime;var u=n-v.startTime;v.currFps=Math.round(1e3/(u/++v.frameCount)*100)/100}var d=.001*v.animTime;!function(n,e){e=e||1,e=Math.max(0,e);const t=n.clientWidth*e|0,r=n.clientHeight*e|0;(n.width!==t||n.height!==r)&&(n.width=t,n.height=r)}(v.gl.canvas);var f={time:[d,d/2,2*d,10*d],resolution:[v.targetTexWidth,v.targetTexHeight],ramp:v.ramp,layer1:v.layer1Params,layer2:v.layer2Params,feedback:v.feedbackSettings,noiseDither:v.globalParams.noise,backBufferTex:v.ppb.lastTexture(),seed:v.seed};r.bind(),t.useProgram(a.program),bn(t,a,s),hn(a,f),wn(t,s),r.swap();for(var x=v.blurSettings.iterations,m=0;m 130\n#define texture2D texture\n#endif\n\nprecision mediump float;\n\n\nuniform vec2 resolution;\nuniform sampler2D iChannel0;\nuniform vec2 direction;\nout vec4 FragColor;\n\n\nvec4 blur(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 }\n\n\n\nvoid main(){\n vec2 uv = gl_FragCoord.xy / resolution;\n\n FragColor = blur(iChannel0, uv, resolution.xy, direction);\n}\n"]),this.bufferInfo=F(e,Tn);for(var x=[],m=n([],this.colors,!0);m.length>0;)x.push(m.splice(Math.floor(this.rng()*m.length),1)[0]);this.ramp=function(n,e){var t,r,o,i=null!==(t=e.resolution)&&void 0!==t?t:256,a=null!==(r=e.height)&&void 0!==r?r:256,c=null!==(o=e.colors)&&void 0!==o?o:[[255,0,0],[0,0,255],[0,255,0]];if(!c||c.length<2)return console.log("Need at least 2 colors to make a gradient"),null;var s=zn(n,[Pn,_n]),l=F(n,Tn);n.viewport(0,0,i,a);var u=n.createTexture();n.bindTexture(n.TEXTURE_2D,u),n.texImage2D(n.TEXTURE_2D,0,n.RGB,i,a,0,n.RGB,n.UNSIGNED_BYTE,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.MIRRORED_REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.MIRRORED_REPEAT);var d=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,d);var f=n.COLOR_ATTACHMENT0;return n.framebufferTexture2D(n.FRAMEBUFFER,f,n.TEXTURE_2D,u,0),n.useProgram(s.program),n.clearColor(0,0,0,1),bn(n,s,l),hn(s,{colors:c.flat(),numColors:c.length,resolution:[i,a]}),wn(n,l),u}(e,{colors:x,resolution:256}),this.ppb=new Rn(e,{width:this.targetTexWidth,height:this.targetTexHeight})}return e.defaultParams={animTime:0,seed:1,colors:n(n([],Mn,!0),[Mn[0]],!1),globalParams:{contrast:1.37,displayGradient:!1,feedback:.99,noise:.5,saturation:1.69,speed:.13,targetFps:60,value:1},layer1Params:{blobbyness:1.3,blur:1.01,brightness:.52,enabled:!0},layer2Params:{blur:1.47,brightness:.6,cycleSpeed:.12,enabled:!0},feedbackSettings:{amount:.28,centerX:.5,centerY:.5,dist:.06,scaleX:1.01,scaleY:1.01},blurSettings:{iterations:5,radius:5}},e}()}(); diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000..dcfb382 Binary files /dev/null and b/favicon.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..481e64c --- /dev/null +++ b/index.html @@ -0,0 +1,206 @@ + + + + + + + + + + + + Lightward Aura + + + + + + + + +
+
+
Lightward Aura
+
+ + + + \ No newline at end of file diff --git a/wordmark-display.png b/wordmark-display.png new file mode 100644 index 0000000..c3140e4 Binary files /dev/null and b/wordmark-display.png differ