<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">!function(t,e){if("object"==typeof exports&amp;&amp;"object"==typeof module)module.exports=e();else if("function"==typeof define&amp;&amp;define.amd)define([],e);else{var n=e();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(self,(function(){return(()=&gt;{"use strict";var t={};function e(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function n(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function i(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t}function s(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}function r(t,e){return t[0]*e[1]-t[1]*e[0]}(t=&gt;{"undefined"!=typeof Symbol&amp;&amp;Symbol.toStringTag&amp;&amp;Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})})(t);class a extends Array{constructor(t=0,e=t){return super(t,e),this}get x(){return this[0]}get y(){return this[1]}set x(t){this[0]=t}set y(t){this[1]=t}set(t,e=t){return t.length?this.copy(t):(function(t,e,n){t[0]=e,t[1]=n}(this,t,e),this)}copy(t){var e,n;return n=t,(e=this)[0]=n[0],e[1]=n[1],this}add(t,n){return n?e(this,t,n):e(this,this,t),this}sub(t,e){return e?n(this,t,e):n(this,this,t),this}multiply(t){var e,n;return t.length?(this,n=t,(e=this)[0]=this[0]*n[0],e[1]=this[1]*n[1]):i(this,this,t),this}divide(t){var e,n;return t.length?(this,n=t,(e=this)[0]=this[0]/n[0],e[1]=this[1]/n[1]):i(this,this,1/t),this}inverse(t=this){var e,n;return n=t,(e=this)[0]=1/n[0],e[1]=1/n[1],this}len(){return s(this)}distance(t){return t?(this,n=(e=t)[0]-this[0],i=e[1]-this[1],Math.sqrt(n*n+i*i)):s(this);var e,n,i}squaredLen(){return this.squaredDistance()}squaredDistance(t){return t?(this,(n=(e=t)[0]-this[0])*n+(i=e[1]-this[1])*i):function(t){var e=t[0],n=t[1];return e*e+n*n}(this);var e,n,i}negate(t=this){var e,n;return n=t,(e=this)[0]=-n[0],e[1]=-n[1],this}cross(t,e){return e?r(t,e):r(this,t)}scale(t){return i(this,this,t),this}normalize(){var t,e,n,i;return this,(i=(e=(t=this)[0])*e+(n=t[1])*n)&gt;0&amp;&amp;(i=1/Math.sqrt(i)),this[0]=t[0]*i,this[1]=t[1]*i,this}dot(t){return e=t,this[0]*e[0]+this[1]*e[1];var e}equals(t){return e=t,this[0]===e[0]&amp;&amp;this[1]===e[1];var e}applyMatrix3(t){var e,n,i;return this,e=t,n=this[0],i=this[1],this[0]=e[0]*n+e[3]*i+e[6],this[1]=e[1]*n+e[4]*i+e[7],this}applyMatrix4(t){return function(t,e,n){let i=e[0],s=e[1];t[0]=n[0]*i+n[4]*s+n[12],t[1]=n[1]*i+n[5]*s+n[13]}(this,this,t),this}lerp(t,e){return function(t,e,n,i){var s=e[0],r=e[1];t[0]=s+i*(n[0]-s),t[1]=r+i*(n[1]-r)}(this,this,t,e),this}clone(){return new a(this[0],this[1])}fromArray(t,e=0){return this[0]=t[e],this[1]=t[e+1],this}toArray(t=[],e=0){return t[e]=this[0],t[e+1]=this[1],t}}function o(t){let e=t[0],n=t[1],i=t[2];return Math.sqrt(e*e+n*n+i*i)}function h(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function l(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function u(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function c(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function p(t){let e=t[0],n=t[1],i=t[2];return e*e+n*n+i*i}function d(t,e){let n=e[0],i=e[1],s=e[2],r=n*n+i*i+s*s;return r&gt;0&amp;&amp;(r=1/Math.sqrt(r)),t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function m(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function f(t,e,n){let i=e[0],s=e[1],r=e[2],a=n[0],o=n[1],h=n[2];return t[0]=s*h-r*o,t[1]=r*a-i*h,t[2]=i*o-s*a,t}const g=function(){const t=[0,0,0],e=[0,0,0];return function(n,i){h(t,n),h(e,i),d(t,t),d(e,e);let s=m(t,e);return s&gt;1?0:s&lt;-1?Math.PI:Math.acos(s)}}();class v extends Array{constructor(t=0,e=t,n=t){return super(t,e,n),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(t){this[0]=t}set y(t){this[1]=t}set z(t){this[2]=t}set(t,e=t,n=t){return t.length?this.copy(t):(function(t,e,n,i){t[0]=e,t[1]=n,t[2]=i}(this,t,e,n),this)}copy(t){return h(this,t),this}add(t,e){return e?l(this,t,e):l(this,this,t),this}sub(t,e){return e?u(this,t,e):u(this,this,t),this}multiply(t){var e,n,i;return t.length?(n=this,i=t,(e=this)[0]=n[0]*i[0],e[1]=n[1]*i[1],e[2]=n[2]*i[2]):c(this,this,t),this}divide(t){var e,n,i;return t.length?(n=this,i=t,(e=this)[0]=n[0]/i[0],e[1]=n[1]/i[1],e[2]=n[2]/i[2]):c(this,this,1/t),this}inverse(t=this){var e,n;return n=t,(e=this)[0]=1/n[0],e[1]=1/n[1],e[2]=1/n[2],this}len(){return o(this)}distance(t){return t?function(t,e){let n=e[0]-t[0],i=e[1]-t[1],s=e[2]-t[2];return Math.sqrt(n*n+i*i+s*s)}(this,t):o(this)}squaredLen(){return p(this)}squaredDistance(t){return t?function(t,e){let n=e[0]-t[0],i=e[1]-t[1],s=e[2]-t[2];return n*n+i*i+s*s}(this,t):p(this)}negate(t=this){var e,n;return n=t,(e=this)[0]=-n[0],e[1]=-n[1],e[2]=-n[2],this}cross(t,e){return e?f(this,t,e):f(this,this,t),this}scale(t){return c(this,this,t),this}normalize(){return d(this,this),this}dot(t){return m(this,t)}equals(t){return e=t,this[0]===e[0]&amp;&amp;this[1]===e[1]&amp;&amp;this[2]===e[2];var e}applyMatrix3(t){return function(t,e,n){let i=e[0],s=e[1],r=e[2];t[0]=i*n[0]+s*n[3]+r*n[6],t[1]=i*n[1]+s*n[4]+r*n[7],t[2]=i*n[2]+s*n[5]+r*n[8]}(this,this,t),this}applyMatrix4(t){return function(t,e,n){let i=e[0],s=e[1],r=e[2],a=n[3]*i+n[7]*s+n[11]*r+n[15];a=a||1,t[0]=(n[0]*i+n[4]*s+n[8]*r+n[12])/a,t[1]=(n[1]*i+n[5]*s+n[9]*r+n[13])/a,t[2]=(n[2]*i+n[6]*s+n[10]*r+n[14])/a}(this,this,t),this}scaleRotateMatrix4(t){return function(t,e,n){let i=e[0],s=e[1],r=e[2],a=n[3]*i+n[7]*s+n[11]*r+n[15];a=a||1,t[0]=(n[0]*i+n[4]*s+n[8]*r)/a,t[1]=(n[1]*i+n[5]*s+n[9]*r)/a,t[2]=(n[2]*i+n[6]*s+n[10]*r)/a}(this,this,t),this}applyQuaternion(t){return function(t,e,n){let i=e[0],s=e[1],r=e[2],a=n[0],o=n[1],h=n[2],l=o*r-h*s,u=h*i-a*r,c=a*s-o*i,p=o*c-h*u,d=h*l-a*c,m=a*u-o*l,f=2*n[3];l*=f,u*=f,c*=f,p*=2,d*=2,m*=2,t[0]=i+l+p,t[1]=s+u+d,t[2]=r+c+m}(this,this,t),this}angle(t){return g(this,t)}lerp(t,e){return function(t,e,n,i){let s=e[0],r=e[1],a=e[2];t[0]=s+i*(n[0]-s),t[1]=r+i*(n[1]-r),t[2]=a+i*(n[2]-a)}(this,this,t,e),this}clone(){return new v(this[0],this[1],this[2])}fromArray(t,e=0){return this[0]=t[e],this[1]=t[e+1],this[2]=t[e+2],this}toArray(t=[],e=0){return t[e]=this[0],t[e+1]=this[1],t[e+2]=this[2],t}transformDirection(t){const e=this[0],n=this[1],i=this[2];return this[0]=t[0]*e+t[4]*n+t[8]*i,this[1]=t[1]*e+t[5]*n+t[9]*i,this[2]=t[2]*e+t[6]*n+t[10]*i,this.normalize()}}const y=new v;let x=1;class w{constructor({canvas:t=document.createElement("canvas"),width:e=300,height:n=150,dpr:i=1,alpha:s=!1,depth:r=!0,stencil:a=!1,antialias:o=!1,premultipliedAlpha:h=!1,preserveDrawingBuffer:l=!1,powerPreference:u="default",autoClear:c=!0,webgl:p=2}={}){const d={alpha:s,depth:r,stencil:a,antialias:o,premultipliedAlpha:h,preserveDrawingBuffer:l,powerPreference:u};this.dpr=i,this.alpha=s,this.color=!0,this.depth=r,this.stencil=a,this.premultipliedAlpha=h,this.autoClear=c,this.id=x++,2===p&amp;&amp;(this.gl=t.getContext("webgl2",d)),this.isWebgl2=!!this.gl,this.gl||(this.gl=t.getContext("webgl",d)),this.gl||console.error("unable to create webgl context"),this.gl.renderer=this,this.setSize(e,n),this.state={},this.state.blendFunc={src:this.gl.ONE,dst:this.gl.ZERO},this.state.blendEquation={modeRGB:this.gl.FUNC_ADD},this.state.cullFace=null,this.state.frontFace=this.gl.CCW,this.state.depthMask=!0,this.state.depthFunc=this.gl.LESS,this.state.premultiplyAlpha=!1,this.state.flipY=!1,this.state.unpackAlignment=4,this.state.framebuffer=null,this.state.viewport={x:0,y:0,width:null,height:null},this.state.textureUnits=[],this.state.activeTextureUnit=0,this.state.boundBuffer=null,this.state.uniformLocations=new Map,this.extensions={},this.isWebgl2?(this.getExtension("EXT_color_buffer_float"),this.getExtension("OES_texture_float_linear")):(this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_texture_half_float"),this.getExtension("OES_texture_half_float_linear"),this.getExtension("OES_element_index_uint"),this.getExtension("OES_standard_derivatives"),this.getExtension("EXT_sRGB"),this.getExtension("WEBGL_depth_texture"),this.getExtension("WEBGL_draw_buffers")),this.getExtension("WEBGL_compressed_texture_astc"),this.getExtension("EXT_texture_compression_bptc"),this.getExtension("WEBGL_compressed_texture_s3tc"),this.getExtension("WEBGL_compressed_texture_etc1"),this.getExtension("WEBGL_compressed_texture_pvrtc"),this.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this.vertexAttribDivisor=this.getExtension("ANGLE_instanced_arrays","vertexAttribDivisor","vertexAttribDivisorANGLE"),this.drawArraysInstanced=this.getExtension("ANGLE_instanced_arrays","drawArraysInstanced","drawArraysInstancedANGLE"),this.drawElementsInstanced=this.getExtension("ANGLE_instanced_arrays","drawElementsInstanced","drawElementsInstancedANGLE"),this.createVertexArray=this.getExtension("OES_vertex_array_object","createVertexArray","createVertexArrayOES"),this.bindVertexArray=this.getExtension("OES_vertex_array_object","bindVertexArray","bindVertexArrayOES"),this.deleteVertexArray=this.getExtension("OES_vertex_array_object","deleteVertexArray","deleteVertexArrayOES"),this.drawBuffers=this.getExtension("WEBGL_draw_buffers","drawBuffers","drawBuffersWEBGL"),this.parameters={},this.parameters.maxTextureUnits=this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.parameters.maxAnisotropy=this.getExtension("EXT_texture_filter_anisotropic")?this.gl.getParameter(this.getExtension("EXT_texture_filter_anisotropic").MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}setSize(t,e){this.width=t,this.height=e,this.gl.canvas.width=t*this.dpr,this.gl.canvas.height=e*this.dpr,Object.assign(this.gl.canvas.style,{width:t+"px",height:e+"px"})}setViewport(t,e,n=0,i=0){this.state.viewport.width===t&amp;&amp;this.state.viewport.height===e||(this.state.viewport.width=t,this.state.viewport.height=e,this.state.viewport.x=n,this.state.viewport.y=i,this.gl.viewport(n,i,t,e))}setScissor(t,e,n=0,i=0){this.gl.scissor(n,i,t,e)}enable(t){!0!==this.state[t]&amp;&amp;(this.gl.enable(t),this.state[t]=!0)}disable(t){!1!==this.state[t]&amp;&amp;(this.gl.disable(t),this.state[t]=!1)}setBlendFunc(t,e,n,i){this.state.blendFunc.src===t&amp;&amp;this.state.blendFunc.dst===e&amp;&amp;this.state.blendFunc.srcAlpha===n&amp;&amp;this.state.blendFunc.dstAlpha===i||(this.state.blendFunc.src=t,this.state.blendFunc.dst=e,this.state.blendFunc.srcAlpha=n,this.state.blendFunc.dstAlpha=i,void 0!==n?this.gl.blendFuncSeparate(t,e,n,i):this.gl.blendFunc(t,e))}setBlendEquation(t,e){t=t||this.gl.FUNC_ADD,this.state.blendEquation.modeRGB===t&amp;&amp;this.state.blendEquation.modeAlpha===e||(this.state.blendEquation.modeRGB=t,this.state.blendEquation.modeAlpha=e,void 0!==e?this.gl.blendEquationSeparate(t,e):this.gl.blendEquation(t))}setCullFace(t){this.state.cullFace!==t&amp;&amp;(this.state.cullFace=t,this.gl.cullFace(t))}setFrontFace(t){this.state.frontFace!==t&amp;&amp;(this.state.frontFace=t,this.gl.frontFace(t))}setDepthMask(t){this.state.depthMask!==t&amp;&amp;(this.state.depthMask=t,this.gl.depthMask(t))}setDepthFunc(t){this.state.depthFunc!==t&amp;&amp;(this.state.depthFunc=t,this.gl.depthFunc(t))}activeTexture(t){this.state.activeTextureUnit!==t&amp;&amp;(this.state.activeTextureUnit=t,this.gl.activeTexture(this.gl.TEXTURE0+t))}bindFramebuffer({target:t=this.gl.FRAMEBUFFER,buffer:e=null}={}){this.state.framebuffer!==e&amp;&amp;(this.state.framebuffer=e,this.gl.bindFramebuffer(t,e))}getExtension(t,e,n){return e&amp;&amp;this.gl[e]?this.gl[e].bind(this.gl):(this.extensions[t]||(this.extensions[t]=this.gl.getExtension(t)),e?this.extensions[t]?this.extensions[t][n].bind(this.extensions[t]):null:this.extensions[t])}sortOpaque(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program.id!==e.program.id?t.program.id-e.program.id:t.zDepth!==e.zDepth?t.zDepth-e.zDepth:e.id-t.id}sortTransparent(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.zDepth!==e.zDepth?e.zDepth-t.zDepth:e.id-t.id}sortUI(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program.id!==e.program.id?t.program.id-e.program.id:e.id-t.id}getRenderList({scene:t,camera:e,frustumCull:n,sort:i}){let s=[];if(e&amp;&amp;n&amp;&amp;e.updateFrustum(),t.traverse((t=&gt;{if(!t.visible)return!0;t.draw&amp;&amp;(n&amp;&amp;t.frustumCulled&amp;&amp;e&amp;&amp;!e.frustumIntersectsMesh(t)||s.push(t))})),i){const t=[],n=[],i=[];s.forEach((s=&gt;{s.program.transparent?s.program.depthTest?n.push(s):i.push(s):t.push(s),s.zDepth=0,0===s.renderOrder&amp;&amp;s.program.depthTest&amp;&amp;e&amp;&amp;(s.worldMatrix.getTranslation(y),y.applyMatrix4(e.projectionViewMatrix),s.zDepth=y.z)})),t.sort(this.sortOpaque),n.sort(this.sortTransparent),i.sort(this.sortUI),s=t.concat(n,i)}return s}render({scene:t,camera:e,target:n=null,update:i=!0,sort:s=!0,frustumCull:r=!0,clear:a}){null===n?(this.bindFramebuffer(),this.setViewport(this.width*this.dpr,this.height*this.dpr)):(this.bindFramebuffer(n),this.setViewport(n.width,n.height)),(a||this.autoClear&amp;&amp;!1!==a)&amp;&amp;(!this.depth||n&amp;&amp;!n.depth||(this.enable(this.gl.DEPTH_TEST),this.setDepthMask(!0)),this.gl.clear((this.color?this.gl.COLOR_BUFFER_BIT:0)|(this.depth?this.gl.DEPTH_BUFFER_BIT:0)|(this.stencil?this.gl.STENCIL_BUFFER_BIT:0))),i&amp;&amp;t.updateMatrixWorld(),e&amp;&amp;e.updateMatrixWorld(),this.getRenderList({scene:t,camera:e,frustumCull:r,sort:s}).forEach((t=&gt;{t.draw({camera:e})}))}}function b(t,e,n){let i=e[0],s=e[1],r=e[2],a=e[3],o=n[0],h=n[1],l=n[2],u=n[3];return t[0]=i*u+a*o+s*l-r*h,t[1]=s*u+a*h+r*o-i*l,t[2]=r*u+a*l+i*h-s*o,t[3]=a*u-i*o-s*h-r*l,t}class E extends Array{constructor(t=0,e=0,n=0,i=1){return super(t,e,n,i),this.onChange=()=&gt;{},this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(t){this[0]=t,this.onChange()}set y(t){this[1]=t,this.onChange()}set z(t){this[2]=t,this.onChange()}set w(t){this[3]=t,this.onChange()}identity(){var t;return(t=this)[0]=0,t[1]=0,t[2]=0,t[3]=1,this.onChange(),this}set(t,e,n,i){return t.length?this.copy(t):(function(t,e,n,i,s){t[0]=e,t[1]=n,t[2]=i,t[3]=s}(this,t,e,n,i),this.onChange(),this)}rotateX(t){return function(t,e,n){n*=.5;let i=e[0],s=e[1],r=e[2],a=e[3],o=Math.sin(n),h=Math.cos(n);t[0]=i*h+a*o,t[1]=s*h+r*o,t[2]=r*h-s*o,t[3]=a*h-i*o}(this,this,t),this.onChange(),this}rotateY(t){return function(t,e,n){n*=.5;let i=e[0],s=e[1],r=e[2],a=e[3],o=Math.sin(n),h=Math.cos(n);t[0]=i*h-r*o,t[1]=s*h+a*o,t[2]=r*h+i*o,t[3]=a*h-s*o}(this,this,t),this.onChange(),this}rotateZ(t){return function(t,e,n){n*=.5;let i=e[0],s=e[1],r=e[2],a=e[3],o=Math.sin(n),h=Math.cos(n);t[0]=i*h+s*o,t[1]=s*h-i*o,t[2]=r*h+a*o,t[3]=a*h-r*o}(this,this,t),this.onChange(),this}inverse(t=this){return function(t,e){let n=e[0],i=e[1],s=e[2],r=e[3],a=n*n+i*i+s*s+r*r,o=a?1/a:0;t[0]=-n*o,t[1]=-i*o,t[2]=-s*o,t[3]=r*o}(this,t),this.onChange(),this}conjugate(t=this){var e,n;return n=t,(e=this)[0]=-n[0],e[1]=-n[1],e[2]=-n[2],e[3]=n[3],this.onChange(),this}copy(t){return n=t,(e=this)[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],this.onChange(),this;var e,n}normalize(t=this){return function(t,e){let n=e[0],i=e[1],s=e[2],r=e[3],a=n*n+i*i+s*s+r*r;a&gt;0&amp;&amp;(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=i*a,t[2]=s*a,t[3]=r*a}(this,t),this.onChange(),this}multiply(t,e){return e?b(this,t,e):b(this,this,t),this.onChange(),this}dot(t){return n=t,(e=this)[0]*n[0]+e[1]*n[1]+e[2]*n[2]+e[3]*n[3];var e,n}fromMatrix3(t){return function(t,e){let n,i=e[0]+e[4]+e[8];if(i&gt;0)n=Math.sqrt(i+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{let i=0;e[4]&gt;e[0]&amp;&amp;(i=1),e[8]&gt;e[3*i+i]&amp;&amp;(i=2);let s=(i+1)%3,r=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*s+s]-e[3*r+r]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*s+r]-e[3*r+s])*n,t[s]=(e[3*s+i]+e[3*i+s])*n,t[r]=(e[3*r+i]+e[3*i+r])*n}}(this,t),this.onChange(),this}fromEuler(t){return function(t,e,n="YXZ"){let i=Math.sin(.5*e[0]),s=Math.cos(.5*e[0]),r=Math.sin(.5*e[1]),a=Math.cos(.5*e[1]),o=Math.sin(.5*e[2]),h=Math.cos(.5*e[2]);"XYZ"===n?(t[0]=i*a*h+s*r*o,t[1]=s*r*h-i*a*o,t[2]=s*a*o+i*r*h,t[3]=s*a*h-i*r*o):"YXZ"===n?(t[0]=i*a*h+s*r*o,t[1]=s*r*h-i*a*o,t[2]=s*a*o-i*r*h,t[3]=s*a*h+i*r*o):"ZXY"===n?(t[0]=i*a*h-s*r*o,t[1]=s*r*h+i*a*o,t[2]=s*a*o+i*r*h,t[3]=s*a*h-i*r*o):"ZYX"===n?(t[0]=i*a*h-s*r*o,t[1]=s*r*h+i*a*o,t[2]=s*a*o-i*r*h,t[3]=s*a*h+i*r*o):"YZX"===n?(t[0]=i*a*h+s*r*o,t[1]=s*r*h+i*a*o,t[2]=s*a*o-i*r*h,t[3]=s*a*h-i*r*o):"XZY"===n&amp;&amp;(t[0]=i*a*h-s*r*o,t[1]=s*r*h-i*a*o,t[2]=s*a*o+i*r*h,t[3]=s*a*h+i*r*o)}(this,t,t.order),this}fromAxisAngle(t,e){return function(t,e,n){n*=.5;let i=Math.sin(n);t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(n)}(this,t,e),this}slerp(t,e){return function(t,e,n,i){let s,r,a,o,h,l=e[0],u=e[1],c=e[2],p=e[3],d=n[0],m=n[1],f=n[2],g=n[3];r=l*d+u*m+c*f+p*g,r&lt;0&amp;&amp;(r=-r,d=-d,m=-m,f=-f,g=-g),1-r&gt;1e-6?(s=Math.acos(r),a=Math.sin(s),o=Math.sin((1-i)*s)/a,h=Math.sin(i*s)/a):(o=1-i,h=i),t[0]=o*l+h*d,t[1]=o*u+h*m,t[2]=o*c+h*f,t[3]=o*p+h*g}(this,this,t,e),this}fromArray(t,e=0){return this[0]=t[e],this[1]=t[e+1],this[2]=t[e+2],this[3]=t[e+3],this}toArray(t=[],e=0){return t[e]=this[0],t[e+1]=this[1],t[e+2]=this[2],t[e+3]=this[3],t}}function M(t,e,n){let i=e[0],s=e[1],r=e[2],a=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],p=e[9],d=e[10],m=e[11],f=e[12],g=e[13],v=e[14],y=e[15],x=n[0],w=n[1],b=n[2],E=n[3];return t[0]=x*i+w*o+b*c+E*f,t[1]=x*s+w*h+b*p+E*g,t[2]=x*r+w*l+b*d+E*v,t[3]=x*a+w*u+b*m+E*y,x=n[4],w=n[5],b=n[6],E=n[7],t[4]=x*i+w*o+b*c+E*f,t[5]=x*s+w*h+b*p+E*g,t[6]=x*r+w*l+b*d+E*v,t[7]=x*a+w*u+b*m+E*y,x=n[8],w=n[9],b=n[10],E=n[11],t[8]=x*i+w*o+b*c+E*f,t[9]=x*s+w*h+b*p+E*g,t[10]=x*r+w*l+b*d+E*v,t[11]=x*a+w*u+b*m+E*y,x=n[12],w=n[13],b=n[14],E=n[15],t[12]=x*i+w*o+b*c+E*f,t[13]=x*s+w*h+b*p+E*g,t[14]=x*r+w*l+b*d+E*v,t[15]=x*a+w*u+b*m+E*y,t}function A(t,e){let n=e[0],i=e[1],s=e[2],r=e[4],a=e[5],o=e[6],h=e[8],l=e[9],u=e[10];return t[0]=Math.hypot(n,i,s),t[1]=Math.hypot(r,a,o),t[2]=Math.hypot(h,l,u),t}const S=function(){const t=[0,0,0];return function(e,n){let i=t;A(i,n);let s=1/i[0],r=1/i[1],a=1/i[2],o=n[0]*s,h=n[1]*r,l=n[2]*a,u=n[4]*s,c=n[5]*r,p=n[6]*a,d=n[8]*s,m=n[9]*r,f=n[10]*a,g=o+c+f,v=0;return g&gt;0?(v=2*Math.sqrt(g+1),e[3]=.25*v,e[0]=(p-m)/v,e[1]=(d-l)/v,e[2]=(h-u)/v):o&gt;c&amp;&amp;o&gt;f?(v=2*Math.sqrt(1+o-c-f),e[3]=(p-m)/v,e[0]=.25*v,e[1]=(h+u)/v,e[2]=(d+l)/v):c&gt;f?(v=2*Math.sqrt(1+c-o-f),e[3]=(d-l)/v,e[0]=(h+u)/v,e[1]=.25*v,e[2]=(p+m)/v):(v=2*Math.sqrt(1+f-o-c),e[3]=(h-u)/v,e[0]=(d+l)/v,e[1]=(p+m)/v,e[2]=.25*v),e}}();class T extends Array{constructor(t=1,e=0,n=0,i=0,s=0,r=1,a=0,o=0,h=0,l=0,u=1,c=0,p=0,d=0,m=0,f=1){return super(t,e,n,i,s,r,a,o,h,l,u,c,p,d,m,f),this}get x(){return this[12]}get y(){return this[13]}get z(){return this[14]}get w(){return this[15]}set x(t){this[12]=t}set y(t){this[13]=t}set z(t){this[14]=t}set w(t){this[15]=t}set(t,e,n,i,s,r,a,o,h,l,u,c,p,d,m,f){return t.length?this.copy(t):(function(t,e,n,i,s,r,a,o,h,l,u,c,p,d,m,f,g){t[0]=e,t[1]=n,t[2]=i,t[3]=s,t[4]=r,t[5]=a,t[6]=o,t[7]=h,t[8]=l,t[9]=u,t[10]=c,t[11]=p,t[12]=d,t[13]=m,t[14]=f,t[15]=g}(this,t,e,n,i,s,r,a,o,h,l,u,c,p,d,m,f),this)}translate(t,e=this){return function(t,e,n){let i,s,r,a,o,h,l,u,c,p,d,m,f=n[0],g=n[1],v=n[2];e===t?(t[12]=e[0]*f+e[4]*g+e[8]*v+e[12],t[13]=e[1]*f+e[5]*g+e[9]*v+e[13],t[14]=e[2]*f+e[6]*g+e[10]*v+e[14],t[15]=e[3]*f+e[7]*g+e[11]*v+e[15]):(i=e[0],s=e[1],r=e[2],a=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],p=e[9],d=e[10],m=e[11],t[0]=i,t[1]=s,t[2]=r,t[3]=a,t[4]=o,t[5]=h,t[6]=l,t[7]=u,t[8]=c,t[9]=p,t[10]=d,t[11]=m,t[12]=i*f+o*g+c*v+e[12],t[13]=s*f+h*g+p*v+e[13],t[14]=r*f+l*g+d*v+e[14],t[15]=a*f+u*g+m*v+e[15])}(this,e,t),this}rotate(t,e,n=this){return function(t,e,n,i){let s,r,a,o,h,l,u,c,p,d,m,f,g,v,y,x,w,b,E,M,A,S,T,C,P=i[0],F=i[1],O=i[2],_=Math.hypot(P,F,O);Math.abs(_)&lt;1e-6||(_=1/_,P*=_,F*=_,O*=_,s=Math.sin(n),r=Math.cos(n),a=1-r,o=e[0],h=e[1],l=e[2],u=e[3],c=e[4],p=e[5],d=e[6],m=e[7],f=e[8],g=e[9],v=e[10],y=e[11],x=P*P*a+r,w=F*P*a+O*s,b=O*P*a-F*s,E=P*F*a-O*s,M=F*F*a+r,A=O*F*a+P*s,S=P*O*a+F*s,T=F*O*a-P*s,C=O*O*a+r,t[0]=o*x+c*w+f*b,t[1]=h*x+p*w+g*b,t[2]=l*x+d*w+v*b,t[3]=u*x+m*w+y*b,t[4]=o*E+c*M+f*A,t[5]=h*E+p*M+g*A,t[6]=l*E+d*M+v*A,t[7]=u*E+m*M+y*A,t[8]=o*S+c*T+f*C,t[9]=h*S+p*T+g*C,t[10]=l*S+d*T+v*C,t[11]=u*S+m*T+y*C,e!==t&amp;&amp;(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,n,t,e),this}scale(t,e=this){return function(t,e,n){let i=n[0],s=n[1],r=n[2];t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(this,e,"number"==typeof t?[t,t,t]:t),this}multiply(t,e){return e?M(this,t,e):M(this,this,t),this}identity(){var t;return(t=this)[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}copy(t){var e,n;return n=t,(e=this)[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}fromPerspective({fov:t,aspect:e,near:n,far:i}={}){return function(t,e,n,i,s){let r=1/Math.tan(e/2),a=1/(i-s);t[0]=r/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(s+i)*a,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*s*i*a,t[15]=0}(this,t,e,n,i),this}fromOrthogonal({left:t,right:e,bottom:n,top:i,near:s,far:r}){return function(t,e,n,i,s,r,a){let o=1/(e-n),h=1/(i-s),l=1/(r-a);t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+n)*o,t[13]=(s+i)*h,t[14]=(a+r)*l,t[15]=1}(this,t,e,n,i,s,r),this}fromQuaternion(t){return function(t,e){let n=e[0],i=e[1],s=e[2],r=e[3],a=n+n,o=i+i,h=s+s,l=n*a,u=i*a,c=i*o,p=s*a,d=s*o,m=s*h,f=r*a,g=r*o,v=r*h;t[0]=1-c-m,t[1]=u+v,t[2]=p-g,t[3]=0,t[4]=u-v,t[5]=1-l-m,t[6]=d+f,t[7]=0,t[8]=p+g,t[9]=d-f,t[10]=1-l-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this}setPosition(t){return this.x=t[0],this.y=t[1],this.z=t[2],this}inverse(t=this){return function(t,e){let n=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],l=e[7],u=e[8],c=e[9],p=e[10],d=e[11],m=e[12],f=e[13],g=e[14],v=e[15],y=n*o-i*a,x=n*h-s*a,w=n*l-r*a,b=i*h-s*o,E=i*l-r*o,M=s*l-r*h,A=u*f-c*m,S=u*g-p*m,T=u*v-d*m,C=c*g-p*f,P=c*v-d*f,F=p*v-d*g,O=y*F-x*P+w*C+b*T-E*S+M*A;O&amp;&amp;(O=1/O,t[0]=(o*F-h*P+l*C)*O,t[1]=(s*P-i*F-r*C)*O,t[2]=(f*M-g*E+v*b)*O,t[3]=(p*E-c*M-d*b)*O,t[4]=(h*T-a*F-l*S)*O,t[5]=(n*F-s*T+r*S)*O,t[6]=(g*w-m*M-v*x)*O,t[7]=(u*M-p*w+d*x)*O,t[8]=(a*P-o*T+l*A)*O,t[9]=(i*T-n*P-r*A)*O,t[10]=(m*E-f*w+v*y)*O,t[11]=(c*w-u*E-d*y)*O,t[12]=(o*S-a*C-h*A)*O,t[13]=(n*C-i*S+s*A)*O,t[14]=(f*x-m*b-g*y)*O,t[15]=(u*b-c*x+p*y)*O)}(this,t),this}compose(t,e,n){return function(t,e,n,i){let s=e[0],r=e[1],a=e[2],o=e[3],h=s+s,l=r+r,u=a+a,c=s*h,p=s*l,d=s*u,m=r*l,f=r*u,g=a*u,v=o*h,y=o*l,x=o*u,w=i[0],b=i[1],E=i[2];t[0]=(1-(m+g))*w,t[1]=(p+x)*w,t[2]=(d-y)*w,t[3]=0,t[4]=(p-x)*b,t[5]=(1-(c+g))*b,t[6]=(f+v)*b,t[7]=0,t[8]=(d+y)*E,t[9]=(f-v)*E,t[10]=(1-(c+m))*E,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1}(this,t,e,n),this}getRotation(t){return S(t,this),this}getTranslation(t){var e,n;return n=this,(e=t)[0]=n[12],e[1]=n[13],e[2]=n[14],this}getScaling(t){return A(t,this),this}getMaxScaleOnAxis(){return function(t){let e=t[0],n=t[1],i=t[2],s=t[4],r=t[5],a=t[6],o=t[8],h=t[9],l=t[10];const u=e*e+n*n+i*i,c=s*s+r*r+a*a,p=o*o+h*h+l*l;return Math.sqrt(Math.max(u,c,p))}(this)}lookAt(t,e,n){return function(t,e,n,i){let s=e[0],r=e[1],a=e[2],o=i[0],h=i[1],l=i[2],u=s-n[0],c=r-n[1],p=a-n[2],d=u*u+c*c+p*p;0===d?p=1:(d=1/Math.sqrt(d),u*=d,c*=d,p*=d);let m=h*p-l*c,f=l*u-o*p,g=o*c-h*u;d=m*m+f*f+g*g,0===d&amp;&amp;(l?o+=1e-6:h?l+=1e-6:h+=1e-6,m=h*p-l*c,f=l*u-o*p,g=o*c-h*u,d=m*m+f*f+g*g),d=1/Math.sqrt(d),m*=d,f*=d,g*=d,t[0]=m,t[1]=f,t[2]=g,t[3]=0,t[4]=c*g-p*f,t[5]=p*m-u*g,t[6]=u*f-c*m,t[7]=0,t[8]=u,t[9]=c,t[10]=p,t[11]=0,t[12]=s,t[13]=r,t[14]=a,t[15]=1}(this,t,e,n),this}determinant(){return function(t){let e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],a=t[5],o=t[6],h=t[7],l=t[8],u=t[9],c=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15];return(e*a-n*r)*(c*g-p*f)-(e*o-i*r)*(u*g-p*m)+(e*h-s*r)*(u*f-c*m)+(n*o-i*a)*(l*g-p*d)-(n*h-s*a)*(l*f-c*d)+(i*h-s*o)*(l*m-u*d)}(this)}fromArray(t,e=0){return this[0]=t[e],this[1]=t[e+1],this[2]=t[e+2],this[3]=t[e+3],this[4]=t[e+4],this[5]=t[e+5],this[6]=t[e+6],this[7]=t[e+7],this[8]=t[e+8],this[9]=t[e+9],this[10]=t[e+10],this[11]=t[e+11],this[12]=t[e+12],this[13]=t[e+13],this[14]=t[e+14],this[15]=t[e+15],this}toArray(t=[],e=0){return t[e]=this[0],t[e+1]=this[1],t[e+2]=this[2],t[e+3]=this[3],t[e+4]=this[4],t[e+5]=this[5],t[e+6]=this[6],t[e+7]=this[7],t[e+8]=this[8],t[e+9]=this[9],t[e+10]=this[10],t[e+11]=this[11],t[e+12]=this[12],t[e+13]=this[13],t[e+14]=this[14],t[e+15]=this[15],t}}const C=new T;class P extends Array{constructor(t=0,e=t,n=t,i="YXZ"){return super(t,e,n),this.order=i,this.onChange=()=&gt;{},this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(t){this[0]=t,this.onChange()}set y(t){this[1]=t,this.onChange()}set z(t){this[2]=t,this.onChange()}set(t,e=t,n=t){return t.length?this.copy(t):(this[0]=t,this[1]=e,this[2]=n,this.onChange(),this)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.onChange(),this}reorder(t){return this.order=t,this.onChange(),this}fromRotationMatrix(t,e=this.order){return function(t,e,n="YXZ"){"XYZ"===n?(t[1]=Math.asin(Math.min(Math.max(e[8],-1),1)),Math.abs(e[8])&lt;.99999?(t[0]=Math.atan2(-e[9],e[10]),t[2]=Math.atan2(-e[4],e[0])):(t[0]=Math.atan2(e[6],e[5]),t[2]=0)):"YXZ"===n?(t[0]=Math.asin(-Math.min(Math.max(e[9],-1),1)),Math.abs(e[9])&lt;.99999?(t[1]=Math.atan2(e[8],e[10]),t[2]=Math.atan2(e[1],e[5])):(t[1]=Math.atan2(-e[2],e[0]),t[2]=0)):"ZXY"===n?(t[0]=Math.asin(Math.min(Math.max(e[6],-1),1)),Math.abs(e[6])&lt;.99999?(t[1]=Math.atan2(-e[2],e[10]),t[2]=Math.atan2(-e[4],e[5])):(t[1]=0,t[2]=Math.atan2(e[1],e[0]))):"ZYX"===n?(t[1]=Math.asin(-Math.min(Math.max(e[2],-1),1)),Math.abs(e[2])&lt;.99999?(t[0]=Math.atan2(e[6],e[10]),t[2]=Math.atan2(e[1],e[0])):(t[0]=0,t[2]=Math.atan2(-e[4],e[5]))):"YZX"===n?(t[2]=Math.asin(Math.min(Math.max(e[1],-1),1)),Math.abs(e[1])&lt;.99999?(t[0]=Math.atan2(-e[9],e[5]),t[1]=Math.atan2(-e[2],e[0])):(t[0]=0,t[1]=Math.atan2(e[8],e[10]))):"XZY"===n&amp;&amp;(t[2]=Math.asin(-Math.min(Math.max(e[4],-1),1)),Math.abs(e[4])&lt;.99999?(t[0]=Math.atan2(e[6],e[5]),t[1]=Math.atan2(e[8],e[0])):(t[0]=Math.atan2(-e[9],e[10]),t[1]=0))}(this,t,e),this}fromQuaternion(t,e=this.order){return C.fromQuaternion(t),this.fromRotationMatrix(C,e)}toArray(t=[],e=0){return t[e]=this[0],t[e+1]=this[1],t[e+2]=this[2],t}}class F{constructor(){this.parent=null,this.children=[],this.visible=!0,this.matrix=new T,this.worldMatrix=new T,this.matrixAutoUpdate=!0,this.position=new v,this.quaternion=new E,this.scale=new v(1),this.rotation=new P,this.up=new v(0,1,0),this.rotation.onChange=()=&gt;this.quaternion.fromEuler(this.rotation),this.quaternion.onChange=()=&gt;this.rotation.fromQuaternion(this.quaternion)}setParent(t,e=!0){this.parent&amp;&amp;t!==this.parent&amp;&amp;this.parent.removeChild(this,!1),this.parent=t,e&amp;&amp;t&amp;&amp;t.addChild(this,!1)}addChild(t,e=!0){~this.children.indexOf(t)||this.children.push(t),e&amp;&amp;t.setParent(this,!1)}removeChild(t,e=!0){~this.children.indexOf(t)&amp;&amp;this.children.splice(this.children.indexOf(t),1),e&amp;&amp;t.setParent(null,!1)}updateMatrixWorld(t){this.matrixAutoUpdate&amp;&amp;this.updateMatrix(),(this.worldMatrixNeedsUpdate||t)&amp;&amp;(null===this.parent?this.worldMatrix.copy(this.matrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.matrix),this.worldMatrixNeedsUpdate=!1,t=!0);for(let e=0,n=this.children.length;e&lt;n;e++)this.children[e].updateMatrixWorld(t)}updateMatrix(){this.matrix.compose(this.quaternion,this.position,this.scale),this.worldMatrixNeedsUpdate=!0}traverse(t){if(!t(this))for(let e=0,n=this.children.length;e&lt;n;e++)this.children[e].traverse(t)}decompose(){this.matrix.getTranslation(this.position),this.matrix.getRotation(this.quaternion),this.matrix.getScaling(this.scale),this.rotation.fromQuaternion(this.quaternion)}lookAt(t,e=!1){e?this.matrix.lookAt(this.position,t,this.up):this.matrix.lookAt(t,this.position,this.up),this.matrix.getRotation(this.quaternion),this.rotation.fromQuaternion(this.quaternion)}}const O=new T,_=new v,D=new v;class R extends F{constructor(t,{near:e=.1,far:n=100,fov:i=45,aspect:s=1,left:r,right:a,bottom:o,top:h,zoom:l=1}={}){super(),Object.assign(this,{near:e,far:n,fov:i,aspect:s,left:r,right:a,bottom:o,top:h,zoom:l}),this.projectionMatrix=new T,this.viewMatrix=new T,this.projectionViewMatrix=new T,this.worldPosition=new v,this.type=r||a?"orthographic":"perspective","orthographic"===this.type?this.orthographic():this.perspective()}perspective({near:t=this.near,far:e=this.far,fov:n=this.fov,aspect:i=this.aspect}={}){return Object.assign(this,{near:t,far:e,fov:n,aspect:i}),this.projectionMatrix.fromPerspective({fov:n*(Math.PI/180),aspect:i,near:t,far:e}),this.type="perspective",this}orthographic({near:t=this.near,far:e=this.far,left:n=this.left,right:i=this.right,bottom:s=this.bottom,top:r=this.top,zoom:a=this.zoom}={}){return Object.assign(this,{near:t,far:e,left:n,right:i,bottom:s,top:r,zoom:a}),n/=a,i/=a,s/=a,r/=a,this.projectionMatrix.fromOrthogonal({left:n,right:i,bottom:s,top:r,near:t,far:e}),this.type="orthographic",this}updateMatrixWorld(){return super.updateMatrixWorld(),this.viewMatrix.inverse(this.worldMatrix),this.worldMatrix.getTranslation(this.worldPosition),this.projectionViewMatrix.multiply(this.projectionMatrix,this.viewMatrix),this}lookAt(t){return super.lookAt(t,!0),this}project(t){return t.applyMatrix4(this.viewMatrix),t.applyMatrix4(this.projectionMatrix),this}unproject(t){return t.applyMatrix4(O.inverse(this.projectionMatrix)),t.applyMatrix4(this.worldMatrix),this}updateFrustum(){this.frustum||(this.frustum=[new v,new v,new v,new v,new v,new v]);const t=this.projectionViewMatrix;this.frustum[0].set(t[3]-t[0],t[7]-t[4],t[11]-t[8]).constant=t[15]-t[12],this.frustum[1].set(t[3]+t[0],t[7]+t[4],t[11]+t[8]).constant=t[15]+t[12],this.frustum[2].set(t[3]+t[1],t[7]+t[5],t[11]+t[9]).constant=t[15]+t[13],this.frustum[3].set(t[3]-t[1],t[7]-t[5],t[11]-t[9]).constant=t[15]-t[13],this.frustum[4].set(t[3]-t[2],t[7]-t[6],t[11]-t[10]).constant=t[15]-t[14],this.frustum[5].set(t[3]+t[2],t[7]+t[6],t[11]+t[10]).constant=t[15]+t[14];for(let t=0;t&lt;6;t++){const e=1/this.frustum[t].distance();this.frustum[t].multiply(e),this.frustum[t].constant*=e}}frustumIntersectsMesh(t){if(!t.geometry.attributes.position)return!0;if(t.geometry.bounds&amp;&amp;t.geometry.bounds.radius!==1/0||t.geometry.computeBoundingSphere(),!t.geometry.bounds)return!0;const e=_;e.copy(t.geometry.bounds.center),e.applyMatrix4(t.worldMatrix);const n=t.geometry.bounds.radius*t.worldMatrix.getMaxScaleOnAxis();return this.frustumIntersectsSphere(e,n)}frustumIntersectsSphere(t,e){const n=D;for(let i=0;i&lt;6;i++){const s=this.frustum[i];if(n.copy(s).dot(t)+s.constant&lt;-e)return!1}return!0}}let I=1;const N={};class L{constructor(t,{vertex:e,fragment:n,uniforms:i={},transparent:s=!1,cullFace:r=t.BACK,frontFace:a=t.CCW,depthTest:o=!0,depthWrite:h=!0,depthFunc:l=t.LESS}={}){t.canvas||console.error("gl not passed as fist argument to Program"),this.gl=t,this.uniforms=i,this.id=I++,e||console.warn("vertex shader not supplied"),n||console.warn("fragment shader not supplied"),this.transparent=s,this.cullFace=r,this.frontFace=a,this.depthTest=o,this.depthWrite=h,this.depthFunc=l,this.blendFunc={},this.blendEquation={},this.transparent&amp;&amp;!this.blendFunc.src&amp;&amp;(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA));const u=t.createShader(t.VERTEX_SHADER);t.shaderSource(u,e),t.compileShader(u),""!==t.getShaderInfoLog(u)&amp;&amp;console.warn(`${t.getShaderInfoLog(u)}\nVertex Shader\n${B(e)}`);const c=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(c,n),t.compileShader(c),""!==t.getShaderInfoLog(c)&amp;&amp;console.warn(`${t.getShaderInfoLog(c)}\nFragment Shader\n${B(n)}`),this.program=t.createProgram(),t.attachShader(this.program,u),t.attachShader(this.program,c),t.linkProgram(this.program),!t.getProgramParameter(this.program,t.LINK_STATUS))return console.warn(t.getProgramInfoLog(this.program));t.deleteShader(u),t.deleteShader(c),this.uniformLocations=new Map;let p=t.getProgramParameter(this.program,t.ACTIVE_UNIFORMS);for(let e=0;e&lt;p;e++){let n=t.getActiveUniform(this.program,e);this.uniformLocations.set(n,t.getUniformLocation(this.program,n.name));const i=n.name.match(/(\w+)/g);n.uniformName=i[0],3===i.length?(n.isStructArray=!0,n.structIndex=Number(i[1]),n.structProperty=i[2]):2===i.length&amp;&amp;isNaN(Number(i[1]))&amp;&amp;(n.isStruct=!0,n.structProperty=i[1])}this.attributeLocations=new Map;const d=[],m=t.getProgramParameter(this.program,t.ACTIVE_ATTRIBUTES);for(let e=0;e&lt;m;e++){const n=t.getActiveAttrib(this.program,e),i=t.getAttribLocation(this.program,n.name);d[i]=n.name,this.attributeLocations.set(n,i)}this.attributeOrder=d.join("")}setBlendFunc(t,e,n,i){this.blendFunc.src=t,this.blendFunc.dst=e,this.blendFunc.srcAlpha=n,this.blendFunc.dstAlpha=i,t&amp;&amp;(this.transparent=!0)}setBlendEquation(t,e){this.blendEquation.modeRGB=t,this.blendEquation.modeAlpha=e}applyState(){this.depthTest?this.gl.renderer.enable(this.gl.DEPTH_TEST):this.gl.renderer.disable(this.gl.DEPTH_TEST),this.cullFace?this.gl.renderer.enable(this.gl.CULL_FACE):this.gl.renderer.disable(this.gl.CULL_FACE),this.blendFunc.src?this.gl.renderer.enable(this.gl.BLEND):this.gl.renderer.disable(this.gl.BLEND),this.cullFace&amp;&amp;this.gl.renderer.setCullFace(this.cullFace),this.gl.renderer.setFrontFace(this.frontFace),this.gl.renderer.setDepthMask(this.depthWrite),this.gl.renderer.setDepthFunc(this.depthFunc),this.blendFunc.src&amp;&amp;this.gl.renderer.setBlendFunc(this.blendFunc.src,this.blendFunc.dst,this.blendFunc.srcAlpha,this.blendFunc.dstAlpha),this.gl.renderer.setBlendEquation(this.blendEquation.modeRGB,this.blendEquation.modeAlpha)}use({flipFaces:t=!1}={}){let e=-1;this.gl.renderer.currentProgram===this.id||(this.gl.useProgram(this.program),this.gl.renderer.currentProgram=this.id),this.uniformLocations.forEach(((t,n)=&gt;{let i=n.uniformName,s=this.uniforms[i];if(n.isStruct&amp;&amp;(s=s[n.structProperty],i+=`.${n.structProperty}`),n.isStructArray&amp;&amp;(s=s[n.structIndex][n.structProperty],i+=`[${n.structIndex}].${n.structProperty}`),!s)return Y(`Active uniform ${i} has not been supplied`);if(s&amp;&amp;void 0===s.value)return Y(`${i} uniform is missing a value parameter`);if(s.value.texture)return e+=1,s.value.update(e),z(this.gl,n.type,t,e);if(s.value.length&amp;&amp;s.value[0].texture){const i=[];return s.value.forEach((t=&gt;{e+=1,t.update(e),i.push(e)})),z(this.gl,n.type,t,i)}z(this.gl,n.type,t,s.value)})),this.applyState(),t&amp;&amp;this.gl.renderer.setFrontFace(this.frontFace===this.gl.CCW?this.gl.CW:this.gl.CCW)}remove(){this.gl.deleteProgram(this.program)}}function z(t,e,n,i){i=i.length?function(t){const e=t.length,n=t[0].length;if(void 0===n)return t;const i=e*n;let s=N[i];s||(N[i]=s=new Float32Array(i));for(let i=0;i&lt;e;i++)s.set(t[i],i*n);return s}(i):i;const s=t.renderer.state.uniformLocations.get(n);if(i.length)if(void 0===s||s.length!==i.length)t.renderer.state.uniformLocations.set(n,i.slice(0));else{if(function(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n&lt;i;n++)if(t[n]!==e[n])return!1;return!0}(s,i))return;s.set?s.set(i):function(t,e){for(let n=0,i=t.length;n&lt;i;n++)t[n]=e[n]}(s,i),t.renderer.state.uniformLocations.set(n,s)}else{if(s===i)return;t.renderer.state.uniformLocations.set(n,i)}switch(e){case 5126:return i.length?t.uniform1fv(n,i):t.uniform1f(n,i);case 35664:return t.uniform2fv(n,i);case 35665:return t.uniform3fv(n,i);case 35666:return t.uniform4fv(n,i);case 35670:case 5124:case 35678:case 35680:return i.length?t.uniform1iv(n,i):t.uniform1i(n,i);case 35671:case 35667:return t.uniform2iv(n,i);case 35672:case 35668:return t.uniform3iv(n,i);case 35673:case 35669:return t.uniform4iv(n,i);case 35674:return t.uniformMatrix2fv(n,!1,i);case 35675:return t.uniformMatrix3fv(n,!1,i);case 35676:return t.uniformMatrix4fv(n,!1,i)}}function B(t){let e=t.split("\n");for(let t=0;t&lt;e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}let U=0;function Y(t){U&gt;100||(console.warn(t),U++,U&gt;100&amp;&amp;console.warn("More than 100 program warnings - stopping logs."))}function X(t,e,n){let i=e[0],s=e[1],r=e[2],a=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],p=n[0],d=n[1],m=n[2],f=n[3],g=n[4],v=n[5],y=n[6],x=n[7],w=n[8];return t[0]=p*i+d*a+m*l,t[1]=p*s+d*o+m*u,t[2]=p*r+d*h+m*c,t[3]=f*i+g*a+v*l,t[4]=f*s+g*o+v*u,t[5]=f*r+g*h+v*c,t[6]=y*i+x*a+w*l,t[7]=y*s+x*o+w*u,t[8]=y*r+x*h+w*c,t}class V extends Array{constructor(t=1,e=0,n=0,i=0,s=1,r=0,a=0,o=0,h=1){return super(t,e,n,i,s,r,a,o,h),this}set(t,e,n,i,s,r,a,o,h){return t.length?this.copy(t):(function(t,e,n,i,s,r,a,o,h,l){t[0]=e,t[1]=n,t[2]=i,t[3]=s,t[4]=r,t[5]=a,t[6]=o,t[7]=h,t[8]=l}(this,t,e,n,i,s,r,a,o,h),this)}translate(t,e=this){return function(t,e,n){let i=e[0],s=e[1],r=e[2],a=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],p=n[0],d=n[1];t[0]=i,t[1]=s,t[2]=r,t[3]=a,t[4]=o,t[5]=h,t[6]=p*i+d*a+l,t[7]=p*s+d*o+u,t[8]=p*r+d*h+c}(this,e,t),this}rotate(t,e=this){return function(t,e,n){let i=e[0],s=e[1],r=e[2],a=e[3],o=e[4],h=e[5],l=e[6],u=e[7],c=e[8],p=Math.sin(n),d=Math.cos(n);t[0]=d*i+p*a,t[1]=d*s+p*o,t[2]=d*r+p*h,t[3]=d*a-p*i,t[4]=d*o-p*s,t[5]=d*h-p*r,t[6]=l,t[7]=u,t[8]=c}(this,e,t),this}scale(t,e=this){return function(t,e,n){let i=n[0],s=n[1];t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8]}(this,e,t),this}multiply(t,e){return e?X(this,t,e):X(this,this,t),this}identity(){var t;return(t=this)[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,this}copy(t){var e,n;return n=t,(e=this)[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}fromMatrix4(t){var e,n;return n=t,(e=this)[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[4],e[4]=n[5],e[5]=n[6],e[6]=n[8],e[7]=n[9],e[8]=n[10],this}fromQuaternion(t){return function(t,e){let n=e[0],i=e[1],s=e[2],r=e[3],a=n+n,o=i+i,h=s+s,l=n*a,u=i*a,c=i*o,p=s*a,d=s*o,m=s*h,f=r*a,g=r*o,v=r*h;t[0]=1-c-m,t[3]=u-v,t[6]=p+g,t[1]=u+v,t[4]=1-l-m,t[7]=d-f,t[2]=p-g,t[5]=d+f,t[8]=1-l-c}(this,t),this}fromBasis(t,e,n){return this.set(t[0],t[1],t[2],e[0],e[1],e[2],n[0],n[1],n[2]),this}inverse(t=this){return function(t,e){let n=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],l=e[7],u=e[8],c=u*a-o*l,p=-u*r+o*h,d=l*r-a*h,m=n*c+i*p+s*d;m&amp;&amp;(m=1/m,t[0]=c*m,t[1]=(-u*i+s*l)*m,t[2]=(o*i-s*a)*m,t[3]=p*m,t[4]=(u*n-s*h)*m,t[5]=(-o*n+s*r)*m,t[6]=d*m,t[7]=(-l*n+i*h)*m,t[8]=(a*n-i*r)*m)}(this,t),this}getNormalMatrix(t){return function(t,e){let n=e[0],i=e[1],s=e[2],r=e[3],a=e[4],o=e[5],h=e[6],l=e[7],u=e[8],c=e[9],p=e[10],d=e[11],m=e[12],f=e[13],g=e[14],v=e[15],y=n*o-i*a,x=n*h-s*a,w=n*l-r*a,b=i*h-s*o,E=i*l-r*o,M=s*l-r*h,A=u*f-c*m,S=u*g-p*m,T=u*v-d*m,C=c*g-p*f,P=c*v-d*f,F=p*v-d*g,O=y*F-x*P+w*C+b*T-E*S+M*A;O&amp;&amp;(O=1/O,t[0]=(o*F-h*P+l*C)*O,t[1]=(h*T-a*F-l*S)*O,t[2]=(a*P-o*T+l*A)*O,t[3]=(s*P-i*F-r*C)*O,t[4]=(n*F-s*T+r*S)*O,t[5]=(i*T-n*P-r*A)*O,t[6]=(f*M-g*E+v*b)*O,t[7]=(g*w-m*M-v*x)*O,t[8]=(m*E-f*w+v*y)*O)}(this,t),this}}let k=0;class q extends F{constructor(t,{geometry:e,program:n,mode:i=t.TRIANGLES,frustumCulled:s=!0,renderOrder:r=0}={}){super(),t.canvas||console.error("gl not passed as first argument to Mesh"),this.gl=t,this.id=k++,this.geometry=e,this.program=n,this.mode=i,this.frustumCulled=s,this.renderOrder=r,this.modelViewMatrix=new T,this.normalMatrix=new V,this.beforeRenderCallbacks=[],this.afterRenderCallbacks=[]}onBeforeRender(t){return this.beforeRenderCallbacks.push(t),this}onAfterRender(t){return this.afterRenderCallbacks.push(t),this}draw({camera:t}={}){this.beforeRenderCallbacks.forEach((e=&gt;e&amp;&amp;e({mesh:this,camera:t}))),t&amp;&amp;(this.program.uniforms.modelMatrix||Object.assign(this.program.uniforms,{modelMatrix:{value:null},viewMatrix:{value:null},modelViewMatrix:{value:null},normalMatrix:{value:null},projectionMatrix:{value:null},cameraPosition:{value:null}}),this.program.uniforms.projectionMatrix.value=t.projectionMatrix,this.program.uniforms.cameraPosition.value=t.worldPosition,this.program.uniforms.viewMatrix.value=t.viewMatrix,this.modelViewMatrix.multiply(t.viewMatrix,this.worldMatrix),this.normalMatrix.getNormalMatrix(this.modelViewMatrix),this.program.uniforms.modelMatrix.value=this.worldMatrix,this.program.uniforms.modelViewMatrix.value=this.modelViewMatrix,this.program.uniforms.normalMatrix.value=this.normalMatrix);let e=this.program.cullFace&amp;&amp;this.worldMatrix.determinant()&lt;0;this.program.use({flipFaces:e}),this.geometry.draw({mode:this.mode,program:this.program}),this.afterRenderCallbacks.forEach((e=&gt;e&amp;&amp;e({mesh:this,camera:t})))}}const H=new Uint8Array(4);function G(t){return 0==(t&amp;t-1)}let W=1;class j{constructor(t,{image:e,target:n=t.TEXTURE_2D,type:i=t.UNSIGNED_BYTE,format:s=t.RGBA,internalFormat:r=s,wrapS:a=t.CLAMP_TO_EDGE,wrapT:o=t.CLAMP_TO_EDGE,generateMipmaps:h=!0,minFilter:l=(h?t.NEAREST_MIPMAP_LINEAR:t.LINEAR),magFilter:u=t.LINEAR,premultiplyAlpha:c=!1,unpackAlignment:p=4,flipY:d=n==t.TEXTURE_2D,anisotropy:m=0,level:f=0,width:g,height:v=g}={}){this.gl=t,this.id=W++,this.image=e,this.target=n,this.type=i,this.format=s,this.internalFormat=r,this.minFilter=l,this.magFilter=u,this.wrapS=a,this.wrapT=o,this.generateMipmaps=h,this.premultiplyAlpha=c,this.unpackAlignment=p,this.flipY=d,this.anisotropy=Math.min(m,this.gl.renderer.parameters.maxAnisotropy),this.level=f,this.width=g,this.height=v,this.texture=this.gl.createTexture(),this.store={image:null},this.glState=this.gl.renderer.state,this.state={},this.state.minFilter=this.gl.NEAREST_MIPMAP_LINEAR,this.state.magFilter=this.gl.LINEAR,this.state.wrapS=this.gl.REPEAT,this.state.wrapT=this.gl.REPEAT,this.state.anisotropy=0}bind(){this.glState.textureUnits[this.glState.activeTextureUnit]!==this.id&amp;&amp;(this.gl.bindTexture(this.target,this.texture),this.glState.textureUnits[this.glState.activeTextureUnit]=this.id)}update(t=0){const e=!(this.image===this.store.image&amp;&amp;!this.needsUpdate);if((e||this.glState.textureUnits[t]!==this.id)&amp;&amp;(this.gl.renderer.activeTexture(t),this.bind()),e){if(this.needsUpdate=!1,this.flipY!==this.glState.flipY&amp;&amp;(this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,this.flipY),this.glState.flipY=this.flipY),this.premultiplyAlpha!==this.glState.premultiplyAlpha&amp;&amp;(this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),this.glState.premultiplyAlpha=this.premultiplyAlpha),this.unpackAlignment!==this.glState.unpackAlignment&amp;&amp;(this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,this.unpackAlignment),this.glState.unpackAlignment=this.unpackAlignment),this.minFilter!==this.state.minFilter&amp;&amp;(this.gl.texParameteri(this.target,this.gl.TEXTURE_MIN_FILTER,this.minFilter),this.state.minFilter=this.minFilter),this.magFilter!==this.state.magFilter&amp;&amp;(this.gl.texParameteri(this.target,this.gl.TEXTURE_MAG_FILTER,this.magFilter),this.state.magFilter=this.magFilter),this.wrapS!==this.state.wrapS&amp;&amp;(this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_S,this.wrapS),this.state.wrapS=this.wrapS),this.wrapT!==this.state.wrapT&amp;&amp;(this.gl.texParameteri(this.target,this.gl.TEXTURE_WRAP_T,this.wrapT),this.state.wrapT=this.wrapT),this.anisotropy&amp;&amp;this.anisotropy!==this.state.anisotropy&amp;&amp;(this.gl.texParameterf(this.target,this.gl.renderer.getExtension("EXT_texture_filter_anisotropic").TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropy),this.state.anisotropy=this.anisotropy),this.image){if(this.image.width&amp;&amp;(this.width=this.image.width,this.height=this.image.height),this.target===this.gl.TEXTURE_CUBE_MAP)for(let t=0;t&lt;6;t++)this.gl.texImage2D(this.gl.TEXTURE_CUBE_MAP_POSITIVE_X+t,this.level,this.internalFormat,this.format,this.type,this.image[t]);else if(ArrayBuffer.isView(this.image))this.gl.texImage2D(this.target,this.level,this.internalFormat,this.width,this.height,0,this.format,this.type,this.image);else if(this.image.isCompressedTexture)for(let t=0;t&lt;this.image.length;t++)this.gl.compressedTexImage2D(this.target,t,this.internalFormat,this.image[t].width,this.image[t].height,0,this.image[t].data);else this.gl.texImage2D(this.target,this.level,this.internalFormat,this.format,this.type,this.image);this.generateMipmaps&amp;&amp;(this.gl.renderer.isWebgl2||G(this.image.width)&amp;&amp;G(this.image.height)?this.gl.generateMipmap(this.target):(this.generateMipmaps=!1,this.wrapS=this.wrapT=this.gl.CLAMP_TO_EDGE,this.minFilter=this.gl.LINEAR)),this.onUpdate&amp;&amp;this.onUpdate()}else if(this.target===this.gl.TEXTURE_CUBE_MAP)for(let t=0;t&lt;6;t++)this.gl.texImage2D(this.gl.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,this.gl.RGBA,1,1,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,H);else this.width?this.gl.texImage2D(this.target,this.level,this.internalFormat,this.width,this.height,0,this.format,this.type,null):this.gl.texImage2D(this.target,0,this.gl.RGBA,1,1,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,H);this.store.image=this.image}}}class Z{constructor(t,{width:e=t.canvas.width,height:n=t.canvas.height,target:i=t.FRAMEBUFFER,color:s=1,depth:r=!0,stencil:a=!1,depthTexture:o=!1,wrapS:h=t.CLAMP_TO_EDGE,wrapT:l=t.CLAMP_TO_EDGE,minFilter:u=t.LINEAR,magFilter:c=u,type:p=t.UNSIGNED_BYTE,format:d=t.RGBA,internalFormat:m=d,unpackAlignment:f,premultiplyAlpha:g}={}){this.gl=t,this.width=e,this.height=n,this.depth=r,this.buffer=this.gl.createFramebuffer(),this.target=i,this.gl.bindFramebuffer(this.target,this.buffer),this.textures=[];const v=[];for(let i=0;i&lt;s;i++)this.textures.push(new j(t,{width:e,height:n,wrapS:h,wrapT:l,minFilter:u,magFilter:c,type:p,format:d,internalFormat:m,unpackAlignment:f,premultiplyAlpha:g,flipY:!1,generateMipmaps:!1})),this.textures[i].update(),this.gl.framebufferTexture2D(this.target,this.gl.COLOR_ATTACHMENT0+i,this.gl.TEXTURE_2D,this.textures[i].texture,0),v.push(this.gl.COLOR_ATTACHMENT0+i);v.length&gt;1&amp;&amp;this.gl.renderer.drawBuffers(v),this.texture=this.textures[0],o&amp;&amp;(this.gl.renderer.isWebgl2||this.gl.renderer.getExtension("WEBGL_depth_texture"))?(this.depthTexture=new j(t,{width:e,height:n,minFilter:this.gl.NEAREST,magFilter:this.gl.NEAREST,format:this.gl.DEPTH_COMPONENT,internalFormat:t.renderer.isWebgl2?this.gl.DEPTH_COMPONENT16:this.gl.DEPTH_COMPONENT,type:this.gl.UNSIGNED_INT}),this.depthTexture.update(),this.gl.framebufferTexture2D(this.target,this.gl.DEPTH_ATTACHMENT,this.gl.TEXTURE_2D,this.depthTexture.texture,0)):(r&amp;&amp;!a&amp;&amp;(this.depthBuffer=this.gl.createRenderbuffer(),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,this.depthBuffer),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,e,n),this.gl.framebufferRenderbuffer(this.target,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,this.depthBuffer)),a&amp;&amp;!r&amp;&amp;(this.stencilBuffer=this.gl.createRenderbuffer(),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,this.stencilBuffer),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.STENCIL_INDEX8,e,n),this.gl.framebufferRenderbuffer(this.target,this.gl.STENCIL_ATTACHMENT,this.gl.RENDERBUFFER,this.stencilBuffer)),r&amp;&amp;a&amp;&amp;(this.depthStencilBuffer=this.gl.createRenderbuffer(),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,this.depthStencilBuffer),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_STENCIL,e,n),this.gl.framebufferRenderbuffer(this.target,this.gl.DEPTH_STENCIL_ATTACHMENT,this.gl.RENDERBUFFER,this.depthStencilBuffer))),this.gl.bindFramebuffer(this.target,null)}setSize(t,e){if(this.width!==t||this.height!==e){this.width=t,this.height=e,this.gl.bindFramebuffer(this.target,this.buffer);for(let n=0;n&lt;this.textures.length;n++)this.textures[n].width=t,this.textures[n].height=e,this.textures[n].needsUpdate=!0,this.textures[n].update(),this.gl.framebufferTexture2D(this.target,this.gl.COLOR_ATTACHMENT0+n,this.gl.TEXTURE_2D,this.textures[n].texture,0);this.depthTexture?(this.depthTexture.width=t,this.depthTexture.height=e,this.depthTexture.needsUpdate=!0,this.depthTexture.update(),this.gl.framebufferTexture2D(this.target,this.gl.DEPTH_ATTACHMENT,this.gl.TEXTURE_2D,this.depthTexture.texture,0)):(this.depthBuffer&amp;&amp;(this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,this.depthBuffer),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,t,e)),this.stencilBuffer&amp;&amp;(this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,this.stencilBuffer),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.STENCIL_INDEX8,t,e)),this.depthStencilBuffer&amp;&amp;(this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,this.depthStencilBuffer),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_STENCIL,t,e))),this.gl.bindFramebuffer(this.target,null)}}}const $=new v;let Q=1,J=1,K=!1;class tt{constructor(t,e={}){t.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=t,this.attributes=e,this.id=Q++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let t in e)this.addAttribute(t,e[t])}addAttribute(t,e){if(this.attributes[t]=e,e.id=J++,e.size=e.size||1,e.type=e.type||(e.data.constructor===Float32Array?this.gl.FLOAT:e.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),e.target="index"===t?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,e.normalized=e.normalized||!1,e.stride=e.stride||0,e.offset=e.offset||0,e.count=e.count||(e.stride?e.data.byteLength/e.stride:e.data.length/e.size),e.divisor=e.instanced||0,e.needsUpdate=!1,e.usage=e.usage||this.gl.STATIC_DRAW,e.buffer||this.updateAttribute(e),e.divisor){if(this.isInstanced=!0,this.instancedCount&amp;&amp;this.instancedCount!==e.count*e.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,e.count*e.divisor);this.instancedCount=e.count*e.divisor}else"index"===t?this.drawRange.count=e.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,e.count))}updateAttribute(t){const e=!t.buffer;e&amp;&amp;(t.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==t.buffer&amp;&amp;(this.gl.bindBuffer(t.target,t.buffer),this.glState.boundBuffer=t.buffer),e?this.gl.bufferData(t.target,t.data,t.usage):this.gl.bufferSubData(t.target,0,t.data),t.needsUpdate=!1}setIndex(t){this.addAttribute("index",t)}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}setInstancedCount(t){this.instancedCount=t}createVAO(t){this.VAOs[t.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[t.attributeOrder]),this.bindAttributes(t)}bindAttributes(t){t.attributeLocations.forEach(((t,{name:e,type:n})=&gt;{if(!this.attributes[e])return void console.warn(`active attribute ${e} not being supplied`);const i=this.attributes[e];this.gl.bindBuffer(i.target,i.buffer),this.glState.boundBuffer=i.buffer;let s=1;35674===n&amp;&amp;(s=2),35675===n&amp;&amp;(s=3),35676===n&amp;&amp;(s=4);const r=i.size/s,a=1===s?0:s*s*s,o=1===s?0:s*s;for(let e=0;e&lt;s;e++)this.gl.vertexAttribPointer(t+e,r,i.type,i.normalized,i.stride+a,i.offset+e*o),this.gl.enableVertexAttribArray(t+e),this.gl.renderer.vertexAttribDivisor(t+e,i.divisor)})),this.attributes.index&amp;&amp;this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:t,mode:e=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${t.attributeOrder}`&amp;&amp;(this.VAOs[t.attributeOrder]||this.createVAO(t),this.gl.renderer.bindVertexArray(this.VAOs[t.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${t.attributeOrder}`),t.attributeLocations.forEach(((t,{name:e})=&gt;{const n=this.attributes[e];n.needsUpdate&amp;&amp;this.updateAttribute(n)})),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(e,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+2*this.drawRange.start,this.instancedCount):this.gl.renderer.drawArraysInstanced(e,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(e,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+2*this.drawRange.start):this.gl.drawArrays(e,this.drawRange.start,this.drawRange.count)}getPosition(){const t=this.attributes.position;return t.data?t:K?void 0:(console.warn("No position buffer data found to compute bounds"),K=!0)}computeBoundingBox(t){t||(t=this.getPosition());const e=t.data,n=t.stride?t.stride/e.BYTES_PER_ELEMENT:t.size;this.bounds||(this.bounds={min:new v,max:new v,center:new v,scale:new v,radius:1/0});const i=this.bounds.min,s=this.bounds.max,r=this.bounds.center,a=this.bounds.scale;i.set(1/0),s.set(-1/0);for(let t=0,r=e.length;t&lt;r;t+=n){const n=e[t],r=e[t+1],a=e[t+2];i.x=Math.min(n,i.x),i.y=Math.min(r,i.y),i.z=Math.min(a,i.z),s.x=Math.max(n,s.x),s.y=Math.max(r,s.y),s.z=Math.max(a,s.z)}a.sub(s,i),r.add(i,s).divide(2)}computeBoundingSphere(t){t||(t=this.getPosition());const e=t.data,n=t.stride?t.stride/e.BYTES_PER_ELEMENT:t.size;this.bounds||this.computeBoundingBox(t);let i=0;for(let t=0,s=e.length;t&lt;s;t+=n)$.fromArray(e,t),i=Math.max(i,this.bounds.center.squaredDistance($));this.bounds.radius=Math.sqrt(i)}remove(){for(let t in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[t]),delete this.VAOs[t];for(let t in this.attributes)this.gl.deleteBuffer(this.attributes[t].buffer),delete this.attributes[t]}}class et extends tt{constructor(t,{attributes:e={}}={}){Object.assign(e,{position:{size:2,data:new Float32Array([-1,-1,3,-1,-1,3])},uv:{size:2,data:new Float32Array([0,0,2,0,0,2])}}),super(t,e)}}class nt{constructor(t,{width:e,height:n,dpr:i,wrapS:s=t.CLAMP_TO_EDGE,wrapT:r=t.CLAMP_TO_EDGE,minFilter:a=t.LINEAR,magFilter:o=t.LINEAR,geometry:h=new et(t),targetOnly:l=null}={}){this.gl=t,this.options={wrapS:s,wrapT:r,minFilter:a,magFilter:o},this.passes=[],this.geometry=h,this.uniform={value:null},this.targetOnly=l;const u=this.fbo={read:null,write:null,swap:()=&gt;{let t=u.read;u.read=u.write,u.write=t}};this.resize({width:e,height:n,dpr:i})}addPass({vertex:t=it,fragment:e=st,uniforms:n={},textureUniform:i="tMap",enabled:s=!0}={}){n[i]={value:this.fbo.read.texture};const r=new L(this.gl,{vertex:t,fragment:e,uniforms:n}),a={mesh:new q(this.gl,{geometry:this.geometry,program:r}),program:r,uniforms:n,enabled:s,textureUniform:i};return this.passes.push(a),a}resize({width:t,height:e,dpr:n}={}){n&amp;&amp;(this.dpr=n),t&amp;&amp;(this.width=t,this.height=e||t),n=this.dpr||this.gl.renderer.dpr,t=Math.floor((this.width||this.gl.renderer.width)*n),e=Math.floor((this.height||this.gl.renderer.height)*n),this.options.width=t,this.options.height=e,this.fbo.read=new Z(this.gl,this.options),this.fbo.write=new Z(this.gl,this.options)}render({scene:t,camera:e,texture:n,target:i=null,update:s=!0,sort:r=!0,frustumCull:a=!0}){const o=this.passes.filter((t=&gt;t.enabled));n||(this.gl.renderer.render({scene:t,camera:e,target:o.length||!i&amp;&amp;this.targetOnly?this.fbo.write:i,update:s,sort:r,frustumCull:a}),this.fbo.swap()),o.forEach(((t,e)=&gt;{t.mesh.program.uniforms[t.textureUniform].value=!e&amp;&amp;n?n:this.fbo.read.texture,this.gl.renderer.render({scene:t.mesh,target:e!==o.length-1||!i&amp;&amp;this.targetOnly?this.fbo.write:i,clear:!0}),this.fbo.swap()})),this.uniform.value=this.fbo.read.texture}}const it="\n    attribute vec2 uv;\n    attribute vec2 position;\n\n    varying vec2 vUv;\n\n    void main() {\n        vUv = uv;\n        gl_Position = vec4(position, 0, 1);\n    }\n",st="\n    precision highp float;\n\n    uniform sampler2D tMap;\n    varying vec2 vUv;\n\n    void main() {\n        gl_FragColor = texture2D(tMap, vUv);\n    }\n";class rt{constructor(t,{size:e=128,falloff:n=.3,alpha:i=1,dissipation:s=.98,type:r}={}){const o=this;this.gl=t,this.uniform={value:null},this.mask={read:null,write:null,swap:()=&gt;{let t=o.mask.read;o.mask.read=o.mask.write,o.mask.write=t,o.uniform.value=o.mask.read.texture}},function(){r||(r=t.HALF_FLOAT||t.renderer.extensions.OES_texture_half_float.HALF_FLOAT_OES);let n=t.renderer.isWebgl2||t.renderer.extensions[`OES_texture_${r===t.FLOAT?"":"half_"}float_linear`]?t.LINEAR:t.NEAREST;const i={width:e,height:e,type:r,format:t.RGBA,internalFormat:t.renderer.isWebgl2?r===t.FLOAT?t.RGBA32F:t.RGBA16F:t.RGBA,minFilter:n,depth:!1};o.mask.read=new Z(t,i),o.mask.write=new Z(t,i),o.mask.swap()}(),this.aspect=1,this.mouse=new a,this.velocity=new a,this.mesh=new q(t,{geometry:new et(t),program:new L(t,{vertex:at,fragment:ot,uniforms:{tMap:o.uniform,uFalloff:{value:.5*n},uAlpha:{value:i},uDissipation:{value:s},uAspect:{value:1},uMouse:{value:o.mouse},uVelocity:{value:o.velocity}},depthTest:!1})})}update(){this.mesh.program.uniforms.uAspect.value=this.aspect,this.gl.renderer.render({scene:this.mesh,target:this.mask.write,clear:!1}),this.mask.swap()}}const at="\n    attribute vec2 uv;\n    attribute vec2 position;\n\n    varying vec2 vUv;\n\n    void main() {\n        vUv = uv;\n        gl_Position = vec4(position, 0, 1);\n    }\n",ot="\n    precision highp float;\n\n    uniform sampler2D tMap;\n\n    uniform float uFalloff;\n    uniform float uAlpha;\n    uniform float uDissipation;\n    \n    uniform float uAspect;\n    uniform vec2 uMouse;\n    uniform vec2 uVelocity;\n\n    varying vec2 vUv;\n\n    void main() {\n        vec4 color = texture2D(tMap, vUv) * uDissipation;\n\n        vec2 cursor = vUv - uMouse;\n        cursor.x *= uAspect;\n\n        vec3 stamp = vec3(uVelocity * vec2(1, -1), 1.0 - pow(1.0 - min(1.0, length(uVelocity)), 3.0));\n        float falloff = smoothstep(uFalloff, 0.0, length(cursor)) * uAlpha;\n\n        color.rgb = mix(color.rgb, stamp, vec3(falloff));\n\n        gl_FragColor = color;\n    }\n";class ht extends tt{constructor(t,{width:e=1,height:n=1,widthSegments:i=1,heightSegments:s=1,attributes:r={}}={}){const a=i,o=s,h=(a+1)*(o+1),l=a*o*6,u=new Float32Array(3*h),c=new Float32Array(3*h),p=new Float32Array(2*h),d=l&gt;65536?new Uint32Array(l):new Uint16Array(l);ht.buildPlane(u,c,p,d,e,n,0,a,o),Object.assign(r,{position:{size:3,data:u},normal:{size:3,data:c},uv:{size:2,data:p},index:{data:d}}),super(t,r)}static buildPlane(t,e,n,i,s,r,a,o,h,l=0,u=1,c=2,p=1,d=-1,m=0,f=0){const g=m,v=s/o,y=r/h;for(let x=0;x&lt;=h;x++){let w=x*y-r/2;for(let r=0;r&lt;=o;r++,m++){let y=r*v-s/2;if(t[3*m+l]=y*p,t[3*m+u]=w*d,t[3*m+c]=a/2,e[3*m+l]=0,e[3*m+u]=0,e[3*m+c]=a&gt;=0?1:-1,n[2*m]=r/o,n[2*m+1]=1-x/h,x===h||r===o)continue;let b=g+r+x*(o+1),E=g+r+(x+1)*(o+1),M=g+r+(x+1)*(o+1)+1,A=g+r+x*(o+1)+1;i[6*f]=b,i[6*f+1]=E,i[6*f+2]=A,i[6*f+3]=E,i[6*f+4]=M,i[6*f+5]=A,f++}}}}var lt={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},ut={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},ct=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],pt={CSS:{},springs:{}};function dt(t,e,n){return Math.min(Math.max(t,e),n)}function mt(t,e){return t.indexOf(e)&gt;-1}function ft(t,e){return t.apply(null,e)}var gt={arr:function(t){return Array.isArray(t)},obj:function(t){return mt(Object.prototype.toString.call(t),"Object")},pth:function(t){return gt.obj(t)&amp;&amp;t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||gt.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return gt.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return gt.hex(t)||gt.rgb(t)||gt.hsl(t)},key:function(t){return!lt.hasOwnProperty(t)&amp;&amp;!ut.hasOwnProperty(t)&amp;&amp;"targets"!==t&amp;&amp;"keyframes"!==t}};function vt(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function yt(t,e){var n=vt(t),i=dt(gt.und(n[0])?1:n[0],.1,100),s=dt(gt.und(n[1])?100:n[1],.1,100),r=dt(gt.und(n[2])?10:n[2],.1,100),a=dt(gt.und(n[3])?0:n[3],.1,100),o=Math.sqrt(s/i),h=r/(2*Math.sqrt(s*i)),l=h&lt;1?o*Math.sqrt(1-h*h):0,u=h&lt;1?(h*o-a)/l:-a+o;function c(t){var n=e?e*t/1e3:t;return n=h&lt;1?Math.exp(-n*h*o)*(1*Math.cos(l*n)+u*Math.sin(l*n)):(1+u*n)*Math.exp(-n*o),0===t||1===t?t:1-n}return e?c:function(){var e=pt.springs[t];if(e)return e;for(var n=1/6,i=0,s=0;;)if(1===c(i+=n)){if(++s&gt;=16)break}else s=0;var r=i*n*1e3;return pt.springs[t]=r,r}}function xt(t){return void 0===t&amp;&amp;(t=10),function(e){return Math.ceil(dt(e,1e-6,1)*t)*(1/t)}}var wt,bt,Et=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function n(t,e){return 3*e-6*t}function i(t){return 3*t}function s(t,s,r){return((e(s,r)*t+n(s,r))*t+i(s))*t}function r(t,s,r){return 3*e(s,r)*t*t+2*n(s,r)*t+i(s)}return function(e,n,i,a){if(0&lt;=e&amp;&amp;e&lt;=1&amp;&amp;0&lt;=i&amp;&amp;i&lt;=1){var o=new Float32Array(11);if(e!==n||i!==a)for(var h=0;h&lt;11;++h)o[h]=s(h*t,e,i);return function(h){return e===n&amp;&amp;i===a||0===h||1===h?h:s(function(n){for(var a=0,h=1;10!==h&amp;&amp;o[h]&lt;=n;++h)a+=t;--h;var l=a+(n-o[h])/(o[h+1]-o[h])*t,u=r(l,e,i);return u&gt;=.001?function(t,e,n,i){for(var a=0;a&lt;4;++a){var o=r(e,n,i);if(0===o)return e;e-=(s(e,n,i)-t)/o}return e}(n,l,e,i):0===u?l:function(t,e,n,i,r){var a,o,h=0;do{(a=s(o=e+(n-e)/2,i,r)-t)&gt;0?n=o:e=o}while(Math.abs(a)&gt;1e-7&amp;&amp;++h&lt;10);return o}(n,a,a+t,e,i)}(h),n,a)}}}}(),Mt=(wt={linear:function(){return function(t){return t}}},bt={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,n=4;t&lt;((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&amp;&amp;(t=1),void 0===e&amp;&amp;(e=.5);var n=dt(t,1,10),i=dt(e,.1,2);return function(t){return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach((function(t,e){bt[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(bt).forEach((function(t){var e=bt[t];wt["easeIn"+t]=e,wt["easeOut"+t]=function(t,n){return function(i){return 1-e(t,n)(1-i)}},wt["easeInOut"+t]=function(t,n){return function(i){return i&lt;.5?e(t,n)(2*i)/2:1-e(t,n)(-2*i+2)/2}},wt["easeOutIn"+t]=function(t,n){return function(i){return i&lt;.5?(1-e(t,n)(1-2*i))/2:(e(t,n)(2*i-1)+1)/2}}})),wt);function At(t,e){if(gt.fnc(t))return t;var n=t.split("(")[0],i=Mt[n],s=vt(t);switch(n){case"spring":return yt(t,e);case"cubicBezier":return ft(Et,s);case"steps":return ft(xt,s);default:return ft(i,s)}}function St(t){try{return document.querySelectorAll(t)}catch(t){return}}function Tt(t,e){for(var n=t.length,i=arguments.length&gt;=2?arguments[1]:void 0,s=[],r=0;r&lt;n;r++)if(r in t){var a=t[r];e.call(i,a,r,t)&amp;&amp;s.push(a)}return s}function Ct(t){return t.reduce((function(t,e){return t.concat(gt.arr(e)?Ct(e):e)}),[])}function Pt(t){return gt.arr(t)?t:(gt.str(t)&amp;&amp;(t=St(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Ft(t,e){return t.some((function(t){return t===e}))}function Ot(t){var e={};for(var n in t)e[n]=t[n];return e}function _t(t,e){var n=Ot(t);for(var i in t)n[i]=e.hasOwnProperty(i)?e[i]:t[i];return n}function Dt(t,e){var n=Ot(t);for(var i in e)n[i]=gt.und(t[i])?e[i]:t[i];return n}function Rt(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function It(t,e){return gt.fnc(t)?t(e.target,e.id,e.total):t}function Nt(t,e){return t.getAttribute(e)}function Lt(t,e,n){if(Ft([n,"deg","rad","turn"],Rt(e)))return e;var i=pt.CSS[e+n];if(!gt.und(i))return i;var s=document.createElement(t.tagName),r=t.parentNode&amp;&amp;t.parentNode!==document?t.parentNode:document.body;r.appendChild(s),s.style.position="absolute",s.style.width=100+n;var a=100/s.offsetWidth;r.removeChild(s);var o=a*parseFloat(e);return pt.CSS[e+n]=o,o}function zt(t,e,n){if(e in t.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s=t.style[e]||getComputedStyle(t).getPropertyValue(i)||"0";return n?Lt(t,s,n):s}}function Bt(t,e){return gt.dom(t)&amp;&amp;!gt.inp(t)&amp;&amp;(!gt.nil(Nt(t,e))||gt.svg(t)&amp;&amp;t[e])?"attribute":gt.dom(t)&amp;&amp;Ft(ct,e)?"transform":gt.dom(t)&amp;&amp;"transform"!==e&amp;&amp;zt(t,e)?"css":null!=t[e]?"object":void 0}function Ut(t){if(gt.dom(t)){for(var e,n=t.style.transform||"",i=/(\w+)\(([^)]*)\)/g,s=new Map;e=i.exec(n);)s.set(e[1],e[2]);return s}}function Yt(t,e,n,i){switch(Bt(t,e)){case"transform":return function(t,e,n,i){var s=mt(e,"scale")?1:0+function(t){return mt(t,"translate")||"perspective"===t?"px":mt(t,"rotate")||mt(t,"skew")?"deg":void 0}(e),r=Ut(t).get(e)||s;return n&amp;&amp;(n.transforms.list.set(e,r),n.transforms.last=e),i?Lt(t,r,i):r}(t,e,i,n);case"css":return zt(t,e,n);case"attribute":return Nt(t,e);default:return t[e]||0}}function Xt(t,e){var n=/^(\*=|\+=|-=)/.exec(t);if(!n)return t;var i=Rt(t)||0,s=parseFloat(e),r=parseFloat(t.replace(n[0],""));switch(n[0][0]){case"+":return s+r+i;case"-":return s-r+i;case"*":return s*r+i}}function Vt(t,e){if(gt.col(t))return function(t){return gt.rgb(t)?(n=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+n[1]+",1)":e:gt.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,n,i){return e+e+n+n+i+i})),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}(t):gt.hsl(t)?function(t){var e,n,i,s=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),r=parseInt(s[1],10)/360,a=parseInt(s[2],10)/100,o=parseInt(s[3],10)/100,h=s[4]||1;function l(t,e,n){return n&lt;0&amp;&amp;(n+=1),n&gt;1&amp;&amp;(n-=1),n&lt;1/6?t+6*(e-t)*n:n&lt;.5?e:n&lt;2/3?t+(e-t)*(2/3-n)*6:t}if(0==a)e=n=i=o;else{var u=o&lt;.5?o*(1+a):o+a-o*a,c=2*o-u;e=l(c,u,r+1/3),n=l(c,u,r),i=l(c,u,r-1/3)}return"rgba("+255*e+","+255*n+","+255*i+","+h+")"}(t):void 0;var e,n}(t);if(/\s/g.test(t))return t;var n=Rt(t),i=n?t.substr(0,t.length-n.length):t;return e?i+e:i}function kt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function qt(t){for(var e,n=t.points,i=0,s=0;s&lt;n.numberOfItems;s++){var r=n.getItem(s);s&gt;0&amp;&amp;(i+=kt(e,r)),e=r}return i}function Ht(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*Nt(t,"r")}(t);case"rect":return function(t){return 2*Nt(t,"width")+2*Nt(t,"height")}(t);case"line":return function(t){return kt({x:Nt(t,"x1"),y:Nt(t,"y1")},{x:Nt(t,"x2"),y:Nt(t,"y2")})}(t);case"polyline":return qt(t);case"polygon":return function(t){var e=t.points;return qt(t)+kt(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function Gt(t,e){var n=e||{},i=n.el||function(t){for(var e=t.parentNode;gt.svg(e)&amp;&amp;gt.svg(e.parentNode);)e=e.parentNode;return e}(t),s=i.getBoundingClientRect(),r=Nt(i,"viewBox"),a=s.width,o=s.height,h=n.viewBox||(r?r.split(" "):[0,0,a,o]);return{el:i,viewBox:h,x:h[0]/1,y:h[1]/1,w:a,h:o,vW:h[2],vH:h[3]}}function Wt(t,e,n){function i(n){void 0===n&amp;&amp;(n=0);var i=e+n&gt;=1?e+n:0;return t.el.getPointAtLength(i)}var s=Gt(t.el,t.svg),r=i(),a=i(-1),o=i(1),h=n?1:s.w/s.vW,l=n?1:s.h/s.vH;switch(t.property){case"x":return(r.x-s.x)*h;case"y":return(r.y-s.y)*l;case"angle":return 180*Math.atan2(o.y-a.y,o.x-a.x)/Math.PI}}function jt(t,e){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,i=Vt(gt.pth(t)?t.totalLength:t,e)+"";return{original:i,numbers:i.match(n)?i.match(n).map(Number):[0],strings:gt.str(t)||e?i.split(n):[]}}function Zt(t){return Tt(t?Ct(gt.arr(t)?t.map(Pt):Pt(t)):[],(function(t,e,n){return n.indexOf(t)===e}))}function $t(t){var e=Zt(t);return e.map((function(t,n){return{target:t,id:n,total:e.length,transforms:{list:Ut(t)}}}))}function Qt(t,e){var n=Ot(e);if(/^spring/.test(n.easing)&amp;&amp;(n.duration=yt(n.easing)),gt.arr(t)){var i=t.length;2!==i||gt.obj(t[0])?gt.fnc(e.duration)||(n.duration=e.duration/i):t={value:t}}var s=gt.arr(t)?t:[t];return s.map((function(t,n){var i=gt.obj(t)&amp;&amp;!gt.pth(t)?t:{value:t};return gt.und(i.delay)&amp;&amp;(i.delay=n?0:e.delay),gt.und(i.endDelay)&amp;&amp;(i.endDelay=n===s.length-1?e.endDelay:0),i})).map((function(t){return Dt(t,n)}))}var Jt={css:function(t,e,n){return t.style[e]=n},attribute:function(t,e,n){return t.setAttribute(e,n)},object:function(t,e,n){return t[e]=n},transform:function(t,e,n,i,s){if(i.list.set(e,n),e===i.last||s){var r="";i.list.forEach((function(t,e){r+=e+"("+t+") "})),t.style.transform=r}}};function Kt(t,e){$t(t).forEach((function(t){for(var n in e){var i=It(e[n],t),s=t.target,r=Rt(i),a=Yt(s,n,r,t),o=Xt(Vt(i,r||Rt(a)),a),h=Bt(s,n);Jt[h](s,n,o,t.transforms,!0)}}))}function te(t,e){return Tt(Ct(t.map((function(t){return e.map((function(e){return function(t,e){var n=Bt(t.target,e.name);if(n){var i=function(t,e){var n;return t.tweens.map((function(i){var s=function(t,e){var n={};for(var i in t){var s=It(t[i],e);gt.arr(s)&amp;&amp;1===(s=s.map((function(t){return It(t,e)}))).length&amp;&amp;(s=s[0]),n[i]=s}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(i,e),r=s.value,a=gt.arr(r)?r[1]:r,o=Rt(a),h=Yt(e.target,t.name,o,e),l=n?n.to.original:h,u=gt.arr(r)?r[0]:l,c=Rt(u)||Rt(h),p=o||c;return gt.und(a)&amp;&amp;(a=l),s.from=jt(u,p),s.to=jt(Xt(a,u),p),s.start=n?n.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=At(s.easing,s.duration),s.isPath=gt.pth(r),s.isPathTargetInsideSVG=s.isPath&amp;&amp;gt.svg(e.target),s.isColor=gt.col(s.from.original),s.isColor&amp;&amp;(s.round=1),n=s,s}))}(e,t),s=i[i.length-1];return{type:n,property:e.name,animatable:t,tweens:i,duration:s.end,delay:i[0].delay,endDelay:s.endDelay}}}(t,e)}))}))),(function(t){return!gt.und(t)}))}function ee(t,e){var n=t.length,i=function(t){return t.timelineOffset?t.timelineOffset:0},s={};return s.duration=n?Math.max.apply(Math,t.map((function(t){return i(t)+t.duration}))):e.duration,s.delay=n?Math.min.apply(Math,t.map((function(t){return i(t)+t.delay}))):e.delay,s.endDelay=n?s.duration-Math.max.apply(Math,t.map((function(t){return i(t)+t.duration-t.endDelay}))):e.endDelay,s}var ne=0,ie=[],se=function(){var t;function e(n){for(var i=ie.length,s=0;s&lt;i;){var r=ie[s];r.paused?(ie.splice(s,1),i--):(r.tick(n),s++)}t=s&gt;0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&amp;&amp;document.addEventListener("visibilitychange",(function(){ae.suspendWhenDocumentHidden&amp;&amp;(re()?t=cancelAnimationFrame(t):(ie.forEach((function(t){return t._onDocumentVisibility()})),se()))})),function(){t||re()&amp;&amp;ae.suspendWhenDocumentHidden||!(ie.length&gt;0)||(t=requestAnimationFrame(e))}}();function re(){return!!document&amp;&amp;document.hidden}function ae(t){void 0===t&amp;&amp;(t={});var e,n=0,i=0,s=0,r=0,a=null;function o(t){var e=window.Promise&amp;&amp;new Promise((function(t){return a=t}));return t.finished=e,e}var h=function(t){var e=_t(lt,t),n=_t(ut,t),i=function(t,e){var n=[],i=e.keyframes;for(var s in i&amp;&amp;(e=Dt(function(t){for(var e=Tt(Ct(t.map((function(t){return Object.keys(t)}))),(function(t){return gt.key(t)})).reduce((function(t,e){return t.indexOf(e)&lt;0&amp;&amp;t.push(e),t}),[]),n={},i=function(i){var s=e[i];n[s]=t.map((function(t){var e={};for(var n in t)gt.key(n)?n==s&amp;&amp;(e.value=t[n]):e[n]=t[n];return e}))},s=0;s&lt;e.length;s++)i(s);return n}(i),e)),e)gt.key(s)&amp;&amp;n.push({name:s,tweens:Qt(e[s],t)});return n}(n,t),s=$t(t.targets),r=te(s,i),a=ee(r,n),o=ne;return ne++,Dt(e,{id:o,children:[],animatables:s,animations:r,duration:a.duration,delay:a.delay,endDelay:a.endDelay})}(t);function l(){var t=h.direction;"alternate"!==t&amp;&amp;(h.direction="normal"!==t?"normal":"reverse"),h.reversed=!h.reversed,e.forEach((function(t){return t.reversed=h.reversed}))}function u(t){return h.reversed?h.duration-t:t}function c(){n=0,i=u(h.currentTime)*(1/ae.speed)}function p(t,e){e&amp;&amp;e.seek(t-e.timelineOffset)}function d(t){for(var e=0,n=h.animations,i=n.length;e&lt;i;){var s=n[e],r=s.animatable,a=s.tweens,o=a.length-1,l=a[o];o&amp;&amp;(l=Tt(a,(function(e){return t&lt;e.end}))[0]||l);for(var u=dt(t-l.start-l.delay,0,l.duration)/l.duration,c=isNaN(u)?1:l.easing(u),p=l.to.strings,d=l.round,m=[],f=l.to.numbers.length,g=void 0,v=0;v&lt;f;v++){var y=void 0,x=l.to.numbers[v],w=l.from.numbers[v]||0;y=l.isPath?Wt(l.value,c*x,l.isPathTargetInsideSVG):w+c*(x-w),d&amp;&amp;(l.isColor&amp;&amp;v&gt;2||(y=Math.round(y*d)/d)),m.push(y)}var b=p.length;if(b){g=p[0];for(var E=0;E&lt;b;E++){p[E];var M=p[E+1],A=m[E];isNaN(A)||(g+=M?A+M:A+" ")}}else g=m[0];Jt[s.type](r.target,s.property,g,r.transforms),s.currentValue=g,e++}}function m(t){h[t]&amp;&amp;!h.passThrough&amp;&amp;h[t](h)}function f(t){var c=h.duration,f=h.delay,g=c-h.endDelay,v=u(t);h.progress=dt(v/c*100,0,100),h.reversePlayback=v&lt;h.currentTime,e&amp;&amp;function(t){if(h.reversePlayback)for(var n=r;n--;)p(t,e[n]);else for(var i=0;i&lt;r;i++)p(t,e[i])}(v),!h.began&amp;&amp;h.currentTime&gt;0&amp;&amp;(h.began=!0,m("begin")),!h.loopBegan&amp;&amp;h.currentTime&gt;0&amp;&amp;(h.loopBegan=!0,m("loopBegin")),v&lt;=f&amp;&amp;0!==h.currentTime&amp;&amp;d(0),(v&gt;=g&amp;&amp;h.currentTime!==c||!c)&amp;&amp;d(c),v&gt;f&amp;&amp;v&lt;g?(h.changeBegan||(h.changeBegan=!0,h.changeCompleted=!1,m("changeBegin")),m("change"),d(v)):h.changeBegan&amp;&amp;(h.changeCompleted=!0,h.changeBegan=!1,m("changeComplete")),h.currentTime=dt(v,0,c),h.began&amp;&amp;m("update"),t&gt;=c&amp;&amp;(i=0,h.remaining&amp;&amp;!0!==h.remaining&amp;&amp;h.remaining--,h.remaining?(n=s,m("loopComplete"),h.loopBegan=!1,"alternate"===h.direction&amp;&amp;l()):(h.paused=!0,h.completed||(h.completed=!0,m("loopComplete"),m("complete"),!h.passThrough&amp;&amp;"Promise"in window&amp;&amp;(a(),o(h)))))}return o(h),h.reset=function(){var t=h.direction;h.passThrough=!1,h.currentTime=0,h.progress=0,h.paused=!0,h.began=!1,h.loopBegan=!1,h.changeBegan=!1,h.completed=!1,h.changeCompleted=!1,h.reversePlayback=!1,h.reversed="reverse"===t,h.remaining=h.loop,e=h.children;for(var n=r=e.length;n--;)h.children[n].reset();(h.reversed&amp;&amp;!0!==h.loop||"alternate"===t&amp;&amp;1===h.loop)&amp;&amp;h.remaining++,d(h.reversed?h.duration:0)},h._onDocumentVisibility=c,h.set=function(t,e){return Kt(t,e),h},h.tick=function(t){s=t,n||(n=s),f((s+(i-n))*ae.speed)},h.seek=function(t){f(u(t))},h.pause=function(){h.paused=!0,c()},h.play=function(){h.paused&amp;&amp;(h.completed&amp;&amp;h.reset(),h.paused=!1,ie.push(h),c(),se())},h.reverse=function(){l(),h.completed=!h.reversed,c()},h.restart=function(){h.reset(),h.play()},h.remove=function(t){he(Zt(t),h)},h.reset(),h.autoplay&amp;&amp;h.play(),h}function oe(t,e){for(var n=e.length;n--;)Ft(t,e[n].animatable.target)&amp;&amp;e.splice(n,1)}function he(t,e){var n=e.animations,i=e.children;oe(t,n);for(var s=i.length;s--;){var r=i[s],a=r.animations;oe(t,a),a.length||r.children.length||i.splice(s,1)}n.length||i.length||e.pause()}ae.version="3.2.1",ae.speed=1,ae.suspendWhenDocumentHidden=!0,ae.running=ie,ae.remove=function(t){for(var e=Zt(t),n=ie.length;n--;)he(e,ie[n])},ae.get=Yt,ae.set=Kt,ae.convertPx=Lt,ae.path=function(t,e){var n=gt.str(t)?St(t)[0]:t,i=e||100;return function(t){return{property:t,el:n,svg:Gt(n),totalLength:Ht(n)*(i/100)}}},ae.setDashoffset=function(t){var e=Ht(t);return t.setAttribute("stroke-dasharray",e),e},ae.stagger=function(t,e){void 0===e&amp;&amp;(e={});var n=e.direction||"normal",i=e.easing?At(e.easing):null,s=e.grid,r=e.axis,a=e.from||0,o="first"===a,h="center"===a,l="last"===a,u=gt.arr(t),c=u?parseFloat(t[0]):parseFloat(t),p=u?parseFloat(t[1]):0,d=Rt(u?t[1]:t)||0,m=e.start||0+(u?c:0),f=[],g=0;return function(t,e,v){if(o&amp;&amp;(a=0),h&amp;&amp;(a=(v-1)/2),l&amp;&amp;(a=v-1),!f.length){for(var y=0;y&lt;v;y++){if(s){var x=h?(s[0]-1)/2:a%s[0],w=h?(s[1]-1)/2:Math.floor(a/s[0]),b=x-y%s[0],E=w-Math.floor(y/s[0]),M=Math.sqrt(b*b+E*E);"x"===r&amp;&amp;(M=-b),"y"===r&amp;&amp;(M=-E),f.push(M)}else f.push(Math.abs(a-y));g=Math.max.apply(Math,f)}i&amp;&amp;(f=f.map((function(t){return i(t/g)*g}))),"reverse"===n&amp;&amp;(f=f.map((function(t){return r?t&lt;0?-1*t:-t:Math.abs(g-t)})))}return m+(u?(p-c)/g:c)*(Math.round(100*f[e])/100)+d}},ae.timeline=function(t){void 0===t&amp;&amp;(t={});var e=ae(t);return e.duration=0,e.add=function(n,i){var s=ie.indexOf(e),r=e.children;function a(t){t.passThrough=!0}s&gt;-1&amp;&amp;ie.splice(s,1);for(var o=0;o&lt;r.length;o++)a(r[o]);var h=Dt(n,_t(ut,t));h.targets=h.targets||t.targets;var l=e.duration;h.autoplay=!1,h.direction=e.direction,h.timelineOffset=gt.und(i)?l:Xt(i,l),a(e),e.seek(h.timelineOffset);var u=ae(h);a(u),r.push(u);var c=ee(r,t);return e.delay=c.delay,e.endDelay=c.endDelay,e.duration=c.duration,e.seek(0),e.reset(),e.autoplay&amp;&amp;e.play(),e},e},ae.easing=At,ae.penner=Mt,ae.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};const le=ae;function ue(t){t=t||{};for(var e=1;e&lt;arguments.length;e++){var n=arguments[e];if(n)for(var i in n)n.hasOwnProperty(i)&amp;&amp;("object"==typeof n[i]&amp;&amp;null!==n[i]?n[i]instanceof Array?t[i]=n[i].slice(0):t[i]=ue(t[i],n[i]):t[i]=n[i])}return t}function ce(t,e,n){return t*(1-n)+e*n}class pe extends class{constructor(t,e,n){this.animatedIn=!1,this.options=n||{},this.passes=t.passes,this.program=t,this.texture=e,this.animationParams={offsetX:0,offsetY:0,scaleX:1,scaleY:1,strength:0,opacity:1},this.params={progress:0,velocity:0,translateX:0,translateY:0,translateZ:0}}play(){}render(){}mouseMove(){}onScroll(){}mouseOver(){}mouseOut(){}enable(){this.enabled=!0}disable(){this.enabled=!1}}{constructor(t,e,n){super(t,e,n),this.delay=this.options.delay||0}play(t){super.play(),t&amp;&amp;(this.options=ue({},this.options,t)),this.duration=this.options.in.duration,this.delay=this.options.in.delay,this.animejs&amp;&amp;this.animejs.remove(this.animationParams);const e=this;this.lastTime=0,this.animationParams.progress=0,this.animationParams.velocity=0,this.params.progress=0,this.animejs=le({targets:this.animationParams,offset:0,progress:1,duration:this.duration,easing:this.options.in.easing,delay:this.delay,begin:function(){e.options.onStart()},change:function(){e.started=!0,e.params.progress=e.animationParams.progress},complete:function(){e.params.progress=1,e.params.velocity=0,e.options.onComplete()}})}reset(){this.params.progress=0}render(){}}class de{constructor(t,e){return t.addPass({fragment:"\n\n// precision highp float;\nprecision mediump float;\n\nuniform sampler2D tMap;\nuniform sampler2D tAlphaMap;\nuniform sampler2D tTransition;\nuniform float strength;\nuniform float progress;\nuniform float speed;\nuniform float threshold;\nuniform float displacement;\nuniform float angle;\nuniform float tAspect;\nuniform vec2 uDirection;\nuniform float planeW;\nuniform float planeH;\nuniform float planeX;\nuniform float planeY;\nuniform float alphaMapAngle;\nuniform vec3 velocity;\n\n// uniform float scroll;\n\nvarying vec2 vUv;\n\n// distance from line (pt1, pt2 and point pt3)\nfloat dist(vec2 pt1, vec2 pt2, vec2 pt3){\n   vec2 v1 = pt2 - pt1; //line vector\n   vec2 v2 = pt1 - pt3;\n   vec2 v3 = vec2(v1.y,-v1.x);\n   return abs(dot(v2,normalize(v3)));\n}\n\nvec2 vectorFromAngle(float angleDeg) {\n    float angleRad = radians(angleDeg);\n    return vec2(cos(angleRad), sin(angleRad));\n}\n\nvoid main() {\n    vec2 uv = vUv;\n\t/*\n\tvec2 uvAlphaMap = uv;\n\tif( tAspect &gt; 1. ){\n\t\tuvAlphaMap -= .5;\n\t\tuvAlphaMap.y /= tAspect;\n\t\tuvAlphaMap += .5;\n\t} \n\t\n    vec4 colorAlpha = texture2D(tAlphaMap, uvAlphaMap);\n\n    float spread = 0.01;\n    vec4 colorAlpha2 = texture2D(tAlphaMap, uvAlphaMap + vec2(spread, spread));\n    vec4 colorAlpha3 = texture2D(tAlphaMap, uvAlphaMap + vec2(-spread, spread));\n    vec4 colorAlpha4 = texture2D(tAlphaMap, uvAlphaMap + vec2(spread, -spread));\n    vec4 colorAlpha5 = texture2D(tAlphaMap, uvAlphaMap + vec2(-spread, -spread));\n\tcolorAlpha = (colorAlpha + colorAlpha2 + colorAlpha3 + colorAlpha4 + colorAlpha5) / 5.;\n\n    float d = 1. - (colorAlpha.r + colorAlpha.g + colorAlpha.b) / 3.; \n\t\n*/\n\n\tvec4 color = texture2D(tMap, uv);\n\n\tfloat distMax = 1.;\n\n\tfloat d = 0.;\n\tif(alphaMapAngle == 0.){\n\t\td = uv.x;\n\t}else if(alphaMapAngle == 180.){\n\t\td = 1. - uv.x;\n\t}else if(alphaMapAngle == 90.){\n\t\td = uv.y;\n\t}else if(alphaMapAngle == 270.){\n\t\td = 1. - uv.y;\n\t}else if(alphaMapAngle == 45.){\n\t\td = (uv.y * uv.y + uv.x * uv.x) / 2.;\n\t}else if(alphaMapAngle == 135.){\n\t\td = (uv.y * uv.y + (1. - uv.x) * (1. - uv.x)) / 2.;\n\t}else if(alphaMapAngle == 225.){\n\t\td = ((1. - uv.y) * (1. - uv.y) + (1. - uv.x) * (1. - uv.x)) / 2.;\n\t}else if(alphaMapAngle == 315.){\n\t\td = (uv.x * uv.x + (1. - uv.y) * (1. - uv.y)) / 2.;\n\t}else if(alphaMapAngle == -1.){\n\t\td = (color.r + color.g + color.b) / 3.;\n\t}else if(alphaMapAngle == -2.){\n\t\td = (1. - (color.r + color.g + color.b) / 3.);\n\t}else if(alphaMapAngle == -4.){\n\t\td = distance(uv, vec2(.5)) / (sqrt(2.) * .5);\n\t}else if(alphaMapAngle == -8.){\n\t\td = distance(uv, vec2(.0)) / sqrt(2.);\n\t}else if(alphaMapAngle == -7.){\n\t\td = distance(uv, vec2(1., 0.)) / sqrt(2.);\n\t}else if(alphaMapAngle == -6.){\n\t\td = distance(uv, vec2(0., 1.)) / sqrt(2.);\n\t}else if(alphaMapAngle == -5.){\n\t\td = distance(uv, vec2(1., 1.)) / sqrt(2.);\n\t}\n\n\n\t//test\n\t// float d = 1.;\n\n\n\t// d *= distance(uv, vec2(.0)) / ( sqrt(2.) / 1.); // distance from uv to point \n\t// d = pow(d, 3.);\n\t// d *= dist(vec2(0., 0.), vec2(0., 1.), uv); //distance form uv to line de,fined by two points\n\n\n\t// d *= uv.x;\n\t// d *= uv.y;\n\n    //displacement\n\tfloat dis = displacement;\n\t// dis = 1.; // test displacement\n    if(dis != 0.){\n        vec2 displacement_xy = vec2(dis * sin(angle), -dis * cos(angle));\n        uv -= .5;\n        uv -= d * strength * displacement_xy; \n        uv += .5;\n        if(uv.x &lt; 0. || uv.x &gt; 1. || uv.y &lt; 0. || uv.y &gt; 1.) discard;\n    }\n\n\t/** RGB split */\n\t// vec2 direction = vectorFromAngle(alphaMapAngle);\n    // vec4 colorR = texture2D(tMap, uv + velocity.xy);\n    // vec4 colorGBA = texture2D(tMap, uv);\n    // vec4 colorBA = texture2D(tMap, uv - velocity.xy );\n\t// vec4 color = vec4(colorR.r, colorGBA.gba);\n\n\t\n\n\n\n\t// d *= color.r / progress;\n\n    // vec2 distanceVector = uv - uDirection;\n    // float dist;\n  \n    \n    // dist = sqrt(dot(distanceVector, distanceVector));\n\n    /*\n    if(uDirection.y == .5 )\n        dist = uv.x;\n    else if(uDirection.x == .5 )\n        dist = uv.y;\n    else if(uDirection.x == -.5 )\n        dist = 1. - uv.y;\n    else if(uDirection.y == -.5 )\n        dist = 1. - uv.x;\n    // bottom right\n    else if(uDirection.x == 1. &amp;&amp; uDirection.y == 0.){\n        dist = abs(-uv.x + uv.y + 1.) / sqrt(2.);\n        distMax = sqrt(2.);\n    }\n    // top right\n    else if(uDirection.x == 1. &amp;&amp; uDirection.y == 1.){\n        dist = abs(uv.x + uv.y - 2.) / sqrt(2.);\n        distMax = sqrt(2.);\n    }\n    // top left\n    else if(uDirection.x == 0. &amp;&amp; uDirection.y == 1.){\n        dist = abs(-uv.x + uv.y - 1.) / sqrt(2.);\n        distMax = sqrt(2.);\n    }\n    // bottom left\n    else if(uDirection.x == 0. &amp;&amp; uDirection.y == 0.){\n        dist = abs(uv.x + uv.y) / sqrt(2.);\n        distMax = sqrt(2.);\n    }\n\n    */\n\n    // d = dist;\n\n\t\n\t// strips \n\t/*\n\tfloat stripes = 3.;\n\tfloat stripesDelay = .0;\n\tfloat duration = 1. - stripesDelay * (stripes - 1.);\n\tfloat progressStripes = (progress - floor((1. - uv.y) * stripes) * stripesDelay) / duration;  \n\t*/\n\n    if(progress != 1.){\n\n\t\tif(threshold &gt;= 3.){\n\n            color.a *= progress;\n\n        }else{\n            // color.rgb /= .2 + .8 * smoothstep(dist, dist + s, progress * distMax * (1. + s));\n            // color.a *= smoothstep(d, d + threshold, progressStripes * distMax * (1. + threshold));        \n            // color.a *= smoothstep(d, d + threshold, progress * (1. + threshold));    \n\n\t\t\tcolor.a = smoothstep(0., 1., color.a * (progress * (1. + threshold) - d) / threshold);\n\t\t}\n    }\n\n    gl_FragColor = color;    \n}\n\n",uniforms:{strength:{value:1},progress:{value:0},speed:{value:0},velocity:{value:new v(0)},tAlphaMap:{value:null},threshold:{value:e.fade.threshold},displacement:{value:0},angle:{value:0},planeW:{value:0},planeH:{value:0},planeX:{value:0},planeY:{value:0},tAspect:{value:1},alphaMapAngle:{value:0}},transparent:!0})}}class me{constructor(t,{domElement:e,index:n,options:i,scene:s,width:r,height:o}={}){this.gl=t,this.animations={},this.index=n,this.scene=s,this.viewportWidth=r,this.viewportHeight=o,this.mouse=new a(-1),this.originalOptions=JSON.parse(JSON.stringify(i)),this.useOffscreenCanvas=!0,this.dataURL=!1,this.initialState=!0,this.initDomElement(e),this.initOptions(),this.addListeners(),this.enabled=!0}initDomElement(t){this.cssClasses=Array.from(t.classList),t.dataset.agl=!0,this.originalDomElementOpacity=getComputedStyle(t).opacity,0==Number(this.originalDomElementOpacity)&amp;&amp;(this.originalDomElementOpacity="1"),t.style.opacity="0",t.style.visibility="visible",this.originalDomElement=t;const e=this;new IntersectionObserver((t=&gt;{const n=t[0];e.inViewport=n.isIntersecting,e.inViewport&amp;&amp;(n.intersectionRatio&gt;.7||e.options.in.lockToScrollbar)?e.onViewportEnter():e.inViewport||e.onViewportExit()}),{threshold:[0,.7]}).observe(t),new IntersectionObserver((t=&gt;{t[0].isIntersecting&amp;&amp;!e.options.in.lockToScrollbar&amp;&amp;(e.inViewport=!0,e.onViewportEnter())}),{rootMargin:"-200px 0px -200px 0px"}).observe(t),new MutationObserver((function(t){let n=0;t.forEach((function(t){t.addedNodes.length&amp;&amp;(n=1)})),n&amp;&amp;e.findDomElement()})).observe(t,{childList:!0,subtree:!0}),this.textureImg=new Image,this.textureImg.crossOrigin="anonymous",this.alphaMapImg=new Image,this.alphaMapImg.crossOrigin="anonymous",this.findDomElement()}findDomElement(){let t=this.originalDomElement;if("FIGURE"==t.nodeName&amp;&amp;(t=t.querySelector("img")),"IMG"!=t.nodeName){const e=t.querySelectorAll("img");function n(t){if(3===t.nodeType)return""!==t.textContent.replace(/[\t\n\r]/g,"").trim();for(let e=0;e&lt;t.childNodes.length;e++)if("FIGCAPTION"!==t.childNodes[e].nodeName&amp;&amp;n(t.childNodes[e]))return!0;return!1}1!=e.length||n(t)||(t=e[0])}"IMG"==t.nodeName?(this.textureImg.src=t.src,this.isImage=!0):this.htmlToCanvas=!0,this.domElement=t}initAnimationParams(){this.animationParams={translateX:0,translateY:0,translateZ:0}}init3d(){if(this.texture)return;const t=this.gl;this.texture=new j(t,{premultiplyAlpha:!0});const e=new ht(t,{widthSegments:20,heightSegments:20});this.program=this.program=new L(t,{vertex:"\n\nprecision mediump float;\n\nattribute vec3 position;\nattribute vec2 uv;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nvarying vec2 vUv;\nuniform vec2 scale;\nuniform float radius;\nuniform float strength; // reversed progress \nuniform float bend;\nuniform float scrollBend;\nuniform float stretch;\nuniform float curl;\nuniform float progress;\n// uniform float offset;\n// uniform float angle;\nuniform float scrollAngle;\nuniform float origin;\nuniform float fisheye;\nuniform float scrollFisheye;\nuniform sampler2D tAlphaMap;\nuniform float displacement;\nuniform float scrollDisplacement;\nuniform float planeW;\nuniform float planeH;\nuniform float planeX;\nuniform float planeY;\nuniform float tAspect;\nuniform vec3 translate;\nuniform vec3 rotate;\nuniform vec2 p1;\nuniform vec2 p2;\nuniform vec2 p3;\nuniform vec2 p4;\nuniform float easeX;\nuniform float easeY;\n\n#define PI 3.1415926535897932384626433832795\n\nvec3 deformationCurve(vec3 position, vec2 uv, float bend) {\n\tfloat d = 1.;\n\t// if(bend &lt; 0.) d = 0.;\n    position.y = position.y + (( cos((position.x + .0) * PI * 1.) - d) * bend);\n    return position;\n}\n\nfloat ease(float type, float value){\n\tif(type == 1.){\n\t\treturn 1. - sin(value * PI / 2. + PI / 2.);\n\t}else if(type == 2.){\n\t\treturn sin(value * PI / 2.);\n\t}else if(type == 3.){\n\t\treturn 1. - sin(value * PI);\n\t}else{\n\t\treturn value;\n\t}\n}\n\nvoid main() {\n    vUv = uv;\n\tvec3 pos = position;\n\n\t// vec4 colorAlpha = texture2D(tAlphaMap, uv);\n\n\t// pos.z += colorAlpha.r * displacement * .1;\n\n\t// pos.x *= scale.x;\n\t// pos.y *= scale.y;\n\n\tif(curl != 0.){\n\t\t// constraint LEFT\n\n\t\tfloat bendOrigin = 1. - curl; // 0 - from left\n\n\t\t// if(pos.x &gt; bendOrigin){\n\n\t\t\t// pos.x -= bendOrigin;\n\n\t\t\t//rotate before bend\n\n\t\t\t// float rot = angle - PI / 2.;\n\t\t\tfloat rot = - PI / 2.;\n\t\t\tmat2 m = mat2(cos(rot), -sin(rot), sin(rot), cos(rot));\n\t\t\tpos.xy *= m;\n\n\t\t\tif(pos.x &gt; bendOrigin){\n\t\t\t\tpos.x -= bendOrigin;\n\n\t\t\t\t// float r = radius / strength;\n\t\t\t\tfloat r = radius * pow(curl, .5) / curl;\n\t\t\t\tfloat x = pos.x ;\n\t\t\t\tfloat a = x / r ;\n\t\t\t\tpos.z = (1. - cos(a)) * r;\n\t\t\t\tpos.x = sin(a) * r;\n\t\t\t\tpos.x += bendOrigin;\n\t\t\t}\n\n\t\t\t//rotate back after bend\n\t\t\tm = mat2(cos(-rot), -sin(-rot), sin(-rot), cos(-rot));\n\t\t\tpos.xy *= m;\n\n\t\t\t// pos.x += bendOrigin;\n\n\t\t// }\n\n\t\t//constraint RIGHT\n\n\t\t// pos.x += .5;\n\n\t\t// float r = radius / strength;\n\t\t// float x = 1. - pos.x;\n\t\t// float a = x / r ;\n\t\t// pos.z = (1. - cos(a)) * r;\n\t\t// pos.x = 1. - sin(a) * r;\n\n\t\t// pos.x -= .5;\n\n\t\t//bend end\n\n\t\t// pos.z += pow(1. - (pos.x - (1. - strength)), 2.);\n\n\t}\n\n\n\n\n\t// pos.x += pow(pos.x, 2.) * (scale.x - 1.);\n\t// pos.y += pow(1. + pos.y, 1.5) ;\n\t// pos.y += pow(1. + pos.y, 2.) * ( scale.y - 1.);\n\n\t// vec2 offsetxy = vec2(offset * sin(angle), offset  * cos(angle));\n\n\t// pos += vec3(offsetxy, 0.);\n\n\n\t//   pos += vec3(.5 + offset.x, -.5 + offset.y, 0.);\n\n\n\t// BEND 2D\n\t// if(bend != 0.){\n\t// \tfloat a = angle + PI / 2.;\n\t// \tpos.xy *= mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n\t// \tpos = deformationCurve(pos, uv, bend);\n\t// \tpos.xy *= mat2(cos(-angle), -sin(-angle), sin(-angle), cos(-angle));\n\t// }\n\n\tif(scrollBend != 0.){\n\t\tif(scrollAngle != 0.) pos.xy *= mat2(cos(scrollAngle), -sin(scrollAngle), sin(scrollAngle), cos(scrollAngle));\n\t\tpos = deformationCurve(pos, uv, scrollBend);\n\t\tif(scrollAngle != 0.) pos.xy *= mat2(cos(-scrollAngle), -sin(-scrollAngle), sin(-scrollAngle), cos(-scrollAngle));\n\t}\n\n\t// mat2 m = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n\t// pos -= vec3(.5, -.5, 0.);\n\t// pos.xy *= m;\n\t// pos += vec3(.5, -.5, 0.);\n\n\n\t//test scale\n\t//   pos.x += pow(pos.x, 3.) * (scale.x - 1.);\n\n\n\t// test\n\tfloat screenY;\n\tif(fisheye != 0.){\n\t\tscreenY = (pos.y) * planeH + planeY - .5; \n\t\tpos.z += sin((screenY) * PI) * fisheye;\n\t}\n\n\tif(scrollFisheye != 0.){\n\t\tscreenY = (pos.y) * planeH + planeY - .5; \n\t\tpos.z += sin((screenY) * PI) * scrollFisheye;\n\t}\n\n\n\n\t//center 3D bend in / out based on scroll\n\n\t/*\n\tif(fisheye &gt; 0.){\n\t\tpos.z = sin((screenY) * M_PI) * fisheye;\n\t}else if(fisheye &lt; 0.){\n\n\t\t// if(scroll &lt; 0.)\n\t\t// \tpos.z = pow(- screenY - 1., 31.) * scroll * fisheye * -10.;\n\t\t// else\n\t\t// \tpos.z = - pow(screenY, 31.) * scroll * fisheye * -10.;\n\n\t\tif(scrollAngle &gt; 0.) \n\t\t\tpos.z = - pow(screenY, 31.) * fisheye * -10.;\n\t\telse\n\t\t\tpos.z = + pow(screenY, 31.) * fisheye * -10.;\n\n\t}\n\t*/\n\n\t// pos.z += strength * 3. * smoothstep(-.5, .5, pos.x) * smoothstep(-.5, .5, pos.y);\n\t// pos.x += strength * 3. * smoothstep(-.5, .5, pos.x);\n\t// pos.z += 5. * strength * cos(pos.x * M_PI / 2.) * cos(pos.y * M_PI / 2.);\n\n\t// pos.z -= 1. * strength + 3. * (sin((pos.x - .5)* M_PI * .5)) * (sin((pos.y - .5)* M_PI * .5)) * strength;\n\t// pos.z = -2. * strength + (.5 * (sin((pos.x - .5)* M_PI * 1.)) * (sin((pos.y - .5)* M_PI * 1.)))* sin(strength * M_PI);\n\t\t\n\t// pos.z += - 3. * ( sin(((uv.x) * M_PI / 2.)) + sin(((uv.y) * M_PI / 2.))) * sin(strength * M_PI);\n\t// if(strength &gt; .3)\n\t// \tpos.z -= pow(strength - .3, 2.) * 10.;\n\n\n\tvec3 start = pos;\n\n\tif (rotate.x != 0. || rotate.y != 0. || rotate.z != 0.) {\n\t\tfloat asp = 64. / 40.;\n\t\tstart.x *= asp;\n\n\t\tif (rotate.x != 0.) {\n\t\t\tfloat cosX = cos(rotate.x);\n\t\t\tfloat sinX = sin(rotate.x);\n\t\t\tmat2 m1 = mat2(cosX, -sinX, sinX, cosX);\n\t\t\tstart.yz *= m1;\n\t\t}\n\n\t\tif (rotate.y != 0.) {\n\t\t\tfloat cosY = cos(rotate.y);\n\t\t\tfloat sinY = sin(rotate.y);\n\t\t\tmat2 m2 = mat2(cosY, -sinY, sinY, cosY);\n\t\t\tstart.xz *= m2;\n\t\t}\n\n\t\tif (rotate.z != 0.) {\n\t\t\tfloat cosZ = cos(rotate.z);\n\t\t\tfloat sinZ = sin(rotate.z);\n\t\t\tmat2 m3 = mat2(cosZ, -sinZ, sinZ, cosZ);\n\t\t\tstart.xy *= m3;\n\t\t}\n\n\t\tstart.x /= asp;\n\t}\n\n\tstart += translate;\n\n\tif(progress &gt; 0. &amp;&amp; progress &lt; 1.){\n\t\tif (p1.x != 0. || p2.x != 0. || p3.x != 0. || p4.x != 0. || \n\t\t\tp1.y != 1. || p2.y != 1. || p3.y != 1. || p4.y != 1. ){\n\t\t\tfloat xEase = ease(easeX, uv.x);\n\t\t\tfloat yEase = ease(easeY, uv.y);\n\n\t\t\tfloat currentPos = mix(\n\t\t\t\tmix(smoothstep(p1.x, p1.y, progress), smoothstep(p2.x, p2.y, progress), xEase),\n\t\t\t\tmix(smoothstep(p3.x, p3.y, progress), smoothstep(p4.x, p4.y, progress), xEase),\n\t\t\t\tyEase\n\t\t\t);\n\n\t\t\tpos = mix(start, pos, currentPos);\n\t\t} else {\n\t\t\tpos = mix(start, pos, progress);\n\t\t}\n\t} \n\n\t// if(displacement != 0.){\n\n\t\t// vec2 displacement_xy = vec2(displacement * sin(angle), displacement * cos(angle));\n\t\t// pos.xy += (1. - colorAlpha.r) * displacement_xy;\n\n\t// }\n\n\t// if(scrollDisplacement != 0.){\n\n\t// \tvec2 displacement_xy_scroll = vec2(scrollDisplacement * sin(scrollAngle), scrollDisplacement * cos(scrollAngle));\n\t// \tpos.xy += (1. - colorAlpha.r) * displacement_xy_scroll;\n\n\t// }\n  \n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n}\n\n",fragment:"\n    precision highp float;\n    uniform sampler2D tMap;\n    uniform float tScale;\n    varying vec2 vUv;\n    void main() {\n        vec2 uv = vUv;\n        uv -= .5;\n        if(tScale &lt; 1.)\n            uv.y *= tScale;\n        else if (tScale &gt; 1.)\n            uv.x /= tScale;\n        uv += .5;\n        vec4 color = texture2D(tMap, uv);\n        gl_FragColor = vec4(color.rgb * color.a, color.a);\n    }\n",uniforms:{tMap:{value:this.texture},tAspect:{value:2},tScale:{value:1},translate:{value:new v(0,0,0)},rotate:{value:new v(0,0,0)},displacement:{value:0},scrollDisplacement:{value:0},scale:{value:new a(1,1)},resolution:{value:new a(300,300)},uMouse:{value:new a(10,10)},radius:{value:.5},strength:{value:.5},progress:{value:.5},center:{value:new a(.7,.7)},direction:{value:new a(-.001,-.001)},time:{value:0},angle:{value:0},scrollAngle:{value:0},bend:{value:0},scrollBend:{value:0},fisheye:{value:0},scrollFisheye:{value:0},stretch:{value:0},curl:{value:0},tAlphaMap:{value:this.texture},planeW:{value:0},planeH:{value:0},planeX:{value:0},planeY:{value:0},p1:{value:new a(0,1)},p2:{value:new a(0,1)},p3:{value:new a(0,1)},p4:{value:new a(0,1)},easeX:{value:1},easeY:{value:1}},depthTest:!1,transparent:!0,cullFace:null}),this.post=new nt(t,{dpr:window.devicePixelRatio,targetOnly:!0,alpha:!1}),this.post.addPass({transparent:!0}),this.alphaMap=new j(t,{}),this.passes={},this.passes.fade=new de(this.post,this.options.in),this.passes.fade.uniforms.tAlphaMap.value=this.alphaMap,this.mesh=new q(t,{geometry:e,program:this.program}),this.hideMesh(),this.zPosition=0,this.initAnimationParams(),this.initAnimations()}initOptions(){this.options=JSON.parse(JSON.stringify(this.originalOptions)),this.originalDomElement.className;const t=this.options.in.presets;this.options.in.name&amp;&amp;(this.options.in=ue({},this.options.in,t[this.options.in.name])),this.isCSSAnimation="css"==this.options.in.type,this.originalDomElement.classList.forEach((e=&gt;{for(const n in t)e==`agl-${n}`&amp;&amp;(this.options.in=JSON.parse(JSON.stringify(agl.defaults.in)),this.options.in=ue({},this.options.in,t[n]),this.options.in.name=n,this.options.in.nameFromCSSClass=n,this.isCSSAnimation=e.includes("CSS"));this.getOptionsFromClassName(e,this.options.in)})),this.isCSSAnimation&amp;&amp;this.originalDomElement.classList.remove("agl-html2canvas"),this.getOptionFromClassName(this.options.in,"lockToScrollbar"),this.getOptionFromClassName(this.options.in,"repeat")}getOptionFromClassName(t,e){const n=this.originalDomElement.className;t[e]=n.includes(e)&amp;&amp;n.includes("agl")}onViewportEnter(){this.viewportEntered||(this.options.in.repeat&amp;&amp;(this.animatedIn=!1),this.isCSSAnimation?this.showDomElement():this.options.in.lockToScrollbar||this.animatedIn&amp;&amp;this.options.mouse.flowmap.enabled||!this.animatedIn?(this.showMesh(),this.updatePositions(),this.updateOffset()):this.options.repeat&amp;&amp;this.hideDomElement(),this.options.in.lockToScrollbar?(this.animatedIn=!1,this.onScroll()):this.animeIn(),this.viewportEntered=!0)}onViewportExit(){this.options.in.repeat&amp;&amp;(this.isCSSAnimation||this.entranceAnimamtionPlaying,this.hideDomElement()),this.hideMesh(),this.viewportEntered=!1}onEntranceAnimationStart(){this.entranceAnimamtionPlaying=!0,this.isCSSAnimation?(this.showDomElement(),this.hideMesh()):(this.hideDomElement(),this.showMesh(),this.updatePositions(),this.updateOffset())}onEntranceAnimationEnd(){this.entranceAnimamtionPlaying=!1,this.isCSSAnimation?this.animejs&amp;&amp;this.options.in.repeat&amp;&amp;!this.inViewport&amp;&amp;this.animejs.seek(0):this.options.mouse.flowmap.enabled||(this.hideMesh(),!this.inViewport&amp;&amp;this.options.in.repeat||this.showDomElement())}cssClassUpdated(){const t=Array.from(this.originalDomElement.classList),e=this.cssClasses,n=t.filter((t=&gt;!e.includes(t))),i=e.filter((e=&gt;!t.includes(e))),s=n.some((t=&gt;t.includes("agl"))),r=i.some((t=&gt;t.includes("agl")));this.cssClasses=t,(s||r)&amp;&amp;(this.initOptions(),this.animatedIn=!1,this.inViewport&amp;&amp;(this.isCSSAnimation?this.showDomElement():(this.hideDomElement(),this.showMesh(),this.updatePositions(),this.updateOffset()),this.options.in.lockToScrollbar?(this.animatedIn=!1,this.onScroll()):this.animeIn()))}initAnimations(){const t=this;this.options.onStart=function(){t.onEntranceAnimationStart()},this.options.onComplete=function(){t.onEntranceAnimationEnd()},this.animations.in=new pe(this.program,this.texture,this.options),this.timeOld=performance.now(),this.meshVelocityLerp={x:0,y:0,z:0},this.meshPositionOld=this.mesh.position}addListeners(){const t=this.originalDomElement,e=this;window.addEventListener("agl-animate",(function(){t.classList.contains("agl-editor")&amp;&amp;(e.animatedIn=!1,e.inViewport&amp;&amp;!e.lockToScrollbar&amp;&amp;(e.options.in.live=!1,e.animeIn()))})),t.addEventListener("agl-disable",(function(t){e.disable()})),t.addEventListener("agl-enable",(function(t){e.enable()})),t.addEventListener("agl-remove",(function(t){})),t.addEventListener("agl-animate",(function(t){e.onAnimate(t)})),t.addEventListener("agl-update-setting",(function(t){})),window.addEventListener("agl-option-change",(function(n){if(t.classList.contains("agl-editor")){const t=JSON.parse(JSON.stringify(n.detail));if(t.in.name){const n=agl.defaults.in.presets;e.options.in.nameFromCSSClass||(e.options.in=ue({},agl.defaults.in,n[t.in.name]))}else e.options.in.nameFromCSSClass||(e.options=t);const i=e.originalDomElement.className;(i.includes("agl-in-fade")||i.includes("agl-in-translate")||i.includes("agl-in-rotate"))&amp;&amp;(e.options.in.translate={x:0,y:0,z:0},e.options.in.rotate={x:0,y:0,z:0},e.options.in.fade.type="right"),e.originalDomElement.classList.forEach((function(t){e.getOptionsFromClassName(t,e.options.in)})),e.options.in.live=t.in.live,e.isCSSAnimation="css"==e.options.in.type,e.options.in.live?(e.options.in.progress=t.in.progress,e.isCSSAnimation?(e.hideMesh(),e.showDomElement(),e.animejs.seek(e.options.in.progress*e.animejs.duration)):(e.showMesh(),e.hideDomElement(),e.updatePositions(),e.updateOffset())):(e.animatedIn=!1,e.animeIn(e.options))}}));const n=this.domElement;"IMG"===n.tagName&amp;&amp;new MutationObserver((t=&gt;{t.forEach((t=&gt;{if(t.attributeName.includes("src")){const t=new Image;t.crossOrigin="anonymous",t.src=n.src,t.onload=function(){e.texture.image=t}}}))})).observe(n,{attributes:!0,attributeFilter:["src"]}),t.addEventListener("click",(function(t){})),t.addEventListener("mouseover",this.mouseOver.bind(this)),t.addEventListener("mousemove",(function(t){})),t.addEventListener("mouseout",this.mouseOut.bind(this))}onAnimate(t){this.animatedIn=!1;const e=JSON.parse(JSON.stringify(agl.options));let n=e.in;n.scroll=e.scroll,n.mouse=e.mouse,this.getOptionsFromClassName(t.options.entranceName),n=ue({},n,t.options);const i=this;if(n.transitionImageSrc){const t=new Image;t.src=n.transitionImageSrc,t.crossOrigin="anonymous",t.onload=function(){i.alphaMapImg=t,i.animeIn(n)}}else this.animeIn(n)}onMouseMove(t){this.mouseMove(t)}getOptionsFromClassName(t){const e=this.options,n={right:0,left:180,up:90,down:270,topRight:45,topLeft:135,bottomLeft:225,bottomRight:315,light:-1,dark:-2,basic:-3,circle:-4,circleBottomLeft:-5,circleBottomRight:-6,circleTopLeft:-7,circleTopRight:-8};if(t.includes("CSS")&amp;&amp;t.includes("agl")&amp;&amp;(this.isCSSAnimation=!0),t.includes("in-fade")&amp;&amp;t.includes("fade-")&amp;&amp;(e.in.fade.type=t.split("fade-")[1]),"none"==e.in.fade.type?e.in.fade.enabled=!1:e.in.fade.enabled=!0,"basic"==e.in.fade.type&amp;&amp;(e.in.fade.threshold=3),e.in.fade.alphaMapAngle=n[e.in.fade.type]||n.right,t.includes("in-translate")&amp;&amp;(e.in.translate.enabled=!0,this.getOptionFromClass(t,e.in.translate,"x"),this.getOptionFromClass(t,e.in.translate,"y"),this.getOptionFromClass(t,e.in.translate,"z")),t.includes("in-rotate")&amp;&amp;(e.in.rotate.enabled=!0,this.getOptionFromClass(t,e.in.rotate,"x"),this.getOptionFromClass(t,e.in.rotate,"y"),this.getOptionFromClass(t,e.in.rotate,"z")),t.includes("in-corners-start")){e.in.corners.enabled=!0;const n=t.split("in-corners-start-")[1].split("-");e.in.corners.start1=Number(n[0]),e.in.corners.start2=Number(n[1]),e.in.corners.start3=Number(n[2]),e.in.corners.start4=Number(n[3])}if(t.includes("in-corners-end")){e.in.corners.enabled=!0;const n=t.split("in-corners-end-")[1].split("-");e.in.corners.end1=Number(n[0]),e.in.corners.end2=Number(n[1]),e.in.corners.end3=Number(n[2]),e.in.corners.end4=Number(n[3])}if(this.getOptionFromClass(t,e.in,"delay"),this.getOptionFromClass(t,e.in,"duration"),this.getOptionFromClass(t,e.in.fade,"threshold"),this.getOptionFromClass(t,e.in,"easing"),this.getOptionFromClass(t,e.in,"distance"),1!=e.in.distance)for(let t in e.in.translate){const n=e.in.translate[t];isNaN(n)?n.includes("px")?e.in.translate[t]=e.in.distance*Number(n.replace("px",""))+"px":n.includes("%")&amp;&amp;(e.in.translate[t]=e.in.distance*Number(n.replace("%",""))+"%"):e.in.translate[t]*=e.in.distance}t.includes("agl-scroll-bend-")&amp;&amp;(e.scroll.bend.strength=t.split("agl-scroll-bend-")[1]),t.includes("agl-scroll-fisheye-")&amp;&amp;(e.scroll.fisheye.strength=t.split("agl-scroll-fisheye-")[1]),t.includes("agl-scroll-fisheye-type")&amp;&amp;(e.scroll.fisheye.type=t.split("agl-scroll-fisheye-type")[1]),t.includes("agl-scroll-stretch-")&amp;&amp;(e.scroll.stretch.strength=t.split("agl-scroll-stretch-")[1]),t.includes("agl-scroll-displacement-")&amp;&amp;(e.scroll.fade.displacement=t.split("agl-scroll-displacement-")[1]),t.includes("agl-scroll-translateX-")&amp;&amp;(e.scroll.translateX=t.split("agl-scroll-translateX-")[1]),t.includes("agl-scroll-translateY-")&amp;&amp;(e.scroll.translateY=t.split("agl-scroll-translateY-")[1]),t.includes("agl-scroll-translateY-")&amp;&amp;(e.scroll.translateZ=t.split("agl-scroll-translateZ-")[1])}getOptionFromClass(t,e,n){t.includes(`-${n}-`)?(e[n]=t.split(`-${n}-`)[1],isNaN(Number(e[n]))||(e[n]=Number(e[n]))):t.includes(`-${n}`)&amp;&amp;(e[n]=!0)}mouseMove(t){}mouseOver(t){this.animations.hover&amp;&amp;this.animations.hover.mouseOver(),this.hover=!0}mouseOut(t){this.oldMouse=null,this.animations.hover&amp;&amp;this.animations.hover.mouseOut(),this.hover=!1}loadScript(t){return new Promise(((e,n)=&gt;{let i=document.querySelector(`script[src="${t}"]`);i?"true"===i.dataset.loaded?e(i):(i.addEventListener("load",(()=&gt;e(i))),i.addEventListener("error",(t=&gt;n(new Error(`Failed to load script: ${src}`,t))))):(i=document.createElement("script"),i.src=t,i.async=!0,i.type="application/javascript",i.onload=()=&gt;{i.dataset.loaded="true",e(i)},i.onerror=t=&gt;{i.dataset.loaded="false",n(new Error(`Failed to load script: ${src}`,t))},document.head.appendChild(i))}))}animeInCSS=function(){this.animejs&amp;&amp;this.animejs.remove(this.animationParams);const t=getComputedStyle(this.originalDomElement).transitionDuration,e=this.originalDomElement;e.style.transitionDuration="0s",e.style.transformOrigin="50% 50%";const n={targets:this.originalDomElement,opacity:[0,1],easing:this.options.in.easing,duration:this.options.in.duration,delay:this.options.in.delay},i=this.options.in.translate;i.x&amp;&amp;(n.translateX=[isNaN(i.x)?i.x:100*i.x+"%",0]),i.y&amp;&amp;(n.translateY=[isNaN(i.y)?i.y:100*i.y+"%",0]);let s=getComputedStyle(e.parentNode).perspective;e.parentNode.style.perspective="1000px",i.z&amp;&amp;(n.translateZ=[500*i.z+"px",0]);const r=this.options.in.rotate;r.x&amp;&amp;(n.rotateX=[r.x,0]),r.y&amp;&amp;(n.rotateY=[r.y,0]),r.z&amp;&amp;(n.rotateZ=[r.z,0]),1!=this.options.in.scale&amp;&amp;(n.scale=[this.options.in.scale,1]),this.options.in.clipPath&amp;&amp;(Array.isArray(this.options.in.clipPath)?n.clipPath=this.options.in.clipPath:n.clipPath=[this.options.in.clipPath.from,this.options.in.clipPath.to],n.clipPath[0]||n.clipPath[1]?delete n.opacity:delete n.clipPath),n.autoplay=!1,this.options.in.lockToScrollbar&amp;&amp;(n.easing="linear");const a=this;n.begin=function(t){a.onEntranceAnimationStart()},n.complete=function(i){n.clipPath&amp;&amp;(e.style.clipPath="none"),s&amp;&amp;(e.parentNode.style.perspective=s,s=null),e.style.transitionDuration=t,a.onEntranceAnimationEnd()},this.animationParams=n,this.animejs=le(this.animationParams),this.options.in.live||this.options.in.lockToScrollbar?this.animejs.seek(this.options.in.progress*this.animejs.duration):this.animejs.began&amp;&amp;!this.animejs.completed||this.animejs.play()};async animeIn(t){if(!this.animatedIn&amp;&amp;!this.entranceAnimamtionPlaying)if(t=t||this.options,this.animatedIn=!0,this.options.in.fade.alphaMapSrc&amp;&amp;(this.alphaMapImg.src=this.options.in.fade.alphaMapSrc),this.isCSSAnimation)this.animeInCSS();else{if(this.mesh||this.init3d(),this.mesh.parent||this.mesh.setParent(this.scene),this.initAnimationParams(),this.animations.in.reset(),this.htmlToCanvas&amp;&amp;(await this.loadScript(this.options.rootFolder+this.options.html2canvasSrc),this.textureImg.src||(this.renderHTMLToCanvasPromise=this.renderHTMLToCanvasPromise||this.renderHTMLToCanvas(),await this.renderHTMLToCanvasPromise)),await this.loadTextures(),this.post&amp;&amp;this.post.passes&amp;&amp;this.post.passes.length){const t=this.textureImg;this.post.passes.forEach((function(e){e.uniforms.tAspect&amp;&amp;(e.uniforms.tAspect.value=t.naturalWidth/t.naturalHeight)}))}this.texture.image=this.textureImg,this.alphaMap.image=this.alphaMapImg,this.options.in.live||this.options.in.lockToScrollbar||(this.updatePositions(),this.updateOffset(),this.animations.in.play(t))}}loadTextures(){const t=[this.loadImage(this.textureImg)];return Promise.all(t)}getCanvas(t,e){let n;return n=this.useOffscreenCanvas&amp;&amp;"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(t,e):document.createElement("canvas"),n.width=t,n.height=e,n}async renderHTMLToCanvas(){const t=this.originalDomElement;if("undefined"!=typeof html2canvas){const e=window.devicePixelRatio,n=t.offsetWidth*e,i=t.offsetHeight*e,s=this.getCanvas(n,i),r=s.getContext("2d");r.imageSmoothingEnabled=!1,r.textRendering="optimizeSpeed";const a=getComputedStyle(t).opacity;t.style.opacity="1",t.classList.add("agl-html2canvas");const o=html2canvas(t,{backgroundColor:null,logging:!1,scale:e,windowWidth:window.innerWidth-(window.innerWidth-document.documentElement.clientWidth),ignoreElements:function(e){return!e.contains(t)&amp;&amp;!t.contains(e)&amp;&amp;t!==e&amp;&amp;"HEAD"!=e.nodeName&amp;&amp;"STYLE"!=e.nodeName&amp;&amp;"META"!=e.nodeName&amp;&amp;"LINK"!=e.nodeName},onclone:function(t,e){e.querySelectorAll("span").forEach((function(t){"flex"==window.getComputedStyle(t).display&amp;&amp;e.querySelectorAll("span").forEach((function(t){"static"==window.getComputedStyle(t).position&amp;&amp;(t.style.position="relative")}))}))},canvas:s});t.style.opacity=a;const h=await o;if(this.dataURL)return void(this.textureImg.src=h.toDataURL());{let t;t=this.useOffscreenCanvas&amp;&amp;"undefined"!=typeof OffscreenCanvas?await h.convertToBlob({type:"image/webp"}):await new Promise((t=&gt;{h.toBlob(t,"image/webp")}));const e=URL.createObjectURL(t);return this.textureImg.addEventListener("load",(function(){URL.revokeObjectURL(e)})),this.textureImg=new Image,void(this.textureImg.src=e)}}}loadImage(t){return new Promise((function(e,n){t.complete&amp;&amp;0!==t.naturalHeight?e(t):(t.addEventListener("load",(function(){e(this)})),t.addEventListener("error",(function(){n(new Error("Image not found"))})))}))}updatePositions(){if(this.isCSSAnimation)return;if(!this.mesh||!this.mesh.visible)return;const t=this.domElement.getBoundingClientRect();this.rect={x:t.x,y:t.y+this.scrollY,width:t.width,height:t.height},this.program.uniforms.tScale.value=this.imageAspect/this.aspect;const e=this.originalDpr||window.devicePixelRatio;if(this.originalDpr=e,this.aspect=t.width/t.height,this.postWidth!=t.width||this.postHeight!=t.height){if(this.post.resize({width:t.width,height:t.height,dpr:e}),this.postWidth&amp;&amp;this.postHeight&amp;&amp;this.htmlToCanvas&amp;&amp;this.inViewport){this.textureImg=new Image;const t=this;this.renderHTMLToCanvasPromise=this.renderHTMLToCanvas(),this.renderHTMLToCanvasPromise.then((function(){t.loadImage(t.textureImg).then((function(e){t.texture.image=e}))}))}this.postWidth=t.width,this.postHeight=t.height}const n=this.gl.canvas.width,i=this.gl.canvas.height,s=n/i,r=this.scrollX*e,a=this.scrollY*e,o=t.height*e/i,h=o*t.width/t.height;this.planeW=h,this.planeH=o,this.mesh.position.set(-.5*s+(t.x*e+r)/i+h/2,.5-(t.y*e+a)/i-o/2,this.zPosition),this.mesh.scale.set(h,o),this.s=this.mesh.scale.clone(),this.program.uniforms.planeW.value=h,this.program.uniforms.planeH.value=o,this.program.uniforms.planeX.value=this.mesh.position.x,this.program.uniforms.planeY.value=this.mesh.position.y,this.animations.in&amp;&amp;this.passes.fade&amp;&amp;(this.passes.fade.uniforms.planeW.value=this.program.uniforms.planeW.value,this.passes.fade.uniforms.planeH.value=this.program.uniforms.planeH.value,this.passes.fade.uniforms.planeX.value=this.program.uniforms.planeX.value,this.passes.fade.uniforms.planeY.value=this.program.uniforms.planeY.value),this.pos={x:this.mesh.position.x,y:this.mesh.position.y,z:this.mesh.position.z}}hideMesh(){this.mesh&amp;&amp;(this.mesh.visible=!1,this.post.passes.forEach((function(t){t.enabled=!1})))}showMesh(){this.mesh||this.init3d(),this.mesh.parent||this.mesh.setParent(this.scene),this.mesh.visible=!0,this.post.passes.forEach((function(t){t.enabled=!0}))}hideDomElement(){this.domElementVisible=!1,this.originalDomElement.style.opacity="0"}showDomElement(){this.domElementVisible=!0,this.originalDomElement.style.opacity=this.originalDomElementOpacity}setViewportSize(t,e){this.viewportWidth=t,this.viewportHeight=e}updateOffset(t,e){const n=this.viewportHeight;if(t=t||this.scrollX/window.innerWidth,e=e||this.scrollY/n,this.offsetX=t,this.offsetY=e,this.options.in.lockToScrollbar){const t=this.domElement.getBoundingClientRect(),e={top:n*this.options.in.viewportTopMargin,bottom:n*(1-this.options.in.viewportBottomMargin)},i=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)-n,s=Math.max(t.bottom+scrollY-i,e.bottom-(e.bottom-e.top)/2+t.height/2),r=e.bottom;let a;if(t.bottom&lt;=s)a=1;else if(t.top&gt;=r)a=0;else{const e=r-s+t.height;a=(r-t.top)/e,this.needsUpdate=!0}this.options.in.progress=a,this.isCSSAnimation?(this.animatedIn=!1,this.animeInCSS()):(a&gt;=0?(this.options.in.live=!0,this.enable()):this.disable(),this.animatedIn=!1,this.animeIn())}if(!this.isCSSAnimation){if(!this.mesh||!this.mesh.visible)return;const n=this.gl.canvas.width/this.gl.canvas.height;this.mesh.position.x=this.pos.x-n*t,this.mesh.position.y=this.pos.y+e,this.p=this.mesh.position.clone(),this.meshPosition={x:this.pos.x-n*t,y:this.pos.y+e,z:this.pos.z},this.program.uniforms.planeX.value=this.mesh.position.x,this.program.uniforms.planeY.value=this.mesh.position.y}}onScroll(t,e){this.scrollX=t,this.scrollY=e,this.inViewport&amp;&amp;(this.updatePositions(),this.updateOffset())}onResize(){this.updatePositions()}updateUniformValues(){const t=this,e=this.getInParam("progress"),n=this.program.uniforms.progress.value;this.program.uniforms.progress.value=e;const i=this.program.uniforms.progress.value-n;this.post.passes.forEach((function(n){n.enabled&amp;&amp;(n.uniforms.hasOwnProperty("u_time")&amp;&amp;(n.uniforms.u_time.value+=.02),n.uniforms.hasOwnProperty("u_radius")&amp;&amp;(n.uniforms.u_radius.value=e*(Math.pow(2,.5)/2)*1.2),n.uniforms.hasOwnProperty("strength")&amp;&amp;(n.uniforms.strength.value=1-e),n.uniforms.hasOwnProperty("progress")&amp;&amp;(n.uniforms.progress.value=e),n.uniforms.hasOwnProperty("speed")&amp;&amp;(n.uniforms.speed.value=i),n.uniforms.hasOwnProperty("threshold")&amp;&amp;(n.uniforms.threshold.value=t.options.in.fade.threshold),n.uniforms.hasOwnProperty("alphaMapAngle")&amp;&amp;(n.uniforms.alphaMapAngle.value=t.options.in.fade.alphaMapAngle))})),this.program.uniforms.strength.value=1-e,this.program.uniforms.translate.value.x=this.options.in.translate.x,this.program.uniforms.translate.value.y=this.options.in.translate.y,this.program.uniforms.translate.value.z=this.options.in.translate.z,this.program.uniforms.rotate.value.x=Math.PI*this.options.in.rotate.x/180,this.program.uniforms.rotate.value.y=Math.PI*this.options.in.rotate.y/180,this.program.uniforms.rotate.value.z=Math.PI*this.options.in.rotate.z/180,this.program.uniforms.p1.value.x=this.options.in.corners.start1,this.program.uniforms.p2.value.x=this.options.in.corners.start2,this.program.uniforms.p3.value.x=this.options.in.corners.start3,this.program.uniforms.p4.value.x=this.options.in.corners.start4,this.program.uniforms.p1.value.y=this.options.in.corners.end1,this.program.uniforms.p2.value.y=this.options.in.corners.end2,this.program.uniforms.p3.value.y=this.options.in.corners.end3,this.program.uniforms.p4.value.y=this.options.in.corners.end4,this.program.uniforms.easeX.value=this.options.in.corners.easeX,this.program.uniforms.easeY.value=this.options.in.corners.easeY}updateUniformsFromAnimationParams(){(this.getInParam("progress")&lt;1||this.options.mouse.flowmap.enabled)&amp;&amp;(this.options.in.lockToScrollbar||(this.needsUpdate=!0),this.updateUniformValues())}getInParam(t){return this.options.in.live?this.options.in[t]:this.animations.in.params[t]}updateMeshPosition(){this.animationParams.translateY=0,this.meshPosition&amp;&amp;this.mesh.position.set(this.meshPosition.x+this.animationParams.translateX,this.meshPosition.y+this.animationParams.translateY,this.meshPosition.z+this.animationParams.translateZ)}updateMeshVelocity(){this.timeNow=performance.now(),this.deltaTime=this.timeNow-this.timeOld,this.timeOld=this.timeNow;const t=1-this.getInParam("progress");this.meshTranslateOld&amp;&amp;(this.meshVelocity={x:(this.options.in.translate.x*t-this.meshTranslateOld.x)/this.deltaTime,y:(this.options.in.translate.y*t-this.meshTranslateOld.y)/this.deltaTime,z:(this.options.in.translate.z*t-this.meshTranslateOld.z)/this.deltaTime},this.meshVelocityLerp={x:ce(this.meshVelocityLerp.x,this.meshVelocity.x,.2),y:ce(this.meshVelocityLerp.y,this.meshVelocity.y,.2),z:ce(this.meshVelocityLerp.z,this.meshVelocity.z,.2)}),this.meshTranslateOld={x:this.options.in.translate.x*t,y:this.options.in.translate.y*t,z:this.options.in.translate.z*t}}updateActivePasses(){for(let t in this.passes)this.options.in[t]&amp;&amp;(this.passes[t].enabled=this.options.in[t].enabled)}enable(){this.enabled||(this.enabled=!0,this.updatePositions(),this.updateOffset(this.offsetX,this.offsetY),this.hideDomElement())}disable(){if(this.enabled){const t=this;this.showDomElement();const e=this.originalDomElement.querySelectorAll("img");if(e.length){const n=e[0],i=new Image;i.src=n.src,i.onload=function(){requestAnimationFrame((function(){t.enabled=!1}))}}else requestAnimationFrame((function(){t.enabled=!1}))}}render(t,e){this.scroll=t,this.isCSSAnimation||(this.lastRender||this.mesh&amp;&amp;this.mesh.visible)&amp;&amp;(this.lastRender=!1,this.animations.scroll&amp;&amp;this.animations.scroll.render(t),this.updateActivePasses(),this.updateUniformsFromAnimationParams(),this.updateMeshPosition(),this.needsUpdate&amp;&amp;(this.post.render({texture:this.texture}),this.mesh.program.uniforms.tMap.value=this.post.uniform.value,this.needsUpdate=!1))}}class fe{constructor(t,e,n,i,s,r){this.selector=e,this.options=t,this.width=i,this.height=s;const o=new w({alpha:!0,dpr:window.devicePixelRatio,premultipliedAlpha:!0,preserveDrawingBuffer:!0,preserveDrawingBuffer:!1,depth:!0}),h=o.gl;this.gl=h,this.renderer=o,h.clearColor(0,0,0,0),t.canvasWrapper.appendChild(h.canvas),h.canvas.style.position="absolute",h.canvas.style.top="0",h.canvas.style.left="0",h.canvas.style.zIndex=n,h.canvas.style.pointerEvents="none";const l=t.in.cameraFov,u=new R(h,{fov:l});window.camera=u,this.camera=u;let c=l*Math.PI/180,p=1/(2*Math.tan(c/2));window.addEventListener("agl-update",(function(){c=t.in.cameraFov*Math.PI/180,p=1/(2*Math.tan(c/2)),u.fov=t.in.cameraFov,u.perspective(),u.position.z=p})),u.position.set(0,0,p),u.lookAt([0,0,0]);const d=new F;this.scene=d,this.planes=[];const m=new nt(h);this.postComposite=m;const f={value:new a};this.resolution=f;const g={value:new a};this.bloomResolution=g,this.flowmap=r||new rt(h,{size:64,falloff:.2,alpha:.2,dissipation:.9,type:h.HALF_FLOAT});const y=m.addPass({fragment:"\n\nprecision highp float;\nuniform sampler2D tMap;\n// uniform sampler2D tBloom;\nuniform vec2 uResolution;\n// uniform float uBloomStrength;\nvarying vec2 vUv;\nvoid main() {\n    // // gl_FragColor = texture2D(tMap, vUv) + texture2D(tBloom, vUv) * uBloomStrength;\n    // if(uBloomStrength &gt; 0.01)\n    //     gl_FragColor = texture2D(tMap, vUv) + texture2D(tBloom, vUv) * uBloomStrength;\n    //     // gl_FragColor = texture2D(tBloom, vUv);\n    // else{\n    //     gl_FragColor = texture2D(tMap, vUv);\n    // }\n\n    gl_FragColor = texture2D(tMap, vUv);\n}\n\n",uniforms:{uResolution:f}});this.compositePass=y;const x=m.addPass({fragment:"\n\n// precision highp float;\nprecision mediump float;\n\nuniform sampler2D tMap;\nuniform sampler2D tFlow;\nuniform float rgbSplit;\nuniform float time;\nuniform vec3 water;\n// uniform float uTime;\nvarying vec2 vUv;\n\n#define NUM_OCTAVES 5\n\nfloat rand(vec2 n) { \n\treturn fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);\n}\n\nfloat noise(vec2 p){\n\tvec2 ip = floor(p);\n\tvec2 u = fract(p);\n\tu = u*u*(3.0-2.0*u);\n\t\n\tfloat res = mix(\n\t\tmix(rand(ip),rand(ip+vec2(1.0,0.0)),u.x),\n\t\tmix(rand(ip+vec2(0.0,1.0)),rand(ip+vec2(1.0,1.0)),u.x),u.y);\n\treturn res*res;\n}\n\nfloat fbm(vec2 x, float ang) {\n\tfloat v = .25;\n\tfloat a = 0.5;\n\tvec2 shift = vec2(100);\n    float angle = .25;\n\t// Rotate to reduce axial bias\n    mat2 rot = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n\tfor (int i = 0; i &lt; NUM_OCTAVES; ++i) {\n\t\tv += a * noise(x);\n\t\tx = rot * x * 2.0 + shift;\n\t\ta *= 0.5;\n\t}\n\treturn v;\n}\n\n\n\n\nvoid main() {\n    vec2 uv = vUv;\n\n    // R and G values are velocity in the x and y direction\n    // B value is the velocity length\n    vec3 flow = texture2D(tFlow, vUv).rgb;\n\n    float threshold = .01;\n\n    if(flow.z &gt; threshold) {\n            \n        float strength = water.x + flow.z;\n\n        if(water.x &gt; 0.){\n\n            // water distorsion\n            strength *= flow.z;\n            // vec2 surface = flow.b * vec2(mix(-.3, .3, fbm(10. * uv + .5 * time, time / 20.)));\n            vec2 surface = strength  * vec2(mix(-.3, .3, fbm(10. * water.y * uv + .3 * time, time / 10.)));\n            // vec2 surface = strength * vec2(mix(-t1, t1, fbm(t2 * uv + t3 * time, time / t4)));\n            // vec2 modified = refract(vec2(0.), surface, 1. / 1.3333);\n            uv += refract(vec2(0.), surface, 1. / 1.3333);\n            // vec4 noise = vec4(vec3(surface.y), 1.);\n        }else{\n\n            // 2D pull distorsion \n            uv -= flow.z * (flow.xy) * .2;\n        }\n\n    }\n\n    // RGB split\n    vec4 c1 = texture2D(tMap, uv);\n\n    // // debug - show flow map \n    // if(flow.z &gt; threshold)\n    //     c1.r = 1.;\n\n        \n    if(rgbSplit &gt; 0. &amp;&amp; flow.z &gt; threshold){\n        uv -= flow.z * (flow.xy) * rgbSplit;\n        vec4 c2 = texture2D(tMap, uv);\n        gl_FragColor = vec4(c1.r, c2.gba);\n    }else{\n        gl_FragColor = c1;\n    }\n    \n}\n\n",uniforms:{tFlow:{value:this.flowmap.uniform.value},rgbSplit:{value:.1},time:{value:0},water:{value:new v}}});this.flowPass=x,this.createPlanes(),window.addEventListener("click",(function(t){})),window.addEventListener("agl-init",this.createPlanes.bind(this))}createPlanes(){let t;this.flowmap;const e=this.gl,n=this.scene,i=this.options,s=this.planes,r=this.width,a=this.height;this.elements=document.querySelectorAll(this.selector),this.elements.forEach((function(o,h){o.plane||(t=new me(e,{domElement:o,index:h,options:i,scene:n,width:r,height:a}),s.push(t),o.plane=t,o.addEventListener("agl-remove",(function(t){this.plane&amp;&amp;(this.plane.mesh.setParent(null),this.plane=null,s.splice(s.indexOf(this.plane),1))})))})),this.onScroll(window.scrollX,window.scrollY)}onMouseMove(t){this.planes.forEach((function(e){e.onMouseMove(t)}))}resize(t,e){this.width==t&amp;&amp;this.height==e&amp;&amp;this.initialized||(this.initialized=!0,this.planes.forEach((function(n){n.setViewportSize(t,e)})),this.width=t,this.height=e,this.renderer.setSize(t,e),this.camera.perspective({aspect:this.gl.canvas.width/this.gl.canvas.height}),this.postComposite.resize(),this.resolution.value.set(t,e),this.onScroll(this.scrollX,this.scrollY))}onScroll(t,e){if(this.scrollX=t,this.scrollY=e,0==this.planes.length)return;const n=Math.min(t,document.body.scrollWidth),i=Math.min(e,document.body.scrollHeight);this.renderer.gl.canvas.style.transform=" translate3d("+n+"px,"+i+"px, 0px)",this.planes.forEach((function(n){n.onScroll(t,e)}))}render(t,e,n,i,s,r){if(0==this.planes.length)return;let a=0;this.planes.forEach((function(t){t.isCSSAnimation||a++})),a&amp;&amp;(this.flowmap.aspect=1,this.flowmap.mouse.copy(i),this.flowmap.velocity.lerp(s,s.len?.2:.1),this.flowmap.update(),this.planes.forEach((function(r){r.render((e-n)/1e3,t,i,s)})),this.compositePass.enabled=!1,this.flowPass.enabled=!1,this.postComposite.targetOnly=!0,this.postComposite.render({scene:this.scene,camera:this.camera}),this.compositePass.enabled=!0,this.options.mouse.flowmap.enabled&amp;&amp;(this.flowPass.enabled=!0,this.flowmap.mesh.program.uniforms.uAlpha.value=this.options.mouse.flowmap.strength,this.flowmap.mesh.program.uniforms.uFalloff.value=this.options.mouse.flowmap.size,this.flowmap.mesh.program.uniforms.uDissipation.value=1-this.options.mouse.flowmap.ease,this.flowPass.uniforms.rgbSplit.value=this.options.mouse.flowmap.rgbSplit),this.options.mouse.water.enabled?(this.flowPass.enabled=!0,this.flowPass.uniforms.time.value=this.options.mouse.water.speed*t/100,this.flowPass.uniforms.water.value.x=r/1e4||this.options.mouse.flowmap.strength,this.flowPass.uniforms.water.value.y=this.options.mouse.flowmap.size):this.flowPass.uniforms.water.value.x=0,this.postComposite.targetOnly=!1,this.postComposite.render({texture:this.postComposite.uniform.value}))}}return window.AnimateGL=class{constructor(){const t=ue({},agl.defaults,arguments[0]);this.options=t;const e=new a(-1),n=new a,i=new a;let s,r=0,o=0,h=0;const l=[],u=document.createElement("div");u.style.position="fixed",u.style.top="0",u.style.left="0",u.style.height="100vh",u.style.pointerEvents="none",document.body.appendChild(u);let c=document.documentElement.clientWidth,p=u.clientHeight,d=document.createElement("div");d.style.position="absolute",d.style.top="0",d.style.left="0",d.className="agl-canvas-wrapper",document.body.appendChild(d),this.options.canvasWrapper=d;const m=new fe(this.options,".agl",999,c,p);function f(t){t.changedTouches&amp;&amp;t.changedTouches.length&amp;&amp;(t.x=t.changedTouches[0].pageX,t.y=t.changedTouches[0].pageY),void 0===t.x&amp;&amp;(t.x=t.pageX,t.y=t.pageY),e.set(t.x/c,1-t.y/p),s||(s=performance.now(),i.set(t.x,t.y));const r=t.x-i.x,a=t.y-i.y;i.set(t.x,t.y);let o=performance.now(),h=Math.max(14,o-s);s=o,n.x=r/h,n.y=a/h,n.needsUpdate=!0,l.forEach((function(e){e.onMouseMove(t)}))}let g;function v(){p=u.clientHeight,c=document.documentElement.clientWidth,l.forEach((function(t){t.resize(c,p)})),y&amp;&amp;(y=!1,clearTimeout(g),g=setTimeout(v,1e3))}l.push(m),new MutationObserver((function(t){t.forEach((function(t){if("class"===t.attributeName){var e=t.target;e.classList.contains("agl")?e.plane?e.plane.cssClassUpdated():window.dispatchEvent(new Event("agl-init")):e.plane&amp;&amp;e.plane.disable()}else if(t.addedNodes.length){const e=t.addedNodes;for(let t=0;t&lt;e.length;t++){const n=e[t];n.classList&amp;&amp;n.classList.contains("agl")&amp;&amp;(n.plane?n.plane.cssClassUpdated():window.dispatchEvent(new Event("agl-init")))}}}))})).observe(document.body,{attributes:!0,attributeFilter:["class"],childList:!0,subtree:!0}),"ontouchstart"in window?(window.addEventListener("touchstart",f,!1),window.addEventListener("touchmove",f,!1)):window.addEventListener("mousemove",f,!1),requestAnimationFrame((function i(s){n.needsUpdate||(e.set(-1),n.set(0)),n.needsUpdate=!1,o=w,r=ce(r,o,t.scroll.ease),h=Math.abs(o-r),l.forEach((function(t){t.render(s,o,r,e,n,h)})),requestAnimationFrame(i)}));let y=!1;window.addEventListener("resize",(function(){y=!0,clearTimeout(g),g=setTimeout(v,100)}),!1),new ResizeObserver((t=&gt;{y=!0,clearTimeout(g),g=setTimeout(v,100)})).observe(document.querySelector("body"));let x=0,w=0;window.addEventListener("scroll",(function(){x=window.scrollX,w=window.scrollY,l.forEach((function(t){t.onScroll(x,w)}))}))}update(){console.log("update")}},window.agl=window.agl||{defaults:{}},agl.defaults=ue({},agl.defaults,{rootFolder:"../",html2canvasSrc:"js/lib/html2canvas.min.js",in:{name:"",easing:"easeInOutSine",ease:.1,opacity:0,duration:1e3,delay:0,distance:1,scale:1,type:"webgl",angle:0,lockToScrollbar:!1,repeat:!1,viewportTopMargin:0,viewportBottomMargin:0,cameraFov:30,displacement:{strength:0},curl:{radius:.2,strength:0},bend:{strength:0},fade:{enabled:!0,threshold:.4,type:"right",alphaMapSrc:null},liquid:{enabled:!1},translate:{enabled:!1,x:0,y:0,z:0},rotate:{enabled:!1,x:0,y:0,z:0},corners:{enabled:!0,start1:0,start2:0,start3:0,start4:0,end1:1,end2:1,end3:1,end4:1,easeX:1,easeY:1},presets:{bend:{fade:{type:"basic"},translate:{x:1},corners:{end1:.7,end2:.7,easeY:3}},bendLeft:{fade:{type:"basic"},translate:{x:1},corners:{end1:.7,end2:.7,easeY:3}},bendRight:{fade:{type:"basic"},translate:{x:-1},corners:{end1:.7,end2:.7,easeY:3}},bendUp:{fade:{type:"basic"},translate:{y:-1},corners:{end1:.7,end3:.7,easeX:3}},bendDown:{fade:{type:"basic"},translate:{y:1},corners:{end1:.7,end3:.7,easeX:3}},fade:{fade:{type:"right"}},fadeLeft:{fade:{type:"left"}},fadeRight:{fade:{type:"right"}},fadeUp:{fade:{type:"up"}},fadeDown:{fade:{type:"down"}},peel:{fade:{type:"basic"},translate:{x:1,z:.7},rotate:{y:180},corners:{end2:.5,end4:.6,end1:.9,easeX:2}},peelLeft:{fade:{type:"basic"},translate:{x:1,z:.7},rotate:{y:180},corners:{end2:.5,end4:.6,end1:.9,easeX:2}},peelRight:{fade:{type:"basic"},translate:{x:-1,z:.7},rotate:{y:-180},corners:{end1:.5,end3:.6,end2:.9,easeX:1}},peelUp:{fade:{type:"basic"},translate:{y:-1,z:.7},rotate:{x:-180},corners:{end1:.5,end2:.6,end3:.9,easeY:1}},peelDown:{fade:{type:"basic"},translate:{y:1,z:.7},rotate:{x:-180},corners:{end1:.9,end3:.5,end4:.6,easeY:2}},flip:{fade:{type:"basic"},rotate:{y:180},translate:{z:-1},corners:{end1:.8,end2:1,end3:.4,end4:.6,easeX:2,easeY:2}},flipLeft:{fade:{type:"basic"},rotate:{y:180},translate:{z:-1},corners:{end1:.8,end2:1,end3:.4,end4:.6,easeX:2,easeY:2}},flipRight:{fade:{type:"basic"},rotate:{y:180},translate:{z:-1},corners:{end1:1,end2:.8,end3:.6,end4:.4,easeX:2,easeY:2}},flipUp:{fade:{type:"basic"},rotate:{x:180},translate:{z:-1},corners:{end1:.8,end2:.4,end3:1,end4:.6,easeX:2,easeY:2}},flipDown:{fade:{type:"basic"},rotate:{x:180},translate:{z:-1},corners:{end1:1,end2:.6,end3:.8,end4:.4,easeX:2,easeY:2}},slide:{fade:{type:"right"},translate:{x:.4}},slideLeft:{fade:{type:"right"},translate:{x:.4}},slideRight:{fade:{type:"left"},translate:{x:-.4}},slideUp:{fade:{type:"down"},translate:{y:-.4}},slideDown:{fade:{type:"up"},translate:{y:.4}},stretch:{fade:{type:"basic"},translate:{x:.4},corners:{start2:.3,start4:.3,end1:.6,end3:.6,easeX:1}},stretchLeft:{fade:{type:"basic"},translate:{x:.4},corners:{start2:.3,start4:.3,end1:.6,end3:.6,easeX:1}},stretchRight:{fade:{type:"basic"},translate:{x:-.4},corners:{start1:.3,start3:.3,end2:.6,end4:.6,easeX:2}},stretchDown:{fade:{type:"basic"},translate:{y:.4},corners:{start3:.3,start4:.3,end1:.6,end2:.6,easeY:1}},stretchUp:{fade:{type:"basic"},translate:{y:-.4},corners:{start1:.3,start2:.3,end3:.6,end4:.6,easeY:2}},zoomIn:{fade:{type:"basic"},translate:{z:-10},corners:{end2:.8,end1:.6,end3:.8}},zoomInLeft:{fade:{type:"basic"},translate:{z:-10,x:3},corners:{end2:.8,end1:.6,end3:.8}},zoomInRight:{fade:{type:"basic"},translate:{z:-10,x:-3},corners:{end2:.6,end1:.8,end4:.8}},zoomInUp:{fade:{type:"basic"},translate:{z:-10,y:-3},corners:{end4:.8,end1:.8,end3:.6}},zoomInDown:{fade:{type:"basic"},translate:{z:-10,y:3},corners:{end2:.8,end1:.6,end3:.8}},zoomOut:{fade:{type:"basic"},translate:{z:5},corners:{end2:.8,end1:.6,end3:.8}},zoomOutLeft:{fade:{type:"basic"},translate:{z:5,x:3},corners:{end2:.8,end1:.6,end3:.8}},zoomOutRight:{fade:{type:"basic"},translate:{z:5,x:-3},corners:{end2:.6,end1:.8,end4:.8}},zoomOutUp:{fade:{type:"basic"},translate:{z:5,y:-3},corners:{end4:.8,end1:.8,end3:.6}},zoomOutDown:{fade:{type:"basic"},translate:{z:5,y:3},corners:{end2:.8,end1:.6,end3:.8}},fadeCSS:{},fadeCSSLeft:{translate:{x:"50px"}},fadeCSSRight:{translate:{x:"-50px"}},fadeCSSUp:{translate:{y:"50px"}},fadeCSSDown:{translate:{y:"-50px"}},zoomInCSS:{scale:.75},zoomInCSSLeft:{translate:{x:"25%"},scale:.75},zoomInCSSRight:{translate:{x:"-25%"},scale:.75},zoomInCSSUp:{translate:{y:"25%"},scale:.75},zoomInCSSDown:{translate:{y:"-25%"},scale:.75},zoomOutCSS:{scale:1.25},zoomOutCSSLeft:{translate:{x:"25%"},scale:1.25},zoomOutCSSRight:{translate:{x:"-25%"},scale:1.25},zoomOutCSSUp:{translate:{y:"25%"},scale:1.25},zoomOutCSSDown:{translate:{y:"-25%"},scale:1.25},wipeCSS:{clipPath:["inset(0% 100% 0% 0%)","inset(0% 0% 0% 0%)"]},wipeCSSLeft:{clipPath:["inset(0% 0% 0% 100%)","inset(0% 0% 0% 0%)"]},wipeCSSRight:{clipPath:["inset(0% 100% 0% 0%)","inset(0% 0% 0% 0%)"]},wipeCSSUp:{clipPath:["inset(100% 0% 0% 0%)","inset(0% 0% 0% 0%)"]},wipeCSSDown:{clipPath:["inset(0% 0% 100% 0%)","inset(0% 0% 0% 0%)"]},slideCSS:{clipPath:["inset(0% 0% 0% 100%)","inset(0% 0% 0% 0%)"],translate:{x:"-100%"}},slideCSSLeft:{clipPath:["inset(0% 100% 0% 0%)","inset(0% 0% 0% 0%)"],translate:{x:"100%"}},slideCSSRight:{clipPath:["inset(0% 0% 0% 100%)","inset(0% 0% 0% 0%)"],translate:{x:"-100%"}},slideCSSUp:{clipPath:["inset(0% 0% 100% 0%)","inset(0% 0% 0% 0%)"],translate:{y:"100%"}},slideCSSDown:{clipPath:["inset(100% 0% 0% 0%)","inset(0% 0% 0% 0%)"],translate:{y:"-100%"}}},names:[{name:"fadeCSS",title:"Fade"},{name:"zoomInCSS",title:"Zoom In"},{name:"zoomOutCSS",title:"Zoom Out"},{name:"wipeCSS",title:"Wipe"},{name:"slideCSS",title:"Slide"},{name:"fade",title:"Fade"},{name:"flip",title:"Flip"},{name:"slide",title:"Slide"},{name:"stretch",title:"Stretch"},{name:"bend",title:"Bend"},{name:"peel",title:"Peel"},{name:"zoomIn",title:"Zoom In"},{name:"zoomOut",title:"Zoom Out"}]},mouse:{flowmap:{enabled:!1,size:.2,strength:.2,ease:.2,rgbSplit:.2},water:{enabled:!1,speed:.5,strength:1,size:.5},rotate:{enabled:!1,ease:.25,inertia:.85},hover:{enabled:!1,rotate:.5,zoom:0,scale:1.2,ease:.1}},scroll:{bend:{enabled:!1,radius:.2,strength:0},fisheye:{enabled:!1,strength:0},stretch:{strength:0},displacement:{strength:0},rgbShift:{strength:0},ease:.1}}),t})()}));</pre></body></html>