@firecms/neat 0.7.0 → 0.8.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 +1 -1
- package/dist/NeatGradient.d.ts +32 -55
- package/dist/NeatGradient.js +145 -2
- package/dist/NeatGradient.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +401 -224
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +113 -27
- package/dist/index.umd.js.map +1 -1
- package/dist/shaders.d.ts +2 -2
- package/dist/shaders.js +101 -15
- package/dist/shaders.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/package.json +1 -1
- package/src/NeatGradient.ts +172 -63
- package/src/index.ts +1 -0
- package/src/shaders.ts +101 -15
- package/src/types.ts +27 -0
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(F,
|
|
1
|
+
(function(F,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(F=typeof globalThis<"u"?globalThis:F||self,I(F.neat={}))})(this,function(F){"use strict";const I=`void main() {
|
|
2
2
|
vUv = uv;
|
|
3
3
|
|
|
4
4
|
// SCROLLING LOGIC
|
|
@@ -72,7 +72,10 @@
|
|
|
72
72
|
|
|
73
73
|
v_color = color;
|
|
74
74
|
|
|
75
|
-
// 4.
|
|
75
|
+
// 4. FRESNEL (rim glow)
|
|
76
|
+
// (Calculated in fragment shader using displacement slope approximation)
|
|
77
|
+
|
|
78
|
+
// 5. VERTEX POSITION
|
|
76
79
|
vec3 newPosition = position + normal * v_displacement_amount * u_wave_amplitude;
|
|
77
80
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
|
|
78
81
|
v_new_position = gl_Position;
|
|
@@ -93,31 +96,32 @@ float fbm(vec3 x) {
|
|
|
93
96
|
return value;
|
|
94
97
|
}
|
|
95
98
|
|
|
99
|
+
// Branchless HSL to RGB for iridescence
|
|
100
|
+
vec3 hsl2rgb(float h, float s, float l) {
|
|
101
|
+
vec3 rgb = clamp(abs(mod(h * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
|
|
102
|
+
return l + s * (rgb - 0.5) * (1.0 - abs(2.0 * l - 1.0));
|
|
103
|
+
}
|
|
104
|
+
|
|
96
105
|
void main() {
|
|
97
106
|
vec2 finalUv = vFlowUv;
|
|
98
107
|
|
|
99
108
|
vec3 baseColor;
|
|
100
109
|
|
|
101
110
|
if (u_enable_procedural_texture > 0.5) {
|
|
102
|
-
// Calculate flow field distance for ease effect
|
|
103
111
|
vec2 ppp = -1.0 + 2.0 * finalUv;
|
|
104
112
|
ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
|
|
105
113
|
ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
|
|
106
114
|
ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
|
|
107
115
|
ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
|
|
108
|
-
float r = length(ppp);
|
|
116
|
+
float r = length(ppp);
|
|
109
117
|
|
|
110
|
-
// Ease blending: 0 = topographic (flow), 1 = image (UV)
|
|
111
118
|
float vx = (finalUv.x * u_texture_ease) + (r * (1.0 - u_texture_ease));
|
|
112
119
|
float vy = (finalUv.y * u_texture_ease) + (0.0 * (1.0 - u_texture_ease));
|
|
113
120
|
vec2 texUv = vec2(vx, vy);
|
|
114
121
|
|
|
115
|
-
|
|
116
|
-
// We manually apply a smaller offset here to make the texture lag behind
|
|
117
|
-
float parallaxFactor = 0.25; // 25% speed of the color mixing
|
|
122
|
+
float parallaxFactor = 0.25;
|
|
118
123
|
texUv.y -= (u_y_offset * u_y_offset_color_multiplier / u_plane_height) * parallaxFactor;
|
|
119
|
-
|
|
120
|
-
texUv *= 1.5; // Tiling scale
|
|
124
|
+
texUv *= 1.5;
|
|
121
125
|
|
|
122
126
|
vec4 texSample = texture2D(u_procedural_texture, texUv);
|
|
123
127
|
baseColor = texSample.rgb;
|
|
@@ -127,24 +131,70 @@ void main() {
|
|
|
127
131
|
|
|
128
132
|
vec3 color = baseColor;
|
|
129
133
|
|
|
134
|
+
// === DOMAIN WARPING (simplified: 3 fbm calls instead of 5) ===
|
|
135
|
+
if (u_domain_warp_enabled > 0.5) {
|
|
136
|
+
vec3 p = vec3(finalUv * u_domain_warp_scale, u_time * 0.15);
|
|
137
|
+
vec2 q = vec2(fbm(p), fbm(p + vec3(5.2, 1.3, 0.0)));
|
|
138
|
+
float f = fbm(p + vec3(4.0 * q, 0.0));
|
|
139
|
+
vec3 warpColor = color * (1.0 + f * 0.8 * u_domain_warp_intensity);
|
|
140
|
+
float pattern = clamp(f * f * f + 0.6 * f * f + 0.5 * f, 0.0, 1.0);
|
|
141
|
+
color = mix(color, warpColor * (0.6 + pattern * 0.8), u_domain_warp_intensity * 0.7);
|
|
142
|
+
}
|
|
143
|
+
|
|
130
144
|
// Post-processing
|
|
131
145
|
color += v_displacement_amount * u_highlights;
|
|
132
|
-
// Replace pow() with direct multiplication to avoid negative base undefined behavior in GLSL
|
|
133
146
|
float shadowFactor = 1.0 - v_displacement_amount;
|
|
134
147
|
color -= shadowFactor * shadowFactor * u_shadows;
|
|
135
148
|
color = saturation(color, 1.0 + u_saturation);
|
|
136
149
|
color = color * u_brightness;
|
|
137
150
|
|
|
138
|
-
//
|
|
139
|
-
|
|
151
|
+
// === IRIDESCENCE ===
|
|
152
|
+
if (u_iridescence_enabled > 0.5) {
|
|
153
|
+
float hue = fract(v_displacement_amount * 0.5 + 0.5 + u_time * u_iridescence_speed * 0.05);
|
|
154
|
+
vec3 iriColor = hsl2rgb(hue, 0.8, 0.6);
|
|
155
|
+
color = mix(color, iriColor, u_iridescence_intensity * abs(v_displacement_amount) * 0.6);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// === FRESNEL (Rim glow) ===
|
|
159
|
+
if (u_fresnel_enabled > 0.5) {
|
|
160
|
+
float slope = 1.0 - abs(v_displacement_amount);
|
|
161
|
+
float fresnel = pow(max(slope, 0.0), u_fresnel_power);
|
|
162
|
+
color += u_fresnel_color * fresnel * u_fresnel_intensity;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// === VIGNETTE ===
|
|
166
|
+
if (u_vignette_intensity > 0.0) {
|
|
167
|
+
float dist = length(vUv - vec2(0.5));
|
|
168
|
+
float vig = smoothstep(u_vignette_radius, u_vignette_radius * 0.3, dist);
|
|
169
|
+
color *= mix(1.0, vig, u_vignette_intensity);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// === FAKE BLOOM ===
|
|
173
|
+
if (u_bloom_intensity > 0.0) {
|
|
174
|
+
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
|
|
175
|
+
float bloomMask = smoothstep(u_bloom_threshold, 1.0, luma);
|
|
176
|
+
color += color * bloomMask * u_bloom_intensity;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// === CHROMATIC ABERRATION ===
|
|
180
|
+
if (u_chromatic_aberration > 0.0) {
|
|
181
|
+
float caAmount = u_chromatic_aberration * 0.008;
|
|
182
|
+
float dist = length(vUv - vec2(0.5));
|
|
183
|
+
float rShift = v_displacement_amount + caAmount * dist;
|
|
184
|
+
float bShift = v_displacement_amount - caAmount * dist;
|
|
185
|
+
color.r *= 1.0 + rShift * caAmount * 10.0;
|
|
186
|
+
color.b *= 1.0 - bShift * caAmount * 10.0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Grain (use cheap hash noise instead of expensive fbm when static)
|
|
140
190
|
float grain = 0.0;
|
|
141
|
-
|
|
142
|
-
// Completely bypass expensive noise generation if grain is disabled
|
|
143
191
|
if (u_grain_intensity > 0.0) {
|
|
192
|
+
vec2 noiseCoords = gl_FragCoord.xy / u_grain_scale;
|
|
144
193
|
if (u_grain_speed != 0.0) {
|
|
145
194
|
grain = fbm(vec3(noiseCoords, u_time * u_grain_speed));
|
|
146
195
|
} else {
|
|
147
|
-
grain
|
|
196
|
+
// Static grain: use cheap hash instead of fbm
|
|
197
|
+
grain = random(noiseCoords) - 0.5;
|
|
148
198
|
}
|
|
149
199
|
|
|
150
200
|
grain = grain * 0.5 + 0.5;
|
|
@@ -201,6 +251,12 @@ uniform float u_flow_distortion_b;
|
|
|
201
251
|
uniform float u_flow_scale;
|
|
202
252
|
uniform float u_flow_ease;
|
|
203
253
|
uniform float u_flow_enabled;
|
|
254
|
+
|
|
255
|
+
// Fresnel uniforms
|
|
256
|
+
uniform float u_fresnel_enabled;
|
|
257
|
+
uniform float u_fresnel_power;
|
|
258
|
+
uniform float u_fresnel_intensity;
|
|
259
|
+
uniform vec3 u_fresnel_color;
|
|
204
260
|
`}function re(){return`precision highp float;
|
|
205
261
|
|
|
206
262
|
varying vec2 vUv;
|
|
@@ -209,6 +265,7 @@ varying vec3 v_color;
|
|
|
209
265
|
varying float v_displacement_amount;
|
|
210
266
|
|
|
211
267
|
uniform float u_time;
|
|
268
|
+
uniform vec2 u_resolution;
|
|
212
269
|
uniform float u_plane_height;
|
|
213
270
|
|
|
214
271
|
uniform float u_shadows;
|
|
@@ -232,7 +289,36 @@ uniform float u_flow_scale;
|
|
|
232
289
|
uniform sampler2D u_procedural_texture;
|
|
233
290
|
uniform float u_enable_procedural_texture;
|
|
234
291
|
uniform float u_texture_ease;
|
|
235
|
-
|
|
292
|
+
|
|
293
|
+
// Domain warping uniforms
|
|
294
|
+
uniform float u_domain_warp_enabled;
|
|
295
|
+
uniform float u_domain_warp_intensity;
|
|
296
|
+
uniform float u_domain_warp_scale;
|
|
297
|
+
|
|
298
|
+
// Vignette uniforms
|
|
299
|
+
uniform float u_vignette_intensity;
|
|
300
|
+
uniform float u_vignette_radius;
|
|
301
|
+
|
|
302
|
+
// Fresnel uniforms (fragment side)
|
|
303
|
+
uniform float u_fresnel_enabled;
|
|
304
|
+
uniform float u_fresnel_power;
|
|
305
|
+
uniform float u_fresnel_intensity;
|
|
306
|
+
uniform vec3 u_fresnel_color;
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
// Iridescence uniforms
|
|
311
|
+
uniform float u_iridescence_enabled;
|
|
312
|
+
uniform float u_iridescence_intensity;
|
|
313
|
+
uniform float u_iridescence_speed;
|
|
314
|
+
|
|
315
|
+
// Bloom uniforms
|
|
316
|
+
uniform float u_bloom_intensity;
|
|
317
|
+
uniform float u_bloom_threshold;
|
|
318
|
+
|
|
319
|
+
// Chromatic aberration
|
|
320
|
+
uniform float u_chromatic_aberration;
|
|
321
|
+
`}function V(){return`
|
|
236
322
|
// 1. REPLACEMENT PERMUTE:
|
|
237
323
|
// Uses a hash function (fract/sin) instead of a modular lookup table.
|
|
238
324
|
vec4 permute(vec4 x) {
|
|
@@ -384,26 +470,26 @@ float cnoise(vec3 P)
|
|
|
384
470
|
float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
|
|
385
471
|
return 2.2 * n_xyz;
|
|
386
472
|
}
|
|
387
|
-
`}function
|
|
473
|
+
`}function X(){return`
|
|
388
474
|
vec3 saturation(vec3 rgb, float adjustment) {
|
|
389
475
|
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
|
390
476
|
vec3 intensity = vec3(dot(rgb, W));
|
|
391
477
|
return mix(intensity, rgb, adjustment);
|
|
392
478
|
}
|
|
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,
|
|
479
|
+
`}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,r,s){return this.elements[12]+=this.elements[0]*e+this.elements[4]*r+this.elements[8]*s,this.elements[13]+=this.elements[1]*e+this.elements[5]*r+this.elements[9]*s,this.elements[14]+=this.elements[2]*e+this.elements[6]*r+this.elements[10]*s,this.elements[15]+=this.elements[3]*e+this.elements[7]*r+this.elements[11]*s,this}rotateX(e){const r=Math.cos(e),s=Math.sin(e),t=this.elements[4],S=this.elements[5],y=this.elements[6],a=this.elements[7],p=this.elements[8],v=this.elements[9],T=this.elements[10],x=this.elements[11];return this.elements[4]=r*t+s*p,this.elements[5]=r*S+s*v,this.elements[6]=r*y+s*T,this.elements[7]=r*a+s*x,this.elements[8]=r*p-s*t,this.elements[9]=r*v-s*S,this.elements[10]=r*T-s*y,this.elements[11]=r*x-s*a,this}}class oe{left;right;top;bottom;near;far;position;projectionMatrix;constructor(e,r,s,t,S,y){this.left=e,this.right=r,this.top=s,this.bottom=t,this.near=S,this.far=y,this.position=[0,0,0],this.projectionMatrix=new G,this.updateProjectionMatrix()}updateProjectionMatrix(){const e=1/(this.right-this.left),r=1/(this.top-this.bottom),s=1/(this.far-this.near),t=(this.right+this.left)*e,S=(this.top+this.bottom)*r,y=(this.far+this.near)*s;this.projectionMatrix.elements=new Float32Array([2*e,0,0,0,0,2*r,0,0,0,0,-2*s,0,-t,-S,-y,1])}}function j(l,e,r,s=50,t=50){const a=e*r/1e6*s*t/1.5,p=e/r,v=Math.sqrt(a*p),T=a/v;let x=-s/2,h=Math.min((x+v)/1.5,s/2),b=t/4,R=Math.max((b-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,b=b*g,R=R*g}l.left=x,l.right=h,l.top=b,l.bottom=R,l.near=-100,l.far=1e3,l.updateProjectionMatrix()}function se(l,e,r,s){const t=l/2,S=e/2,y=Math.floor(r),a=Math.floor(s),p=y+1,v=a+1,T=l/y,x=e/a,h=[],b=[],R=[],E=[];for(let _=0;_<v;_++){const u=_*x-S;for(let m=0;m<p;m++){const n=m*T-t;b.push(n,-u,0),R.push(0,0,1),E.push(m/y),E.push(1-_/a)}}for(let _=0;_<a;_++)for(let u=0;u<y;u++){const m=u+p*_,n=u+p*(_+1),f=u+1+p*(_+1),c=u+1+p*_;h.push(m,n,c),h.push(n,f,c)}const g=b.length/3>65535,A=[];for(let _=0;_<h.length;_+=3){const u=h[_],m=h[_+1],n=h[_+2];A.push(u,m,m,n,n,u)}return{position:new Float32Array(b),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
480
|
|
|
395
481
|
Licensed under MIT + The Commons Clause.
|
|
396
482
|
Free for personal and commercial use.
|
|
397
483
|
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()+`
|
|
484
|
+
https://neat.firecms.co`,"font-weight: bold; font-size: 14px; color: #FF5772;","color: inherit;");const Y=50,H=80,L=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;_domainWarpEnabled=!1;_domainWarpIntensity=.5;_domainWarpScale=1;_vignetteIntensity=.5;_vignetteRadius=.8;_fresnelEnabled=!1;_fresnelPower=2;_fresnelIntensity=.5;_fresnelColor="#FFFFFF";_fresnelColorRgb=[1,1,1];_iridescenceEnabled=!1;_iridescenceIntensity=.5;_iridescenceSpeed=1;_bloomIntensity=0;_bloomThreshold=.7;_chromaticAberration=0;_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:r,speed:s=4,horizontalPressure:t=3,verticalPressure:S=3,waveFrequencyX:y=5,waveFrequencyY:a=5,waveAmplitude:p=3,colors:v,highlights:T=4,shadows:x=4,colorSaturation:h=0,colorBrightness:b=1,colorBlending:R=5,grainScale:E=2,grainIntensity:g=.55,grainSparsity:A=0,grainSpeed:_=.1,wireframe:u=!1,backgroundColor:m="#FFFFFF",backgroundAlpha:n=1,resolution:f=1,seed:c,yOffset:d=0,yOffsetWaveMultiplier:C=4,yOffsetColorMultiplier:D=4,yOffsetFlowMultiplier:M=4,flowDistortionA:U=0,flowDistortionB:k=0,flowScale:q=1,flowEase:z=0,flowEnabled:w=!0,enableProceduralTexture:B=!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:be=20,textureShapeCircles:we=15,textureShapeBars:Se=15,textureShapeSquiggles:Ee=10,domainWarpEnabled:Te=!1,domainWarpIntensity:Re=.5,domainWarpScale:Ae=1,vignetteIntensity:Ce=.5,vignetteRadius:Pe=.8,fresnelEnabled:De=!1,fresnelPower:ze=2,fresnelIntensity:Fe=.5,fresnelColor:Ie="#FFFFFF",iridescenceEnabled:Me=!1,iridescenceIntensity:Ue=.5,iridescenceSpeed:Be=1,bloomIntensity:Oe=0,bloomThreshold:Le=.7,chromaticAberration:Ne=0}=e;this._ref=r,this.destroy=this.destroy.bind(this),this._initScene=this._initScene.bind(this),this.speed=s,this.horizontalPressure=t,this.verticalPressure=S,this.waveFrequencyX=y,this.waveFrequencyY=a,this.waveAmplitude=p,this.colorBlending=R,this.grainScale=E,this.grainIntensity=g,this.grainSparsity=A,this.grainSpeed=_,this.colors=v,this.shadows=x,this.highlights=T,this.colorSaturation=h,this.colorBrightness=b,this.wireframe=u,this.backgroundColor=m,this.backgroundAlpha=n,this.yOffset=d,this.yOffsetWaveMultiplier=C,this.yOffsetColorMultiplier=D,this.yOffsetFlowMultiplier=M,this.flowDistortionA=U,this.flowDistortionB=k,this.flowScale=q,this.flowEase=z,this.flowEnabled=w,this.enableProceduralTexture=B,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=be,this._textureShapeCircles=we,this._textureShapeBars=Se,this._textureShapeSquiggles=Ee,this.domainWarpEnabled=Te,this.domainWarpIntensity=Re,this.domainWarpScale=Ae,this.vignetteIntensity=Ce,this.vignetteRadius=Pe,this.fresnelEnabled=De,this.fresnelPower=ze,this.fresnelIntensity=Fe,this.fresnelColor=Ie,this.iridescenceEnabled=Me,this.iridescenceIntensity=Ue,this.iridescenceSpeed=Be,this.bloomIntensity=Oe,this.bloomThreshold=Le,this.chromaticAberration=Ne,this.glState=this._initScene(f),ce();let K=c!==void 0?c:ue(),Z=performance.now();const J=()=>{const{gl:i,program:N,locations:o,indexCount:O,indexType:W}=this.glState;if(this._linkCheckCounter++,this._linkCheckCounter>=300&&(this._linkCheckCounter=0,(!this._linkElement||!document.contains(this._linkElement))&&(this._linkElement=le(r))),this._initialized){const Q=performance.now();if(K+=(Q-Z)/1e3*this._speed,Z=Q,i.useProgram(N),i.uniform1f(o.uniforms.u_time,K),this._uniformsDirty&&(i.uniform2f(o.uniforms.u_resolution,this._ref.clientWidth,this._ref.clientHeight),i.uniform2f(o.uniforms.u_color_pressure,this._horizontalPressure,this._verticalPressure),i.uniform1f(o.uniforms.u_wave_frequency_x,this._waveFrequencyX),i.uniform1f(o.uniforms.u_wave_frequency_y,this._waveFrequencyY),i.uniform1f(o.uniforms.u_wave_amplitude,this._waveAmplitude),i.uniform1f(o.uniforms.u_color_blending,this._colorBlending),i.uniform1f(o.uniforms.u_shadows,this._shadows),i.uniform1f(o.uniforms.u_highlights,this._highlights),i.uniform1f(o.uniforms.u_saturation,this._saturation),i.uniform1f(o.uniforms.u_brightness,this._brightness),i.uniform1f(o.uniforms.u_grain_intensity,this._grainIntensity),i.uniform1f(o.uniforms.u_grain_sparsity,this._grainSparsity),i.uniform1f(o.uniforms.u_grain_speed,this._grainSpeed),i.uniform1f(o.uniforms.u_grain_scale,this._grainScale),i.uniform1f(o.uniforms.u_y_offset,this._yOffset),i.uniform1f(o.uniforms.u_y_offset_wave_multiplier,this._yOffsetWaveMultiplier),i.uniform1f(o.uniforms.u_y_offset_color_multiplier,this._yOffsetColorMultiplier),i.uniform1f(o.uniforms.u_y_offset_flow_multiplier,this._yOffsetFlowMultiplier),i.uniform1f(o.uniforms.u_flow_distortion_a,this._flowDistortionA),i.uniform1f(o.uniforms.u_flow_distortion_b,this._flowDistortionB),i.uniform1f(o.uniforms.u_flow_scale,this._flowScale),i.uniform1f(o.uniforms.u_flow_ease,this._flowEase),i.uniform1f(o.uniforms.u_flow_enabled,this._flowEnabled?1:0),i.uniform1f(o.uniforms.u_enable_procedural_texture,this._enableProceduralTexture?1:0),i.uniform1f(o.uniforms.u_texture_ease,this._textureEase),i.uniform1f(o.uniforms.u_domain_warp_enabled,this._domainWarpEnabled?1:0),i.uniform1f(o.uniforms.u_domain_warp_intensity,this._domainWarpIntensity),i.uniform1f(o.uniforms.u_domain_warp_scale,this._domainWarpScale),i.uniform1f(o.uniforms.u_vignette_intensity,this._vignetteIntensity),i.uniform1f(o.uniforms.u_vignette_radius,this._vignetteRadius),i.uniform1f(o.uniforms.u_fresnel_enabled,this._fresnelEnabled?1:0),i.uniform1f(o.uniforms.u_fresnel_power,this._fresnelPower),i.uniform1f(o.uniforms.u_fresnel_intensity,this._fresnelIntensity),i.uniform3fv(o.uniforms.u_fresnel_color,this._fresnelColorRgb),i.uniform1f(o.uniforms.u_iridescence_enabled,this._iridescenceEnabled?1:0),i.uniform1f(o.uniforms.u_iridescence_intensity,this._iridescenceIntensity),i.uniform1f(o.uniforms.u_iridescence_speed,this._iridescenceSpeed),i.uniform1f(o.uniforms.u_bloom_intensity,this._bloomIntensity),i.uniform1f(o.uniforms.u_bloom_threshold,this._bloomThreshold),i.uniform1f(o.uniforms.u_chromatic_aberration,this._chromaticAberration),this._uniformsDirty=!1),this._textureNeedsUpdate&&this._enableProceduralTexture&&(this._proceduralTexture&&i.deleteTexture(this._proceduralTexture),this._proceduralTexture=this._createProceduralTexture(i),this._textureNeedsUpdate=!1,this._textureDirty=!0),this._textureDirty&&this._proceduralTexture&&(i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._proceduralTexture),i.uniform1i(o.uniforms.u_procedural_texture,1),this._textureDirty=!1),this._colorsChanged){this._colorsChanged=!1;for(let P=0;P<L;P++)if(P<this._colors.length){const ee=this._colors[P],ke=this._cachedColorRgb[P]||[0,0,0];i.uniform1f(o.uniforms[`u_colors[${P}].is_active`],ee.enabled?1:0),i.uniform3fv(o.uniforms[`u_colors[${P}].color`],ke),i.uniform1f(o.uniforms[`u_colors[${P}].influence`],ee.influence||0)}else i.uniform1f(o.uniforms[`u_colors[${P}].is_active`],0);i.uniform1i(o.uniforms.u_colors_count,L)}}i.clearColor(this._backgroundColorRgb[0],this._backgroundColorRgb[1],this._backgroundColorRgb[2],this._backgroundAlpha),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT),this._wireframe?(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.glState.buffers.wireframeIndex),i.drawElements(i.LINES,this.glState.wireframeIndexCount,W,0),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index)):i.drawElements(i.TRIANGLES,O,W,0),this.requestRef=requestAnimationFrame(J)},We=()=>{const{gl:i,camera:N}=this.glState,o=this._ref.clientWidth,O=this._ref.clientHeight;this._ref.width=o,this._ref.height=O,i.viewport(0,0,o,O),j(N,o,O);const W=i.getUniformLocation(this.glState.program,"projectionMatrix");i.useProgram(this.glState.program),i.uniformMatrix4fv(W,!1,N.projectionMatrix.elements)};this.sizeObserver=new ResizeObserver(()=>{this._resizeTimeoutId!==null&&clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(()=>{We(),this._resizeTimeoutId=null},100)}),this.sizeObserver.observe(r),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 r=this._ref.toDataURL("image/png");_e(r,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(r=>this._hexToRgb(r.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 r=this.glState.gl;r.deleteProgram(this.glState.program),r.deleteBuffer(this.glState.buffers.position),r.deleteBuffer(this.glState.buffers.normal),r.deleteBuffer(this.glState.buffers.uv),r.deleteBuffer(this.glState.buffers.index),r.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 r=parseInt(e.replace("#",""),16);return[(r>>16&255)/255,(r>>8&255)/255,(r&255)/255]}_initScene(e){const r=this._ref.clientWidth,s=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,r,s);const{position:S,normal:y,uv:a,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,S,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,a,t.STATIC_DRAW);const b=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,b),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,b);const E=ie()+`
|
|
400
485
|
`+V()+`
|
|
401
|
-
`+
|
|
402
|
-
|
|
486
|
+
`+X()+`
|
|
487
|
+
`+I,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(`
|
|
488
|
+
`).map((w,B)=>`${B+1}: ${w}`).join(`
|
|
403
489
|
`)),console.log("VERTEX_SHADER_ERROR_END"));const A=re()+`
|
|
490
|
+
`+X()+`
|
|
404
491
|
`+V()+`
|
|
405
|
-
`+
|
|
406
|
-
|
|
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"}})});
|
|
492
|
+
`+te,_=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(_,A),t.compileShader(_),t.getShaderParameter(_,t.COMPILE_STATUS)||(console.log("FRAGMENT_SHADER_ERROR_START"),console.log("Fragment shader error: ",t.getShaderInfoLog(_)),console.log("GL Error Code:",t.getError()),console.log("Fragment Shader Source Dump:"),console.log(A.split(`
|
|
493
|
+
`).map((w,B)=>`${B+1}: ${w}`).join(`
|
|
494
|
+
`)),console.log("FRAGMENT_SHADER_ERROR_END"));const u=t.createProgram();t.attachShader(u,g),t.attachShader(u,_),t.linkProgram(u),t.getProgramParameter(u,t.LINK_STATUS)||(console.log("PROGRAM_LINK_ERROR_START"),console.log("Program linking error: ",t.getProgramInfoLog(u)),console.log("GL Error Code:",t.getError()),console.log("PROGRAM_LINK_ERROR_END")),t.useProgram(u);const m=new oe(0,0,0,0,0,1e3);m.position=[0,0,5],j(m,r,s);const n=t.getAttribLocation(u,"position"),f=t.getAttribLocation(u,"normal"),c=t.getAttribLocation(u,"uv");t.enableVertexAttribArray(n),t.bindBuffer(t.ARRAY_BUFFER,T),t.vertexAttribPointer(n,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(c),t.bindBuffer(t.ARRAY_BUFFER,h),t.vertexAttribPointer(c,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,b);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 C=t.getUniformLocation(u,"modelViewMatrix");t.uniformMatrix4fv(C,!1,d.elements);const D=t.getUniformLocation(u,"projectionMatrix");t.uniformMatrix4fv(D,!1,m.projectionMatrix.elements);const M=t.getUniformLocation(u,"u_plane_width");t.uniform1f(M,Y);const U=t.getUniformLocation(u,"u_plane_height");t.uniform1f(U,H);const k=t.getUniformLocation(u,"u_colors_count");t.uniform1i(k,L);const q=["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","u_domain_warp_enabled","u_domain_warp_intensity","u_domain_warp_scale","u_vignette_intensity","u_vignette_radius","u_fresnel_enabled","u_fresnel_power","u_fresnel_intensity","u_fresnel_color","u_iridescence_enabled","u_iridescence_intensity","u_iridescence_speed","u_bloom_intensity","u_bloom_threshold","u_chromatic_aberration"],z={attributes:{position:n,normal:f,uv:c},uniforms:{}};q.forEach(w=>{z.uniforms[w]=t.getUniformLocation(u,w)});for(let w=0;w<L;w++)z.uniforms[`u_colors[${w}].is_active`]=t.getUniformLocation(u,`u_colors[${w}].is_active`),z.uniforms[`u_colors[${w}].color`]=t.getUniformLocation(u,`u_colors[${w}].color`),z.uniforms[`u_colors[${w}].influence`]=t.getUniformLocation(u,`u_colors[${w}].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:u,buffers:{position:T,normal:x,uv:h,index:b,wireframeIndex:R},locations:z,camera:m,indexCount:p.length,wireframeIndexCount:v.length,indexType:p instanceof Uint32Array?t.UNSIGNED_INT:t.UNSIGNED_SHORT}}_createProceduralTexture(e){const s=document.createElement("canvas");s.width=1024,s.height=1024;const t=s.getContext("2d",{willReadFrequently:!0});if(!t)return null;let S=this._textureSeed;const y=this._textureSeed;function a(){const n=Math.sin(S++)*1e4;return n-Math.floor(n)}const p=n=>{S=y+n},v=this._colors.filter(n=>n.enabled).map(n=>n.color);if(v.length===0)return null;function T(n){const f=parseInt(n.replace("#",""),16);return{r:f>>16&255,g:f>>8&255,b:f&255}}function x(n,f,c){return"#"+((1<<24)+(Math.round(n)<<16)+(Math.round(f)<<8)+Math.round(c)).toString(16).slice(1).padStart(6,"0")}const h=()=>{const n=v[Math.floor(a()*v.length)],f=v[Math.floor(a()*v.length)],c=a()*this._textureColorBlending,d=T(n),C=T(f),D=d.r+(C.r-d.r)*c,M=d.g+(C.g-d.g)*c,U=d.b+(C.b-d.b)*c;return x(D,M,U)},b=this._proceduralBackgroundColor||"#000000";t.fillStyle=b,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 n=0;n<this._textureShapeTriangles;n++){t.fillStyle=h(),t.beginPath();const f=a()*1024,c=a()*1024,d=100+a()*300;t.moveTo(f,c),t.lineTo(f+(a()-.5)*d,c+(a()-.5)*d),t.lineTo(f+(a()-.5)*d,c+(a()-.5)*d),t.fill()}for(let n=0;n<this._textureShapeCircles;n++){t.strokeStyle=h(),t.lineWidth=10+a()*50,t.beginPath();const f=a()*1024,c=a()*1024,d=50+a()*150;t.arc(f,c,d,0,Math.PI*2),t.stroke()}for(let n=0;n<this._textureShapeBars;n++)t.fillStyle=h(),t.save(),t.translate(a()*1024,a()*1024),t.rotate(a()*Math.PI),t.fillRect(-150,-25,300,50),t.restore();t.lineWidth=15,t.lineCap="round";for(let n=0;n<this._textureShapeSquiggles;n++){t.strokeStyle=h(),t.beginPath();let f=a()*1024,c=a()*1024;t.moveTo(f,c);for(let d=0;d<4;d++)t.bezierCurveTo(f+(a()-.5)*300,c+(a()-.5)*300,f+(a()-.5)*300,c+(a()-.5)*300,f+(a()-.5)*300,c+(a()-.5)*300),f+=(a()-.5)*300,c+=(a()-.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=b,g.fillRect(0,0,1024,1024);let A=0;const _=[];for(;A<1024;)if(a()<this._textureVoidLikelihood){const f=this._textureVoidWidthMin+a()*(this._textureVoidWidthMax-this._textureVoidWidthMin);_.push({type:"void",x:A,width:f}),A+=f}else{const f=50+a()*200;_.push({type:"matter",x:A,width:f}),A+=f}for(const n of _)if(n.type==="matter"){const f=n.x,c=Math.min(n.x+n.width,1024);let d=f;for(;d<c;){const C=(2+a()*20)/this._textureBandDensity,D=Math.floor(a()*1024);g.drawImage(s,D,0,C,1024,d,0,C,1024),d+=C}}const u=e.createTexture();e.bindTexture(e.TEXTURE_2D,u),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 n=e.getParameter(m.MAX_TEXTURE_MAX_ANISOTROPY_EXT);e.texParameterf(e.TEXTURE_2D,m.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,n))}return u}set domainWarpEnabled(e){this._domainWarpEnabled!==e&&(this._domainWarpEnabled=e,this._uniformsDirty=!0)}set domainWarpIntensity(e){this._domainWarpIntensity!==e&&(this._domainWarpIntensity=e,this._uniformsDirty=!0)}set domainWarpScale(e){this._domainWarpScale!==e&&(this._domainWarpScale=e,this._uniformsDirty=!0)}set vignetteIntensity(e){this._vignetteIntensity!==e&&(this._vignetteIntensity=e,this._uniformsDirty=!0)}set vignetteRadius(e){this._vignetteRadius!==e&&(this._vignetteRadius=e,this._uniformsDirty=!0)}set fresnelEnabled(e){this._fresnelEnabled!==e&&(this._fresnelEnabled=e,this._uniformsDirty=!0)}set fresnelPower(e){this._fresnelPower!==e&&(this._fresnelPower=e,this._uniformsDirty=!0)}set fresnelIntensity(e){this._fresnelIntensity!==e&&(this._fresnelIntensity=e,this._uniformsDirty=!0)}set fresnelColor(e){this._fresnelColor!==e&&(this._fresnelColor=e,this._fresnelColorRgb=this._hexToRgb(e),this._uniformsDirty=!0)}set iridescenceEnabled(e){this._iridescenceEnabled!==e&&(this._iridescenceEnabled=e,this._uniformsDirty=!0)}set iridescenceIntensity(e){this._iridescenceIntensity!==e&&(this._iridescenceIntensity=e,this._uniformsDirty=!0)}set iridescenceSpeed(e){this._iridescenceSpeed!==e&&(this._iridescenceSpeed=e,this._uniformsDirty=!0)}set bloomIntensity(e){this._bloomIntensity!==e&&(this._bloomIntensity=e,this._uniformsDirty=!0)}set bloomThreshold(e){this._bloomThreshold!==e&&(this._bloomThreshold=e,this._uniformsDirty=!0)}set chromaticAberration(e){this._chromaticAberration!==e&&(this._chromaticAberration=e,this._uniformsDirty=!0)}}const $=l=>{l.id=ne,l.href="https://neat.firecms.co",l.target="_blank",l.style.position="absolute",l.style.display="block",l.style.bottom="0",l.style.right="0",l.style.padding="10px",l.style.color="#dcdcdc",l.style.opacity="0.8",l.style.fontFamily="sans-serif",l.style.fontSize="16px",l.style.fontWeight="bold",l.style.textDecoration="none",l.style.zIndex="10000",l.style.pointerEvents="auto",l.setAttribute("data-n","1"),l.innerHTML="NEAT"},le=l=>{const e=l.parentElement;if(e&&getComputedStyle(e).position==="static"&&(e.style.position="relative"),e){const s=e.querySelector("a[data-n]");if(s)return $(s),s}const r=document.createElement("a");return $(r),e?.appendChild(r),r};function ue(){const l=new Date,e=l.getMinutes(),r=l.getSeconds();return e*60+r}function fe(l=6){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let r="";for(let s=0;s<l;s++){const t=Math.floor(Math.random()*e.length);r+=e.charAt(t)}return r}function _e(l,e){const r=document.createElement("a");r.download=e,r.href=l,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function ce(){if(document.getElementById("neat-seo-schema"))return;const l=document.createElement("script");l.id="neat-seo-schema",l.type="application/ld+json",l.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(l);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 r=e.attachShadow({mode:"closed"}),s=document.createElement("a");s.href="https://firecms.co",s.textContent="FireCMS",r.appendChild(s)}catch{const s=document.createElement("a");s.href="https://firecms.co",s.textContent="FireCMS",e.appendChild(s)}document.body.appendChild(e)}F.NeatGradient=ae,Object.defineProperties(F,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
409
495
|
//# sourceMappingURL=index.umd.js.map
|