@firecms/neat 0.9.0 → 0.9.2
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/dist/NeatGradient.d.ts +8 -0
- package/dist/NeatGradient.js +73 -7
- package/dist/NeatGradient.js.map +1 -1
- package/dist/index.es.js +315 -285
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +31 -29
- package/dist/index.umd.js.map +1 -1
- package/dist/math.d.ts +1 -0
- package/dist/math.js +20 -0
- package/dist/math.js.map +1 -1
- package/dist/shaders.d.ts +2 -2
- package/dist/shaders.js +19 -17
- package/dist/shaders.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +4 -1
- package/src/NeatGradient.ts +77 -6
- package/src/math.ts +8 -0
- package/src/shaders.ts +19 -17
- package/src/types.ts +1 -0
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(k,
|
|
1
|
+
(function(k,q){typeof exports=="object"&&typeof module<"u"?q(exports):typeof define=="function"&&define.amd?define(["exports"],q):(k=typeof globalThis<"u"?globalThis:k||self,q(k.neat={}))})(this,function(k){"use strict";const q=`void main() {
|
|
2
2
|
vUv = uv;
|
|
3
3
|
vPosition = position;
|
|
4
4
|
float waveOffset = -u_y_offset * u_y_offset_wave_multiplier;
|
|
@@ -26,7 +26,7 @@ flowUv = mix(baseUv, vec2(baseUv.x * (1.0 - u_flow_ease) + r * u_flow_ease, base
|
|
|
26
26
|
vFlowUv = flowUv;
|
|
27
27
|
vec3 color = u_colors[0].color;
|
|
28
28
|
vec3 distortedPos = position;
|
|
29
|
-
if (
|
|
29
|
+
if (u_flat_shading < 0.5) {
|
|
30
30
|
if (u_flow_enabled > 0.5) {
|
|
31
31
|
if (u_flow_ease > 0.0 || u_flow_distortion_a > 0.0) {
|
|
32
32
|
vec3 ppp = position / 25.0;
|
|
@@ -44,7 +44,7 @@ position.z * (1.0 - u_flow_ease) + r * u_flow_ease * 25.0
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
vec3 noise_cord;
|
|
47
|
-
if (
|
|
47
|
+
if (u_flat_shading < 0.5) {
|
|
48
48
|
noise_cord = vec3(distortedPos.x / 50.0, (distortedPos.y + colorOffset) / 50.0, distortedPos.z / 50.0);
|
|
49
49
|
} else {
|
|
50
50
|
vec2 adjustedUv = flowUv;
|
|
@@ -60,7 +60,7 @@ float noiseFlow = (1. + float(i)) / 30.;
|
|
|
60
60
|
float noiseSpeed = (1. + float(i)) * 0.11;
|
|
61
61
|
float noiseSeed = 13. + float(i) * 7.;
|
|
62
62
|
float noise_z = u_time * noiseSpeed;
|
|
63
|
-
if (
|
|
63
|
+
if (u_flat_shading < 0.5) {
|
|
64
64
|
noise_z = noise_cord.z * u_color_pressure.x * u_color_pressure.x + u_time * noiseSpeed;
|
|
65
65
|
}
|
|
66
66
|
float noise = snoise(
|
|
@@ -89,7 +89,7 @@ float fbm(vec3 x) {
|
|
|
89
89
|
float value = 0.0;
|
|
90
90
|
float amplitude = 0.5;
|
|
91
91
|
float frequency = 1.0;
|
|
92
|
-
for (int i = 0; i <
|
|
92
|
+
for (int i = 0; i < 2; i++) {
|
|
93
93
|
value += amplitude * snoise(x * frequency);
|
|
94
94
|
frequency *= 2.0;
|
|
95
95
|
amplitude *= 0.5;
|
|
@@ -105,7 +105,7 @@ vec2 finalUv = vFlowUv;
|
|
|
105
105
|
vec3 baseColor;
|
|
106
106
|
float texAlpha = 1.0;
|
|
107
107
|
if (u_enable_procedural_texture > 0.5) {
|
|
108
|
-
if (
|
|
108
|
+
if (u_flat_shading < 0.5) {
|
|
109
109
|
float parallaxFactor = 0.25;
|
|
110
110
|
float scrollOffset = (u_y_offset * u_y_offset_color_multiplier) * parallaxFactor;
|
|
111
111
|
vec3 scrolledPos = vPosition;
|
|
@@ -114,9 +114,9 @@ vec3 p = (scrolledPos * 1.5) / 50.0;
|
|
|
114
114
|
vec2 uvX = p.yz + vec2(0.5);
|
|
115
115
|
vec2 uvY = p.zx + vec2(0.5);
|
|
116
116
|
vec2 uvZ = p.xy + vec2(0.5);
|
|
117
|
-
vec4 colX = texture2D(u_procedural_texture,
|
|
118
|
-
vec4 colY = texture2D(u_procedural_texture,
|
|
119
|
-
vec4 colZ = texture2D(u_procedural_texture,
|
|
117
|
+
vec4 colX = texture2D(u_procedural_texture, uvX);
|
|
118
|
+
vec4 colY = texture2D(u_procedural_texture, uvY);
|
|
119
|
+
vec4 colZ = texture2D(u_procedural_texture, uvZ);
|
|
120
120
|
vec3 n = normalize(vNormal);
|
|
121
121
|
vec3 blendWeights = abs(n);
|
|
122
122
|
blendWeights = blendWeights / (blendWeights.x + blendWeights.y + blendWeights.z + 0.0001);
|
|
@@ -138,7 +138,7 @@ vec2 texUv = vec2(vx, vy);
|
|
|
138
138
|
float parallaxFactor = 0.25;
|
|
139
139
|
texUv.y -= (u_y_offset * u_y_offset_color_multiplier / u_plane_height) * parallaxFactor;
|
|
140
140
|
texUv *= 1.5;
|
|
141
|
-
vec4 texSample = texture2D(u_procedural_texture,
|
|
141
|
+
vec4 texSample = texture2D(u_procedural_texture, texUv);
|
|
142
142
|
baseColor = texSample.rgb;
|
|
143
143
|
if (u_transparent_texture_void > 0.5) {
|
|
144
144
|
texAlpha = texSample.a;
|
|
@@ -150,7 +150,7 @@ baseColor = v_color;
|
|
|
150
150
|
vec3 color = baseColor;
|
|
151
151
|
if (u_domain_warp_enabled > 0.5) {
|
|
152
152
|
vec3 p;
|
|
153
|
-
if (
|
|
153
|
+
if (u_flat_shading < 0.5) {
|
|
154
154
|
p = vec3((vPosition / 50.0 + vec3(0.5)) * u_domain_warp_scale);
|
|
155
155
|
p.z += u_time * 0.15;
|
|
156
156
|
} else {
|
|
@@ -179,7 +179,7 @@ vec3 lightDir = normalize(vec3(1.0, 1.0, 1.0));
|
|
|
179
179
|
float diffuse = max(dot(normal, lightDir), 0.0);
|
|
180
180
|
vec3 halfDir = normalize(lightDir + viewDir);
|
|
181
181
|
float specular = pow(max(dot(normal, halfDir), 0.0), 32.0);
|
|
182
|
-
if (
|
|
182
|
+
if (u_flat_shading > 0.5) {
|
|
183
183
|
color += v_displacement_amount * u_highlights;
|
|
184
184
|
float heightShadow = 1.0 - v_displacement_amount;
|
|
185
185
|
color -= heightShadow * heightShadow * u_shadows;
|
|
@@ -204,7 +204,7 @@ color += u_fresnel_color * fresnel * u_fresnel_intensity;
|
|
|
204
204
|
}
|
|
205
205
|
if (u_vignette_intensity > 0.0) {
|
|
206
206
|
vec2 vigUv = vUv;
|
|
207
|
-
if (
|
|
207
|
+
if (u_flat_shading < 0.5) {
|
|
208
208
|
vigUv = (v_new_position.xy / v_new_position.w) * 0.5 + vec2(0.5);
|
|
209
209
|
}
|
|
210
210
|
float dist = length(vigUv - vec2(0.5));
|
|
@@ -219,7 +219,7 @@ color += color * bloomMask * u_bloom_intensity;
|
|
|
219
219
|
if (u_chromatic_aberration > 0.0) {
|
|
220
220
|
float caAmount = u_chromatic_aberration * 0.008;
|
|
221
221
|
vec2 caUv = vUv;
|
|
222
|
-
if (
|
|
222
|
+
if (u_flat_shading < 0.5) {
|
|
223
223
|
caUv = (v_new_position.xy / v_new_position.w) * 0.5 + vec2(0.5);
|
|
224
224
|
}
|
|
225
225
|
float dist = length(caUv - vec2(0.5));
|
|
@@ -231,7 +231,7 @@ color.b *= 1.0 - bShift * caAmount * 10.0;
|
|
|
231
231
|
float grain = 0.0;
|
|
232
232
|
if (u_grain_intensity > 0.0) {
|
|
233
233
|
vec2 noiseCoords = gl_FragCoord.xy / u_grain_scale;
|
|
234
|
-
if (u_grain_speed != 0.0 ||
|
|
234
|
+
if (u_grain_speed != 0.0 || u_flat_shading > 0.5) {
|
|
235
235
|
grain = fbm(vec3(noiseCoords, u_time * u_grain_speed));
|
|
236
236
|
} else {
|
|
237
237
|
grain = random(noiseCoords) - 0.5;
|
|
@@ -243,7 +243,7 @@ grain *= u_grain_intensity;
|
|
|
243
243
|
}
|
|
244
244
|
color += vec3(grain);
|
|
245
245
|
float edgeAlpha = 1.0;
|
|
246
|
-
if (
|
|
246
|
+
if (u_silhouette_fade > 0.0 && u_flat_shading < 0.5) {
|
|
247
247
|
edgeAlpha = smoothstep(0.0, u_silhouette_fade, ndotv);
|
|
248
248
|
}
|
|
249
249
|
if (u_shape_type == 3.0) {
|
|
@@ -299,7 +299,8 @@ uniform float u_fresnel_enabled;
|
|
|
299
299
|
uniform float u_fresnel_power;
|
|
300
300
|
uniform float u_fresnel_intensity;
|
|
301
301
|
uniform vec3 u_fresnel_color;
|
|
302
|
-
uniform float u_shape_type
|
|
302
|
+
uniform float u_shape_type;
|
|
303
|
+
uniform float u_flat_shading;`}function ge(){return`precision highp float;
|
|
303
304
|
varying vec2 vUv;
|
|
304
305
|
varying vec2 vFlowUv;
|
|
305
306
|
varying vec4 v_new_position;
|
|
@@ -346,7 +347,8 @@ uniform float u_shape_type;
|
|
|
346
347
|
uniform float u_transparent_texture_void;
|
|
347
348
|
uniform float u_silhouette_fade;
|
|
348
349
|
uniform float u_cylinder_fade;
|
|
349
|
-
uniform float u_ribbon_fade
|
|
350
|
+
uniform float u_ribbon_fade;
|
|
351
|
+
uniform float u_flat_shading;`}function te(){return`vec4 permute(vec4 x) {
|
|
350
352
|
return floor(fract(sin(x) * 43758.5453123) * 289.0);
|
|
351
353
|
}
|
|
352
354
|
vec4 taylorInvSqrt(vec4 r) {
|
|
@@ -458,24 +460,24 @@ vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_
|
|
|
458
460
|
vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
|
|
459
461
|
float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
|
|
460
462
|
return 2.2 * n_xyz;
|
|
461
|
-
}`}function
|
|
463
|
+
}`}function ie(){return`vec3 saturation(vec3 rgb, float adjustment) {
|
|
462
464
|
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
|
463
465
|
vec3 intensity = vec3(dot(rgb, W));
|
|
464
466
|
return mix(intensity, rgb, adjustment);
|
|
465
|
-
}`}class
|
|
467
|
+
}`}class se{elements;constructor(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}identity(){const e=this.elements;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}translate(e,i,r){return this.elements[12]+=this.elements[0]*e+this.elements[4]*i+this.elements[8]*r,this.elements[13]+=this.elements[1]*e+this.elements[5]*i+this.elements[9]*r,this.elements[14]+=this.elements[2]*e+this.elements[6]*i+this.elements[10]*r,this.elements[15]+=this.elements[3]*e+this.elements[7]*i+this.elements[11]*r,this}rotateX(e){const i=Math.cos(e),r=Math.sin(e),t=this.elements[4],y=this.elements[5],v=this.elements[6],s=this.elements[7],l=this.elements[8],_=this.elements[9],b=this.elements[10],a=this.elements[11];return this.elements[4]=i*t+r*l,this.elements[5]=i*y+r*_,this.elements[6]=i*v+r*b,this.elements[7]=i*s+r*a,this.elements[8]=i*l-r*t,this.elements[9]=i*_-r*y,this.elements[10]=i*b-r*v,this.elements[11]=i*a-r*s,this}rotateY(e){const i=Math.cos(e),r=Math.sin(e),t=this.elements[0],y=this.elements[1],v=this.elements[2],s=this.elements[3],l=this.elements[8],_=this.elements[9],b=this.elements[10],a=this.elements[11];return this.elements[0]=i*t-r*l,this.elements[1]=i*y-r*_,this.elements[2]=i*v-r*b,this.elements[3]=i*s-r*a,this.elements[8]=r*t+i*l,this.elements[9]=r*y+i*_,this.elements[10]=r*v+i*b,this.elements[11]=r*s+i*a,this}rotateZ(e){const i=Math.cos(e),r=Math.sin(e),t=this.elements[0],y=this.elements[1],v=this.elements[2],s=this.elements[3],l=this.elements[4],_=this.elements[5],b=this.elements[6],a=this.elements[7];return this.elements[0]=i*t+r*l,this.elements[1]=i*y+r*_,this.elements[2]=i*v+r*b,this.elements[3]=i*s+r*a,this.elements[4]=-r*t+i*l,this.elements[5]=-r*y+i*_,this.elements[6]=-r*v+i*b,this.elements[7]=-r*s+i*a,this}}class ye{left;right;top;bottom;near;far;position;projectionMatrix;zoom;constructor(e,i,r,t,y,v){this.left=e,this.right=i,this.top=r,this.bottom=t,this.near=y,this.far=v,this.position=[0,0,0],this.zoom=1,this.projectionMatrix=new se,this.updateProjectionMatrix()}updateProjectionMatrix(){const e=1/(this.right-this.left),i=1/(this.top-this.bottom),r=1/(this.far-this.near),t=(this.right+this.left)*e,y=(this.top+this.bottom)*i,v=(this.far+this.near)*r;this.projectionMatrix.elements=new Float32Array([2*e,0,0,0,0,2*i,0,0,0,0,-2*r,0,-t,-y,-v,1])}}function H(n,e,i,r=50,t=50,y="plane",v=1){n.zoom=v;const s=e/i;if(y==="plane"){const b=e*i/1e6*r*t/1.5,a=Math.sqrt(b*s),h=b/a;let p=-r/2,c=Math.min((p+a)/1.5,r/2),d=t/4,R=Math.max((d-h)/2,-t/4);if(s<1){const g=s;p=p*g,c=c*g;const x=1.05;p=p*x,c=c*x,d=d*x,R=R*x}n.left=p,n.right=c,n.top=d,n.bottom=R}else{let l=25;if(y==="sphere"?l=30:y==="torus"?l=35:y==="cylinder"&&(l=30),s>=1)n.left=-l*s,n.right=l*s,n.top=l,n.bottom=-l;else{n.left=-l,n.right=l,n.top=l/s,n.bottom=-l/s;const _=1.05;n.left*=_,n.right*=_,n.top*=_,n.bottom*=_}}n.left/=v,n.right/=v,n.top/=v,n.bottom/=v,n.near=-100,n.far=1e3,n.updateProjectionMatrix()}function re(n,e,i,r){const t=n/2,y=e/2,v=Math.floor(i),s=Math.floor(r),l=v+1,_=s+1,b=n/v,a=e/s,h=[],p=[],c=[],d=[];for(let x=0;x<_;x++){const w=x*a-y;for(let u=0;u<l;u++){const T=u*b-t;p.push(T,-w,0),c.push(0,0,1),d.push(u/v),d.push(1-x/s)}}for(let x=0;x<s;x++)for(let w=0;w<v;w++){const u=w+l*x,T=w+l*(x+1),A=w+1+l*(x+1),D=w+1+l*x;h.push(u,T,D),h.push(T,A,D)}const R=p.length/3>65535,g=[];for(let x=0;x<h.length;x+=3){const w=h[x],u=h[x+1],T=h[x+2];g.push(w,u,u,T,T,w)}return{position:new Float32Array(p),normal:new Float32Array(c),uv:new Float32Array(d),index:R?new Uint32Array(h):new Uint16Array(h),wireframeIndex:R?new Uint32Array(g):new Uint16Array(g)}}function oe(n,e,i){const r=[],t=[],y=[],v=[],s=Math.floor(e),l=Math.floor(i);for(let a=0;a<=l;a++){const h=a/l,p=h*Math.PI;for(let c=0;c<=s;c++){const d=c/s,R=d*Math.PI*2,g=-n*Math.sin(p)*Math.cos(R),x=n*Math.cos(p),w=n*Math.sin(p)*Math.sin(R);r.push(g,x,w);const u=Math.sqrt(g*g+x*x+w*w);t.push(g/u,x/u,w/u),y.push(d,1-h)}}for(let a=0;a<l;a++)for(let h=0;h<s;h++){const p=h+(s+1)*a,c=h+(s+1)*(a+1),d=h+1+(s+1)*(a+1),R=h+1+(s+1)*a;v.push(p,c,R),v.push(c,d,R)}const _=r.length/3>65535,b=[];for(let a=0;a<v.length;a+=3){const h=v[a],p=v[a+1],c=v[a+2];b.push(h,p,p,c,c,h)}return{position:new Float32Array(r),normal:new Float32Array(t),uv:new Float32Array(y),index:_?new Uint32Array(v):new Uint16Array(v),wireframeIndex:_?new Uint32Array(b):new Uint16Array(b)}}function ne(n,e,i,r){const t=[],y=[],v=[],s=[],l=Math.floor(i),_=Math.floor(r);for(let h=0;h<=l;h++){const p=h/l*Math.PI*2;for(let c=0;c<=_;c++){const d=c/_*Math.PI*2,R=(n+e*Math.cos(p))*Math.cos(d),g=(n+e*Math.cos(p))*Math.sin(d),x=e*Math.sin(p);t.push(R,g,x);const w=n*Math.cos(d),u=n*Math.sin(d),T=R-w,A=g-u,D=x,m=Math.sqrt(T*T+A*A+D*D);y.push(T/m,A/m,D/m),v.push(c/_,h/l)}}for(let h=1;h<=l;h++)for(let p=1;p<=_;p++){const c=(_+1)*h+p-1,d=(_+1)*(h-1)+p-1,R=(_+1)*(h-1)+p,g=(_+1)*h+p;s.push(c,d,g),s.push(d,R,g)}const b=t.length/3>65535,a=[];for(let h=0;h<s.length;h+=3){const p=s[h],c=s[h+1],d=s[h+2];a.push(p,c,c,d,d,p)}return{position:new Float32Array(t),normal:new Float32Array(y),uv:new Float32Array(v),index:b?new Uint32Array(s):new Uint16Array(s),wireframeIndex:b?new Uint32Array(a):new Uint16Array(a)}}function ae(n,e,i,r,t){const y=[],v=[],s=[],l=[],_=Math.floor(r),b=Math.floor(t),a=i/2;for(let c=0;c<=b;c++){const d=c/b,R=d*i-a,g=d*(e-n)+n;for(let x=0;x<=_;x++){const w=x/_,u=w*Math.PI*2,T=Math.sin(u),A=Math.cos(u);y.push(g*T,-R,g*A),v.push(T,0,A),s.push(w,1-d)}}for(let c=0;c<b;c++)for(let d=0;d<_;d++){const R=d+(_+1)*c,g=d+(_+1)*(c+1),x=d+1+(_+1)*(c+1),w=d+1+(_+1)*c;l.push(R,g,w),l.push(g,x,w)}const h=y.length/3>65535,p=[];for(let c=0;c<l.length;c+=3){const d=l[c],R=l[c+1],g=l[c+2];p.push(d,R,R,g,g,d)}return{position:new Float32Array(y),normal:new Float32Array(v),uv:new Float32Array(s),index:h?new Uint32Array(l):new Uint16Array(l),wireframeIndex:h?new Uint32Array(p):new Uint16Array(p)}}function le(n,e,i,r,t,y){const v=n/2,s=e/2,l=Math.floor(i),_=Math.floor(r),b=l+1,a=_+1,h=n/l,p=e/_,c=[],d=[],R=[],g=[];for(let u=0;u<a;u++){const T=u*p-s;for(let A=0;A<b;A++){const D=A*h-v;let m=D,F=T,C=0,z=0,M=0,P=1;if(Math.abs(t)>.001){const E=n/t,S=D/E;m=E*Math.sin(S),C=E*(1-Math.cos(S)),z=Math.sin(S),P=Math.cos(S)}if(Math.abs(y)>.001){const E=T/e*y,S=Math.cos(E),U=Math.sin(E),B=m*S-C*U,O=m*U+C*S;m=B,C=O;const I=z*S-P*U,Y=z*U+P*S;z=I,P=Y}c.push(m,-F,C),d.push(z,M,P),R.push(A/l),R.push(1-u/_)}}for(let u=0;u<_;u++)for(let T=0;T<l;T++){const A=T+b*u,D=T+b*(u+1),m=T+1+b*(u+1),F=T+1+b*u;g.push(A,D,F),g.push(D,m,F)}const x=c.length/3>65535,w=[];for(let u=0;u<g.length;u+=3){const T=g[u],A=g[u+1],D=g[u+2];w.push(T,A,A,D,D,T)}return{position:new Float32Array(c),normal:new Float32Array(d),uv:new Float32Array(R),index:x?new Uint32Array(g):new Uint16Array(g),wireframeIndex:x?new Uint32Array(w):new Uint16Array(w)}}console.info(`%c\u{1F308} Neat Gradients%c
|
|
466
468
|
|
|
467
469
|
Licensed under MIT + The Commons Clause.
|
|
468
470
|
Free for personal and commercial use.
|
|
469
471
|
Selling this software or its derivatives is strictly prohibited.
|
|
470
|
-
https://neat.firecms.co`,"font-weight: bold; font-size: 14px; color: #FF5772;","color: inherit;");const X=50,O=80,j=6,xe=Se();class ve{_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;_resolution=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;_transparentTextureVoid=!1;_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;_silhouetteFade=.25;_cylinderFade=.08;_ribbonFade=.05;_shapeType="plane";_shapeRotationX=0;_shapeRotationY=0;_shapeRotationZ=0;_shapeAutoRotateSpeedX=0;_shapeAutoRotateSpeedY=0;_sphereRadius=15;_torusRadius=15;_torusTube=5;_cylinderRadius=10;_cylinderHeight=40;_planeBend=0;_planeTwist=0;_cameraLock=!1;_cameraX=0;_cameraY=0;_cameraZ=0;_cameraRotationX=0;_cameraRotationY=0;_cameraRotationZ=0;_cameraZoom=1;_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;_sourceCanvas=null;_sourceCtx=null;_maskedCanvas=null;_maskedCtx=null;_resizeTimeoutId=null;_textureNeedsUpdate=!1;_linkCheckCounter=0;_colorsChanged=!0;_uniformsDirty=!0;_textureDirty=!0;constructor(e){const{ref:i,speed:r=4,horizontalPressure:t=3,verticalPressure:y=3,waveFrequencyX:x=5,waveFrequencyY:o=5,waveAmplitude:l=3,colors:_,highlights:b=4,shadows:a=4,colorSaturation:h=0,colorBrightness:p=1,colorBlending:c=5,grainScale:f=2,grainIntensity:R=.55,grainSparsity:g=0,grainSpeed:v=.1,wireframe:w=!1,backgroundColor:u="#FFFFFF",backgroundAlpha:T=1,resolution:A=1,seed:M,yOffset:m=0,yOffsetWaveMultiplier:F=4,yOffsetColorMultiplier:D=4,yOffsetFlowMultiplier:z=4,flowDistortionA:C=0,flowDistortionB:P=0,flowScale:E=1,flowEase:S=0,flowEnabled:U=!0,enableProceduralTexture:B=!1,textureVoidLikelihood:W=.45,textureVoidWidthMin:I=200,textureVoidWidthMax:Y=486,textureBandDensity:Te=2.15,textureColorBlending:Ee=.01,textureSeed:Ae=333,textureEase:Fe=.5,proceduralBackgroundColor:ze="#000000",transparentTextureVoid:Me=!1,textureShapeTriangles:Ce=20,textureShapeCircles:De=15,textureShapeBars:Pe=15,textureShapeSquiggles:Ue=10,domainWarpEnabled:Ie=!1,domainWarpIntensity:Be=.5,domainWarpScale:Le=1,vignetteIntensity:We=0,vignetteRadius:Ne=.8,fresnelEnabled:Xe=!1,fresnelPower:Oe=2,fresnelIntensity:Ye=.5,fresnelColor:ke="#FFFFFF",iridescenceEnabled:Ve=!1,iridescenceIntensity:qe=.5,iridescenceSpeed:Ze=1,bloomIntensity:Ge=0,bloomThreshold:je=.7,chromaticAberration:He=0,silhouetteFade:$e=.25,cylinderFade:Ke=.08,ribbonFade:Je=.05,cameraLock:Qe=!1,cameraX:et=0,cameraY:tt=0,cameraZ:it=0,cameraRotationX:ot=0,cameraRotationY:rt=0,cameraRotationZ:st=0,cameraZoom:nt=1,shapeType:at="plane",shapeRotationX:lt=0,shapeRotationY:ut=0,shapeRotationZ:_t=0,shapeAutoRotateSpeedX:ct=0,shapeAutoRotateSpeedY:ht=0,sphereRadius:ft=15,torusRadius:dt=15,torusTube:mt=5,cylinderRadius:pt=10,cylinderHeight:gt=40,planeBend:yt=0,planeTwist:xt=0}=e;this._ref=i,this.destroy=this.destroy.bind(this),this._initScene=this._initScene.bind(this),this.speed=r,this.horizontalPressure=t,this.verticalPressure=y,this.waveFrequencyX=x,this.waveFrequencyY=o,this.waveAmplitude=l,this.colorBlending=c,this._resolution=A,this.grainScale=f,this.grainIntensity=R,this.grainSparsity=g,this.grainSpeed=v,this.colors=_,this.shadows=a,this.highlights=b,this.colorSaturation=h,this.colorBrightness=p,this.wireframe=w,this.backgroundColor=u,this.backgroundAlpha=T,this.yOffset=m,this.yOffsetWaveMultiplier=F,this.yOffsetColorMultiplier=D,this.yOffsetFlowMultiplier=z,this.flowDistortionA=C,this.flowDistortionB=P,this.flowScale=E,this.flowEase=S,this.flowEnabled=U,this.enableProceduralTexture=B,this.textureVoidLikelihood=W,this.textureVoidWidthMin=I,this.textureVoidWidthMax=Y,this.textureBandDensity=Te,this.textureColorBlending=Ee,this.textureSeed=Ae,this.textureEase=Fe,this._proceduralBackgroundColor=ze,this.transparentTextureVoid=Me,this._textureShapeTriangles=Ce,this._textureShapeCircles=De,this._textureShapeBars=Pe,this._textureShapeSquiggles=Ue,this.domainWarpEnabled=Ie,this.domainWarpIntensity=Be,this.domainWarpScale=Le,this.vignetteIntensity=We,this.vignetteRadius=Ne,this.fresnelEnabled=Xe,this.fresnelPower=Oe,this.fresnelIntensity=Ye,this.fresnelColor=ke,this.iridescenceEnabled=Ve,this.iridescenceIntensity=qe,this.iridescenceSpeed=Ze,this.bloomIntensity=Ge,this.bloomThreshold=je,this.chromaticAberration=He,this.silhouetteFade=$e,this.cylinderFade=Ke,this.ribbonFade=Je,this._cameraLock=Qe,this._cameraX=et,this._cameraY=tt,this._cameraZ=it,this._cameraRotationX=ot,this._cameraRotationY=rt,this._cameraRotationZ=st,this._cameraZoom=nt,this._shapeType=at,this._shapeRotationX=lt,this._shapeRotationY=ut,this._shapeRotationZ=_t,this._shapeAutoRotateSpeedX=ct,this._shapeAutoRotateSpeedY=ht,this._sphereRadius=ft,this._torusRadius=dt,this._torusTube=mt,this._cylinderRadius=pt,this._cylinderHeight=gt,this._planeBend=yt,this._planeTwist=xt,this.glState=this._initScene(A),Re();let H=M!==void 0?M:we(),ue=performance.now();const _e=()=>{const{gl:n,program:$,locations:d,indexCount:q,indexType:Z}=this.glState;if(this._linkCheckCounter++,this._linkCheckCounter>=300&&(this._linkCheckCounter=0,(!this._linkElement||!document.contains(this._linkElement))&&(this._linkElement=be(i))),this._initialized){const ce=performance.now();H+=(ce-ue)/1e3*this._speed,ue=ce,n.useProgram($),n.uniform1f(d.uniforms.u_time,H);const K=this.glState.camera,N=new te;N.translate(-K.position[0]-this._cameraX,-K.position[1]-this._cameraY,-K.position[2]-this._cameraZ),N.translate(0,0,-1),N.rotateX(-this._cameraRotationX),N.rotateY(-this._cameraRotationY),N.rotateZ(-this._cameraRotationZ);let J=this._shapeRotationX,he=this._shapeRotationY,bt=this._shapeRotationZ;this._shapeAutoRotateSpeedX!==0&&(J+=H*this._shapeAutoRotateSpeedX*.1),this._shapeAutoRotateSpeedY!==0&&(he+=H*this._shapeAutoRotateSpeedY*.1),this._shapeType==="plane"||this._shapeType==="ribbon"?N.rotateX(J-Math.PI/3.5):N.rotateX(J),N.rotateY(he),N.rotateZ(bt);const fe=d.uniforms.modelViewMatrix;if(fe&&n.uniformMatrix4fv(fe,!1,N.elements),this._uniformsDirty){n.uniform2f(d.uniforms.u_resolution,this._ref.clientWidth,this._ref.clientHeight),n.uniform2f(d.uniforms.u_color_pressure,this._horizontalPressure,this._verticalPressure),n.uniform1f(d.uniforms.u_wave_frequency_x,this._waveFrequencyX),n.uniform1f(d.uniforms.u_wave_frequency_y,this._waveFrequencyY),n.uniform1f(d.uniforms.u_wave_amplitude,this._waveAmplitude),n.uniform1f(d.uniforms.u_color_blending,this._colorBlending),n.uniform1f(d.uniforms.u_shadows,this._shadows),n.uniform1f(d.uniforms.u_highlights,this._highlights),n.uniform1f(d.uniforms.u_saturation,this._saturation),n.uniform1f(d.uniforms.u_brightness,this._brightness),n.uniform1f(d.uniforms.u_grain_intensity,this._grainIntensity),n.uniform1f(d.uniforms.u_grain_sparsity,this._grainSparsity),n.uniform1f(d.uniforms.u_grain_speed,this._grainSpeed),n.uniform1f(d.uniforms.u_grain_scale,this._grainScale),n.uniform1f(d.uniforms.u_y_offset,this._yOffset),n.uniform1f(d.uniforms.u_y_offset_wave_multiplier,this._yOffsetWaveMultiplier),n.uniform1f(d.uniforms.u_y_offset_color_multiplier,this._yOffsetColorMultiplier),n.uniform1f(d.uniforms.u_y_offset_flow_multiplier,this._yOffsetFlowMultiplier),n.uniform1f(d.uniforms.u_flow_distortion_a,this._flowDistortionA),n.uniform1f(d.uniforms.u_flow_distortion_b,this._flowDistortionB),n.uniform1f(d.uniforms.u_flow_scale,this._flowScale),n.uniform1f(d.uniforms.u_flow_ease,this._flowEase),n.uniform1f(d.uniforms.u_flow_enabled,this._flowEnabled?1:0);let L=0;this._shapeType==="sphere"?L=1:this._shapeType==="torus"?L=2:this._shapeType==="cylinder"?L=3:this._shapeType==="ribbon"&&(L=4),n.uniform1f(d.uniforms.u_shape_type,L),n.uniform1f(d.uniforms.u_enable_procedural_texture,this._enableProceduralTexture?1:0),n.uniform1f(d.uniforms.u_texture_ease,this._textureEase),n.uniform1f(d.uniforms.u_transparent_texture_void,this._transparentTextureVoid?1:0),n.uniform1f(d.uniforms.u_domain_warp_enabled,this._domainWarpEnabled?1:0),n.uniform1f(d.uniforms.u_domain_warp_intensity,this._domainWarpIntensity),n.uniform1f(d.uniforms.u_domain_warp_scale,this._domainWarpScale),n.uniform1f(d.uniforms.u_vignette_intensity,this._vignetteIntensity),n.uniform1f(d.uniforms.u_vignette_radius,this._vignetteRadius),n.uniform1f(d.uniforms.u_fresnel_enabled,this._fresnelEnabled?1:0),n.uniform1f(d.uniforms.u_fresnel_power,this._fresnelPower),n.uniform1f(d.uniforms.u_fresnel_intensity,this._fresnelIntensity),n.uniform3fv(d.uniforms.u_fresnel_color,this._fresnelColorRgb),n.uniform1f(d.uniforms.u_iridescence_enabled,this._iridescenceEnabled?1:0),n.uniform1f(d.uniforms.u_iridescence_intensity,this._iridescenceIntensity),n.uniform1f(d.uniforms.u_iridescence_speed,this._iridescenceSpeed),n.uniform1f(d.uniforms.u_bloom_intensity,this._bloomIntensity),n.uniform1f(d.uniforms.u_bloom_threshold,this._bloomThreshold),n.uniform1f(d.uniforms.u_chromatic_aberration,this._chromaticAberration),n.uniform1f(d.uniforms.u_silhouette_fade,this._silhouetteFade),n.uniform1f(d.uniforms.u_cylinder_fade,this._cylinderFade),n.uniform1f(d.uniforms.u_ribbon_fade,this._ribbonFade),this._uniformsDirty=!1}if(this._textureNeedsUpdate&&this._enableProceduralTexture&&(this._proceduralTexture&&n.deleteTexture(this._proceduralTexture),this._proceduralTexture=this._createProceduralTexture(n),this._textureNeedsUpdate=!1,this._textureDirty=!0),this._textureDirty&&this._proceduralTexture&&(n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._proceduralTexture),n.uniform1i(d.uniforms.u_procedural_texture,1),this._textureDirty=!1),this._colorsChanged){this._colorsChanged=!1;for(let L=0;L<j;L++)if(L<this._colors.length){const de=this._colors[L],wt=this._cachedColorRgb[L]||[0,0,0];n.uniform1f(d.uniforms[`u_colors[${L}].is_active`],de.enabled?1:0),n.uniform3fv(d.uniforms[`u_colors[${L}].color`],wt),n.uniform1f(d.uniforms[`u_colors[${L}].influence`],de.influence||0)}else n.uniform1f(d.uniforms[`u_colors[${L}].is_active`],0);n.uniform1i(d.uniforms.u_colors_count,j)}}n.clearColor(this._backgroundColorRgb[0],this._backgroundColorRgb[1],this._backgroundColorRgb[2],this._backgroundAlpha),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),this._wireframe?(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,this.glState.buffers.wireframeIndex),n.drawElements(n.LINES,this.glState.wireframeIndexCount,Z,0),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index)):n.drawElements(n.TRIANGLES,q,Z,0),this.requestRef=requestAnimationFrame(_e)},vt=()=>{const{gl:n,camera:$}=this.glState,d=this._ref.clientWidth,q=this._ref.clientHeight;this._ref.width=d,this._ref.height=q,n.viewport(0,0,d,q),G($,d,q,X,O,this._shapeType,this._cameraZoom);const Z=this.glState.locations.uniforms.projectionMatrix;n.useProgram(this.glState.program),Z&&n.uniformMatrix4fv(Z,!1,$.projectionMatrix.elements)};this.sizeObserver=new ResizeObserver(()=>{this._resizeTimeoutId!==null&&clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(()=>{vt(),this._resizeTimeoutId=null},100)}),this.sizeObserver.observe(i),_e()}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");le(i,e)}recordVideo(e={}){const{durationMs:i=5e3,filename:r="neat.firecms.co",format:t,onProgress:y,onComplete:x}=e,o=this._ref,l=e.width||o.width||o.clientWidth,_=e.height||o.height||o.clientHeight,b=document.createElement("canvas");b.width=l,b.height=_;const a=b.getContext("2d"),h=b.captureStream(0),p=h.getVideoTracks()[0],c=["video/mp4;codecs=avc1","video/mp4;codecs=avc1,opus","video/mp4"],f=["video/webm;codecs=vp9,opus","video/webm;codecs=vp9","video/webm;codecs=vp8,opus","video/webm"];let R;t==="mp4"?R=[...c,...f]:t==="webm"?R=[...f,...c]:R=[...c,...f];let g="video/webm";for(const E of R)if(MediaRecorder.isTypeSupported(E)){g=E;break}const v=l*_,w=8e6,u=1280*720,T=Math.round(w*Math.max(1,v/u)),A=new MediaRecorder(h,{mimeType:g,videoBitsPerSecond:T}),M=[];A.ondataavailable=E=>{E.data.size>0&&M.push(E.data)};let m=!1,F;const D=performance.now();let z=0;const C=()=>{if(m)return;a.clearRect(0,0,l,_),a.drawImage(o,0,0,l,_);const E=Math.max(14,Math.round(_*.025));if(a.font=`bold ${E}px "Sofia Sans", sans-serif`,a.textAlign="right",a.textBaseline="bottom",a.shadowColor="rgba(0,0,0,0.5)",a.shadowBlur=4,a.shadowOffsetX=1,a.shadowOffsetY=1,a.fillStyle="rgba(255,255,255,0.7)",a.fillText("NEAT",l-E*.8,_-E*.5),a.shadowColor="transparent",a.shadowBlur=0,a.shadowOffsetX=0,a.shadowOffsetY=0,p.requestFrame&&p.requestFrame(),y){const S=performance.now();S-z>250&&(z=S,y(Math.min(.99,(S-D)/i)))}F=requestAnimationFrame(C)};A.onstop=()=>{m=!0,cancelAnimationFrame(F);const E=g.startsWith("video/mp4"),S=E?".mp4":".webm",U=E?"video/mp4":"video/webm",B=r+S,W=new Blob(M,{type:U}),I=URL.createObjectURL(W);le(I,B),setTimeout(()=>URL.revokeObjectURL(I),3e4),y?.(1),x?.()},C(),A.start(100);const P=window.setTimeout(()=>{A.state==="recording"&&A.stop()},i);return()=>{clearTimeout(P),A.state==="recording"&&A.stop()}}get speed(){return this._speed*20}set speed(e){this._uniformsDirty=!0,this._speed=e/20}get horizontalPressure(){return this._horizontalPressure*4}set horizontalPressure(e){this._uniformsDirty=!0,this._horizontalPressure=e/4}get verticalPressure(){return this._verticalPressure*4}set verticalPressure(e){this._uniformsDirty=!0,this._verticalPressure=e/4}get waveFrequencyX(){return this._waveFrequencyX/.04}set waveFrequencyX(e){this._uniformsDirty=!0,this._waveFrequencyX=e*.04}get waveFrequencyY(){return this._waveFrequencyY/.04}set waveFrequencyY(e){this._uniformsDirty=!0,this._waveFrequencyY=e*.04}get waveAmplitude(){return this._waveAmplitude/.75}set waveAmplitude(e){this._uniformsDirty=!0,this._waveAmplitude=e*.75}get colors(){return this._colors}set colors(e){this._uniformsDirty=!0,this._colors=e,this._cachedColorRgb=e.map(i=>this._hexToRgb(i.color)),this._colorsChanged=!0}get highlights(){return this._highlights*100}set highlights(e){this._uniformsDirty=!0,this._highlights=e/100}get shadows(){return this._shadows*100}set shadows(e){this._uniformsDirty=!0,this._shadows=e/100}get colorSaturation(){return this._saturation*10}set colorSaturation(e){this._uniformsDirty=!0,this._saturation=e/10}get colorBrightness(){return this._brightness}set colorBrightness(e){this._uniformsDirty=!0,this._brightness=e}get colorBlending(){return this._colorBlending*10}set colorBlending(e){this._uniformsDirty=!0,this._colorBlending=e/10}get grainScale(){return this._grainScale}set grainScale(e){this._uniformsDirty=!0,this._grainScale=e==0?1:e}get grainIntensity(){return this._grainIntensity}set grainIntensity(e){this._uniformsDirty=!0,this._grainIntensity=e}get grainSparsity(){return this._grainSparsity}set grainSparsity(e){this._uniformsDirty=!0,this._grainSparsity=e}get grainSpeed(){return this._grainSpeed}set grainSpeed(e){this._uniformsDirty=!0,this._grainSpeed=e}get wireframe(){return this._wireframe}set wireframe(e){this._uniformsDirty=!0,this._wireframe=e}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this._updateGeometry())}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._uniformsDirty=!0,this._backgroundColor=e,this._backgroundColorRgb=this._hexToRgb(e)}get backgroundAlpha(){return this._backgroundAlpha}set backgroundAlpha(e){this._uniformsDirty=!0,this._backgroundAlpha=e}get yOffset(){return this._yOffset}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}get flowDistortionA(){return this._flowDistortionA}set flowDistortionA(e){this._uniformsDirty=!0,this._flowDistortionA=e}get flowDistortionB(){return this._flowDistortionB}set flowDistortionB(e){this._uniformsDirty=!0,this._flowDistortionB=e}get flowScale(){return this._flowScale}set flowScale(e){this._uniformsDirty=!0,this._flowScale=e}get flowEase(){return this._flowEase}set flowEase(e){this._uniformsDirty=!0,this._flowEase=e}set flowEnabled(e){this._uniformsDirty=!0,this._flowEnabled=e}get flowEnabled(){return this._flowEnabled}get enableProceduralTexture(){return this._enableProceduralTexture}set enableProceduralTexture(e){this._uniformsDirty=!0,this._enableProceduralTexture=e,e&&!this._proceduralTexture&&(this._textureNeedsUpdate=!0)}get textureVoidLikelihood(){return this._textureVoidLikelihood}set textureVoidLikelihood(e){this._uniformsDirty=!0,this._textureVoidLikelihood=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureVoidWidthMin(){return this._textureVoidWidthMin}set textureVoidWidthMin(e){this._uniformsDirty=!0,this._textureVoidWidthMin=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureVoidWidthMax(){return this._textureVoidWidthMax}set textureVoidWidthMax(e){this._uniformsDirty=!0,this._textureVoidWidthMax=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureBandDensity(){return this._textureBandDensity}set textureBandDensity(e){this._uniformsDirty=!0,this._textureBandDensity=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureColorBlending(){return this._textureColorBlending}set textureColorBlending(e){this._uniformsDirty=!0,this._textureColorBlending=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureSeed(){return this._textureSeed}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}get transparentTextureVoid(){return this._transparentTextureVoid}set transparentTextureVoid(e){this._uniformsDirty=!0,this._transparentTextureVoid=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get proceduralBackgroundColor(){return this._proceduralBackgroundColor}set proceduralBackgroundColor(e){this._uniformsDirty=!0,this._proceduralBackgroundColor=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeTriangles(){return this._textureShapeTriangles}set textureShapeTriangles(e){this._uniformsDirty=!0,this._textureShapeTriangles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeCircles(){return this._textureShapeCircles}set textureShapeCircles(e){this._uniformsDirty=!0,this._textureShapeCircles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeBars(){return this._textureShapeBars}set textureShapeBars(e){this._uniformsDirty=!0,this._textureShapeBars=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeSquiggles(){return this._textureShapeSquiggles}set textureShapeSquiggles(e){this._uniformsDirty=!0,this._textureShapeSquiggles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}_updateGeometry(){if(!this.glState)return;const e=this.glState.gl,i=this._resolution||1;let r;this._shapeType==="sphere"?r=oe(this._sphereRadius,120*i,120*i):this._shapeType==="torus"?r=re(this._torusRadius,this._torusTube,120*i,120*i):this._shapeType==="cylinder"?r=se(this._cylinderRadius,this._cylinderRadius,this._cylinderHeight,120*i,120*i):this._shapeType==="ribbon"?r=ne(X,O,240*i,240*i,this._planeBend,this._planeTwist):r=ie(X,O,240*i,240*i);const{position:t,normal:y,uv:x,index:o,wireframeIndex:l}=r;e.bindBuffer(e.ARRAY_BUFFER,this.glState.buffers.position),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.glState.buffers.normal),e.bufferData(e.ARRAY_BUFFER,y,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.glState.buffers.uv),e.bufferData(e.ARRAY_BUFFER,x,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index),e.bufferData(e.ELEMENT_ARRAY_BUFFER,o,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.glState.buffers.wireframeIndex),e.bufferData(e.ELEMENT_ARRAY_BUFFER,l,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index),this.glState.indexCount=o.length,this.glState.wireframeIndexCount=l.length,this.glState.indexType=o instanceof Uint32Array?e.UNSIGNED_INT:e.UNSIGNED_SHORT;const _=this._ref.clientWidth,b=this._ref.clientHeight;G(this.glState.camera,_,b,X,O,this._shapeType,this._cameraZoom);const a=this.glState.locations.uniforms.projectionMatrix;e.useProgram(this.glState.program),a&&e.uniformMatrix4fv(a,!1,this.glState.camera.projectionMatrix.elements),this._uniformsDirty=!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,r=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,r);let y;this._shapeType==="sphere"?y=oe(this._sphereRadius,120*e,120*e):this._shapeType==="torus"?y=re(this._torusRadius,this._torusTube,120*e,120*e):this._shapeType==="cylinder"?y=se(this._cylinderRadius,this._cylinderRadius,this._cylinderHeight,120*e,120*e):this._shapeType==="ribbon"?y=ne(X,O,240*e,240*e,this._planeBend,this._planeTwist):y=ie(X,O,240*e,240*e);const{position:x,normal:o,uv:l,index:_,wireframeIndex:b}=y,a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,x,t.STATIC_DRAW);const h=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,h),t.bufferData(t.ARRAY_BUFFER,o,t.STATIC_DRAW);const p=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,p),t.bufferData(t.ARRAY_BUFFER,l,t.STATIC_DRAW);const c=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c),t.bufferData(t.ELEMENT_ARRAY_BUFFER,_,t.STATIC_DRAW);const f=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,f),t.bufferData(t.ELEMENT_ARRAY_BUFFER,b,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c);const R=pe()+`
|
|
471
|
-
`+
|
|
472
|
-
`+
|
|
473
|
-
`+
|
|
472
|
+
https://neat.firecms.co`,"font-weight: bold; font-size: 14px; color: #FF5772;","color: inherit;");const N=50,X=80,j=6,ve=Se();class xe{_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;_resolution=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;_transparentTextureVoid=!1;_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;_silhouetteFade=.25;_cylinderFade=.08;_ribbonFade=.05;_flatShading=!0;_shapeType="plane";_shapeRotationX=0;_shapeRotationY=0;_shapeRotationZ=0;_shapeAutoRotateSpeedX=0;_shapeAutoRotateSpeedY=0;_sphereRadius=15;_torusRadius=15;_torusTube=5;_cylinderRadius=10;_cylinderHeight=40;_planeBend=0;_planeTwist=0;_cameraLock=!1;_cameraX=0;_cameraY=0;_cameraZ=0;_cameraRotationX=0;_cameraRotationY=0;_cameraRotationZ=0;_cameraZoom=1;_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;_sourceCanvas=null;_sourceCtx=null;_maskedCanvas=null;_maskedCtx=null;_resizeTimeoutId=null;_textureNeedsUpdate=!1;_linkCheckCounter=0;_colorsChanged=!0;_uniformsDirty=!0;_textureDirty=!0;_yOffsetDirty=!1;_modelViewMatrix=new se;_isVisible=!0;_visibilityObserver=null;_visibilityHandler=null;constructor(e){const{ref:i,speed:r=4,horizontalPressure:t=3,verticalPressure:y=3,waveFrequencyX:v=5,waveFrequencyY:s=5,waveAmplitude:l=3,colors:_,highlights:b=4,shadows:a=4,colorSaturation:h=0,colorBrightness:p=1,colorBlending:c=5,grainScale:d=2,grainIntensity:R=.55,grainSparsity:g=0,grainSpeed:x=.1,wireframe:w=!1,backgroundColor:u="#FFFFFF",backgroundAlpha:T=1,resolution:A=1,seed:D,yOffset:m=0,yOffsetWaveMultiplier:F=4,yOffsetColorMultiplier:C=4,yOffsetFlowMultiplier:z=4,flowDistortionA:M=0,flowDistortionB:P=0,flowScale:E=1,flowEase:S=0,flowEnabled:U=!0,enableProceduralTexture:B=!1,textureVoidLikelihood:O=.45,textureVoidWidthMin:I=200,textureVoidWidthMax:Y=486,textureBandDensity:Te=2.15,textureColorBlending:Ee=.01,textureSeed:Ae=333,textureEase:Fe=.5,proceduralBackgroundColor:ze="#000000",transparentTextureVoid:De=!1,textureShapeTriangles:Me=20,textureShapeCircles:Ce=15,textureShapeBars:Pe=15,textureShapeSquiggles:Ue=10,domainWarpEnabled:Ie=!1,domainWarpIntensity:Be=.5,domainWarpScale:Le=1,vignetteIntensity:Oe=0,vignetteRadius:We=.8,fresnelEnabled:Ne=!1,fresnelPower:Xe=2,fresnelIntensity:Ye=.5,fresnelColor:ke="#FFFFFF",iridescenceEnabled:Ve=!1,iridescenceIntensity:qe=.5,iridescenceSpeed:Ze=1,bloomIntensity:Ge=0,bloomThreshold:He=.7,chromaticAberration:je=0,silhouetteFade:$e=.25,cylinderFade:Ke=.08,ribbonFade:Je=.05,flatShading:Qe=!0,cameraLock:et=!1,cameraX:tt=0,cameraY:it=0,cameraZ:st=0,cameraRotationX:rt=0,cameraRotationY:ot=0,cameraRotationZ:nt=0,cameraZoom:at=1,shapeType:lt="plane",shapeRotationX:ut=0,shapeRotationY:_t=0,shapeRotationZ:ct=0,shapeAutoRotateSpeedX:ht=0,shapeAutoRotateSpeedY:ft=0,sphereRadius:dt=15,torusRadius:mt=15,torusTube:pt=5,cylinderRadius:gt=10,cylinderHeight:yt=40,planeBend:vt=0,planeTwist:xt=0}=e;this._ref=i,this.destroy=this.destroy.bind(this),this._initScene=this._initScene.bind(this),this.speed=r,this.horizontalPressure=t,this.verticalPressure=y,this.waveFrequencyX=v,this.waveFrequencyY=s,this.waveAmplitude=l,this.colorBlending=c,this._resolution=A,this.grainScale=d,this.grainIntensity=R,this.grainSparsity=g,this.grainSpeed=x,this.colors=_,this.shadows=a,this.highlights=b,this.colorSaturation=h,this.colorBrightness=p,this.wireframe=w,this.backgroundColor=u,this.backgroundAlpha=T,this.yOffset=m,this.yOffsetWaveMultiplier=F,this.yOffsetColorMultiplier=C,this.yOffsetFlowMultiplier=z,this.flowDistortionA=M,this.flowDistortionB=P,this.flowScale=E,this.flowEase=S,this.flowEnabled=U,this.enableProceduralTexture=B,this.textureVoidLikelihood=O,this.textureVoidWidthMin=I,this.textureVoidWidthMax=Y,this.textureBandDensity=Te,this.textureColorBlending=Ee,this.textureSeed=Ae,this.textureEase=Fe,this._proceduralBackgroundColor=ze,this.transparentTextureVoid=De,this._textureShapeTriangles=Me,this._textureShapeCircles=Ce,this._textureShapeBars=Pe,this._textureShapeSquiggles=Ue,this.domainWarpEnabled=Ie,this.domainWarpIntensity=Be,this.domainWarpScale=Le,this.vignetteIntensity=Oe,this.vignetteRadius=We,this.fresnelEnabled=Ne,this.fresnelPower=Xe,this.fresnelIntensity=Ye,this.fresnelColor=ke,this.iridescenceEnabled=Ve,this.iridescenceIntensity=qe,this.iridescenceSpeed=Ze,this.bloomIntensity=Ge,this.bloomThreshold=He,this.chromaticAberration=je,this.silhouetteFade=$e,this.cylinderFade=Ke,this.ribbonFade=Je,this._flatShading=Qe,this._cameraLock=et,this._cameraX=tt,this._cameraY=it,this._cameraZ=st,this._cameraRotationX=rt,this._cameraRotationY=ot,this._cameraRotationZ=nt,this._cameraZoom=at,this._shapeType=lt,this._shapeRotationX=ut,this._shapeRotationY=_t,this._shapeRotationZ=ct,this._shapeAutoRotateSpeedX=ht,this._shapeAutoRotateSpeedY=ft,this._sphereRadius=dt,this._torusRadius=mt,this._torusTube=pt,this._cylinderRadius=gt,this._cylinderHeight=yt,this._planeBend=vt,this._planeTwist=xt,this.glState=this._initScene(A),Re();let $=D!==void 0?D:we(),K=performance.now();const J=()=>{const{gl:o,program:V,locations:f,indexCount:Z,indexType:G}=this.glState;if(this._linkCheckCounter++,this._linkCheckCounter>=300&&(this._linkCheckCounter=0,(!this._linkElement||!document.contains(this._linkElement))&&(this._linkElement=be(i))),this._initialized){const ce=performance.now();$+=(ce-K)/1e3*this._speed,K=ce,o.useProgram(V),o.uniform1f(f.uniforms.u_time,$);const Q=this.glState.camera,W=this._modelViewMatrix;W.identity(),W.translate(-Q.position[0]-this._cameraX,-Q.position[1]-this._cameraY,-Q.position[2]-this._cameraZ),W.translate(0,0,-1),W.rotateX(-this._cameraRotationX),W.rotateY(-this._cameraRotationY),W.rotateZ(-this._cameraRotationZ);let ee=this._shapeRotationX,he=this._shapeRotationY,wt=this._shapeRotationZ;this._shapeAutoRotateSpeedX!==0&&(ee+=$*this._shapeAutoRotateSpeedX*.1),this._shapeAutoRotateSpeedY!==0&&(he+=$*this._shapeAutoRotateSpeedY*.1),this._shapeType==="plane"||this._shapeType==="ribbon"?W.rotateX(ee-Math.PI/3.5):W.rotateX(ee),W.rotateY(he),W.rotateZ(wt);const fe=f.uniforms.modelViewMatrix;if(fe&&o.uniformMatrix4fv(fe,!1,W.elements),this._yOffsetDirty&&!this._uniformsDirty&&(o.uniform1f(f.uniforms.u_y_offset,this._yOffset),this._yOffsetDirty=!1),this._uniformsDirty){o.uniform2f(f.uniforms.u_resolution,this._ref.clientWidth,this._ref.clientHeight),o.uniform2f(f.uniforms.u_color_pressure,this._horizontalPressure,this._verticalPressure),o.uniform1f(f.uniforms.u_wave_frequency_x,this._waveFrequencyX),o.uniform1f(f.uniforms.u_wave_frequency_y,this._waveFrequencyY),o.uniform1f(f.uniforms.u_wave_amplitude,this._waveAmplitude),o.uniform1f(f.uniforms.u_color_blending,this._colorBlending),o.uniform1f(f.uniforms.u_shadows,this._shadows),o.uniform1f(f.uniforms.u_highlights,this._highlights),o.uniform1f(f.uniforms.u_saturation,this._saturation),o.uniform1f(f.uniforms.u_brightness,this._brightness),o.uniform1f(f.uniforms.u_grain_intensity,this._grainIntensity),o.uniform1f(f.uniforms.u_grain_sparsity,this._grainSparsity),o.uniform1f(f.uniforms.u_grain_speed,this._grainSpeed),o.uniform1f(f.uniforms.u_grain_scale,this._grainScale),o.uniform1f(f.uniforms.u_y_offset,this._yOffset),o.uniform1f(f.uniforms.u_y_offset_wave_multiplier,this._yOffsetWaveMultiplier),o.uniform1f(f.uniforms.u_y_offset_color_multiplier,this._yOffsetColorMultiplier),o.uniform1f(f.uniforms.u_y_offset_flow_multiplier,this._yOffsetFlowMultiplier),o.uniform1f(f.uniforms.u_flow_distortion_a,this._flowDistortionA),o.uniform1f(f.uniforms.u_flow_distortion_b,this._flowDistortionB),o.uniform1f(f.uniforms.u_flow_scale,this._flowScale),o.uniform1f(f.uniforms.u_flow_ease,this._flowEase),o.uniform1f(f.uniforms.u_flow_enabled,this._flowEnabled?1:0);let L=0;this._shapeType==="sphere"?L=1:this._shapeType==="torus"?L=2:this._shapeType==="cylinder"?L=3:this._shapeType==="ribbon"&&(L=4),o.uniform1f(f.uniforms.u_shape_type,L),o.uniform1f(f.uniforms.u_enable_procedural_texture,this._enableProceduralTexture?1:0),o.uniform1f(f.uniforms.u_texture_ease,this._textureEase),o.uniform1f(f.uniforms.u_transparent_texture_void,this._transparentTextureVoid?1:0),o.uniform1f(f.uniforms.u_domain_warp_enabled,this._domainWarpEnabled?1:0),o.uniform1f(f.uniforms.u_domain_warp_intensity,this._domainWarpIntensity),o.uniform1f(f.uniforms.u_domain_warp_scale,this._domainWarpScale),o.uniform1f(f.uniforms.u_vignette_intensity,this._vignetteIntensity),o.uniform1f(f.uniforms.u_vignette_radius,this._vignetteRadius),o.uniform1f(f.uniforms.u_fresnel_enabled,this._fresnelEnabled?1:0),o.uniform1f(f.uniforms.u_fresnel_power,this._fresnelPower),o.uniform1f(f.uniforms.u_fresnel_intensity,this._fresnelIntensity),o.uniform3fv(f.uniforms.u_fresnel_color,this._fresnelColorRgb),o.uniform1f(f.uniforms.u_iridescence_enabled,this._iridescenceEnabled?1:0),o.uniform1f(f.uniforms.u_iridescence_intensity,this._iridescenceIntensity),o.uniform1f(f.uniforms.u_iridescence_speed,this._iridescenceSpeed),o.uniform1f(f.uniforms.u_bloom_intensity,this._bloomIntensity),o.uniform1f(f.uniforms.u_bloom_threshold,this._bloomThreshold),o.uniform1f(f.uniforms.u_chromatic_aberration,this._chromaticAberration),o.uniform1f(f.uniforms.u_silhouette_fade,this._silhouetteFade),o.uniform1f(f.uniforms.u_cylinder_fade,this._cylinderFade),o.uniform1f(f.uniforms.u_ribbon_fade,this._ribbonFade),o.uniform1f(f.uniforms.u_flat_shading,this._flatShading?1:0),this._uniformsDirty=!1,this._yOffsetDirty=!1}if(this._textureNeedsUpdate&&this._enableProceduralTexture&&(this._proceduralTexture&&o.deleteTexture(this._proceduralTexture),this._proceduralTexture=this._createProceduralTexture(o),this._textureNeedsUpdate=!1,this._textureDirty=!0),this._textureDirty&&this._proceduralTexture&&(o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._proceduralTexture),o.uniform1i(f.uniforms.u_procedural_texture,1),this._textureDirty=!1),this._colorsChanged){this._colorsChanged=!1;for(let L=0;L<j;L++)if(L<this._colors.length){const de=this._colors[L],St=this._cachedColorRgb[L]||[0,0,0];o.uniform1f(f.uniforms[`u_colors[${L}].is_active`],de.enabled?1:0),o.uniform3fv(f.uniforms[`u_colors[${L}].color`],St),o.uniform1f(f.uniforms[`u_colors[${L}].influence`],de.influence||0)}else o.uniform1f(f.uniforms[`u_colors[${L}].is_active`],0);o.uniform1i(f.uniforms.u_colors_count,j)}}o.clearColor(this._backgroundColorRgb[0],this._backgroundColorRgb[1],this._backgroundColorRgb[2],this._backgroundAlpha),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),this._wireframe?(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,this.glState.buffers.wireframeIndex),o.drawElements(o.LINES,this.glState.wireframeIndexCount,G,0),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index)):o.drawElements(o.TRIANGLES,Z,G,0),this._isVisible&&(this.requestRef=requestAnimationFrame(J))};this._visibilityObserver=new IntersectionObserver(o=>{const V=this._isVisible;this._isVisible=o[0].isIntersecting&&document.visibilityState!=="hidden",this._isVisible&&!V&&(K=performance.now(),this.requestRef=requestAnimationFrame(J))},{threshold:0}),this._visibilityObserver.observe(i),this._visibilityHandler=()=>{const o=this._isVisible;document.visibilityState==="hidden"?this._isVisible=!1:(this._isVisible=!0,o||(K=performance.now(),this.requestRef=requestAnimationFrame(J)))},document.addEventListener("visibilitychange",this._visibilityHandler);const bt=()=>{const{gl:o,camera:V}=this.glState,f=this._ref.clientWidth,Z=this._ref.clientHeight;this._ref.width=f,this._ref.height=Z,o.viewport(0,0,f,Z),H(V,f,Z,N,X,this._shapeType,this._cameraZoom);const G=this.glState.locations.uniforms.projectionMatrix;o.useProgram(this.glState.program),G&&o.uniformMatrix4fv(G,!1,V.projectionMatrix.elements)};this.sizeObserver=new ResizeObserver(()=>{this._resizeTimeoutId!==null&&clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(()=>{bt(),this._resizeTimeoutId=null},100)}),this.sizeObserver.observe(i),J()}destroy(){if(cancelAnimationFrame(this.requestRef),this.sizeObserver.disconnect(),this._visibilityObserver&&(this._visibilityObserver.disconnect(),this._visibilityObserver=null),this._visibilityHandler&&(document.removeEventListener("visibilitychange",this._visibilityHandler),this._visibilityHandler=null),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");_e(i,e)}recordVideo(e={}){const{durationMs:i=5e3,filename:r="neat.firecms.co",format:t,onProgress:y,onComplete:v}=e,s=this._ref,l=e.width||s.width||s.clientWidth,_=e.height||s.height||s.clientHeight,b=document.createElement("canvas");b.width=l,b.height=_;const a=b.getContext("2d"),h=b.captureStream(0),p=h.getVideoTracks()[0],c=["video/mp4;codecs=avc1","video/mp4;codecs=avc1,opus","video/mp4"],d=["video/webm;codecs=vp9,opus","video/webm;codecs=vp9","video/webm;codecs=vp8,opus","video/webm"];let R;t==="mp4"?R=[...c,...d]:t==="webm"?R=[...d,...c]:R=[...c,...d];let g="video/webm";for(const E of R)if(MediaRecorder.isTypeSupported(E)){g=E;break}const x=l*_,w=8e6,u=1280*720,T=Math.round(w*Math.max(1,x/u)),A=new MediaRecorder(h,{mimeType:g,videoBitsPerSecond:T}),D=[];A.ondataavailable=E=>{E.data.size>0&&D.push(E.data)};let m=!1,F;const C=performance.now();let z=0;const M=()=>{if(m)return;a.clearRect(0,0,l,_),a.drawImage(s,0,0,l,_);const E=Math.max(14,Math.round(_*.025));if(a.font=`bold ${E}px "Sofia Sans", sans-serif`,a.textAlign="right",a.textBaseline="bottom",a.shadowColor="rgba(0,0,0,0.5)",a.shadowBlur=4,a.shadowOffsetX=1,a.shadowOffsetY=1,a.fillStyle="rgba(255,255,255,0.7)",a.fillText("NEAT",l-E*.8,_-E*.5),a.shadowColor="transparent",a.shadowBlur=0,a.shadowOffsetX=0,a.shadowOffsetY=0,p.requestFrame&&p.requestFrame(),y){const S=performance.now();S-z>250&&(z=S,y(Math.min(.99,(S-C)/i)))}F=requestAnimationFrame(M)};A.onstop=()=>{m=!0,cancelAnimationFrame(F);const E=g.startsWith("video/mp4"),S=E?".mp4":".webm",U=E?"video/mp4":"video/webm",B=r+S,O=new Blob(D,{type:U}),I=URL.createObjectURL(O);_e(I,B),setTimeout(()=>URL.revokeObjectURL(I),3e4),y?.(1),v?.()},M(),A.start(100);const P=window.setTimeout(()=>{A.state==="recording"&&A.stop()},i);return()=>{clearTimeout(P),A.state==="recording"&&A.stop()}}get speed(){return this._speed*20}set speed(e){this._uniformsDirty=!0,this._speed=e/20}get horizontalPressure(){return this._horizontalPressure*4}set horizontalPressure(e){this._uniformsDirty=!0,this._horizontalPressure=e/4}get verticalPressure(){return this._verticalPressure*4}set verticalPressure(e){this._uniformsDirty=!0,this._verticalPressure=e/4}get waveFrequencyX(){return this._waveFrequencyX/.04}set waveFrequencyX(e){this._uniformsDirty=!0,this._waveFrequencyX=e*.04}get waveFrequencyY(){return this._waveFrequencyY/.04}set waveFrequencyY(e){this._uniformsDirty=!0,this._waveFrequencyY=e*.04}get waveAmplitude(){return this._waveAmplitude/.75}set waveAmplitude(e){this._uniformsDirty=!0,this._waveAmplitude=e*.75}get colors(){return this._colors}set colors(e){this._uniformsDirty=!0,this._colors=e,this._cachedColorRgb=e.map(i=>this._hexToRgb(i.color)),this._colorsChanged=!0}get highlights(){return this._highlights*100}set highlights(e){this._uniformsDirty=!0,this._highlights=e/100}get shadows(){return this._shadows*100}set shadows(e){this._uniformsDirty=!0,this._shadows=e/100}get colorSaturation(){return this._saturation*10}set colorSaturation(e){this._uniformsDirty=!0,this._saturation=e/10}get colorBrightness(){return this._brightness}set colorBrightness(e){this._uniformsDirty=!0,this._brightness=e}get colorBlending(){return this._colorBlending*10}set colorBlending(e){this._uniformsDirty=!0,this._colorBlending=e/10}get grainScale(){return this._grainScale}set grainScale(e){this._uniformsDirty=!0,this._grainScale=e==0?1:e}get grainIntensity(){return this._grainIntensity}set grainIntensity(e){this._uniformsDirty=!0,this._grainIntensity=e}get grainSparsity(){return this._grainSparsity}set grainSparsity(e){this._uniformsDirty=!0,this._grainSparsity=e}get grainSpeed(){return this._grainSpeed}set grainSpeed(e){this._uniformsDirty=!0,this._grainSpeed=e}get wireframe(){return this._wireframe}set wireframe(e){this._uniformsDirty=!0,this._wireframe=e}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this._updateGeometry())}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._uniformsDirty=!0,this._backgroundColor=e,this._backgroundColorRgb=this._hexToRgb(e)}get backgroundAlpha(){return this._backgroundAlpha}set backgroundAlpha(e){this._uniformsDirty=!0,this._backgroundAlpha=e}get yOffset(){return this._yOffset}set yOffset(e){this._yOffset!==e&&(this._yOffsetDirty=!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}get flowDistortionA(){return this._flowDistortionA}set flowDistortionA(e){this._uniformsDirty=!0,this._flowDistortionA=e}get flowDistortionB(){return this._flowDistortionB}set flowDistortionB(e){this._uniformsDirty=!0,this._flowDistortionB=e}get flowScale(){return this._flowScale}set flowScale(e){this._uniformsDirty=!0,this._flowScale=e}get flowEase(){return this._flowEase}set flowEase(e){this._uniformsDirty=!0,this._flowEase=e}set flowEnabled(e){this._uniformsDirty=!0,this._flowEnabled=e}get flowEnabled(){return this._flowEnabled}get enableProceduralTexture(){return this._enableProceduralTexture}set enableProceduralTexture(e){this._uniformsDirty=!0,this._enableProceduralTexture=e,e&&!this._proceduralTexture&&(this._textureNeedsUpdate=!0)}get textureVoidLikelihood(){return this._textureVoidLikelihood}set textureVoidLikelihood(e){this._uniformsDirty=!0,this._textureVoidLikelihood=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureVoidWidthMin(){return this._textureVoidWidthMin}set textureVoidWidthMin(e){this._uniformsDirty=!0,this._textureVoidWidthMin=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureVoidWidthMax(){return this._textureVoidWidthMax}set textureVoidWidthMax(e){this._uniformsDirty=!0,this._textureVoidWidthMax=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureBandDensity(){return this._textureBandDensity}set textureBandDensity(e){this._uniformsDirty=!0,this._textureBandDensity=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureColorBlending(){return this._textureColorBlending}set textureColorBlending(e){this._uniformsDirty=!0,this._textureColorBlending=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureSeed(){return this._textureSeed}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}get transparentTextureVoid(){return this._transparentTextureVoid}set transparentTextureVoid(e){this._uniformsDirty=!0,this._transparentTextureVoid=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get proceduralBackgroundColor(){return this._proceduralBackgroundColor}set proceduralBackgroundColor(e){this._uniformsDirty=!0,this._proceduralBackgroundColor=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeTriangles(){return this._textureShapeTriangles}set textureShapeTriangles(e){this._uniformsDirty=!0,this._textureShapeTriangles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeCircles(){return this._textureShapeCircles}set textureShapeCircles(e){this._uniformsDirty=!0,this._textureShapeCircles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeBars(){return this._textureShapeBars}set textureShapeBars(e){this._uniformsDirty=!0,this._textureShapeBars=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}get textureShapeSquiggles(){return this._textureShapeSquiggles}set textureShapeSquiggles(e){this._uniformsDirty=!0,this._textureShapeSquiggles=e,this._enableProceduralTexture&&(this._textureNeedsUpdate=!0)}_updateGeometry(){if(!this.glState)return;const e=this.glState.gl,i=this._resolution||1;let r;this._shapeType==="sphere"?r=oe(this._sphereRadius,120*i,120*i):this._shapeType==="torus"?r=ne(this._torusRadius,this._torusTube,120*i,120*i):this._shapeType==="cylinder"?r=ae(this._cylinderRadius,this._cylinderRadius,this._cylinderHeight,120*i,120*i):this._shapeType==="ribbon"?r=le(N,X,240*i,240*i,this._planeBend,this._planeTwist):r=re(N,X,240*i,240*i);const{position:t,normal:y,uv:v,index:s,wireframeIndex:l}=r;e.bindBuffer(e.ARRAY_BUFFER,this.glState.buffers.position),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.glState.buffers.normal),e.bufferData(e.ARRAY_BUFFER,y,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.glState.buffers.uv),e.bufferData(e.ARRAY_BUFFER,v,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index),e.bufferData(e.ELEMENT_ARRAY_BUFFER,s,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.glState.buffers.wireframeIndex),e.bufferData(e.ELEMENT_ARRAY_BUFFER,l,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.glState.buffers.index),this.glState.indexCount=s.length,this.glState.wireframeIndexCount=l.length,this.glState.indexType=s instanceof Uint32Array?e.UNSIGNED_INT:e.UNSIGNED_SHORT;const _=this._ref.clientWidth,b=this._ref.clientHeight;H(this.glState.camera,_,b,N,X,this._shapeType,this._cameraZoom);const a=this.glState.locations.uniforms.projectionMatrix;e.useProgram(this.glState.program),a&&e.uniformMatrix4fv(a,!1,this.glState.camera.projectionMatrix.elements),this._uniformsDirty=!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,r=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,r);let y;this._shapeType==="sphere"?y=oe(this._sphereRadius,120*e,120*e):this._shapeType==="torus"?y=ne(this._torusRadius,this._torusTube,120*e,120*e):this._shapeType==="cylinder"?y=ae(this._cylinderRadius,this._cylinderRadius,this._cylinderHeight,120*e,120*e):this._shapeType==="ribbon"?y=le(N,X,240*e,240*e,this._planeBend,this._planeTwist):y=re(N,X,240*e,240*e);const{position:v,normal:s,uv:l,index:_,wireframeIndex:b}=y,a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,v,t.STATIC_DRAW);const h=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,h),t.bufferData(t.ARRAY_BUFFER,s,t.STATIC_DRAW);const p=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,p),t.bufferData(t.ARRAY_BUFFER,l,t.STATIC_DRAW);const c=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c),t.bufferData(t.ELEMENT_ARRAY_BUFFER,_,t.STATIC_DRAW);const d=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,d),t.bufferData(t.ELEMENT_ARRAY_BUFFER,b,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c);const R=pe()+`
|
|
473
|
+
`+te()+`
|
|
474
|
+
`+ie()+`
|
|
475
|
+
`+q,g=t.createShader(t.VERTEX_SHADER);t.shaderSource(g,R),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(R.split(`
|
|
474
476
|
`).map((S,U)=>`${U+1}: ${S}`).join(`
|
|
475
|
-
`)),console.log("VERTEX_SHADER_ERROR_END"));const
|
|
476
|
-
`+
|
|
477
|
-
`+
|
|
478
|
-
`+me,w=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(w,
|
|
477
|
+
`)),console.log("VERTEX_SHADER_ERROR_END"));const x=ge()+`
|
|
478
|
+
`+ie()+`
|
|
479
|
+
`+te()+`
|
|
480
|
+
`+me,w=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(w,x),t.compileShader(w),t.getShaderParameter(w,t.COMPILE_STATUS)||(console.log("FRAGMENT_SHADER_ERROR_START"),console.log("Fragment shader error: ",t.getShaderInfoLog(w)),console.log("GL Error Code:",t.getError()),console.log("Fragment Shader Source Dump:"),console.log(x.split(`
|
|
479
481
|
`).map((S,U)=>`${U+1}: ${S}`).join(`
|
|
480
|
-
`)),console.log("FRAGMENT_SHADER_ERROR_END"));const u=t.createProgram();t.attachShader(u,g),t.attachShader(u,w),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 T=new ye(0,0,0,0,0,1e3);T.position=[0,0,5],G(T,i,r,X,O,this._shapeType,this._cameraZoom);const A=t.getAttribLocation(u,"position"),M=t.getAttribLocation(u,"normal"),m=t.getAttribLocation(u,"uv");t.enableVertexAttribArray(A),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(A,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(M),t.bindBuffer(t.ARRAY_BUFFER,h),t.vertexAttribPointer(M,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(m),t.bindBuffer(t.ARRAY_BUFFER,p),t.vertexAttribPointer(m,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c);const F=t.getUniformLocation(u,"projectionMatrix");t.uniformMatrix4fv(F,!1,T.projectionMatrix.elements);const D=t.getUniformLocation(u,"u_plane_width");t.uniform1f(D,X);const z=t.getUniformLocation(u,"u_plane_height");t.uniform1f(z,O);const C=t.getUniformLocation(u,"u_colors_count");t.uniform1i(C,j);const P=["projectionMatrix","modelViewMatrix","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_transparent_texture_void","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","u_shape_type","u_silhouette_fade","u_cylinder_fade","u_ribbon_fade"],E={attributes:{position:A,normal:M,uv:m},uniforms:{}};P.forEach(S=>{E.uniforms[S]=t.getUniformLocation(u,S)});for(let S=0;S<j;S++)E.uniforms[`u_colors[${S}].is_active`]=t.getUniformLocation(u,`u_colors[${S}].is_active`),E.uniforms[`u_colors[${S}].color`]=t.getUniformLocation(u,`u_colors[${S}].color`),E.uniforms[`u_colors[${S}].influence`]=t.getUniformLocation(u,`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:u,buffers:{position:a,normal:h,uv:p,index:c,wireframeIndex:f},locations:E,camera:T,indexCount:_.length,wireframeIndexCount:b.length,indexType:_ instanceof Uint32Array?t.UNSIGNED_INT:t.UNSIGNED_SHORT}}_createProceduralTexture(e){this._sourceCanvas||(this._sourceCanvas=document.createElement("canvas"),this._sourceCanvas.width=1024,this._sourceCanvas.height=1024,this._sourceCtx=this._sourceCanvas.getContext("2d"));const r=this._sourceCanvas,t=this._sourceCtx;if(!t)return null;let y=this._textureSeed;const x=this._textureSeed;function o(){const m=Math.sin(y++)*1e4;return m-Math.floor(m)}const l=m=>{y=x+m},_=this._colors.filter(m=>m.enabled).map(m=>m.color);if(_.length===0)return null;const b=this._shapeType!=="plane",a=b?[-1,0,1]:[0],h=b?[-1,0,1]:[0];function p(m){const F=parseInt(m.replace("#",""),16);return{r:F>>16&255,g:F>>8&255,b:F&255}}function c(m,F,D){return"#"+((1<<24)+(Math.round(m)<<16)+(Math.round(F)<<8)+Math.round(D)).toString(16).slice(1).padStart(6,"0")}const f=()=>{const m=_[Math.floor(o()*_.length)],F=_[Math.floor(o()*_.length)],D=o()*this._textureColorBlending,z=p(m),C=p(F),P=z.r+(C.r-z.r)*D,E=z.g+(C.g-z.g)*D,S=z.b+(C.b-z.b)*D;return c(P,E,S)},R=this._proceduralBackgroundColor||"#000000";t.fillStyle=R,t.fillRect(0,0,1024,1024);const g=t.createLinearGradient(0,0,0,1024);g.addColorStop(0,f()),g.addColorStop(1,f()),t.fillStyle=g,t.fillRect(0,0,1024,1024);for(let m=0;m<this._textureShapeTriangles;m++){const F=f(),D=o()*1024,z=o()*1024,C=100+o()*300,P=(o()-.5)*C,E=(o()-.5)*C,S=(o()-.5)*C,U=(o()-.5)*C;for(const B of a)for(const W of h){t.fillStyle=F,t.beginPath();const I=D+B*1024,Y=z+W*1024;t.moveTo(I,Y),t.lineTo(I+P,Y+E),t.lineTo(I+S,Y+U),t.fill()}}for(let m=0;m<this._textureShapeCircles;m++){const F=f(),D=10+o()*50,z=o()*1024,C=o()*1024,P=50+o()*150;for(const E of a)for(const S of h)t.strokeStyle=F,t.lineWidth=D,t.beginPath(),t.arc(z+E*1024,C+S*1024,P,0,Math.PI*2),t.stroke()}for(let m=0;m<this._textureShapeBars;m++){const F=f(),D=o()*1024,z=o()*1024,C=o()*Math.PI;for(const P of a)for(const E of h)t.fillStyle=F,t.save(),t.translate(D+P*1024,z+E*1024),t.rotate(C),t.fillRect(-150,-25,300,50),t.restore()}t.lineWidth=15,t.lineCap="round";for(let m=0;m<this._textureShapeSquiggles;m++){const F=f(),D=o()*1024,z=o()*1024,C=[];let P=0,E=0;for(let S=0;S<4;S++){const U=P+(o()-.5)*300,B=E+(o()-.5)*300;C.push({cx1:P+(o()-.5)*300,cy1:E+(o()-.5)*300,cx2:P+(o()-.5)*300,cy2:E+(o()-.5)*300,ex:U,ey:B}),P=U,E=B}for(const S of a)for(const U of h){t.strokeStyle=F,t.beginPath();const B=D+S*1024,W=z+U*1024;t.moveTo(B,W);for(const I of C)t.bezierCurveTo(B+I.cx1,W+I.cy1,B+I.cx2,W+I.cy2,B+I.ex,W+I.ey);t.stroke()}}l(5e4),this._maskedCanvas||(this._maskedCanvas=document.createElement("canvas"),this._maskedCanvas.width=1024,this._maskedCanvas.height=1024,this._maskedCtx=this._maskedCanvas.getContext("2d"));const v=this._maskedCanvas,w=this._maskedCtx;if(!w)return null;this._transparentTextureVoid?w.clearRect(0,0,1024,1024):(w.fillStyle=R,w.fillRect(0,0,1024,1024));let u=0;const T=[];for(;u<1024;)if(o()<this._textureVoidLikelihood){const F=this._textureVoidWidthMin+o()*(this._textureVoidWidthMax-this._textureVoidWidthMin);T.push({type:"void",x:u,width:F}),u+=F}else{const F=50+o()*200;T.push({type:"matter",x:u,width:F}),u+=F}for(const m of T)if(m.type==="matter"){const F=m.x,D=Math.min(m.x+m.width,1024);let z=F;for(;z<D;){const C=(2+o()*20)/this._textureBandDensity,P=Math.floor(o()*1024);w.drawImage(r,P,0,C,1024,z,0,C,1024),z+=C}}const A=e.createTexture();e.bindTexture(e.TEXTURE_2D,A),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,v),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 m=e.getParameter(M.MAX_TEXTURE_MAX_ANISOTROPY_EXT);e.texParameterf(e.TEXTURE_2D,M.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,m))}return A}get silhouetteFade(){return this._silhouetteFade}set silhouetteFade(e){this._silhouetteFade!==e&&(this._silhouetteFade=e,this._uniformsDirty=!0)}get cylinderFade(){return this._cylinderFade}set cylinderFade(e){this._cylinderFade!==e&&(this._cylinderFade=e,this._uniformsDirty=!0)}get ribbonFade(){return this._ribbonFade}set ribbonFade(e){this._ribbonFade!==e&&(this._ribbonFade=e,this._uniformsDirty=!0)}get domainWarpEnabled(){return this._domainWarpEnabled}set domainWarpEnabled(e){this._domainWarpEnabled!==e&&(this._domainWarpEnabled=e,this._uniformsDirty=!0)}get domainWarpIntensity(){return this._domainWarpIntensity}set domainWarpIntensity(e){this._domainWarpIntensity!==e&&(this._domainWarpIntensity=e,this._uniformsDirty=!0)}get domainWarpScale(){return this._domainWarpScale}set domainWarpScale(e){this._domainWarpScale!==e&&(this._domainWarpScale=e,this._uniformsDirty=!0)}get vignetteIntensity(){return this._vignetteIntensity}set vignetteIntensity(e){this._vignetteIntensity!==e&&(this._vignetteIntensity=e,this._uniformsDirty=!0)}get vignetteRadius(){return this._vignetteRadius}set vignetteRadius(e){this._vignetteRadius!==e&&(this._vignetteRadius=e,this._uniformsDirty=!0)}get fresnelEnabled(){return this._fresnelEnabled}set fresnelEnabled(e){this._fresnelEnabled!==e&&(this._fresnelEnabled=e,this._uniformsDirty=!0)}get fresnelPower(){return this._fresnelPower}set fresnelPower(e){this._fresnelPower!==e&&(this._fresnelPower=e,this._uniformsDirty=!0)}get fresnelIntensity(){return this._fresnelIntensity}set fresnelIntensity(e){this._fresnelIntensity!==e&&(this._fresnelIntensity=e,this._uniformsDirty=!0)}get fresnelColor(){return this._fresnelColor}set fresnelColor(e){this._fresnelColor!==e&&(this._fresnelColor=e,this._fresnelColorRgb=this._hexToRgb(e),this._uniformsDirty=!0)}get iridescenceEnabled(){return this._iridescenceEnabled}set iridescenceEnabled(e){this._iridescenceEnabled!==e&&(this._iridescenceEnabled=e,this._uniformsDirty=!0)}get iridescenceIntensity(){return this._iridescenceIntensity}set iridescenceIntensity(e){this._iridescenceIntensity!==e&&(this._iridescenceIntensity=e,this._uniformsDirty=!0)}get iridescenceSpeed(){return this._iridescenceSpeed}set iridescenceSpeed(e){this._iridescenceSpeed!==e&&(this._iridescenceSpeed=e,this._uniformsDirty=!0)}get bloomIntensity(){return this._bloomIntensity}set bloomIntensity(e){this._bloomIntensity!==e&&(this._bloomIntensity=e,this._uniformsDirty=!0)}get bloomThreshold(){return this._bloomThreshold}set bloomThreshold(e){this._bloomThreshold!==e&&(this._bloomThreshold=e,this._uniformsDirty=!0)}get chromaticAberration(){return this._chromaticAberration}set chromaticAberration(e){this._chromaticAberration!==e&&(this._chromaticAberration=e,this._uniformsDirty=!0)}get shapeType(){return this._shapeType}set shapeType(e){this._shapeType!==e&&(this._shapeType=e,this._updateGeometry())}get shapeRotationX(){return this._shapeRotationX}set shapeRotationX(e){this._shapeRotationX=e,this._uniformsDirty=!0}get shapeRotationY(){return this._shapeRotationY}set shapeRotationY(e){this._shapeRotationY=e,this._uniformsDirty=!0}get shapeRotationZ(){return this._shapeRotationZ}set shapeRotationZ(e){this._shapeRotationZ=e,this._uniformsDirty=!0}get shapeAutoRotateSpeedX(){return this._shapeAutoRotateSpeedX}set shapeAutoRotateSpeedX(e){this._shapeAutoRotateSpeedX=e,this._uniformsDirty=!0}get shapeAutoRotateSpeedY(){return this._shapeAutoRotateSpeedY}set shapeAutoRotateSpeedY(e){this._shapeAutoRotateSpeedY=e,this._uniformsDirty=!0}get sphereRadius(){return this._sphereRadius}set sphereRadius(e){this._sphereRadius!==e&&(this._sphereRadius=e,this._updateGeometry())}get torusRadius(){return this._torusRadius}set torusRadius(e){this._torusRadius!==e&&(this._torusRadius=e,this._updateGeometry())}get torusTube(){return this._torusTube}set torusTube(e){this._torusTube!==e&&(this._torusTube=e,this._updateGeometry())}get cylinderRadius(){return this._cylinderRadius}set cylinderRadius(e){this._cylinderRadius!==e&&(this._cylinderRadius=e,this._updateGeometry())}get cylinderHeight(){return this._cylinderHeight}set cylinderHeight(e){this._cylinderHeight!==e&&(this._cylinderHeight=e,this._updateGeometry())}get planeBend(){return this._planeBend}set planeBend(e){this._planeBend!==e&&(this._planeBend=e,this._updateGeometry())}get planeTwist(){return this._planeTwist}set planeTwist(e){this._planeTwist!==e&&(this._planeTwist=e,this._updateGeometry())}get cameraLock(){return this._cameraLock}set cameraLock(e){this._cameraLock=e}get cameraX(){return this._cameraX}set cameraX(e){this._cameraX=e,this._uniformsDirty=!0}get cameraY(){return this._cameraY}set cameraY(e){this._cameraY=e,this._uniformsDirty=!0}get cameraZ(){return this._cameraZ}set cameraZ(e){this._cameraZ=e,this._uniformsDirty=!0}get cameraRotationX(){return this._cameraRotationX}set cameraRotationX(e){this._cameraRotationX=e,this._uniformsDirty=!0}get cameraRotationY(){return this._cameraRotationY}set cameraRotationY(e){this._cameraRotationY=e,this._uniformsDirty=!0}get cameraRotationZ(){return this._cameraRotationZ}set cameraRotationZ(e){this._cameraRotationZ=e,this._uniformsDirty=!0}get cameraZoom(){return this._cameraZoom}set cameraZoom(e){this._cameraZoom!==e&&(this._cameraZoom=e,this._updateCameraFrustum())}_updateCameraFrustum(){if(!this.glState)return;const e=this.glState.gl,i=this._ref.clientWidth,r=this._ref.clientHeight;G(this.glState.camera,i,r,X,O,this._shapeType,this._cameraZoom);const t=this.glState.locations.uniforms.projectionMatrix;e.useProgram(this.glState.program),t&&e.uniformMatrix4fv(t,!1,this.glState.camera.projectionMatrix.elements),this._uniformsDirty=!0}}const ae=s=>{s.id=xe,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.style.pointerEvents="auto",s.setAttribute("data-n","1"),s.innerHTML="NEAT"},be=s=>{const e=s.parentElement;if(e&&getComputedStyle(e).position==="static"&&(e.style.position="relative"),e){const r=e.querySelector("a[data-n]");if(r)return ae(r),r}const i=document.createElement("a");return ae(i),e?.appendChild(i),i};function we(){const s=new Date,e=s.getMinutes(),i=s.getSeconds();return e*60+i}function Se(s=6){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let r=0;r<s;r++){const t=Math.floor(Math.random()*e.length);i+=e.charAt(t)}return i}function le(s,e){const i=document.createElement("a");i.download=e,i.href=s,document.body.appendChild(i),i.click(),document.body.removeChild(i)}function Re(){if(document.getElementById("neat-seo-schema"))return;const s=document.createElement("script");s.id="neat-seo-schema",s.type="application/ld+json",s.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(s);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"}),r=document.createElement("a");r.href="https://firecms.co",r.textContent="FireCMS",i.appendChild(r)}catch{const r=document.createElement("a");r.href="https://firecms.co",r.textContent="FireCMS",e.appendChild(r)}document.body.appendChild(e)}k.NeatGradient=ve,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
482
|
+
`)),console.log("FRAGMENT_SHADER_ERROR_END"));const u=t.createProgram();t.attachShader(u,g),t.attachShader(u,w),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 T=new ye(0,0,0,0,0,1e3);T.position=[0,0,5],H(T,i,r,N,X,this._shapeType,this._cameraZoom);const A=t.getAttribLocation(u,"position"),D=t.getAttribLocation(u,"normal"),m=t.getAttribLocation(u,"uv");t.enableVertexAttribArray(A),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(A,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(D),t.bindBuffer(t.ARRAY_BUFFER,h),t.vertexAttribPointer(D,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(m),t.bindBuffer(t.ARRAY_BUFFER,p),t.vertexAttribPointer(m,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c);const F=t.getUniformLocation(u,"projectionMatrix");t.uniformMatrix4fv(F,!1,T.projectionMatrix.elements);const C=t.getUniformLocation(u,"u_plane_width");t.uniform1f(C,N);const z=t.getUniformLocation(u,"u_plane_height");t.uniform1f(z,X);const M=t.getUniformLocation(u,"u_colors_count");t.uniform1i(M,j);const P=["projectionMatrix","modelViewMatrix","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_transparent_texture_void","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","u_shape_type","u_silhouette_fade","u_cylinder_fade","u_ribbon_fade","u_flat_shading"],E={attributes:{position:A,normal:D,uv:m},uniforms:{}};P.forEach(S=>{E.uniforms[S]=t.getUniformLocation(u,S)});for(let S=0;S<j;S++)E.uniforms[`u_colors[${S}].is_active`]=t.getUniformLocation(u,`u_colors[${S}].is_active`),E.uniforms[`u_colors[${S}].color`]=t.getUniformLocation(u,`u_colors[${S}].color`),E.uniforms[`u_colors[${S}].influence`]=t.getUniformLocation(u,`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:u,buffers:{position:a,normal:h,uv:p,index:c,wireframeIndex:d},locations:E,camera:T,indexCount:_.length,wireframeIndexCount:b.length,indexType:_ instanceof Uint32Array?t.UNSIGNED_INT:t.UNSIGNED_SHORT}}_createProceduralTexture(e){this._sourceCanvas||(this._sourceCanvas=document.createElement("canvas"),this._sourceCanvas.width=1024,this._sourceCanvas.height=1024,this._sourceCtx=this._sourceCanvas.getContext("2d"));const r=this._sourceCanvas,t=this._sourceCtx;if(!t)return null;let y=this._textureSeed;const v=this._textureSeed;function s(){const m=Math.sin(y++)*1e4;return m-Math.floor(m)}const l=m=>{y=v+m},_=this._colors.filter(m=>m.enabled).map(m=>m.color);if(_.length===0)return null;const b=this._shapeType!=="plane",a=b?[-1,0,1]:[0],h=b?[-1,0,1]:[0];function p(m){const F=parseInt(m.replace("#",""),16);return{r:F>>16&255,g:F>>8&255,b:F&255}}function c(m,F,C){return"#"+((1<<24)+(Math.round(m)<<16)+(Math.round(F)<<8)+Math.round(C)).toString(16).slice(1).padStart(6,"0")}const d=()=>{const m=_[Math.floor(s()*_.length)],F=_[Math.floor(s()*_.length)],C=s()*this._textureColorBlending,z=p(m),M=p(F),P=z.r+(M.r-z.r)*C,E=z.g+(M.g-z.g)*C,S=z.b+(M.b-z.b)*C;return c(P,E,S)},R=this._proceduralBackgroundColor||"#000000";t.fillStyle=R,t.fillRect(0,0,1024,1024);const g=t.createLinearGradient(0,0,0,1024);g.addColorStop(0,d()),g.addColorStop(1,d()),t.fillStyle=g,t.fillRect(0,0,1024,1024);for(let m=0;m<this._textureShapeTriangles;m++){const F=d(),C=s()*1024,z=s()*1024,M=100+s()*300,P=(s()-.5)*M,E=(s()-.5)*M,S=(s()-.5)*M,U=(s()-.5)*M;for(const B of a)for(const O of h){t.fillStyle=F,t.beginPath();const I=C+B*1024,Y=z+O*1024;t.moveTo(I,Y),t.lineTo(I+P,Y+E),t.lineTo(I+S,Y+U),t.fill()}}for(let m=0;m<this._textureShapeCircles;m++){const F=d(),C=10+s()*50,z=s()*1024,M=s()*1024,P=50+s()*150;for(const E of a)for(const S of h)t.strokeStyle=F,t.lineWidth=C,t.beginPath(),t.arc(z+E*1024,M+S*1024,P,0,Math.PI*2),t.stroke()}for(let m=0;m<this._textureShapeBars;m++){const F=d(),C=s()*1024,z=s()*1024,M=s()*Math.PI;for(const P of a)for(const E of h)t.fillStyle=F,t.save(),t.translate(C+P*1024,z+E*1024),t.rotate(M),t.fillRect(-150,-25,300,50),t.restore()}t.lineWidth=15,t.lineCap="round";for(let m=0;m<this._textureShapeSquiggles;m++){const F=d(),C=s()*1024,z=s()*1024,M=[];let P=0,E=0;for(let S=0;S<4;S++){const U=P+(s()-.5)*300,B=E+(s()-.5)*300;M.push({cx1:P+(s()-.5)*300,cy1:E+(s()-.5)*300,cx2:P+(s()-.5)*300,cy2:E+(s()-.5)*300,ex:U,ey:B}),P=U,E=B}for(const S of a)for(const U of h){t.strokeStyle=F,t.beginPath();const B=C+S*1024,O=z+U*1024;t.moveTo(B,O);for(const I of M)t.bezierCurveTo(B+I.cx1,O+I.cy1,B+I.cx2,O+I.cy2,B+I.ex,O+I.ey);t.stroke()}}l(5e4),this._maskedCanvas||(this._maskedCanvas=document.createElement("canvas"),this._maskedCanvas.width=1024,this._maskedCanvas.height=1024,this._maskedCtx=this._maskedCanvas.getContext("2d"));const x=this._maskedCanvas,w=this._maskedCtx;if(!w)return null;this._transparentTextureVoid?w.clearRect(0,0,1024,1024):(w.fillStyle=R,w.fillRect(0,0,1024,1024));let u=0;const T=[];for(;u<1024;)if(s()<this._textureVoidLikelihood){const F=this._textureVoidWidthMin+s()*(this._textureVoidWidthMax-this._textureVoidWidthMin);T.push({type:"void",x:u,width:F}),u+=F}else{const F=50+s()*200;T.push({type:"matter",x:u,width:F}),u+=F}for(const m of T)if(m.type==="matter"){const F=m.x,C=Math.min(m.x+m.width,1024);let z=F;for(;z<C;){const M=(2+s()*20)/this._textureBandDensity,P=Math.floor(s()*1024);w.drawImage(r,P,0,M,1024,z,0,M,1024),z+=M}}const A=e.createTexture();e.bindTexture(e.TEXTURE_2D,A),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,x),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 D=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");if(D){const m=e.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT);e.texParameterf(e.TEXTURE_2D,D.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(16,m))}return A}get silhouetteFade(){return this._silhouetteFade}set silhouetteFade(e){this._silhouetteFade!==e&&(this._silhouetteFade=e,this._uniformsDirty=!0)}get cylinderFade(){return this._cylinderFade}set cylinderFade(e){this._cylinderFade!==e&&(this._cylinderFade=e,this._uniformsDirty=!0)}get ribbonFade(){return this._ribbonFade}set ribbonFade(e){this._ribbonFade!==e&&(this._ribbonFade=e,this._uniformsDirty=!0)}get flatShading(){return this._flatShading}set flatShading(e){this._flatShading!==e&&(this._flatShading=e,this._uniformsDirty=!0)}get domainWarpEnabled(){return this._domainWarpEnabled}set domainWarpEnabled(e){this._domainWarpEnabled!==e&&(this._domainWarpEnabled=e,this._uniformsDirty=!0)}get domainWarpIntensity(){return this._domainWarpIntensity}set domainWarpIntensity(e){this._domainWarpIntensity!==e&&(this._domainWarpIntensity=e,this._uniformsDirty=!0)}get domainWarpScale(){return this._domainWarpScale}set domainWarpScale(e){this._domainWarpScale!==e&&(this._domainWarpScale=e,this._uniformsDirty=!0)}get vignetteIntensity(){return this._vignetteIntensity}set vignetteIntensity(e){this._vignetteIntensity!==e&&(this._vignetteIntensity=e,this._uniformsDirty=!0)}get vignetteRadius(){return this._vignetteRadius}set vignetteRadius(e){this._vignetteRadius!==e&&(this._vignetteRadius=e,this._uniformsDirty=!0)}get fresnelEnabled(){return this._fresnelEnabled}set fresnelEnabled(e){this._fresnelEnabled!==e&&(this._fresnelEnabled=e,this._uniformsDirty=!0)}get fresnelPower(){return this._fresnelPower}set fresnelPower(e){this._fresnelPower!==e&&(this._fresnelPower=e,this._uniformsDirty=!0)}get fresnelIntensity(){return this._fresnelIntensity}set fresnelIntensity(e){this._fresnelIntensity!==e&&(this._fresnelIntensity=e,this._uniformsDirty=!0)}get fresnelColor(){return this._fresnelColor}set fresnelColor(e){this._fresnelColor!==e&&(this._fresnelColor=e,this._fresnelColorRgb=this._hexToRgb(e),this._uniformsDirty=!0)}get iridescenceEnabled(){return this._iridescenceEnabled}set iridescenceEnabled(e){this._iridescenceEnabled!==e&&(this._iridescenceEnabled=e,this._uniformsDirty=!0)}get iridescenceIntensity(){return this._iridescenceIntensity}set iridescenceIntensity(e){this._iridescenceIntensity!==e&&(this._iridescenceIntensity=e,this._uniformsDirty=!0)}get iridescenceSpeed(){return this._iridescenceSpeed}set iridescenceSpeed(e){this._iridescenceSpeed!==e&&(this._iridescenceSpeed=e,this._uniformsDirty=!0)}get bloomIntensity(){return this._bloomIntensity}set bloomIntensity(e){this._bloomIntensity!==e&&(this._bloomIntensity=e,this._uniformsDirty=!0)}get bloomThreshold(){return this._bloomThreshold}set bloomThreshold(e){this._bloomThreshold!==e&&(this._bloomThreshold=e,this._uniformsDirty=!0)}get chromaticAberration(){return this._chromaticAberration}set chromaticAberration(e){this._chromaticAberration!==e&&(this._chromaticAberration=e,this._uniformsDirty=!0)}get shapeType(){return this._shapeType}set shapeType(e){this._shapeType!==e&&(this._shapeType=e,this._updateGeometry())}get shapeRotationX(){return this._shapeRotationX}set shapeRotationX(e){this._shapeRotationX=e,this._uniformsDirty=!0}get shapeRotationY(){return this._shapeRotationY}set shapeRotationY(e){this._shapeRotationY=e,this._uniformsDirty=!0}get shapeRotationZ(){return this._shapeRotationZ}set shapeRotationZ(e){this._shapeRotationZ=e,this._uniformsDirty=!0}get shapeAutoRotateSpeedX(){return this._shapeAutoRotateSpeedX}set shapeAutoRotateSpeedX(e){this._shapeAutoRotateSpeedX=e,this._uniformsDirty=!0}get shapeAutoRotateSpeedY(){return this._shapeAutoRotateSpeedY}set shapeAutoRotateSpeedY(e){this._shapeAutoRotateSpeedY=e,this._uniformsDirty=!0}get sphereRadius(){return this._sphereRadius}set sphereRadius(e){this._sphereRadius!==e&&(this._sphereRadius=e,this._updateGeometry())}get torusRadius(){return this._torusRadius}set torusRadius(e){this._torusRadius!==e&&(this._torusRadius=e,this._updateGeometry())}get torusTube(){return this._torusTube}set torusTube(e){this._torusTube!==e&&(this._torusTube=e,this._updateGeometry())}get cylinderRadius(){return this._cylinderRadius}set cylinderRadius(e){this._cylinderRadius!==e&&(this._cylinderRadius=e,this._updateGeometry())}get cylinderHeight(){return this._cylinderHeight}set cylinderHeight(e){this._cylinderHeight!==e&&(this._cylinderHeight=e,this._updateGeometry())}get planeBend(){return this._planeBend}set planeBend(e){this._planeBend!==e&&(this._planeBend=e,this._updateGeometry())}get planeTwist(){return this._planeTwist}set planeTwist(e){this._planeTwist!==e&&(this._planeTwist=e,this._updateGeometry())}get cameraLock(){return this._cameraLock}set cameraLock(e){this._cameraLock=e}get cameraX(){return this._cameraX}set cameraX(e){this._cameraX=e,this._uniformsDirty=!0}get cameraY(){return this._cameraY}set cameraY(e){this._cameraY=e,this._uniformsDirty=!0}get cameraZ(){return this._cameraZ}set cameraZ(e){this._cameraZ=e,this._uniformsDirty=!0}get cameraRotationX(){return this._cameraRotationX}set cameraRotationX(e){this._cameraRotationX=e,this._uniformsDirty=!0}get cameraRotationY(){return this._cameraRotationY}set cameraRotationY(e){this._cameraRotationY=e,this._uniformsDirty=!0}get cameraRotationZ(){return this._cameraRotationZ}set cameraRotationZ(e){this._cameraRotationZ=e,this._uniformsDirty=!0}get cameraZoom(){return this._cameraZoom}set cameraZoom(e){this._cameraZoom!==e&&(this._cameraZoom=e,this._updateCameraFrustum())}_updateCameraFrustum(){if(!this.glState)return;const e=this.glState.gl,i=this._ref.clientWidth,r=this._ref.clientHeight;H(this.glState.camera,i,r,N,X,this._shapeType,this._cameraZoom);const t=this.glState.locations.uniforms.projectionMatrix;e.useProgram(this.glState.program),t&&e.uniformMatrix4fv(t,!1,this.glState.camera.projectionMatrix.elements),this._uniformsDirty=!0}}const ue=n=>{n.id=ve,n.href="https://neat.firecms.co",n.target="_blank",n.style.position="absolute",n.style.display="block",n.style.bottom="0",n.style.right="0",n.style.padding="10px",n.style.color="#dcdcdc",n.style.opacity="0.8",n.style.fontFamily="sans-serif",n.style.fontSize="16px",n.style.fontWeight="bold",n.style.textDecoration="none",n.style.zIndex="10000",n.style.pointerEvents="auto",n.setAttribute("data-n","1"),n.innerHTML="NEAT"},be=n=>{let e=n.parentElement;for(;e&&getComputedStyle(e).display==="contents";)e=e.parentElement;if(e&&getComputedStyle(e).position==="static"&&(e.style.position="relative"),e){const r=e.querySelector("a[data-n]");if(r)return ue(r),r}const i=document.createElement("a");return ue(i),e?.appendChild(i),i};function we(){const n=new Date,e=n.getMinutes(),i=n.getSeconds();return e*60+i}function Se(n=6){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let r=0;r<n;r++){const t=Math.floor(Math.random()*e.length);i+=e.charAt(t)}return i}function _e(n,e){const i=document.createElement("a");i.download=e,i.href=n,document.body.appendChild(i),i.click(),document.body.removeChild(i)}function Re(){if(document.getElementById("neat-seo-schema"))return;const n=document.createElement("script");n.id="neat-seo-schema",n.type="application/ld+json",n.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(n);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"}),r=document.createElement("a");r.href="https://firecms.co",r.textContent="FireCMS",i.appendChild(r)}catch{const r=document.createElement("a");r.href="https://firecms.co",r.textContent="FireCMS",e.appendChild(r)}document.body.appendChild(e)}k.NeatGradient=xe,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
481
483
|
//# sourceMappingURL=index.umd.js.map
|