memoscan
← all memos

Memo 0xc1521498…a254b1 on Ethereum

a=Ie<=Le?Ie:Le,i=Pe.material.uniforms;if(i.noiseStrength={value:le},i.numSteps={value:a},i.time={value:ve},i.posTex={value:G.getCurrentRenderTarget(Q).texture},i.xDirTex={value:G.getCurrentRenderTarget(te).texture},i.yDirTex={value:G.getCurrentRenderTarget(re).texture},i.tanTex={value:G.getCurrentRenderTarget(ee).texture},i.colors={value:o},i.stops={value:t.stops},i.dBes={value:t.dB},i.dRs={value:t.dR},i.bgCol={value:Ye},i.numGradients={value:je.gradients.length},i.canvasSize={value:new q.Vector2(ce*ae,se*ae)},Pe.material.wireframe=Ve,Y&&Ie>=500||!Y){let e=ue.getRenderTarget();ue.setRenderTarget(_e),ue.render(xe,me),we.material.uniforms.map.value=_e.texture,we.material.uniforms.time.value=ge,we.material.uniforms.width.value=j,we.material.uniforms.height.value=X,we.material.uniforms.noiseStrength.value=Oe?.6:.8,ue.setRenderTarget(e),ue.render(pe,he)}De||Ie++}function Ze(){se=window.innerHeight;le=a(se*Ce,500,2e3,.4,1,!0),le*=H.noiseStrength,ce=se/ie,ce*=2,se*=2,j=ce,X=se,me.aspect=ce/se,me.updateProjectionMatrix(),ue.setSize(ce,se),ue.domElement.style.width=window.innerHeight/ie+"px",ue.domElement.style.height=window.innerHeight+"px",se<1800&&(se=1800,!Y&&ae<=1&&(se*=2)),ce=se/ie,he=new q.OrthographicCamera(ce/-2,ce/2,se/2,se/-2,-1e4,1e4),he.updateProjectionMatrix(),_e=new q.WebGLRenderTarget(ce*Ce,se*Ce,{depthBuffer:!0}),we.scale.x=ce,we.scale.y=se,Te.scale.x=ce,Te.scale.y=se}Ue.getHSL(Ne),Ue.setHSL(Ne.h,.3*Ne.s,.8*Ne.l),document.body.style.backgroundColor=Ue.getHexString(),ke=Ue.clone(),console.log('tokenData.hash = "'+tokenData.hash+'";'),function(){let e=$.zoomLevel,n=e/ie;me=new q.OrthographicCamera(-n/2,n/2,e/2,-e/2,-50,50),me.position.z=10.5,me.position.z,me.position.z,xe=new q.Scene,xe.background=ke,xe.add(me),ue=new q.WebGLRenderer({antialias:!0,sortObjects:!1}),ue.setPixelRatio(ae),ue.setSize(ce,se),ue.domElement.style.width=ce/2+"px",ue.domElement.style.height=se/2+"px",ye=new q.Object3D,ye.rotation.x=$.xRotation,ye.rotation.y=$.yRotation,xe.add(ye),ue.domElement.setAttribute("id","scene")}(),function(){const e=new q.DirectionalLight(16777215,1.3),n=new q.DirectionalLight(16777215,.6),t=new q.DirectionalLight(16777215,.5);e.position.set(2,2,-3),n.position.set(8,-12,7),t.position.set(-2,2,-6),xe.add(e),xe.add(n),xe.add(t)}(),function(){let e=[],n=0,t=$.nLines;if(0==$.circleDistroAlgo){for(;n<t;)o(e,0);function o(e,r){r<3&&(e.push([]),n++);let a=.01+r/3,s=5-r;if(e.length<s&&i.random_dec()>a&&n<t){(function(e){let n=0;function t(e){for(let o=0;o<e.length;o++)e[o].length&&t(e[o]),n++}return t(e),n})(e=e[i.random_int(0,e.length-1)])<3&&o(e,r+1)}}}else{e=[];let n=i.random_int(3,$.nLines/2);i.random_bool(.03)&&(n=2);let t=$.nLines-n;for(let o=0;o<n;o++){let r=[],a=i.random_int(0,t<6?t:6);o==n-1&&(a=t),t-=a;let s=r;for(let e=0;e<a;e++){let e=[];s.push(e),s=e}e.push(r)}}let o=new THREE.Vector3,r=0;!function e(n,t,o,a){if(r>0){Ee.push(t),Be.push(o),$e.push(a);let e=1.4;$.smallFolds&&a<2&&i.random_bool(.3)&&(e=.6),He.push(e)}r++,a++;let s=n.length;if(1==s)o*=.6,e(n[0],t,o,a);else if(s>1){let r=2*Math.PI/s,c=i.random_num(-Math.PI,Math.PI),l=o/(s+1);for(let s=0;s<n.length;s++){let g=t.clone(),d=.55*o;a<2&&(d+=i.random_num(0,.3*o)),g.y+=Math.sin(c+r*s)*d,g.x+=Math.cos(c+r*s)*d,e(n[s],g,l,a)}}}(e,o,$.startRadius,0)}(),function(){G=new e(Le,Me,ue),J=G.createTexture(),Q=G.addVariable("texturePosition",`\nuniform float time;\nuniform int frame;\nuniform vec3 startPos[${$.nLines}];\nuniform float startRad[${$.nLines}];\n${t}\n#define PI 3.1415926538\n\nfloat fbm(vec3 x, int numOctaves) {\nfloat v = 0.0;\nfloat a = 0.5;\nvec3 shift = vec3(100);\nfor (int i = 0; i < numOctaves; ++i) {\nv += a * cnoise(x);\nx = x * 2.0 + shift;\na *= 0.5;\n}\nreturn v;\n}\n\nvoid main () {\nvec4 pos;\nvec2 uv = gl_FragCoord.xy / resolution.xy;\nvec4 acc = texture2D(textureAcc, uv);\nif (frame == 0)\n{\nint i = int(gl_FragCoord.y);\nfloat rad = startRad[i];\nfloat ang = uv.x * PI * 2.0;\npos = vec4(cos(ang) * rad, sin(ang) * rad, 0.0, 1.0);\npos.xyz += startPos[i];\nfloat fbmScale = .3;\nint octaves = 1;\nfloat scale = 1.5;\nvec3 p = pos.xyz;\np.x += ${i.random_dec(0,1e3)};\np.y += ${i.random_dec(0,1e3)};\n}\nelse if (frame == 1)\n{\nint nX = ${$.nSteps};\nint nY = ${$.nLines};\nint nTotal = nX * nY;\nvec2 offset;\nfor (int y = 0; y < nY; y++)\n{\nfor (int x = 0; x < nX; x++)\n{\nvec2 uv2 = vec2(float(x) + 0.001, float(y) + 0.001) / resolution.xy;\nvec4 pos2 = texture2D(texturePosition, uv2);\noffset += pos2.xy;\n}\n}\noffset /= float(nTotal);\npos = texture2D(texturePosition, uv);\npos.xy -= offset;\npos.x += ${i.random_dec(-.2,.2).toPrecision(5)};\nvec4 vel = texture2D(textureVel, uv);\nif (${H.applyVelocity}) pos.xyz += vel.xyz;\npos.w = vel.w;\n}\nelse\n{\nvec4 vel = texture2D(textureVel, uv);\npos = texture2D(texturePosition, uv);\nif (${H.applyVelocity}) pos.xyz += vel.xyz;\npos.w = vel.w;\n}\ngl_FragColor = pos;\n}`,J),Q.material.uniforms.time={value:0},Q.material.uniforms.frame={value:Ie},Q.material.uniforms.startPos={value:Ee},Q.material.uniforms.startRad={value:Be},N=G.createTexture(),U=G.addVariable("textureAcc",`\n${t}\nuniform float maxAcc;\nuniform float time;\nuniform float foldSize[${$.nLines}];\nuniform int levels[${$.nLines}];\nvoid main () \n{\nvec2 c0 = gl_FragCoord.xy - vec2(1.0, 0.0);\nvec2 c1 = gl_FragCoord.xy;\nvec2 c2 = gl_FragCoord.xy + vec2(1.0, 0.0);\nint level = levels[int(gl_FragCoord.y)];\nif (c1.x < 1.0) c0 = vec2(resolution.x - 1.0, gl_FragCoord.y);\nif (c1.x > resolution.x - 1.0) c2 = vec2(0.0, gl_FragCoord.y);\nvec2 uv0 = c0 / resolution.xy;\nvec2 uv1 = c1 / resolution.xy;\nvec2 uv2 = c2 / resolution.xy;\nvec3 p0 = texture2D(texturePosition, uv0).xyz;\nvec3 p1 = texture2D(texturePosition, uv1).xyz;\nvec3 p2 = texture2D(texturePosition, uv2).xyz;\nfloat type = gl_FragCoord.y;\nvec3 acc = vec3(0.0, 0.0, 0.0);\nfloat segmentLength = .0001;\nfloat internalForceStrength = 1.0;\ninternalForceStrength = foldSize[int(gl_FragCoord.y)];\nvec3 pull1 = p0 - p1;\nvec3 pull2 = p2 - p1;\nvec3 pullToPoint = p0 + ((p2 - p0) * .5);\nvec3 pull3 = p1 - pullToPoint;\npull1 = normalize(pull1) * (length(pull1) - segmentLength);\npull2 = normalize(pull2) * (length(pull2) - segmentLength);\nfloat minDistMin = .4;\nfloat minDistMultiplierMax = .9;\nfloat minDistMultiplier = clamp(time * .5, 0.0, minDistMultiplierMax);\nfloat minDist = minDistMin + ((1.0 + (cnoise(vec3(p1.x * 1.3, p1.y * 1.3, 0.0))) / 2.0) * minDistMultiplier);\nvec2 uv4;\nvec3 p4;\nfloat bendStrength = ${$.bendStrength.toPrecision(5)};\nfloat globalForceStrength = bendStrength;\nif (time > 0.0)\n{\nacc += pull1 * internalForceStrength;\nacc += pull2 * internalForceStrength;\nfloat swirlSize = cnoise(p1 * .5);\nswirlSize = ${$.swirlSize.toPrecision(5)};\nfloat nStrength = ${$.swirlStrength.toPrecision(5)} * (1.0 - clamp((time - 5.0) / 10.0, 0.0, 1.0));\nvec3 np1 = (p1 * swirlSize) + ${i.random_num(100,300).toPrecision(5)};\nvec3 np2 = (p2 * swirlSize) + ${i.random_num(100,300).toPrecision(5)};\nnp1.z += ${i.random_num(0,1e3).toPrecision(5)};\nnp2.z += ${i.random_num(0,1e3).toPrecision(5)};\nacc.x += cnoise(np1) * nStrength;\nacc.y += cnoise(np2) * nStrength;\nvec3 attrPos = vec3(${i.random_num(-2,2).toPrecision(5)}, ${i.random_num(-2,2).toPrecision(5)}, 0.0);\nvec3 attract = p1 - attrPos;\nattract = normalize(attract) * (1.0 - clamp(length(attract) / 3.5, 0.0, 1.0));\nvec3 repulse = p1 - attrPos;\nrepulse = normalize(repulse) * (1.0 - clamp(length(repulse) / .5, 0.0, 1.0));\nacc -= attract * ${$.attrStrength.toPrecision(5)};\nacc += repulse * ${$.attrStrength.toPrecision(5)};\nfor (int i = 0; i < ${$.nLines}; i++)\n{\nfor (int j = 0; j < ${$.nSteps}; j++)\n{\nuv4 = vec2(float(j) + 0.001, float(i) + 0.001) / resolution.xy;\np4 = texture2D(texturePosition, uv4).xyz;\nif (p1 != p4)\n{\nvec3 dist = p4 - p1;\nvec3 pull3 = normalize(dist) * (length(dist) - minDist);\nvec3 push2 = normalize(dist) * clamp((length(dist) - minDist), 0.0, 10.0);\nacc += pull3 * globalForceStrength;\nacc += push2 * -globalForceStrength;\n}\n}\n}\n}\nacc *= 1.0 - pow(clamp((time - 0.0) / 11.1, 0.0, 1.0), 3.0);\ngl_FragColor = vec4(acc, type);\n}`,N),U.material.uniforms.time={value:0},U.material.uniforms.foldSize={value:He},U.material.uniforms.levels={value:$e},W=G.createTexture(),K=G.addVariable("textureVel","\nuniform float time;\nvoid main () {\nvec2 uv = gl_FragCoord.xy / resolution.xy;\nvec4 pos = texture2D(texturePosition, uv);\nvec4 acc = texture2D(textureAcc, uv);\nvec4 vel = texture2D(textureVel, uv);\nvel.xyz *= 0.95;\nvel.xyz += acc.xyz;\nvel.xyz *= .05 + (.05 * (1.0 - pow(clamp((time-3.0) / 4.0, 0.0, 1.0), 2.0)));\ngl_FragColor = vec4(vel.xyz, acc.w);\n}",W),K.material.uniforms.time={value:0},Z=G.createTexture(),ee=G.addVariable("textureTangent","\nvoid main () \n{\nvec3 pos = texture2D(texturePosition, gl_FragCoord.xy / resolution.xy).xyz;\nvec3 prevPos = texture2D(texturePosition, (gl_FragCoord.xy + vec2(1.0, 0.0)) / resolution.xy).xyz;\nvec3 nextPos = texture2D(texturePosition, (gl_FragCoord.xy - vec2(1.0, 0.0)) / resolution.xy).xyz;\nvec3 tangent = normalize(nextPos - pos);\ngl_FragColor = vec4(tangent.xyz, 1.0);\n}",Z),oe=G.createTexture(),re=G.addVariable("textureYDir","\nvoid main () \n{\nvec3 tan = texture2D(textureTangent, gl_FragCoord.xy / resolution.xy).xyz;\nvec3 nextTan = texture2D(textureTangent, (gl_FragCoord.xy - vec2(1.0, 0.0)) / resolution.xy).xyz;\nvec3 yDir = tan;\nyDir = normalize(-yDir);\ngl_FragColor = vec4(yDir.xyz, 1.0);\n}",oe),ne=G.createTexture(),te=G.addVariable("textureXDir","\nvoid main () \n{\nvec3 tan = texture2D(textureTangent, gl_FragCoord.xy / resolution.xy).xyz;\nvec3 yDir = texture2D(textureYDir, gl_FragCoord.xy / resolution.xy).xyz;\nvec3 xDir = normalize(cross(tan, yDir));\ngl_FragColor = vec4(xDir.xyz, 1.0);\n}",ne),G.setVariableDependencies(U,[Q]),G.setVariableDependencies(K,[Q,U,K]),G.setVariableDependencies(Q,[Q,U,K]),G.setVariableDependencies(ee,[Q]),G.setVariableDependencies(re,[Q,ee]),G.setVariableDependencies(te,[Q,ee,re]),_e=new q.WebGLRenderTarget(ce*Ce,se*Ce,{depthBuffer:!0});var n=G.init();null!==n&&console.error(n)}(),function(){let e=Ke(),n=function(e,n){let t=new q.PlaneBufferGeometry(.005,.5,1,n);{t=new THREE.BufferGeometry;let o=[],r=[];for(let t=0;t<n;t++)for(let a=0;a<e;a++)if(o.push(0,0,0),a<e-1)if(t<n-1){let n=t*e+a,o=n+e;r.push(n,n+1,o),r.push(n+1,o+1,o)}else{let n=t*e+a;r.push(n,n+1,a),r.push(n+1,a+1,a)}t.setIndex(r),t.setAttribute("position",new THREE.BufferAttribute(new Float32Array(o),3))}return t}(2,Le),r=function(e,n,r,s,c){let l=M.UniformsUtils.merge([M.ShaderLib.phong.uniforms,{diffuse:{value:new M.Color(16777215)}},{time:{value:0}},{numSteps:{value:0}},{nSides:{value:r}},{posTex:{type:L}},{xDirTex:{value:L}},{yDirTex:{value:L}},{tanTex:{value:L}},{colors:{value:s}},{stops:{value:c.stops}},{dBes:{value:c.dB}},{vSs:{value:c.dB}},{dRs:{value:c.dR}},{numGradients:{value:1}},{canvasSize:{value:new M.Vector2(100,100)}},{bgCol:{value:new M.Color(16777215)}}]),g=M.ShaderLib.phong.vertexShader,d=M.ShaderLib.phong.fragmentShader;g=g.replace("#include <common>",`\n\nvec3 rotAxis(vec3 v, vec3 axis, float angle)\n{\nreturn (1.0 - cos(angle)) * dot(v, axis) * axis + cos(angle) * v + sin(angle) * cross(axis, v);\n}\n\nvec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}\nvec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}\nvec4 fade(vec4 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}\nfloat cnoise(vec4 P){\nvec4 Pi0 = floor(P);\nvec4 Pi1 = Pi0 + 1.0;\nPi0 = mod(Pi0, 289.0);\nPi1 = mod(Pi1, 289.0);\nvec4 Pf0 = fract(P);\nvec4 Pf1 = Pf0 - 1.0;\nvec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\nvec4 iy = vec4(Pi0.yy, Pi1.yy);\nvec4 iz0 = vec4(Pi0.zzzz);\nvec4 iz1 = vec4(Pi1.zzzz);\nvec4 iw0 = vec4(Pi0.wwww);\nvec4 iw1 = vec4(Pi1.wwww);\nvec4 ixy = permute(permute(ix) + iy);\nvec4 ixy0 = permute(ixy + iz0);\nvec4 ixy1 = permute(ixy + iz1);\nvec4 ixy00 = permute(ixy0 + iw0);\nvec4 ixy01 = permute(ixy0 + iw1);\nvec4 ixy10 = permute(ixy1 + iw0);\nvec4 ixy11 = permute(ixy1 + iw1);\nvec4 gx00 = ixy00 / 7.0;\nvec4 gy00 = floor(gx00) / 7.0;\nvec4 gz00 = floor(gy00) / 6.0;\ngx00 = fract(gx00) - 0.5;\ngy00 = fract(gy00) - 0.5;\ngz00 = fract(gz00) - 0.5;\nvec4 gw00 = vec4(0.75) - abs(gx00) - abs(gy00) - abs(gz00);\nvec4 sw00 = step(gw00, vec4(0.0));\ngx00 -= sw00 * (step(0.0, gx00) - 0.5);\ngy00 -= sw00 * (step(0.0, gy00) - 0.5);\nvec4 gx01 = ixy01 / 7.0;\nvec4 gy01 = floor(gx01) / 7.0;\nvec4 gz01 = floor(gy01) / 6.0;\ngx01 = fract(gx01) - 0.5;\ngy01 = fract(gy01) - 0.5;\ngz01 = fract(gz01) - 0.5;\nvec4 gw01 = vec4(0.75) - abs(gx01) - abs(gy01) - abs(gz01);\nvec4 sw01 = step(gw01, vec4(0.0));\ngx01 -= sw01 * (step(0.0, gx01) - 0.5);\ngy01 -= sw01 * (step(0.0, gy01) - 0.5);\nvec4 gx10 = ixy10 / 7.0;\nvec4 gy10 = floor(gx10) / 7.0;\nvec4 gz10 = floor(gy10) / 6.0;\ngx10 = fract(gx10) - 0.5;\ngy10 = fract(gy10) - 0.5;\ngz10 = fract(gz10) - 0.5;\nvec4 gw10 = vec4(0.75) - abs(gx10) - abs(gy10) - abs(gz10);\nvec4 sw10 = step(gw10, vec4(0.0));\ngx10 -= sw10 * (step(0.0, gx10) - 0.5);\ngy10 -= sw10 * (step(0.0, gy10) - 0.5);\nvec4 gx11 = ixy11 / 7.0;\nvec4 gy11 = floor(gx11) / 7.0;\nvec4 gz11 = floor(gy11) / 6.0;\ngx11 = fract(gx11) - 0.5;\ngy11 = fract(gy11) - 0.5;\ngz11 = fract(gz11) - 0.5;\nvec4 gw11 = vec4(0.75) - abs(gx11) - abs(gy11) - abs(gz11);\nvec4 sw11 = step(gw11, vec4(0.0));\ngx11 -= sw11 * (step(0.0, gx11) - 0.5);\ngy11 -= sw11 * (step(0.0, gy11) - 0.5);\nvec4 g0000 = vec4(gx00.x,gy00.x,gz00.x,gw00.x);\nvec4 g1000 = vec4(gx00.y,gy00.y,gz00.y,gw00.y);\nvec4 g0100 = vec4(gx00.z,gy00.z,gz00.z,gw00.z);\nvec4 g1100 = vec4(gx00.w,gy00.w,gz00.w,gw00.w);\nvec4 g0010 = vec4(gx10.x,gy10.x,gz10.x,gw10.x);\nvec4 g1010 = vec4(gx10.y,gy10.y,gz10.y,gw10.y);\nvec4 g0110 = vec4(gx10.z,gy10.z,gz10.z,gw10.z);\nvec4 g1110 = vec4(gx10.w,gy10.w,gz10.w,gw10.w);\nvec4 g0001 = vec4(gx01.x,gy01.x,gz01.x,gw01.x);\nvec4 g1001 = vec4(gx01.y,gy01.y,gz01.y,gw01.y);\nvec4 g0101 = vec4(gx01.z,gy01.z,gz01.z,gw01.z);\nvec4 g1101 = vec4(gx01.w,gy01.w,gz01.w,gw01.w);\nvec4 g0011 = vec4(gx11.x,gy11.x,gz11.x,gw11.x);\nvec4 g1011 = vec4(gx11.y,gy11.y,gz11.y,gw11.y);\nvec4 g0111 = vec4(gx11.z,gy11.z,gz11.z,gw11.z);\nvec4 g1111 = vec4(gx11.w,gy11.w,gz11.w,gw11.w);\nvec4 norm00 = taylorInvSqrt(vec4(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));\ng0000 *= norm00.x;\ng0100 *= norm00.y;\ng1000 *= norm00.z;\ng1100 *= norm00.w;\nvec4 norm01 = taylorInvSqrt(vec4(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));\ng0001 *= norm01.x;\ng0101 *= norm01.y;\ng1001 *= norm01.z;\ng1101 *= norm01.w;\nvec4 norm10 = taylorInvSqrt(vec4(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));\ng0010 *= norm10.x;\ng0110 *= norm10.y;\ng1010 *= norm10.z;\ng1110 *= norm10.w;\nvec4 norm11 = taylorInvSqrt(vec4(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));\ng0011 *= norm11.x;\ng0111 *= norm11.y;\ng1011 *= norm11.z;\ng1111 *= norm11.w;\nfloat n0000 = dot(g0000, Pf0);\nfloat n1000 = dot(g1000, vec4(Pf1.x, Pf0.yzw));\nfloat n0100 = dot(g0100, vec4(Pf0.x, Pf1.y, Pf0.zw));\nfloat n1100 = dot(g1100, vec4(Pf1.xy, Pf0.zw));\nfloat n0010 = dot(g0010, vec4(Pf0.xy, Pf1.z, Pf0.w));\nfloat n1010 = dot(g1010, vec4(Pf1.x, Pf0.y, Pf1.z, Pf0.w));\nfloat n0110 = dot(g0110, vec4(Pf0.x, Pf1.yz, Pf0.w));\nfloat n1110 = dot(g1110, vec4(Pf1.xyz, Pf0.w));\nfloat n0001 = dot(g0001, vec4(Pf0.xyz, Pf1.w));\nfloat n1001 = dot(g1001, vec4(Pf1.x, Pf0.yz, Pf1.w));\nfloat n0101 = dot(g0101, vec4(Pf0.x, Pf1.y, Pf0.z, Pf1.w));\nfloat n1101 = dot(g1101, vec4(Pf1.xy, Pf0.z, Pf1.w));\nfloat n0011 = dot(g0011, vec4(Pf0.xy, Pf1.zw));\nfloat n1011 = dot(g1011, vec4(Pf1.x, Pf0.y, Pf1.zw));\nfloat n0111 = dot(g0111, vec4(Pf0.x, Pf1.yzw));\nfloat n1111 = dot(g1111, Pf1);\nvec4 fade_xyzw = fade(Pf0);\nvec4 n_0w = mix(vec4(n0000, n1000, n0100, n1100), vec4(n0001, n1001, n0101, n1101), fade_xyzw.w);\nvec4 n_1w = mix(vec4(n0010, n1010, n0110, n1110), vec4(n0011, n1011, n0111, n1111), fade_xyzw.w);\nvec4 n_zw = mix(n_0w, n_1w, fade_xyzw.z);\nvec2 n_yzw = mix(n_zw.xy, n_zw.zw, fade_xyzw.y);\nfloat n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);\nreturn 2.2 * n_xyzw;\n}\n${o}\n\nfloat fbm(vec4 x, int numOctaves) {\nfloat v = 0.0;\nfloat a = 0.5;\nvec4 shift = vec4(100);\nfor (int i = 0; i < numOctaves; ++i) {\nv += a * cnoise(x);\nx = x * 2.0 + shift;\na *= 0.5;\n}\nreturn v;\n}\n\n#include <common>\nuniform float time;\nuniform int numSteps;\nuniform int nSides;\nattribute int indexAttr;\nattribute int gradientIndexAttr;\nattribute int gradientIndexAttr2;\nattribute int typeIndex;\nattribute float sIrease;\nattribute float vS;\nattribute float holeThreshold;\nattribute float dB;\nuniform sampler2D posTex;\nuniform sampler2D xDirTex;\nuniform sampler2D yDirTex;\nuniform sampler2D tanTex;\nuniform float mouseRat;\nuniform vec2 canvasSize;\nvarying vec4 vPosition;\nvarying vec4 mvPosition;\nvarying vec3 color;\nvarying float type;\nvarying float indexRat;\nvarying float lengthRad;\nvarying float lengthRadCircular;\nvarying float heightRat;\nvarying float vIndex;\nvarying float gradientIndex;\nvarying float gradientIndex2;\nvarying float animRat;\nvarying float vTypeIndex;\nvarying float vSatIncrease;\nvarying float vHoleThreshold;\nvarying float vDesatBrightness;\nvarying float vValueShift;\n`),g=g.replace("#include <project_vertex>",`\nfloat i = float(indexAttr);\nfloat nX = ${e.toPrecision(5)};\nfloat nY = ${n.toPrecision(5)};\nvTypeIndex = float(typeIndex);\nvSatIncrease = sIrease;\nvHoleThreshold = holeThreshold;\nvDesatBrightness = dB;\nvValueShift = vS;\nfloat y = i + .001;\nint stepIndex = (gl_VertexID / nSides) + 1;\nfloat x = float(stepIndex) + .001;\ngradientIndex = float(gradientIndexAttr);\ngradientIndex2 = float(gradientIndexAttr2);\nindexRat = y / nY;\nfloat yRat = y / nY;\nvec2 uv = vec2(x / nX, yRat);\nvec2 uv2 = vec2(((x + 1.0) / nX), yRat);\nvec4 pos = texture2D(posTex, uv);\nvec4 prevPos = texture2D(posTex, uv2);\nvec4 tan = texture2D(tanTex, uv);\nvec4 xDir = texture2D(xDirTex, uv);\nvec4 yDir = texture2D(yDirTex, uv);\ntype = pos.w;\nvec4 position = vec4( transformed, 1.0 );\nposition = vec4(pos.xyz, 1.0);\nfloat distortFactor = 2.0;\nvec2 distort;\ndistort.x = (1.0 + pow(cnoise(vec4((vec3(position.xy, time * .04) * 0.5) + ${i.random_num(200,400)}, time * .0)), 1.0)) / 2.0;\ndistort.y = (1.0 + pow(cnoise(vec4((vec3(position.xy, time * .04) * 0.5) + ${i.random_num(200,400)}, time * .0)), 1.0)) / 2.0;\nposition.xy *= .7 + (.6 * distort);\nlengthRad = x / nX;\nlengthRadCircular = sin(lengthRad * PI);\nfloat shapePow = 1.0;\nint shapeType = 0;\nvNormal = yDir.xyz;\nfloat offsetMax = .5;\nfloat offset = pow((1.0 + sin(indexRat * 213.3)) / 2.0, 3.0) * offsetMax;\noffset -= pow(1.0 + cnoise(vec4(pos.xy * .8, uv.y, time * .1)) / 2.0, 3.0) * .40;\nanimRat = 1.0 - pow(clamp(.7 - offset - (time * .2), 0.0, 1.0), 3.0);\nfloat noise = cnoise(vec4(position.x * ${$.heightNoiseScale}, position.y * ${$.heightNoiseScale}, time * .03, ${i.random_num(0,1e3).toPrecision(5)}));\nfloat topPos = (1.0 - ${$.heightNoiseAmp}) - .0 + (noise * ${$.heightNoiseAmp});\nfloat bottomPos = -10.0;\nheightRat = 1.0 - (float(gl_VertexID % nSides) / float(nSides));\nif (${H.fadeIn}) topPos -= pow(1.0 - animRat, 2.0) * 3.0;\nposition.z = mix(bottomPos, topPos, heightRat);\nif (typeIndex == 0) position.z -= .35;\nvIndex = y;\nvPosition = position;\nmvPosition = modelViewMatrix * position;\ngl_Position = projectionMatrix * mvPosition;\n`),d=d.replace("#include <common>",`\n#include <common>\nuniform float time;\nuniform vec4 colors[${s.length}];\nuniform float stops[${s.length}];\nuniform float dBes[${c.dB.length}];\nuniform float dRs[${c.dR.length}];\nuniform int numGradients;\nuniform vec2 canvasSize;\nuniform vec3 bgCol;\nuniform float noiseStrength;\nvarying float vIndex;\nvarying vec4 vPosition;\nvarying vec4 mvPosition;\nvarying vec3 color;\nvarying float type;\nvarying float indexRat;\nvarying float lengthRad;\nvarying float lengthRadCircular;\nvarying float animRat;\nvarying float heightRat;\nvarying float gradientIndex;\nvarying float gradientIndex2;\nvarying float vTypeIndex;\nvarying float vSatIncrease;\nvarying float vHoleThreshold;\nvarying float vDesatBrightness;\nvarying float vValueShift;\nfloat roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) \n{\nreturn length(max(abs(CenterPosition)-Size+Radius,0.0))-Radius;\n}\nvec4 gradient(vec4 c1, float s1, vec4 c2, float s2, vec4 c3, float s3, vec4 c4, float s4, float rat)\n{\nvec4 c = mix(c1, c2, smoothstep(s1, s2, rat));\nc = mix(c, c3, smoothstep(s2, s3, rat));\nc = mix(c, c4, smoothstep(s3, s4, rat));\nreturn c;\n}\nvec4 gradient(vec4 c1, float s1, vec4 c2, float s2, vec4 c3, float s3, vec4 c4, float s4, vec4 c5, float s5, float rat)\n{\nvec4 c = mix(c1, c2, smoothstep(s1, s2, rat));\nc = mix(c, c3, smoothstep(s2, s3, rat));\nc = mix(c, c4, smoothstep(s3, s4, rat));\nc = mix(c, c5, smoothstep(s4, s5, rat));\nreturn c;\n}\n${t}\n\nvec3 hsv2rgb(vec3 c)\n{\nvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\nvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\nreturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\n\nvec3 rgb2hsv(vec3 c)\n{\nvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\nvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\nvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\nfloat d = q.x - min(q.w, q.y);\nfloat e = 1.0e-10;\nreturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n\n${o}\n\nfloat hash12(vec2 p)\n{\nvec3 p3 = fract(vec3(p.xyx) * .1031);\np3 += dot(p3, p3.yzx + 33.33);\nreturn fract((p3.x + p3.y) * p3.z);\n}\n\n`);let v=`\nif (sin(vIndex * ${i.random_dec(1.5,4).toPrecision(5)}) > ${i.random_dec(-1,0).toPrecision(5)} && gl_FrontFacing)\n{\ni1 += 1; i2 += 1;\n}`;$.doubleSided||(v="");let f="\nfloat padRatX = 0.03;\nfloat padRatY = 0.03;\nfloat padX = canvasSize.y * padRatX;\nfloat padY = canvasSize.y * padRatY;\nfloat fadeSize = canvasSize.y * 0.06 * 3.0;\nif (