@firecms/neat 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -29
- package/dist/NeatGradient.d.ts +29 -43
- package/dist/NeatGradient.js +394 -897
- package/dist/NeatGradient.js.map +1 -1
- package/dist/index.es.js +778 -715
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +104 -116
- package/dist/index.umd.js.map +1 -1
- package/dist/math.d.ts +26 -0
- package/dist/math.js +148 -0
- package/dist/math.js.map +1 -0
- package/dist/shaders.d.ts +6 -0
- package/dist/shaders.js +407 -0
- package/dist/shaders.js.map +1 -0
- package/dist/types.d.ts +52 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +3 -7
- package/src/NeatGradient.ts +467 -968
- package/src/math.ts +162 -0
- package/src/shaders.ts +411 -0
- package/src/types.ts +54 -0
package/dist/index.umd.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
(function(O,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("three")):typeof define=="function"&&define.amd?define(["exports","three"],B):(O=typeof globalThis<"u"?globalThis:O||self,B(O.FireCMS={},O.THREE))})(this,function(O,B){"use strict";function te(s){if(s&&s.__esModule)return s;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const o in s)if(o!=="default"){const t=Object.getOwnPropertyDescriptor(s,o);Object.defineProperty(e,o,t.get?t:{enumerable:!0,get:()=>s[o]})}}return e.default=s,Object.freeze(e)}const n=te(B),U=50,D=80,oe=!0,L=6,se=new n.Clock,K=ue();class ie{_ref;_speed=-1;_horizontalPressure=-1;_verticalPressure=-1;_waveFrequencyX=-1;_waveFrequencyY=-1;_waveAmplitude=-1;_shadows=-1;_highlights=-1;_saturation=-1;_brightness=-1;_grainScale=-1;_grainIntensity=-1;_grainSparsity=-1;_grainSpeed=-1;_colorBlending=-1;_colors=[];_wireframe=!1;_backgroundColor="#FFFFFF";_backgroundAlpha=1;_flowDistortionA=0;_flowDistortionB=0;_flowScale=1;_flowEase=0;_flowEnabled=!0;_mouseDistortionStrength=0;_mouseDistortionRadius=.25;_mouseDecayRate=.96;_mouseDarken=0;_mouse=new n.Vector2(-1e3,-1e3);_mouseFBO=null;_sceneMouse=null;_cameraMouse=null;_mouseObjects=[];_currentBrush=0;_mouseBrushBaseScale=1;_enableProceduralTexture=!1;_textureVoidLikelihood=.45;_textureVoidWidthMin=200;_textureVoidWidthMax=486;_textureBandDensity=2.15;_textureColorBlending=.01;_textureSeed=333;_textureEase=.5;_proceduralTexture=null;_proceduralBackgroundColor="#000000";_textureShapeTriangles=20;_textureShapeCircles=15;_textureShapeBars=15;_textureShapeSquiggles=10;requestRef=-1;sizeObserver;sceneState;_cachedUniforms=null;_linkElement=null;_yOffset=0;_yOffsetWaveMultiplier=.004;_yOffsetColorMultiplier=.004;_yOffsetFlowMultiplier=.004;_tempClearColor=new n.Color;_resizeTimeoutId=null;_textureNeedsUpdate=!1;_lastColorUpdate=0;_linkCheckCounter=0;_mouseUpdateScheduled=!1;_pendingMousePosition=null;_colorsChanged=!0;constructor(e){const{ref:o,speed:t=4,horizontalPressure:f=3,verticalPressure:c=3,waveFrequencyX:i=5,waveFrequencyY:p=5,waveAmplitude:m=3,colors:d,highlights:v=4,shadows:u=4,colorSaturation:g=0,colorBrightness:T=1,colorBlending:M=5,grainScale:z=2,grainIntensity:y=.55,grainSparsity:E=0,grainSpeed:C=.1,wireframe:a=!1,backgroundColor:l="#FFFFFF",backgroundAlpha:h=1,resolution:_=1,seed:b,yOffset:q=0,yOffsetWaveMultiplier:j=4,yOffsetColorMultiplier:G=4,yOffsetFlowMultiplier:_e=4,flowDistortionA:he=0,flowDistortionB:fe=0,flowScale:de=1,flowEase:pe=0,flowEnabled:ve=!0,mouseDistortionStrength:ge=0,mouseDistortionRadius:me=.25,mouseDecayRate:xe=.96,mouseDarken:ye=0,enableProceduralTexture:we=!1,textureVoidLikelihood:be=.45,textureVoidWidthMin:Se=200,textureVoidWidthMax:ze=486,textureBandDensity:Ce=2.15,textureColorBlending:Me=.01,textureSeed:Pe=333,textureEase:Oe=.5,proceduralBackgroundColor:Te="#000000",textureShapeTriangles:Fe=20,textureShapeCircles:Be=15,textureShapeBars:Ue=15,textureShapeSquiggles:De=10}=e;this._ref=o,this.destroy=this.destroy.bind(this),this._initScene=this._initScene.bind(this),this._buildMaterial=this._buildMaterial.bind(this),this.speed=t,this.horizontalPressure=f,this.verticalPressure=c,this.waveFrequencyX=i,this.waveFrequencyY=p,this.waveAmplitude=m,this.colorBlending=M,this.grainScale=z,this.grainIntensity=y,this.grainSparsity=E,this.grainSpeed=C,this.colors=d,this.shadows=u,this.highlights=v,this.colorSaturation=g,this.colorBrightness=T,this.wireframe=a,this.backgroundColor=l,this.backgroundAlpha=h,this.yOffset=q,this.yOffsetWaveMultiplier=j,this.yOffsetColorMultiplier=G,this.yOffsetFlowMultiplier=_e,this.flowDistortionA=he,this.flowDistortionB=fe,this.flowScale=de,this.flowEase=pe,this.flowEnabled=ve,this.mouseDistortionStrength=ge,this.mouseDistortionRadius=me,this.mouseDecayRate=xe,this.mouseDarken=ye,this.enableProceduralTexture=we,this.textureVoidLikelihood=be,this.textureVoidWidthMin=Se,this.textureVoidWidthMax=ze,this.textureBandDensity=Ce,this.textureColorBlending=Me,this.textureSeed=Pe,this.textureEase=Oe,this._proceduralBackgroundColor=Te,this._textureShapeTriangles=Fe,this._textureShapeCircles=Be,this._textureShapeBars=Ue,this._textureShapeSquiggles=De,this._setupMouseInteraction(),this.sceneState=this._initScene(_);let $=b!==void 0?b:le();const ee=()=>{const{renderer:w,camera:W,scene:F}=this.sceneState;if(this._linkCheckCounter++,this._linkCheckCounter>=300&&(this._linkCheckCounter=0,(!this._linkElement||!document.contains(this._linkElement))&&(this._linkElement=ne(o))),this._cachedUniforms){const r=this._cachedUniforms;$+=se.getDelta()*this._speed,r.u_time.value=$,r.u_resolution.value.set(this._ref.width,this._ref.height),r.u_color_pressure.value.set(this._horizontalPressure,this._verticalPressure),r.u_wave_frequency_x.value=this._waveFrequencyX,r.u_wave_frequency_y.value=this._waveFrequencyY,r.u_wave_amplitude.value=this._waveAmplitude,r.u_color_blending.value=this._colorBlending,r.u_shadows.value=this._shadows,r.u_highlights.value=this._highlights,r.u_saturation.value=this._saturation,r.u_brightness.value=this._brightness,r.u_grain_intensity.value=this._grainIntensity,r.u_grain_sparsity.value=this._grainSparsity,r.u_grain_speed.value=this._grainSpeed,r.u_grain_scale.value=this._grainScale,r.u_y_offset.value=this._yOffset,r.u_y_offset_wave_multiplier.value=this._yOffsetWaveMultiplier,r.u_y_offset_color_multiplier.value=this._yOffsetColorMultiplier,r.u_y_offset_flow_multiplier.value=this._yOffsetFlowMultiplier,r.u_flow_distortion_a.value=this._flowDistortionA,r.u_flow_distortion_b.value=this._flowDistortionB,r.u_flow_scale.value=this._flowScale,r.u_flow_ease.value=this._flowEase,r.u_flow_enabled.value=this._flowEnabled?1:0,r.u_mouse_distortion_strength.value=this._mouseDistortionStrength,r.u_mouse_distortion_radius.value=this._mouseDistortionRadius,r.u_mouse_darken.value=this._mouseDarken,r.u_enable_procedural_texture.value=this._enableProceduralTexture?1:0,this._textureNeedsUpdate&&this._enableProceduralTexture&&(this._proceduralTexture&&this._proceduralTexture.dispose(),this._proceduralTexture=this._createProceduralTexture(),this._textureNeedsUpdate=!1),r.u_procedural_texture.value=this._proceduralTexture,r.u_texture_ease.value=this._textureEase,this.sceneState.meshes[0].material.wireframe=this._wireframe;const x=Date.now();if(this._colorsChanged||x-this._lastColorUpdate>100){this._lastColorUpdate=x,this._colorsChanged=!1;const V=r.u_colors.value;for(let P=0;P<L;P++)if(P<this._colors.length){const X=this._colors[P];V[P].is_active=X.enabled?1:0,V[P].color.setStyle(X.color,""),V[P].influence=X.influence||0}else V[P].is_active=0;r.u_colors_count.value=L}}if(this._mouseFBO&&this._sceneMouse&&this._cameraMouse&&this._mouseDistortionStrength>0){let r=!1;for(let x=0;x<this._mouseObjects.length;x++){const S=this._mouseObjects[x];S.mesh.visible&&(r=!0,S.mesh.rotation.z+=.01,S.mesh.material instanceof n.MeshBasicMaterial&&(S.mesh.material.opacity*=this._mouseDecayRate,S.mesh.material.opacity<.01&&(S.mesh.visible=!1)))}if(r){w.getClearColor(this._tempClearColor);const x=w.getClearAlpha();w.setClearColor(0,0),w.setRenderTarget(this._mouseFBO),w.clear(),w.render(this._sceneMouse,this._cameraMouse),w.setRenderTarget(null),w.setClearColor(this._tempClearColor,x),this._cachedUniforms&&(this._cachedUniforms.u_mouse_texture.value=this._mouseFBO.texture)}}w.setClearColor(this._backgroundColor,this._backgroundAlpha),w.render(F,W),this.requestRef=requestAnimationFrame(ee)},Ee=()=>{const{renderer:w}=this.sceneState,W=w.domElement,F=W.clientWidth,r=W.clientHeight;if(this.sceneState.renderer.setSize(F,r,!1),H(this.sceneState.camera,F,r),this._mouseFBO&&this._cameraMouse){const x=r/2,S=F/r;this._mouseFBO.setSize(F/2,r/2),this._cameraMouse.left=-x*S,this._cameraMouse.right=x*S,this._cameraMouse.top=x,this._cameraMouse.bottom=-x,this._cameraMouse.updateProjectionMatrix()}};this.sizeObserver=new ResizeObserver(()=>{this._resizeTimeoutId!==null&&clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(()=>{Ee(),this._resizeTimeoutId=null},100)}),this.sizeObserver.observe(o),ee()}destroy(){this&&(cancelAnimationFrame(this.requestRef),this.sizeObserver.disconnect(),this._resizeTimeoutId!==null&&(clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=null),this.sceneState&&(this.sceneState.renderer.dispose(),this.sceneState.meshes.forEach(e=>{e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(o=>o.dispose()):e.material.dispose()})),this._mouseFBO&&this._mouseFBO.dispose(),this._proceduralTexture&&this._proceduralTexture.dispose())}downloadAsPNG(e="neat.png"){console.log("Downloading as PNG",this._ref);const o=this._ref.toDataURL("image/png");console.log("data",o),ce(o,e)}set speed(e){this._speed=e/20}set horizontalPressure(e){this._horizontalPressure=e/4}set verticalPressure(e){this._verticalPressure=e/4}set waveFrequencyX(e){this._waveFrequencyX=e*.04}set waveFrequencyY(e){this._waveFrequencyY=e*.04}set waveAmplitude(e){this._waveAmplitude=e*.75}set colors(e){this._colors=e,this._colorsChanged=!0}set highlights(e){this._highlights=e/100}set shadows(e){this._shadows=e/100}set colorSaturation(e){this._saturation=e/10}set colorBrightness(e){this._brightness=e}set colorBlending(e){this._colorBlending=e/10}set grainScale(e){this._grainScale=e==0?1:e}set grainIntensity(e){this._grainIntensity=e}set grainSparsity(e){this._grainSparsity=e}set grainSpeed(e){this._grainSpeed=e}set wireframe(e){this._wireframe=e}set resolution(e){this.sceneState=this._initScene(e)}set backgroundColor(e){this._backgroundColor=e}set backgroundAlpha(e){this._backgroundAlpha=e}set yOffset(e){this._yOffset=e}get yOffsetWaveMultiplier(){return this._yOffsetWaveMultiplier*1e3}set yOffsetWaveMultiplier(e){this._yOffsetWaveMultiplier=e/1e3}get yOffsetColorMultiplier(){return this._yOffsetColorMultiplier*1e3}set yOffsetColorMultiplier(e){this._yOffsetColorMultiplier=e/1e3}get yOffsetFlowMultiplier(){return this._yOffsetFlowMultiplier*1e3}set yOffsetFlowMultiplier(e){this._yOffsetFlowMultiplier=e/1e3}set flowDistortionA(e){this._flowDistortionA=e}set flowDistortionB(e){this._flowDistortionB=e}set flowScale(e){this._flowScale=e}set flowEase(e){this._flowEase=e}set flowEnabled(e){this._flowEnabled=e}get flowEnabled(){return this._flowEnabled}set mouseDistortionStrength(e){this._mouseDistortionStrength=Math.max(0,e)}set mouseDistortionRadius(e){this._mouseDistortionRadius=Math.max(.01,Math.min(e,1)),this._updateBrushScale()}_updateBrushScale(){!this._mouseObjects||this._mouseObjects.length===0||(this._mouseBrushBaseScale=this._mouseDistortionRadius)}set mouseDecayRate(e){this._mouseDecayRate=Math.max(.9,Math.min(e,.99))}set mouseDarken(e){this._mouseDarken=e}set enableProceduralTexture(e){this._enableProceduralTexture=e,e&&!this._proceduralTexture&&(this._textureNeedsUpdate=!0)}set textureVoidLikelihood(e){this._textureVoidLikelihood=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureVoidWidthMin(e){this._textureVoidWidthMin=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureVoidWidthMax(e){this._textureVoidWidthMax=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureBandDensity(e){this._textureBandDensity=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureColorBlending(e){this._textureColorBlending=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureSeed(e){this._textureSeed=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureEase(){return this._textureEase}set textureEase(e){this._textureEase=e}set proceduralBackgroundColor(e){this._proceduralBackgroundColor=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeTriangles(e){this._textureShapeTriangles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeCircles(e){this._textureShapeCircles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeBars(e){this._textureShapeBars=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeSquiggles(e){this._textureShapeSquiggles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}_initScene(e){const o=this._ref.width,t=this._ref.height;this.sceneState&&this.sceneState.renderer&&(this.sceneState.renderer.dispose(),this.sceneState.meshes.forEach(u=>{u.geometry.dispose(),Array.isArray(u.material)?u.material.forEach(g=>g.dispose()):u.material.dispose()}));const f=new n.WebGLRenderer({alpha:!0,preserveDrawingBuffer:!0,canvas:this._ref});f.setClearColor(16711680,.5),f.setSize(o,t,!1);const c=[],i=new n.Scene,p=this._buildMaterial(o,t),m=new n.PlaneGeometry(U,D,240*e,240*e),d=new n.Mesh(m,p);d.rotation.x=-Math.PI/3.5,d.position.z=-1,c.push(d),i.add(d);const v=new n.OrthographicCamera(0,0,0,0,0,0);return v.position.z=5,H(v,o,t),{renderer:f,camera:v,scene:i,meshes:c,resolution:e}}_buildMaterial(e,o){const t=Array.from({length:L}).map((i,p)=>({is_active:p<this._colors.length&&this._colors[p].enabled?1:0,color:new n.Color(p<this._colors.length?this._colors[p].color:0),influence:p<this._colors.length&&this._colors[p].influence||0})),f={u_time:{value:0},u_color_pressure:{value:new n.Vector2(this._horizontalPressure,this._verticalPressure)},u_wave_frequency_x:{value:this._waveFrequencyX},u_wave_frequency_y:{value:this._waveFrequencyY},u_wave_amplitude:{value:this._waveAmplitude},u_resolution:{value:new n.Vector2(e,o)},u_colors:{value:t},u_colors_count:{value:this._colors.length},u_plane_width:{value:U},u_plane_height:{value:D},u_shadows:{value:this._shadows},u_highlights:{value:this._highlights},u_grain_intensity:{value:this._grainIntensity},u_grain_sparsity:{value:this._grainSparsity},u_grain_scale:{value:this._grainScale},u_grain_speed:{value:this._grainSpeed},u_flow_distortion_a:{value:this._flowDistortionA},u_flow_distortion_b:{value:this._flowDistortionB},u_flow_scale:{value:this._flowScale},u_flow_ease:{value:this._flowEase},u_flow_enabled:{value:this._flowEnabled?1:0},u_y_offset:{value:this._yOffset},u_y_offset_wave_multiplier:{value:this._yOffsetWaveMultiplier},u_y_offset_color_multiplier:{value:this._yOffsetColorMultiplier},u_y_offset_flow_multiplier:{value:this._yOffsetFlowMultiplier},u_mouse_distortion_strength:{value:this._mouseDistortionStrength},u_mouse_distortion_radius:{value:this._mouseDistortionRadius},u_mouse_darken:{value:this._mouseDarken},u_mouse_texture:{value:this._mouseFBO?this._mouseFBO.texture:null},u_procedural_texture:{value:this._proceduralTexture},u_enable_procedural_texture:{value:this._enableProceduralTexture?1:0},u_texture_ease:{value:this._textureEase},u_saturation:{value:this._saturation},u_brightness:{value:this._brightness},u_color_blending:{value:this._colorBlending}},c=new n.ShaderMaterial({uniforms:f,vertexShader:Y()+Z()+J()+re(),fragmentShader:Y()+J()+Z()+ae()});return this._cachedUniforms=f,c.wireframe=oe,c}_setupMouseInteraction(){if(!this._ref)return;const e=this._ref.width,o=this._ref.height;this._mouseFBO=new n.WebGLRenderTarget(e/2,o/2),this._sceneMouse=new n.Scene;const t=o/2,f=e/o;this._cameraMouse=new n.OrthographicCamera(-t*f,t*f,t,-t,0,1e4),this._cameraMouse.position.set(0,0,100);const c=document.createElement("canvas");c.width=128,c.height=128;const i=c.getContext("2d");if(i){const u=i.createRadialGradient(64,64,0,64,64,64);u.addColorStop(0,"rgba(255,255,255,0.8)"),u.addColorStop(.5,"rgba(255,255,255,0.4)"),u.addColorStop(1,"rgba(255,255,255,0)"),i.fillStyle=u,i.fillRect(0,0,128,128)}const p=new n.CanvasTexture(c),m=new n.MeshBasicMaterial({map:p,transparent:!0,opacity:1,depthTest:!1,blending:n.AdditiveBlending}),d=new n.PlaneGeometry(200,200),v=50;for(let u=0;u<v;u++){const g=new n.Mesh(d,m.clone());g.visible=!1,this._sceneMouse.add(g),this._mouseObjects.push({mesh:g,active:!1})}this._updateBrushScale(),this._ref.addEventListener("mousemove",this._onMouseMove.bind(this))}_onMouseMove(e){if(!this._ref||!this._sceneMouse)return;const o=this._ref.getBoundingClientRect(),t=this._ref.width,f=this._ref.height;this._pendingMousePosition={x:e.clientX-o.left-t/2,y:-(e.clientY-o.top-f/2)},this._mouseUpdateScheduled||(this._mouseUpdateScheduled=!0,requestAnimationFrame(()=>{if(this._mouseUpdateScheduled=!1,!this._pendingMousePosition)return;this._mouse.x=this._pendingMousePosition.x,this._mouse.y=this._pendingMousePosition.y;const c=this._mouseObjects[this._currentBrush];c.mesh.scale.set(this._mouseBrushBaseScale,this._mouseBrushBaseScale,1),c.active=!0,c.mesh.visible=!0,c.mesh.position.set(this._mouse.x,this._mouse.y,0),c.mesh.rotation.z=Math.random()*Math.PI*2,c.mesh.material instanceof n.MeshBasicMaterial&&(c.mesh.material.opacity=1),this._currentBrush=(this._currentBrush+1)%this._mouseObjects.length,this._pendingMousePosition=null}))}_createProceduralTexture(){const o=document.createElement("canvas");o.width=1024,o.height=1024;const t=o.getContext("2d",{willReadFrequently:!0});if(!t)return new n.Texture;let f=this._textureSeed;const c=this._textureSeed;function i(){const a=Math.sin(f++)*1e4;return a-Math.floor(a)}const p=a=>{f=c+a},m=this._colors.filter(a=>a.enabled).map(a=>a.color);if(m.length===0)return new n.Texture;function d(a){const l=parseInt(a.replace("#",""),16);return{r:l>>16&255,g:l>>8&255,b:l&255}}function v(a,l,h){return"#"+((1<<24)+(Math.round(a)<<16)+(Math.round(l)<<8)+Math.round(h)).toString(16).slice(1)}const u=()=>{const a=m[Math.floor(i()*m.length)],l=m[Math.floor(i()*m.length)],h=i()*this._textureColorBlending,_=d(a),b=d(l),q=_.r+(b.r-_.r)*h,j=_.g+(b.g-_.g)*h,G=_.b+(b.b-_.b)*h;return v(q,j,G)},g=this._proceduralBackgroundColor||"#000000";t.fillStyle=g,t.fillRect(0,0,1024,1024);const T=t.createLinearGradient(0,0,0,1024);T.addColorStop(0,u()),T.addColorStop(1,u()),t.fillStyle=T,t.fillRect(0,0,1024,1024);for(let a=0;a<this._textureShapeTriangles;a++){t.fillStyle=u(),t.beginPath();const l=i()*1024,h=i()*1024,_=100+i()*300;t.moveTo(l,h),t.lineTo(l+(i()-.5)*_,h+(i()-.5)*_),t.lineTo(l+(i()-.5)*_,h+(i()-.5)*_),t.fill()}for(let a=0;a<this._textureShapeCircles;a++){t.strokeStyle=u(),t.lineWidth=10+i()*50,t.beginPath();const l=i()*1024,h=i()*1024,_=50+i()*150;t.arc(l,h,_,0,Math.PI*2),t.stroke()}for(let a=0;a<this._textureShapeBars;a++)t.fillStyle=u(),t.save(),t.translate(i()*1024,i()*1024),t.rotate(i()*Math.PI),t.fillRect(-150,-25,300,50),t.restore();t.lineWidth=15,t.lineCap="round";for(let a=0;a<this._textureShapeSquiggles;a++){t.strokeStyle=u(),t.beginPath();let l=i()*1024,h=i()*1024;t.moveTo(l,h);for(let _=0;_<4;_++)t.bezierCurveTo(l+(i()-.5)*300,h+(i()-.5)*300,l+(i()-.5)*300,h+(i()-.5)*300,l+(i()-.5)*300,h+(i()-.5)*300),l+=(i()-.5)*300,h+=(i()-.5)*300;t.stroke()}p(5e4);const M=document.createElement("canvas");M.width=1024,M.height=1024;const z=M.getContext("2d",{willReadFrequently:!0});if(!z)return new n.Texture;z.fillStyle=g,z.fillRect(0,0,1024,1024);let y=0;const E=[];for(;y<1024;)if(i()<this._textureVoidLikelihood){const l=this._textureVoidWidthMin+i()*(this._textureVoidWidthMax-this._textureVoidWidthMin);E.push({type:"void",x:y,width:l}),y+=l}else{const l=50+i()*200;E.push({type:"matter",x:y,width:l}),y+=l}for(const a of E)if(a.type==="matter"){const l=a.x,h=Math.min(a.x+a.width,1024);let _=l;for(;_<h;){const b=(2+i()*20)/this._textureBandDensity,q=Math.floor(i()*1024);z.drawImage(o,q,0,b,1024,_,0,b,1024),_+=b}}const C=new n.CanvasTexture(M);return C.minFilter=n.LinearMipmapLinearFilter,C.magFilter=n.LinearFilter,C.wrapS=n.RepeatWrapping,C.wrapT=n.RepeatWrapping,C.anisotropy=16,C.needsUpdate=!0,C}}function H(s,e,o){const c=e*o/1e6*U*D/1.5,i=e/o,p=Math.sqrt(c*i),m=c/p;let d=-U/2,v=Math.min((d+p)/1.5,U/2),u=D/4,g=Math.max((u-m)/2,-D/4);if(i<1){const z=i;d=d*z,v=v*z;const y=1.05;d=d*y,v=v*y,u=u*y,g=g*y}const T=-100,M=1e3;s instanceof n.OrthographicCamera?(s.left=d,s.right=v,s.top=u,s.bottom=g,s.near=T,s.far=M,s.updateProjectionMatrix()):s instanceof n.PerspectiveCamera&&(s.aspect=e/o,s.updateProjectionMatrix())}let R=null,k=null;function re(){return R||(R=`
|
|
2
|
-
void main() {
|
|
1
|
+
(function(F,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(F=typeof globalThis<"u"?globalThis:F||self,M(F.neat={}))})(this,function(F){"use strict";const M=`void main() {
|
|
3
2
|
vUv = uv;
|
|
4
3
|
|
|
5
4
|
// SCROLLING LOGIC
|
|
@@ -35,13 +34,14 @@ void main() {
|
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
// Pass the standard flow UV to fragment shader (for
|
|
37
|
+
// Pass the standard flow UV to fragment shader (for texture)
|
|
39
38
|
vFlowUv = flowUv;
|
|
40
39
|
|
|
41
40
|
// 3. COLOR MIXING
|
|
42
41
|
// We take the computed flow UVs and apply the color offset
|
|
43
42
|
// Scale by plane height to match wave offset speed (world space vs UV space)
|
|
44
43
|
vec3 color = u_colors[0].color;
|
|
44
|
+
// ...
|
|
45
45
|
vec2 adjustedUv = flowUv;
|
|
46
46
|
adjustedUv.y += colorOffset / u_plane_height; // Scroll the color mixing pattern
|
|
47
47
|
|
|
@@ -49,22 +49,24 @@ void main() {
|
|
|
49
49
|
const float minNoise = .0;
|
|
50
50
|
const float maxNoise = .9;
|
|
51
51
|
|
|
52
|
-
for (int i = 1; i <
|
|
53
|
-
if(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
for (int i = 1; i < 6; i++) {
|
|
53
|
+
if (i < u_colors_count) {
|
|
54
|
+
if (u_colors[i].is_active > 0.5) {
|
|
55
|
+
float noiseFlow = (1. + float(i)) / 30.;
|
|
56
|
+
float noiseSpeed = (1. + float(i)) * 0.11;
|
|
57
|
+
float noiseSeed = 13. + float(i) * 7.;
|
|
58
|
+
|
|
59
|
+
float noise = snoise(
|
|
60
|
+
vec3(
|
|
61
|
+
noise_cord.x * u_color_pressure.x + u_time * noiseFlow * 2.,
|
|
62
|
+
noise_cord.y * u_color_pressure.y,
|
|
63
|
+
u_time * noiseSpeed
|
|
64
|
+
) + noiseSeed
|
|
65
|
+
) - (.1 * float(i)) + (.5 * u_color_blending);
|
|
66
|
+
|
|
67
|
+
noise = clamp(noise, minNoise, maxNoise + float(i) * 0.02);
|
|
68
|
+
color = mix(color, u_colors[i].color, smoothstep(0.0, u_color_blending, noise));
|
|
69
|
+
}
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
@@ -75,8 +77,7 @@ void main() {
|
|
|
75
77
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
|
|
76
78
|
v_new_position = gl_Position;
|
|
77
79
|
}
|
|
78
|
-
`,
|
|
79
|
-
float random(vec2 p) {
|
|
80
|
+
`,te=`float random(vec2 p) {
|
|
80
81
|
return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);
|
|
81
82
|
}
|
|
82
83
|
|
|
@@ -93,20 +94,8 @@ float fbm(vec3 x) {
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
void main() {
|
|
96
|
-
// MOUSE DISTORTION
|
|
97
97
|
vec2 finalUv = vFlowUv;
|
|
98
98
|
|
|
99
|
-
if (u_mouse_distortion_strength > 0.0) {
|
|
100
|
-
vec4 mouseColor = texture2D(u_mouse_texture, vUv);
|
|
101
|
-
float mouseValue = mouseColor.r;
|
|
102
|
-
|
|
103
|
-
if (mouseValue > 0.001) {
|
|
104
|
-
float distortionAmount = mouseValue * u_mouse_distortion_strength;
|
|
105
|
-
vec2 mouseDisp = vec2(distortionAmount, distortionAmount);
|
|
106
|
-
finalUv -= mouseDisp;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
99
|
vec3 baseColor;
|
|
111
100
|
|
|
112
101
|
if (u_enable_procedural_texture > 0.5) {
|
|
@@ -139,58 +128,67 @@ void main() {
|
|
|
139
128
|
vec3 color = baseColor;
|
|
140
129
|
|
|
141
130
|
// Post-processing
|
|
142
|
-
color +=
|
|
143
|
-
|
|
131
|
+
color += v_displacement_amount * u_highlights;
|
|
132
|
+
// Replace pow() with direct multiplication to avoid negative base undefined behavior in GLSL
|
|
133
|
+
float shadowFactor = 1.0 - v_displacement_amount;
|
|
134
|
+
color -= shadowFactor * shadowFactor * u_shadows;
|
|
144
135
|
color = saturation(color, 1.0 + u_saturation);
|
|
145
136
|
color = color * u_brightness;
|
|
146
137
|
|
|
147
138
|
// Grain
|
|
148
139
|
vec2 noiseCoords = gl_FragCoord.xy / u_grain_scale;
|
|
149
|
-
float grain =
|
|
140
|
+
float grain = 0.0;
|
|
141
|
+
|
|
142
|
+
// Completely bypass expensive noise generation if grain is disabled
|
|
143
|
+
if (u_grain_intensity > 0.0) {
|
|
144
|
+
if (u_grain_speed != 0.0) {
|
|
145
|
+
grain = fbm(vec3(noiseCoords, u_time * u_grain_speed));
|
|
146
|
+
} else {
|
|
147
|
+
grain = fbm(vec3(noiseCoords, 0.0));
|
|
148
|
+
}
|
|
150
149
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
grain = grain * 0.5 + 0.5;
|
|
151
|
+
grain -= 0.5;
|
|
152
|
+
grain = (grain > u_grain_sparsity) ? grain : 0.0;
|
|
153
|
+
grain *= u_grain_intensity;
|
|
154
|
+
}
|
|
155
155
|
|
|
156
156
|
color += vec3(grain);
|
|
157
157
|
|
|
158
158
|
gl_FragColor = vec4(color, 1.0);
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
precision highp float;
|
|
160
|
+
`;function ie(){return`precision highp float;
|
|
162
161
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
float value;
|
|
167
|
-
};
|
|
162
|
+
attribute vec3 position;
|
|
163
|
+
attribute vec3 normal;
|
|
164
|
+
attribute vec2 uv;
|
|
168
165
|
|
|
169
|
-
uniform
|
|
170
|
-
uniform
|
|
171
|
-
uniform float u_grain_scale;
|
|
172
|
-
uniform float u_grain_speed;
|
|
173
|
-
uniform float u_time;
|
|
166
|
+
uniform mat4 modelViewMatrix;
|
|
167
|
+
uniform mat4 projectionMatrix;
|
|
174
168
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
169
|
+
varying vec2 vUv;
|
|
170
|
+
varying vec2 vFlowUv;
|
|
171
|
+
varying vec4 v_new_position;
|
|
172
|
+
varying vec3 v_color;
|
|
173
|
+
varying float v_displacement_amount;
|
|
178
174
|
|
|
175
|
+
uniform float u_time;
|
|
176
|
+
uniform vec2 u_resolution;
|
|
179
177
|
uniform vec2 u_color_pressure;
|
|
180
|
-
|
|
178
|
+
uniform float u_wave_frequency_x;
|
|
179
|
+
uniform float u_wave_frequency_y;
|
|
180
|
+
uniform float u_wave_amplitude;
|
|
181
181
|
uniform float u_plane_width;
|
|
182
182
|
uniform float u_plane_height;
|
|
183
|
-
|
|
184
|
-
uniform float u_shadows;
|
|
185
|
-
uniform float u_highlights;
|
|
186
|
-
uniform float u_saturation;
|
|
187
|
-
uniform float u_brightness;
|
|
188
|
-
|
|
189
183
|
uniform float u_color_blending;
|
|
190
184
|
|
|
191
185
|
uniform int u_colors_count;
|
|
192
|
-
|
|
193
|
-
|
|
186
|
+
struct ColorStop {
|
|
187
|
+
float is_active;
|
|
188
|
+
vec3 color;
|
|
189
|
+
float influence;
|
|
190
|
+
};
|
|
191
|
+
uniform ColorStop u_colors[6];
|
|
194
192
|
|
|
195
193
|
uniform float u_y_offset;
|
|
196
194
|
uniform float u_y_offset_wave_multiplier;
|
|
@@ -203,26 +201,38 @@ uniform float u_flow_distortion_b;
|
|
|
203
201
|
uniform float u_flow_scale;
|
|
204
202
|
uniform float u_flow_ease;
|
|
205
203
|
uniform float u_flow_enabled;
|
|
206
|
-
|
|
207
|
-
// Mouse interaction uniforms
|
|
208
|
-
uniform float u_mouse_distortion_strength;
|
|
209
|
-
uniform float u_mouse_distortion_radius;
|
|
210
|
-
uniform float u_mouse_darken;
|
|
211
|
-
uniform sampler2D u_mouse_texture;
|
|
212
|
-
|
|
213
|
-
// Procedural texture uniforms
|
|
214
|
-
uniform sampler2D u_procedural_texture;
|
|
215
|
-
uniform float u_enable_procedural_texture;
|
|
216
|
-
uniform float u_texture_ease;
|
|
204
|
+
`}function re(){return`precision highp float;
|
|
217
205
|
|
|
218
206
|
varying vec2 vUv;
|
|
219
207
|
varying vec2 vFlowUv;
|
|
220
|
-
varying vec4 v_new_position;
|
|
221
208
|
varying vec3 v_color;
|
|
222
209
|
varying float v_displacement_amount;
|
|
223
210
|
|
|
224
|
-
|
|
211
|
+
uniform float u_time;
|
|
212
|
+
uniform float u_plane_height;
|
|
213
|
+
|
|
214
|
+
uniform float u_shadows;
|
|
215
|
+
uniform float u_highlights;
|
|
216
|
+
uniform float u_saturation;
|
|
217
|
+
uniform float u_brightness;
|
|
218
|
+
uniform float u_grain_intensity;
|
|
219
|
+
uniform float u_grain_sparsity;
|
|
220
|
+
uniform float u_grain_scale;
|
|
221
|
+
uniform float u_grain_speed;
|
|
222
|
+
|
|
223
|
+
uniform float u_y_offset;
|
|
224
|
+
uniform float u_y_offset_color_multiplier;
|
|
225
|
+
|
|
226
|
+
// Flow field uniforms
|
|
227
|
+
uniform float u_flow_distortion_a;
|
|
228
|
+
uniform float u_flow_distortion_b;
|
|
229
|
+
uniform float u_flow_scale;
|
|
225
230
|
|
|
231
|
+
// Procedural texture uniforms
|
|
232
|
+
uniform sampler2D u_procedural_texture;
|
|
233
|
+
uniform float u_enable_procedural_texture;
|
|
234
|
+
uniform float u_texture_ease;
|
|
235
|
+
`}function q(){return`
|
|
226
236
|
// 1. REPLACEMENT PERMUTE:
|
|
227
237
|
// Uses a hash function (fract/sin) instead of a modular lookup table.
|
|
228
238
|
vec4 permute(vec4 x) {
|
|
@@ -374,48 +384,26 @@ float cnoise(vec3 P)
|
|
|
374
384
|
float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
|
|
375
385
|
return 2.2 * n_xyz;
|
|
376
386
|
}
|
|
377
|
-
|
|
378
|
-
|
|
387
|
+
`}function V(){return`
|
|
379
388
|
vec3 saturation(vec3 rgb, float adjustment) {
|
|
380
389
|
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
|
381
390
|
vec3 intensity = vec3(dot(rgb, W));
|
|
382
391
|
return mix(intensity, rgb, adjustment);
|
|
383
392
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
return (max - min) / max;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
vec3 rgb2hsv(vec3 c)
|
|
404
|
-
{
|
|
405
|
-
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
406
|
-
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
407
|
-
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
408
|
-
|
|
409
|
-
float d = q.x - min(q.w, q.y);
|
|
410
|
-
float e = 1.0e-10;
|
|
411
|
-
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
vec3 hsv2rgb(vec3 c)
|
|
415
|
-
{
|
|
416
|
-
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
417
|
-
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
418
|
-
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
419
|
-
}
|
|
420
|
-
`,N),Q=s=>{s.id=K,s.href="https://neat.firecms.co",s.target="_blank",s.style.position="absolute",s.style.display="block",s.style.bottom="0",s.style.right="0",s.style.padding="10px",s.style.color="#dcdcdc",s.style.opacity="0.8",s.style.fontFamily="sans-serif",s.style.fontSize="16px",s.style.fontWeight="bold",s.style.textDecoration="none",s.style.zIndex="10000",s.innerHTML="NEAT"},ne=s=>{const e=s.parentElement?.getElementsByTagName("a");if(e){for(let t=0;t<e.length;t++)if(e[t].id===K)return Q(e[t]),e[t]}const o=document.createElement("a");return Q(o),s.parentElement?.appendChild(o),o};function le(){const s=new Date,e=s.getMinutes(),o=s.getSeconds();return e*60+o}function ue(s=6){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let o="";for(let t=0;t<s;t++){const f=Math.floor(Math.random()*e.length);o+=e.charAt(f)}return o}function ce(s,e){const o=document.createElement("a");o.download=e,o.href=s,document.body.appendChild(o),o.click(),document.body.removeChild(o)}O.NeatGradient=ie,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
393
|
+
`}class G{elements;constructor(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}translate(e,i,o){return this.elements[12]+=this.elements[0]*e+this.elements[4]*i+this.elements[8]*o,this.elements[13]+=this.elements[1]*e+this.elements[5]*i+this.elements[9]*o,this.elements[14]+=this.elements[2]*e+this.elements[6]*i+this.elements[10]*o,this.elements[15]+=this.elements[3]*e+this.elements[7]*i+this.elements[11]*o,this}rotateX(e){const i=Math.cos(e),o=Math.sin(e),t=this.elements[4],b=this.elements[5],y=this.elements[6],n=this.elements[7],p=this.elements[8],v=this.elements[9],T=this.elements[10],x=this.elements[11];return this.elements[4]=i*t+o*p,this.elements[5]=i*b+o*v,this.elements[6]=i*y+o*T,this.elements[7]=i*n+o*x,this.elements[8]=i*p-o*t,this.elements[9]=i*v-o*b,this.elements[10]=i*T-o*y,this.elements[11]=i*x-o*n,this}}class oe{left;right;top;bottom;near;far;position;projectionMatrix;constructor(e,i,o,t,b,y){this.left=e,this.right=i,this.top=o,this.bottom=t,this.near=b,this.far=y,this.position=[0,0,0],this.projectionMatrix=new G,this.updateProjectionMatrix()}updateProjectionMatrix(){const e=1/(this.right-this.left),i=1/(this.top-this.bottom),o=1/(this.far-this.near),t=(this.right+this.left)*e,b=(this.top+this.bottom)*i,y=(this.far+this.near)*o;this.projectionMatrix.elements=new Float32Array([2*e,0,0,0,0,2*i,0,0,0,0,-2*o,0,-t,-b,-y,1])}}function j(a,e,i,o=50,t=50){const n=e*i/1e6*o*t/1.5,p=e/i,v=Math.sqrt(n*p),T=n/v;let x=-o/2,h=Math.min((x+v)/1.5,o/2),w=t/4,R=Math.max((w-T)/2,-t/4);if(p<1){const E=p;x=x*E,h=h*E;const g=1.05;x=x*g,h=h*g,w=w*g,R=R*g}a.left=x,a.right=h,a.top=w,a.bottom=R,a.near=-100,a.far=1e3,a.updateProjectionMatrix()}function se(a,e,i,o){const t=a/2,b=e/2,y=Math.floor(i),n=Math.floor(o),p=y+1,v=n+1,T=a/y,x=e/n,h=[],w=[],R=[],E=[];for(let c=0;c<v;c++){const l=c*x-b;for(let m=0;m<p;m++){const s=m*T-t;w.push(s,-l,0),R.push(0,0,1),E.push(m/y),E.push(1-c/n)}}for(let c=0;c<n;c++)for(let l=0;l<y;l++){const m=l+p*c,s=l+p*(c+1),f=l+1+p*(c+1),_=l+1+p*c;h.push(m,s,_),h.push(s,f,_)}const g=w.length/3>65535,A=[];for(let c=0;c<h.length;c+=3){const l=h[c],m=h[c+1],s=h[c+2];A.push(l,m,m,s,s,l)}return{position:new Float32Array(w),normal:new Float32Array(R),uv:new Float32Array(E),index:g?new Uint32Array(h):new Uint16Array(h),wireframeIndex:g?new Uint32Array(A):new Uint16Array(A)}}console.info(`%c\u{1F308} Neat Gradients%c
|
|
394
|
+
|
|
395
|
+
Licensed under MIT + The Commons Clause.
|
|
396
|
+
Free for personal and commercial use.
|
|
397
|
+
Selling this software or its derivatives is strictly prohibited.
|
|
398
|
+
https://neat.firecms.co`,"font-weight: bold; font-size: 14px; color: #FF5772;","color: inherit;");const Y=50,H=80,O=6,ne=fe();class ae{_ref;_speed=-1;_horizontalPressure=-1;_verticalPressure=-1;_waveFrequencyX=-1;_waveFrequencyY=-1;_waveAmplitude=-1;_shadows=-1;_highlights=-1;_saturation=-1;_brightness=-1;_grainScale=-1;_grainIntensity=-1;_grainSparsity=-1;_grainSpeed=-1;_colorBlending=-1;_colors=[];_wireframe=!1;_backgroundColor="#FFFFFF";_backgroundColorRgb=[1,1,1];_backgroundAlpha=1;_flowDistortionA=0;_flowDistortionB=0;_flowScale=1;_flowEase=0;_flowEnabled=!0;glState;_enableProceduralTexture=!1;_textureVoidLikelihood=.45;_textureVoidWidthMin=200;_textureVoidWidthMax=486;_textureBandDensity=2.15;_textureColorBlending=.01;_textureSeed=333;_textureEase=.5;_proceduralTexture=null;_proceduralBackgroundColor="#000000";_textureShapeTriangles=20;_textureShapeCircles=15;_textureShapeBars=15;_textureShapeSquiggles=10;requestRef=-1;sizeObserver;_initialized=!1;_linkElement=null;_cachedColorRgb=[];_yOffset=0;_yOffsetWaveMultiplier=.004;_yOffsetColorMultiplier=.004;_yOffsetFlowMultiplier=.004;_resizeTimeoutId=null;_textureNeedsUpdate=!1;_linkCheckCounter=0;_colorsChanged=!0;_uniformsDirty=!0;_textureDirty=!0;constructor(e){const{ref:i,speed:o=4,horizontalPressure:t=3,verticalPressure:b=3,waveFrequencyX:y=5,waveFrequencyY:n=5,waveAmplitude:p=3,colors:v,highlights:T=4,shadows:x=4,colorSaturation:h=0,colorBrightness:w=1,colorBlending:R=5,grainScale:E=2,grainIntensity:g=.55,grainSparsity:A=0,grainSpeed:c=.1,wireframe:l=!1,backgroundColor:m="#FFFFFF",backgroundAlpha:s=1,resolution:f=1,seed:_,yOffset:d=0,yOffsetWaveMultiplier:P=4,yOffsetColorMultiplier:C=4,yOffsetFlowMultiplier:U=4,flowDistortionA:B=0,flowDistortionB:k=0,flowScale:X=1,flowEase:D=0,flowEnabled:S=!0,enableProceduralTexture:I=!1,textureVoidLikelihood:he=.45,textureVoidWidthMin:de=200,textureVoidWidthMax:me=486,textureBandDensity:pe=2.15,textureColorBlending:ge=.01,textureSeed:xe=333,textureEase:ye=.5,proceduralBackgroundColor:ve="#000000",textureShapeTriangles:we=20,textureShapeCircles:Se=15,textureShapeBars:be=15,textureShapeSquiggles:Ee=10}=e;this._ref=i,this.destroy=this.destroy.bind(this),this._initScene=this._initScene.bind(this),this.speed=o,this.horizontalPressure=t,this.verticalPressure=b,this.waveFrequencyX=y,this.waveFrequencyY=n,this.waveAmplitude=p,this.colorBlending=R,this.grainScale=E,this.grainIntensity=g,this.grainSparsity=A,this.grainSpeed=c,this.colors=v,this.shadows=x,this.highlights=T,this.colorSaturation=h,this.colorBrightness=w,this.wireframe=l,this.backgroundColor=m,this.backgroundAlpha=s,this.yOffset=d,this.yOffsetWaveMultiplier=P,this.yOffsetColorMultiplier=C,this.yOffsetFlowMultiplier=U,this.flowDistortionA=B,this.flowDistortionB=k,this.flowScale=X,this.flowEase=D,this.flowEnabled=S,this.enableProceduralTexture=I,this.textureVoidLikelihood=he,this.textureVoidWidthMin=de,this.textureVoidWidthMax=me,this.textureBandDensity=pe,this.textureColorBlending=ge,this.textureSeed=xe,this.textureEase=ye,this._proceduralBackgroundColor=ve,this._textureShapeTriangles=we,this._textureShapeCircles=Se,this._textureShapeBars=be,this._textureShapeSquiggles=Ee,this.glState=this._initScene(f),_e();let K=_!==void 0?_:ue(),Z=performance.now();const J=()=>{const{gl:r,program:N,locations:u,indexCount:L,indexType:W}=this.glState;if(this._linkCheckCounter++,this._linkCheckCounter>=300&&(this._linkCheckCounter=0,(!this._linkElement||!document.contains(this._linkElement))&&(this._linkElement=le(i))),this._initialized){const Q=performance.now();if(K+=(Q-Z)/1e3*this._speed,Z=Q,r.useProgram(N),r.uniform1f(u.uniforms.u_time,K),this._uniformsDirty&&(r.uniform2f(u.uniforms.u_resolution,this._ref.clientWidth,this._ref.clientHeight),r.uniform2f(u.uniforms.u_color_pressure,this._horizontalPressure,this._verticalPressure),r.uniform1f(u.uniforms.u_wave_frequency_x,this._waveFrequencyX),r.uniform1f(u.uniforms.u_wave_frequency_y,this._waveFrequencyY),r.uniform1f(u.uniforms.u_wave_amplitude,this._waveAmplitude),r.uniform1f(u.uniforms.u_color_blending,this._colorBlending),r.uniform1f(u.uniforms.u_shadows,this._shadows),r.uniform1f(u.uniforms.u_highlights,this._highlights),r.uniform1f(u.uniforms.u_saturation,this._saturation),r.uniform1f(u.uniforms.u_brightness,this._brightness),r.uniform1f(u.uniforms.u_grain_intensity,this._grainIntensity),r.uniform1f(u.uniforms.u_grain_sparsity,this._grainSparsity),r.uniform1f(u.uniforms.u_grain_speed,this._grainSpeed),r.uniform1f(u.uniforms.u_grain_scale,this._grainScale),r.uniform1f(u.uniforms.u_y_offset,this._yOffset),r.uniform1f(u.uniforms.u_y_offset_wave_multiplier,this._yOffsetWaveMultiplier),r.uniform1f(u.uniforms.u_y_offset_color_multiplier,this._yOffsetColorMultiplier),r.uniform1f(u.uniforms.u_y_offset_flow_multiplier,this._yOffsetFlowMultiplier),r.uniform1f(u.uniforms.u_flow_distortion_a,this._flowDistortionA),r.uniform1f(u.uniforms.u_flow_distortion_b,this._flowDistortionB),r.uniform1f(u.uniforms.u_flow_scale,this._flowScale),r.uniform1f(u.uniforms.u_flow_ease,this._flowEase),r.uniform1f(u.uniforms.u_flow_enabled,this._flowEnabled?1:0),r.uniform1f(u.uniforms.u_enable_procedural_texture,this._enableProceduralTexture?1:0),r.uniform1f(u.uniforms.u_texture_ease,this._textureEase),this._uniformsDirty=!1),this._textureNeedsUpdate&&this._enableProceduralTexture&&(this._proceduralTexture&&r.deleteTexture(this._proceduralTexture),this._proceduralTexture=this._createProceduralTexture(r),this._textureNeedsUpdate=!1,this._textureDirty=!0),this._textureDirty&&this._proceduralTexture&&(r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,this._proceduralTexture),r.uniform1i(u.uniforms.u_procedural_texture,1),this._textureDirty=!1),this._colorsChanged){this._colorsChanged=!1;for(let z=0;z<O;z++)if(z<this._colors.length){const ee=this._colors[z],Re=this._cachedColorRgb[z]||[0,0,0];r.uniform1f(u.uniforms[`u_colors[${z}].is_active`],ee.enabled?1:0),r.uniform3fv(u.uniforms[`u_colors[${z}].color`],Re),r.uniform1f(u.uniforms[`u_colors[${z}].influence`],ee.influence||0)}else r.uniform1f(u.uniforms[`u_colors[${z}].is_active`],0);r.uniform1i(u.uniforms.u_colors_count,O)}}r.clearColor(this._backgroundColorRgb[0],this._backgroundColorRgb[1],this._backgroundColorRgb[2],this._backgroundAlpha),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),this._wireframe?(r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.glState.buffers.wireframeIndex),r.drawElements(r.LINES,this.glState.wireframeIndexCount,W,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index)):r.drawElements(r.TRIANGLES,L,W,0),this.requestRef=requestAnimationFrame(J)},Te=()=>{const{gl:r,camera:N}=this.glState,u=this._ref.clientWidth,L=this._ref.clientHeight;this._ref.width=u,this._ref.height=L,r.viewport(0,0,u,L),j(N,u,L);const W=r.getUniformLocation(this.glState.program,"projectionMatrix");r.useProgram(this.glState.program),r.uniformMatrix4fv(W,!1,N.projectionMatrix.elements)};this.sizeObserver=new ResizeObserver(()=>{this._resizeTimeoutId!==null&&clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(()=>{Te(),this._resizeTimeoutId=null},100)}),this.sizeObserver.observe(i),J()}destroy(){if(cancelAnimationFrame(this.requestRef),this.sizeObserver.disconnect(),this._resizeTimeoutId!==null&&(clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=null),this._linkElement&&this._linkElement.parentElement&&(this._linkElement.parentElement.removeChild(this._linkElement),this._linkElement=null),this.glState){const e=this.glState.gl;e.deleteProgram(this.glState.program),e.deleteBuffer(this.glState.buffers.position),e.deleteBuffer(this.glState.buffers.normal),e.deleteBuffer(this.glState.buffers.uv),e.deleteBuffer(this.glState.buffers.index),e.deleteBuffer(this.glState.buffers.wireframeIndex)}this._proceduralTexture&&this.glState&&this.glState.gl.deleteTexture(this._proceduralTexture)}downloadAsPNG(e="neat.png"){const i=this._ref.toDataURL("image/png");ce(i,e)}set speed(e){this._uniformsDirty=!0,this._speed=e/20}set horizontalPressure(e){this._uniformsDirty=!0,this._horizontalPressure=e/4}set verticalPressure(e){this._uniformsDirty=!0,this._verticalPressure=e/4}set waveFrequencyX(e){this._uniformsDirty=!0,this._waveFrequencyX=e*.04}set waveFrequencyY(e){this._uniformsDirty=!0,this._waveFrequencyY=e*.04}set waveAmplitude(e){this._uniformsDirty=!0,this._waveAmplitude=e*.75}set colors(e){this._uniformsDirty=!0,this._colors=e,this._cachedColorRgb=e.map(i=>this._hexToRgb(i.color)),this._colorsChanged=!0}set highlights(e){this._uniformsDirty=!0,this._highlights=e/100}set shadows(e){this._uniformsDirty=!0,this._shadows=e/100}set colorSaturation(e){this._uniformsDirty=!0,this._saturation=e/10}set colorBrightness(e){this._uniformsDirty=!0,this._brightness=e}set colorBlending(e){this._uniformsDirty=!0,this._colorBlending=e/10}set grainScale(e){this._uniformsDirty=!0,this._grainScale=e==0?1:e}set grainIntensity(e){this._uniformsDirty=!0,this._grainIntensity=e}set grainSparsity(e){this._uniformsDirty=!0,this._grainSparsity=e}set grainSpeed(e){this._uniformsDirty=!0,this._grainSpeed=e}set wireframe(e){this._uniformsDirty=!0,this._wireframe=e}set resolution(e){if(this._uniformsDirty=!0,this.glState){const i=this.glState.gl;i.deleteProgram(this.glState.program),i.deleteBuffer(this.glState.buffers.position),i.deleteBuffer(this.glState.buffers.normal),i.deleteBuffer(this.glState.buffers.uv),i.deleteBuffer(this.glState.buffers.index),i.deleteBuffer(this.glState.buffers.wireframeIndex)}this.glState=this._initScene(e)}set backgroundColor(e){this._uniformsDirty=!0,this._backgroundColor=e,this._backgroundColorRgb=this._hexToRgb(e)}set backgroundAlpha(e){this._uniformsDirty=!0,this._backgroundAlpha=e}set yOffset(e){this._uniformsDirty=!0,this._yOffset=e}get yOffsetWaveMultiplier(){return this._yOffsetWaveMultiplier*1e3}set yOffsetWaveMultiplier(e){this._uniformsDirty=!0,this._yOffsetWaveMultiplier=e/1e3}get yOffsetColorMultiplier(){return this._yOffsetColorMultiplier*1e3}set yOffsetColorMultiplier(e){this._uniformsDirty=!0,this._yOffsetColorMultiplier=e/1e3}get yOffsetFlowMultiplier(){return this._yOffsetFlowMultiplier*1e3}set yOffsetFlowMultiplier(e){this._uniformsDirty=!0,this._yOffsetFlowMultiplier=e/1e3}set flowDistortionA(e){this._uniformsDirty=!0,this._flowDistortionA=e}set flowDistortionB(e){this._uniformsDirty=!0,this._flowDistortionB=e}set flowScale(e){this._uniformsDirty=!0,this._flowScale=e}set flowEase(e){this._uniformsDirty=!0,this._flowEase=e}set flowEnabled(e){this._uniformsDirty=!0,this._flowEnabled=e}get flowEnabled(){return this._flowEnabled}set enableProceduralTexture(e){this._uniformsDirty=!0,this._enableProceduralTexture=e,e&&!this._proceduralTexture&&(this._textureNeedsUpdate=!0)}set textureVoidLikelihood(e){this._uniformsDirty=!0,this._textureVoidLikelihood=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureVoidWidthMin(e){this._uniformsDirty=!0,this._textureVoidWidthMin=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureVoidWidthMax(e){this._uniformsDirty=!0,this._textureVoidWidthMax=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureBandDensity(e){this._uniformsDirty=!0,this._textureBandDensity=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureColorBlending(e){this._uniformsDirty=!0,this._textureColorBlending=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureSeed(e){this._uniformsDirty=!0,this._textureSeed=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureEase(){return this._textureEase}set textureEase(e){this._uniformsDirty=!0,this._textureEase=e}set proceduralBackgroundColor(e){this._uniformsDirty=!0,this._proceduralBackgroundColor=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeTriangles(e){this._uniformsDirty=!0,this._textureShapeTriangles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeCircles(e){this._uniformsDirty=!0,this._textureShapeCircles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeBars(e){this._uniformsDirty=!0,this._textureShapeBars=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}set textureShapeSquiggles(e){this._uniformsDirty=!0,this._textureShapeSquiggles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}_hexToRgb(e){const i=parseInt(e.replace("#",""),16);return[(i>>16&255)/255,(i>>8&255)/255,(i&255)/255]}_initScene(e){const i=this._ref.clientWidth,o=this._ref.clientHeight,t=this._ref.getContext("webgl2",{alpha:!0,preserveDrawingBuffer:!0,antialias:!0})||this._ref.getContext("webgl",{alpha:!0,preserveDrawingBuffer:!0,antialias:!0});if(!t)throw new Error("WebGL not supported");t.getExtension("OES_standard_derivatives"),t.getExtension("OES_element_index_uint"),t.viewport(0,0,i,o);const{position:b,normal:y,uv:n,index:p,wireframeIndex:v}=se(Y,H,240*e,240*e),T=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,T),t.bufferData(t.ARRAY_BUFFER,b,t.STATIC_DRAW);const x=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,x),t.bufferData(t.ARRAY_BUFFER,y,t.STATIC_DRAW);const h=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,h),t.bufferData(t.ARRAY_BUFFER,n,t.STATIC_DRAW);const w=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,w),t.bufferData(t.ELEMENT_ARRAY_BUFFER,p,t.STATIC_DRAW);const R=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,R),t.bufferData(t.ELEMENT_ARRAY_BUFFER,v,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,w);const E=ie()+`
|
|
399
|
+
`+q()+`
|
|
400
|
+
`+V()+`
|
|
401
|
+
`+M,g=t.createShader(t.VERTEX_SHADER);t.shaderSource(g,E),t.compileShader(g),t.getShaderParameter(g,t.COMPILE_STATUS)||(console.log("VERTEX_SHADER_ERROR_START"),console.log("Vertex shader error: ",t.getShaderInfoLog(g)),console.log("GL Error Code:",t.getError()),console.log("Vertex Shader Source Dump:"),console.log(E.split(`
|
|
402
|
+
`).map((S,I)=>`${I+1}: ${S}`).join(`
|
|
403
|
+
`)),console.log("VERTEX_SHADER_ERROR_END"));const A=re()+`
|
|
404
|
+
`+V()+`
|
|
405
|
+
`+q()+`
|
|
406
|
+
`+te,c=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(c,A),t.compileShader(c),t.getShaderParameter(c,t.COMPILE_STATUS)||(console.log("FRAGMENT_SHADER_ERROR_START"),console.log("Fragment shader error: ",t.getShaderInfoLog(c)),console.log("GL Error Code:",t.getError()),console.log("Fragment Shader Source Dump:"),console.log(A.split(`
|
|
407
|
+
`).map((S,I)=>`${I+1}: ${S}`).join(`
|
|
408
|
+
`)),console.log("FRAGMENT_SHADER_ERROR_END"));const l=t.createProgram();t.attachShader(l,g),t.attachShader(l,c),t.linkProgram(l),t.getProgramParameter(l,t.LINK_STATUS)||(console.log("PROGRAM_LINK_ERROR_START"),console.log("Program linking error: ",t.getProgramInfoLog(l)),console.log("GL Error Code:",t.getError()),console.log("PROGRAM_LINK_ERROR_END")),t.useProgram(l);const m=new oe(0,0,0,0,0,1e3);m.position=[0,0,5],j(m,i,o);const s=t.getAttribLocation(l,"position"),f=t.getAttribLocation(l,"normal"),_=t.getAttribLocation(l,"uv");t.enableVertexAttribArray(s),t.bindBuffer(t.ARRAY_BUFFER,T),t.vertexAttribPointer(s,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(f),t.bindBuffer(t.ARRAY_BUFFER,x),t.vertexAttribPointer(f,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(_),t.bindBuffer(t.ARRAY_BUFFER,h),t.vertexAttribPointer(_,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,w);const d=new G;d.translate(-m.position[0],-m.position[1],-m.position[2]),d.translate(0,0,-1),d.rotateX(-Math.PI/3.5);const P=t.getUniformLocation(l,"modelViewMatrix");t.uniformMatrix4fv(P,!1,d.elements);const C=t.getUniformLocation(l,"projectionMatrix");t.uniformMatrix4fv(C,!1,m.projectionMatrix.elements);const U=t.getUniformLocation(l,"u_plane_width");t.uniform1f(U,Y);const B=t.getUniformLocation(l,"u_plane_height");t.uniform1f(B,H);const k=t.getUniformLocation(l,"u_colors_count");t.uniform1i(k,O);const X=["u_time","u_resolution","u_color_pressure","u_wave_frequency_x","u_wave_frequency_y","u_wave_amplitude","u_colors_count","u_plane_width","u_plane_height","u_shadows","u_highlights","u_grain_intensity","u_grain_sparsity","u_grain_scale","u_grain_speed","u_flow_distortion_a","u_flow_distortion_b","u_flow_scale","u_flow_ease","u_flow_enabled","u_y_offset","u_y_offset_wave_multiplier","u_y_offset_color_multiplier","u_y_offset_flow_multiplier","u_procedural_texture","u_enable_procedural_texture","u_texture_ease","u_saturation","u_brightness","u_color_blending"],D={attributes:{position:s,normal:f,uv:_},uniforms:{}};X.forEach(S=>{D.uniforms[S]=t.getUniformLocation(l,S)});for(let S=0;S<O;S++)D.uniforms[`u_colors[${S}].is_active`]=t.getUniformLocation(l,`u_colors[${S}].is_active`),D.uniforms[`u_colors[${S}].color`]=t.getUniformLocation(l,`u_colors[${S}].color`),D.uniforms[`u_colors[${S}].influence`]=t.getUniformLocation(l,`u_colors[${S}].influence`);return this._initialized=!0,this._uniformsDirty=!0,this._colorsChanged=!0,this._textureDirty=!0,t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.enable(t.DEPTH_TEST),{gl:t,program:l,buffers:{position:T,normal:x,uv:h,index:w,wireframeIndex:R},locations:D,camera:m,indexCount:p.length,wireframeIndexCount:v.length,indexType:p instanceof Uint32Array?t.UNSIGNED_INT:t.UNSIGNED_SHORT}}_createProceduralTexture(e){const o=document.createElement("canvas");o.width=1024,o.height=1024;const t=o.getContext("2d",{willReadFrequently:!0});if(!t)return null;let b=this._textureSeed;const y=this._textureSeed;function n(){const s=Math.sin(b++)*1e4;return s-Math.floor(s)}const p=s=>{b=y+s},v=this._colors.filter(s=>s.enabled).map(s=>s.color);if(v.length===0)return null;function T(s){const f=parseInt(s.replace("#",""),16);return{r:f>>16&255,g:f>>8&255,b:f&255}}function x(s,f,_){return"#"+((1<<24)+(Math.round(s)<<16)+(Math.round(f)<<8)+Math.round(_)).toString(16).slice(1).padStart(6,"0")}const h=()=>{const s=v[Math.floor(n()*v.length)],f=v[Math.floor(n()*v.length)],_=n()*this._textureColorBlending,d=T(s),P=T(f),C=d.r+(P.r-d.r)*_,U=d.g+(P.g-d.g)*_,B=d.b+(P.b-d.b)*_;return x(C,U,B)},w=this._proceduralBackgroundColor||"#000000";t.fillStyle=w,t.fillRect(0,0,1024,1024);const R=t.createLinearGradient(0,0,0,1024);R.addColorStop(0,h()),R.addColorStop(1,h()),t.fillStyle=R,t.fillRect(0,0,1024,1024);for(let s=0;s<this._textureShapeTriangles;s++){t.fillStyle=h(),t.beginPath();const f=n()*1024,_=n()*1024,d=100+n()*300;t.moveTo(f,_),t.lineTo(f+(n()-.5)*d,_+(n()-.5)*d),t.lineTo(f+(n()-.5)*d,_+(n()-.5)*d),t.fill()}for(let s=0;s<this._textureShapeCircles;s++){t.strokeStyle=h(),t.lineWidth=10+n()*50,t.beginPath();const f=n()*1024,_=n()*1024,d=50+n()*150;t.arc(f,_,d,0,Math.PI*2),t.stroke()}for(let s=0;s<this._textureShapeBars;s++)t.fillStyle=h(),t.save(),t.translate(n()*1024,n()*1024),t.rotate(n()*Math.PI),t.fillRect(-150,-25,300,50),t.restore();t.lineWidth=15,t.lineCap="round";for(let s=0;s<this._textureShapeSquiggles;s++){t.strokeStyle=h(),t.beginPath();let f=n()*1024,_=n()*1024;t.moveTo(f,_);for(let d=0;d<4;d++)t.bezierCurveTo(f+(n()-.5)*300,_+(n()-.5)*300,f+(n()-.5)*300,_+(n()-.5)*300,f+(n()-.5)*300,_+(n()-.5)*300),f+=(n()-.5)*300,_+=(n()-.5)*300;t.stroke()}p(5e4);const E=document.createElement("canvas");E.width=1024,E.height=1024;const g=E.getContext("2d",{willReadFrequently:!0});if(!g)return null;g.fillStyle=w,g.fillRect(0,0,1024,1024);let A=0;const c=[];for(;A<1024;)if(n()<this._textureVoidLikelihood){const f=this._textureVoidWidthMin+n()*(this._textureVoidWidthMax-this._textureVoidWidthMin);c.push({type:"void",x:A,width:f}),A+=f}else{const f=50+n()*200;c.push({type:"matter",x:A,width:f}),A+=f}for(const s of c)if(s.type==="matter"){const f=s.x,_=Math.min(s.x+s.width,1024);let d=f;for(;d<_;){const P=(2+n()*20)/this._textureBandDensity,C=Math.floor(n()*1024);g.drawImage(o,C,0,P,1024,d,0,P,1024),d+=P}}const l=e.createTexture();e.bindTexture(e.TEXTURE_2D,l),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,E),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.generateMipmap(e.TEXTURE_2D);const m=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(m){const s=e.getParameter(m.MAX_TEXTURE_MAX_ANISOTROPY_EXT);e.texParameterf(e.TEXTURE_2D,m.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,s))}return l}}const $=a=>{a.id=ne,a.href="https://neat.firecms.co",a.target="_blank",a.style.position="absolute",a.style.display="block",a.style.bottom="0",a.style.right="0",a.style.padding="10px",a.style.color="#dcdcdc",a.style.opacity="0.8",a.style.fontFamily="sans-serif",a.style.fontSize="16px",a.style.fontWeight="bold",a.style.textDecoration="none",a.style.zIndex="10000",a.style.pointerEvents="auto",a.setAttribute("data-n","1"),a.innerHTML="NEAT"},le=a=>{const e=a.parentElement;if(e&&getComputedStyle(e).position==="static"&&(e.style.position="relative"),e){const o=e.querySelector("a[data-n]");if(o)return $(o),o}const i=document.createElement("a");return $(i),e?.appendChild(i),i};function ue(){const a=new Date,e=a.getMinutes(),i=a.getSeconds();return e*60+i}function fe(a=6){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let o=0;o<a;o++){const t=Math.floor(Math.random()*e.length);i+=e.charAt(t)}return i}function ce(a,e){const i=document.createElement("a");i.download=e,i.href=a,document.body.appendChild(i),i.click(),document.body.removeChild(i)}function _e(){if(document.getElementById("neat-seo-schema"))return;const a=document.createElement("script");a.id="neat-seo-schema",a.type="application/ld+json",a.text=JSON.stringify({"@context":"https://schema.org","@type":"WebSite",name:"NEAT Gradient",url:"https://neat.firecms.co",author:{"@type":"Organization",name:"FireCMS",url:"https://firecms.co"},description:"Beautiful, fast, heavily customizable, WebGL based gradients."}),document.head.appendChild(a);const e=document.createElement("div");e.style.position="absolute",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.margin="-1px",e.style.overflow="hidden",e.style.clip="rect(0, 0, 0, 0)",e.style.whiteSpace="nowrap",e.style.borderWidth="0";try{const i=e.attachShadow({mode:"closed"}),o=document.createElement("a");o.href="https://firecms.co",o.textContent="FireCMS",i.appendChild(o)}catch{const o=document.createElement("a");o.href="https://firecms.co",o.textContent="FireCMS",e.appendChild(o)}document.body.appendChild(e)}F.NeatGradient=ae,Object.defineProperties(F,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
421
409
|
//# sourceMappingURL=index.umd.js.map
|