@firecms/neat 0.8.0 → 0.9.1

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/index.es.js CHANGED
@@ -1,229 +1,277 @@
1
- const Ce = `void main() {
2
- vUv = uv;
3
-
4
- // SCROLLING LOGIC
5
- // Separate multipliers for wave, color, and flow offsets
6
- float waveOffset = -u_y_offset * u_y_offset_wave_multiplier;
7
- float colorOffset = -u_y_offset * u_y_offset_color_multiplier;
8
- float flowOffset = -u_y_offset * u_y_offset_flow_multiplier;
9
-
10
- // 1. DISPLACEMENT (WAVES)
11
- // We add waveOffset to Y to scroll the wave pattern
12
- v_displacement_amount = cnoise( vec3(
13
- u_wave_frequency_x * position.x + u_time,
14
- u_wave_frequency_y * (position.y + waveOffset) + u_time,
15
- u_time
16
- ));
17
-
18
- // 2. FLOW FIELD
19
- // Apply flow offset to scroll the flow field mask
20
- vec2 baseUv = vUv;
21
- baseUv.y += flowOffset / u_plane_height; // Scale to match wave speed
22
- vec2 flowUv = baseUv;
23
-
24
- if (u_flow_enabled > 0.5) {
25
- if (u_flow_ease > 0.0 || u_flow_distortion_a > 0.0) {
26
- vec2 ppp = -1.0 + 2.0 * baseUv;
27
- ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
28
- ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
29
- ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
30
- ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
31
-
32
- float r = length(ppp);
33
- flowUv = mix(baseUv, vec2(baseUv.x * (1.0 - u_flow_ease) + r * u_flow_ease, baseUv.y), u_flow_ease);
34
- }
35
- }
36
-
37
- // Pass the standard flow UV to fragment shader (for texture)
38
- vFlowUv = flowUv;
39
-
40
- // 3. COLOR MIXING
41
- // We take the computed flow UVs and apply the color offset
42
- // Scale by plane height to match wave offset speed (world space vs UV space)
43
- vec3 color = u_colors[0].color;
44
- // ...
45
- vec2 adjustedUv = flowUv;
46
- adjustedUv.y += colorOffset / u_plane_height; // Scroll the color mixing pattern
47
-
48
- vec2 noise_cord = adjustedUv * u_color_pressure;
49
- const float minNoise = .0;
50
- const float maxNoise = .9;
51
-
52
- for (int i = 1; i < 6; i++) {
53
- if (i < u_colors_count) {
54
- if (u_colors[i].is_active > 0.5) {
55
- float noiseFlow = (1. + float(i)) / 30.;
56
- float noiseSpeed = (1. + float(i)) * 0.11;
57
- float noiseSeed = 13. + float(i) * 7.;
58
-
59
- float noise = snoise(
60
- vec3(
61
- noise_cord.x * u_color_pressure.x + u_time * noiseFlow * 2.,
62
- noise_cord.y * u_color_pressure.y,
63
- u_time * noiseSpeed
64
- ) + noiseSeed
65
- ) - (.1 * float(i)) + (.5 * u_color_blending);
66
-
67
- noise = clamp(noise, minNoise, maxNoise + float(i) * 0.02);
68
- color = mix(color, u_colors[i].color, smoothstep(0.0, u_color_blending, noise));
69
- }
70
- }
71
- }
72
-
73
- v_color = color;
74
-
75
- // 4. FRESNEL (rim glow)
76
- // (Calculated in fragment shader using displacement slope approximation)
77
-
78
- // 5. VERTEX POSITION
79
- vec3 newPosition = position + normal * v_displacement_amount * u_wave_amplitude;
80
- gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
81
- v_new_position = gl_Position;
1
+ const ht = `void main() {
2
+ vUv = uv;
3
+ vPosition = position;
4
+ float waveOffset = -u_y_offset * u_y_offset_wave_multiplier;
5
+ float colorOffset = -u_y_offset * u_y_offset_color_multiplier;
6
+ float flowOffset = -u_y_offset * u_y_offset_flow_multiplier;
7
+ v_displacement_amount = cnoise( vec3(
8
+ u_wave_frequency_x * position.x + u_time,
9
+ u_wave_frequency_y * (position.y + waveOffset) + u_time,
10
+ u_time
11
+ ));
12
+ vec2 baseUv = vUv;
13
+ baseUv.y += flowOffset / u_plane_height;
14
+ vec2 flowUv = baseUv;
15
+ if (u_flow_enabled > 0.5) {
16
+ if (u_flow_ease > 0.0 || u_flow_distortion_a > 0.0) {
17
+ vec2 ppp = -1.0 + 2.0 * baseUv;
18
+ ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
19
+ ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
20
+ ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
21
+ ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
22
+ float r = length(ppp);
23
+ flowUv = mix(baseUv, vec2(baseUv.x * (1.0 - u_flow_ease) + r * u_flow_ease, baseUv.y), u_flow_ease);
82
24
  }
83
- `, Pe = `float random(vec2 p) {
84
- return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);
85
25
  }
86
-
26
+ vFlowUv = flowUv;
27
+ vec3 color = u_colors[0].color;
28
+ vec3 distortedPos = position;
29
+ if (u_flat_shading < 0.5) {
30
+ if (u_flow_enabled > 0.5) {
31
+ if (u_flow_ease > 0.0 || u_flow_distortion_a > 0.0) {
32
+ vec3 ppp = position / 25.0;
33
+ ppp.xyz += 0.1 * cos((1.5 * u_flow_scale) * ppp.yxz + 1.1 * u_time + vec3(0.1, 1.1, 2.1));
34
+ ppp.xyz += 0.1 * cos((2.3 * u_flow_scale) * ppp.zxy + 1.3 * u_time + vec3(3.2, 3.4, 1.2));
35
+ ppp.xyz += 0.1 * cos((2.2 * u_flow_scale) * ppp.yxz + 1.7 * u_time + vec3(1.8, 5.2, 3.1));
36
+ ppp.xyz += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.zxy + 1.4 * u_time + vec3(6.3, 3.9, 4.5));
37
+ float r = length(ppp);
38
+ distortedPos = mix(position, vec3(
39
+ position.x * (1.0 - u_flow_ease) + r * u_flow_ease * 25.0,
40
+ position.y,
41
+ position.z * (1.0 - u_flow_ease) + r * u_flow_ease * 25.0
42
+ ), u_flow_ease);
43
+ }
44
+ }
45
+ }
46
+ vec3 noise_cord;
47
+ if (u_flat_shading < 0.5) {
48
+ noise_cord = vec3(distortedPos.x / 50.0, (distortedPos.y + colorOffset) / 50.0, distortedPos.z / 50.0);
49
+ } else {
50
+ vec2 adjustedUv = flowUv;
51
+ adjustedUv.y += colorOffset / u_plane_height;
52
+ noise_cord = vec3(adjustedUv, 0.0);
53
+ }
54
+ const float minNoise = .0;
55
+ const float maxNoise = .9;
56
+ for (int i = 1; i < 6; i++) {
57
+ if (i < u_colors_count) {
58
+ if (u_colors[i].is_active > 0.5) {
59
+ float noiseFlow = (1. + float(i)) / 30.;
60
+ float noiseSpeed = (1. + float(i)) * 0.11;
61
+ float noiseSeed = 13. + float(i) * 7.;
62
+ float noise_z = u_time * noiseSpeed;
63
+ if (u_flat_shading < 0.5) {
64
+ noise_z = noise_cord.z * u_color_pressure.x * u_color_pressure.x + u_time * noiseSpeed;
65
+ }
66
+ float noise = snoise(
67
+ vec3(
68
+ noise_cord.x * u_color_pressure.x * u_color_pressure.x + u_time * noiseFlow * 2.,
69
+ noise_cord.y * u_color_pressure.y * u_color_pressure.y,
70
+ noise_z
71
+ ) + noiseSeed
72
+ ) - (.1 * float(i)) + (.5 * u_color_blending);
73
+ noise = clamp(noise, minNoise, maxNoise + float(i) * 0.02);
74
+ color = mix(color, u_colors[i].color, smoothstep(0.0, u_color_blending, noise));
75
+ }
76
+ }
77
+ }
78
+ v_color = color;
79
+ vec3 newPosition = position + normal * v_displacement_amount * u_wave_amplitude;
80
+ vec4 mvPosition = modelViewMatrix * vec4(newPosition, 1.0);
81
+ vViewPosition = mvPosition.xyz;
82
+ vNormal = normalize((modelViewMatrix * vec4(normal, 0.0)).xyz);
83
+ gl_Position = projectionMatrix * mvPosition;
84
+ v_new_position = gl_Position;
85
+ }`, ft = `float random(vec2 p) {
86
+ return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);
87
+ }
87
88
  float fbm(vec3 x) {
88
- float value = 0.0;
89
- float amplitude = 0.5;
90
- float frequency = 1.0;
91
- for (int i = 0; i < 4; i++) {
92
- value += amplitude * snoise(x * frequency);
93
- frequency *= 2.0;
94
- amplitude *= 0.5;
95
- }
96
- return value;
89
+ float value = 0.0;
90
+ float amplitude = 0.5;
91
+ float frequency = 1.0;
92
+ for (int i = 0; i < 2; i++) {
93
+ value += amplitude * snoise(x * frequency);
94
+ frequency *= 2.0;
95
+ amplitude *= 0.5;
96
+ }
97
+ return value;
97
98
  }
98
-
99
- // Branchless HSL to RGB for iridescence
100
99
  vec3 hsl2rgb(float h, float s, float l) {
101
- vec3 rgb = clamp(abs(mod(h * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
102
- return l + s * (rgb - 0.5) * (1.0 - abs(2.0 * l - 1.0));
100
+ vec3 rgb = clamp(abs(mod(h * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
101
+ return l + s * (rgb - 0.5) * (1.0 - abs(2.0 * l - 1.0));
103
102
  }
104
-
105
103
  void main() {
106
- vec2 finalUv = vFlowUv;
107
-
108
- vec3 baseColor;
109
-
110
- if (u_enable_procedural_texture > 0.5) {
111
- vec2 ppp = -1.0 + 2.0 * finalUv;
112
- ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
113
- ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
114
- ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
115
- ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
116
- float r = length(ppp);
117
-
118
- float vx = (finalUv.x * u_texture_ease) + (r * (1.0 - u_texture_ease));
119
- float vy = (finalUv.y * u_texture_ease) + (0.0 * (1.0 - u_texture_ease));
120
- vec2 texUv = vec2(vx, vy);
121
-
122
- float parallaxFactor = 0.25;
123
- texUv.y -= (u_y_offset * u_y_offset_color_multiplier / u_plane_height) * parallaxFactor;
124
- texUv *= 1.5;
125
-
126
- vec4 texSample = texture2D(u_procedural_texture, texUv);
127
- baseColor = texSample.rgb;
128
- } else {
129
- baseColor = v_color;
130
- }
131
-
132
- vec3 color = baseColor;
133
-
134
- // === DOMAIN WARPING (simplified: 3 fbm calls instead of 5) ===
135
- if (u_domain_warp_enabled > 0.5) {
136
- vec3 p = vec3(finalUv * u_domain_warp_scale, u_time * 0.15);
137
- vec2 q = vec2(fbm(p), fbm(p + vec3(5.2, 1.3, 0.0)));
138
- float f = fbm(p + vec3(4.0 * q, 0.0));
139
- vec3 warpColor = color * (1.0 + f * 0.8 * u_domain_warp_intensity);
140
- float pattern = clamp(f * f * f + 0.6 * f * f + 0.5 * f, 0.0, 1.0);
141
- color = mix(color, warpColor * (0.6 + pattern * 0.8), u_domain_warp_intensity * 0.7);
142
- }
143
-
144
- // Post-processing
145
- color += v_displacement_amount * u_highlights;
146
- float shadowFactor = 1.0 - v_displacement_amount;
147
- color -= shadowFactor * shadowFactor * u_shadows;
148
- color = saturation(color, 1.0 + u_saturation);
149
- color = color * u_brightness;
150
-
151
- // === IRIDESCENCE ===
152
- if (u_iridescence_enabled > 0.5) {
153
- float hue = fract(v_displacement_amount * 0.5 + 0.5 + u_time * u_iridescence_speed * 0.05);
154
- vec3 iriColor = hsl2rgb(hue, 0.8, 0.6);
155
- color = mix(color, iriColor, u_iridescence_intensity * abs(v_displacement_amount) * 0.6);
156
- }
157
-
158
- // === FRESNEL (Rim glow) ===
159
- if (u_fresnel_enabled > 0.5) {
160
- float slope = 1.0 - abs(v_displacement_amount);
161
- float fresnel = pow(max(slope, 0.0), u_fresnel_power);
162
- color += u_fresnel_color * fresnel * u_fresnel_intensity;
163
- }
164
-
165
- // === VIGNETTE ===
166
- if (u_vignette_intensity > 0.0) {
167
- float dist = length(vUv - vec2(0.5));
168
- float vig = smoothstep(u_vignette_radius, u_vignette_radius * 0.3, dist);
169
- color *= mix(1.0, vig, u_vignette_intensity);
170
- }
171
-
172
- // === FAKE BLOOM ===
173
- if (u_bloom_intensity > 0.0) {
174
- float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
175
- float bloomMask = smoothstep(u_bloom_threshold, 1.0, luma);
176
- color += color * bloomMask * u_bloom_intensity;
177
- }
178
-
179
- // === CHROMATIC ABERRATION ===
180
- if (u_chromatic_aberration > 0.0) {
181
- float caAmount = u_chromatic_aberration * 0.008;
182
- float dist = length(vUv - vec2(0.5));
183
- float rShift = v_displacement_amount + caAmount * dist;
184
- float bShift = v_displacement_amount - caAmount * dist;
185
- color.r *= 1.0 + rShift * caAmount * 10.0;
186
- color.b *= 1.0 - bShift * caAmount * 10.0;
187
- }
188
-
189
- // Grain (use cheap hash noise instead of expensive fbm when static)
190
- float grain = 0.0;
191
- if (u_grain_intensity > 0.0) {
192
- vec2 noiseCoords = gl_FragCoord.xy / u_grain_scale;
193
- if (u_grain_speed != 0.0) {
194
- grain = fbm(vec3(noiseCoords, u_time * u_grain_speed));
195
- } else {
196
- // Static grain: use cheap hash instead of fbm
197
- grain = random(noiseCoords) - 0.5;
198
- }
199
-
200
- grain = grain * 0.5 + 0.5;
201
- grain -= 0.5;
202
- grain = (grain > u_grain_sparsity) ? grain : 0.0;
203
- grain *= u_grain_intensity;
204
- }
205
-
206
- color += vec3(grain);
207
-
208
- gl_FragColor = vec4(color, 1.0);
104
+ vec2 finalUv = vFlowUv;
105
+ vec3 baseColor;
106
+ float texAlpha = 1.0;
107
+ if (u_enable_procedural_texture > 0.5) {
108
+ if (u_flat_shading < 0.5) {
109
+ float parallaxFactor = 0.25;
110
+ float scrollOffset = (u_y_offset * u_y_offset_color_multiplier) * parallaxFactor;
111
+ vec3 scrolledPos = vPosition;
112
+ scrolledPos.y -= scrollOffset;
113
+ vec3 p = (scrolledPos * 1.5) / 50.0;
114
+ vec2 uvX = p.yz + vec2(0.5);
115
+ vec2 uvY = p.zx + vec2(0.5);
116
+ vec2 uvZ = p.xy + vec2(0.5);
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
+ vec3 n = normalize(vNormal);
121
+ vec3 blendWeights = abs(n);
122
+ blendWeights = blendWeights / (blendWeights.x + blendWeights.y + blendWeights.z + 0.0001);
123
+ vec4 texSample = colX * blendWeights.x + colY * blendWeights.y + colZ * blendWeights.z;
124
+ baseColor = texSample.rgb;
125
+ if (u_transparent_texture_void > 0.5) {
126
+ texAlpha = texSample.a;
127
+ }
128
+ } else {
129
+ vec2 ppp = -1.0 + 2.0 * finalUv;
130
+ ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
131
+ ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
132
+ ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
133
+ ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
134
+ float r = length(ppp);
135
+ float vx = (finalUv.x * u_texture_ease) + (r * (1.0 - u_texture_ease));
136
+ float vy = (finalUv.y * u_texture_ease) + (0.0 * (1.0 - u_texture_ease));
137
+ vec2 texUv = vec2(vx, vy);
138
+ float parallaxFactor = 0.25;
139
+ texUv.y -= (u_y_offset * u_y_offset_color_multiplier / u_plane_height) * parallaxFactor;
140
+ texUv *= 1.5;
141
+ vec4 texSample = texture2D(u_procedural_texture, texUv);
142
+ baseColor = texSample.rgb;
143
+ if (u_transparent_texture_void > 0.5) {
144
+ texAlpha = texSample.a;
145
+ }
146
+ }
147
+ } else {
148
+ baseColor = v_color;
149
+ }
150
+ vec3 color = baseColor;
151
+ if (u_domain_warp_enabled > 0.5) {
152
+ vec3 p;
153
+ if (u_flat_shading < 0.5) {
154
+ p = vec3((vPosition / 50.0 + vec3(0.5)) * u_domain_warp_scale);
155
+ p.z += u_time * 0.15;
156
+ } else {
157
+ p = vec3(finalUv * u_domain_warp_scale, u_time * 0.15);
158
+ }
159
+ vec2 q = vec2(fbm(p), fbm(p + vec3(5.2, 1.3, 0.0)));
160
+ float f = fbm(p + vec3(4.0 * q, 0.0));
161
+ vec3 warpColor = color * (1.0 + f * 0.8 * u_domain_warp_intensity);
162
+ float pattern = clamp(f * f * f + 0.6 * f * f + 0.5 * f, 0.0, 1.0);
163
+ color = mix(color, warpColor * (0.6 + pattern * 0.8), u_domain_warp_intensity * 0.7);
164
+ }
165
+ vec3 normal = normalize(vNormal);
166
+ vec3 viewDir = vec3(0.0, 0.0, 1.0);
167
+ float ndotv = dot(normal, viewDir);
168
+ if (u_shape_type > 0.5 && u_shape_type < 3.5) {
169
+ if (ndotv < 0.0) {
170
+ discard;
171
+ }
172
+ } else {
173
+ if (ndotv < 0.0) {
174
+ normal = -normal;
175
+ ndotv = -ndotv;
176
+ }
177
+ }
178
+ vec3 lightDir = normalize(vec3(1.0, 1.0, 1.0));
179
+ float diffuse = max(dot(normal, lightDir), 0.0);
180
+ vec3 halfDir = normalize(lightDir + viewDir);
181
+ float specular = pow(max(dot(normal, halfDir), 0.0), 32.0);
182
+ if (u_flat_shading > 0.5) {
183
+ color += v_displacement_amount * u_highlights;
184
+ float heightShadow = 1.0 - v_displacement_amount;
185
+ color -= heightShadow * heightShadow * u_shadows;
186
+ } else {
187
+ color += specular * u_highlights;
188
+ color += v_displacement_amount * u_highlights * 0.5;
189
+ float heightShadow = 1.0 - v_displacement_amount;
190
+ color -= heightShadow * heightShadow * u_shadows * 0.5;
191
+ color -= (1.0 - diffuse) * u_shadows * 0.5;
192
+ }
193
+ color = saturation(color, 1.0 + u_saturation);
194
+ color = color * u_brightness;
195
+ if (u_iridescence_enabled > 0.5) {
196
+ float hue = fract(v_displacement_amount * 0.5 + 0.5 + u_time * u_iridescence_speed * 0.05);
197
+ vec3 iriColor = hsl2rgb(hue, 0.8, 0.6);
198
+ color = mix(color, iriColor, u_iridescence_intensity * abs(v_displacement_amount) * 0.6);
199
+ }
200
+ if (u_fresnel_enabled > 0.5) {
201
+ float slope = 1.0 - abs(v_displacement_amount);
202
+ float fresnel = pow(max(slope, 0.0), u_fresnel_power);
203
+ color += u_fresnel_color * fresnel * u_fresnel_intensity;
204
+ }
205
+ if (u_vignette_intensity > 0.0) {
206
+ vec2 vigUv = vUv;
207
+ if (u_flat_shading < 0.5) {
208
+ vigUv = (v_new_position.xy / v_new_position.w) * 0.5 + vec2(0.5);
209
+ }
210
+ float dist = length(vigUv - vec2(0.5));
211
+ float vig = smoothstep(u_vignette_radius, u_vignette_radius * 0.3, dist);
212
+ color *= mix(1.0, vig, u_vignette_intensity);
213
+ }
214
+ if (u_bloom_intensity > 0.0) {
215
+ float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
216
+ float bloomMask = smoothstep(u_bloom_threshold, 1.0, luma);
217
+ color += color * bloomMask * u_bloom_intensity;
218
+ }
219
+ if (u_chromatic_aberration > 0.0) {
220
+ float caAmount = u_chromatic_aberration * 0.008;
221
+ vec2 caUv = vUv;
222
+ if (u_flat_shading < 0.5) {
223
+ caUv = (v_new_position.xy / v_new_position.w) * 0.5 + vec2(0.5);
209
224
  }
210
- `;
211
- function De() {
225
+ float dist = length(caUv - vec2(0.5));
226
+ float rShift = v_displacement_amount + caAmount * dist;
227
+ float bShift = v_displacement_amount - caAmount * dist;
228
+ color.r *= 1.0 + rShift * caAmount * 10.0;
229
+ color.b *= 1.0 - bShift * caAmount * 10.0;
230
+ }
231
+ float grain = 0.0;
232
+ if (u_grain_intensity > 0.0) {
233
+ vec2 noiseCoords = gl_FragCoord.xy / u_grain_scale;
234
+ if (u_grain_speed != 0.0 || u_flat_shading > 0.5) {
235
+ grain = fbm(vec3(noiseCoords, u_time * u_grain_speed));
236
+ } else {
237
+ grain = random(noiseCoords) - 0.5;
238
+ }
239
+ grain = grain * 0.5 + 0.5;
240
+ grain -= 0.5;
241
+ grain = (grain > u_grain_sparsity) ? grain : 0.0;
242
+ grain *= u_grain_intensity;
243
+ }
244
+ color += vec3(grain);
245
+ float edgeAlpha = 1.0;
246
+ if (u_silhouette_fade > 0.0 && u_flat_shading < 0.5) {
247
+ edgeAlpha = smoothstep(0.0, u_silhouette_fade, ndotv);
248
+ }
249
+ if (u_shape_type == 3.0) {
250
+ float vFade = smoothstep(0.0, u_cylinder_fade, vUv.y) * smoothstep(1.0, 1.0 - u_cylinder_fade, vUv.y);
251
+ edgeAlpha *= vFade;
252
+ } else if (u_shape_type == 4.0) {
253
+ float uFade = smoothstep(0.0, u_ribbon_fade, vUv.x) * smoothstep(1.0, 1.0 - u_ribbon_fade, vUv.x);
254
+ float vFade = smoothstep(0.0, u_ribbon_fade, vUv.y) * smoothstep(1.0, 1.0 - u_ribbon_fade, vUv.y);
255
+ edgeAlpha *= uFade * vFade;
256
+ }
257
+ edgeAlpha *= texAlpha;
258
+ gl_FragColor = vec4(color, edgeAlpha);
259
+ }`;
260
+ function dt() {
212
261
  return `precision highp float;
213
-
214
262
  attribute vec3 position;
215
263
  attribute vec3 normal;
216
264
  attribute vec2 uv;
217
-
218
265
  uniform mat4 modelViewMatrix;
219
266
  uniform mat4 projectionMatrix;
220
-
221
267
  varying vec2 vUv;
222
268
  varying vec2 vFlowUv;
223
269
  varying vec4 v_new_position;
224
270
  varying vec3 v_color;
225
271
  varying float v_displacement_amount;
226
-
272
+ varying vec3 vViewPosition;
273
+ varying vec3 vNormal;
274
+ varying vec3 vPosition;
227
275
  uniform float u_time;
228
276
  uniform vec2 u_resolution;
229
277
  uniform vec2 u_color_pressure;
@@ -233,263 +281,203 @@ uniform float u_wave_amplitude;
233
281
  uniform float u_plane_width;
234
282
  uniform float u_plane_height;
235
283
  uniform float u_color_blending;
236
-
237
284
  uniform int u_colors_count;
238
285
  struct ColorStop {
239
- float is_active;
240
- vec3 color;
241
- float influence;
286
+ float is_active;
287
+ vec3 color;
288
+ float influence;
242
289
  };
243
290
  uniform ColorStop u_colors[6];
244
-
245
291
  uniform float u_y_offset;
246
292
  uniform float u_y_offset_wave_multiplier;
247
293
  uniform float u_y_offset_color_multiplier;
248
294
  uniform float u_y_offset_flow_multiplier;
249
-
250
- // Flow field uniforms
251
295
  uniform float u_flow_distortion_a;
252
296
  uniform float u_flow_distortion_b;
253
297
  uniform float u_flow_scale;
254
298
  uniform float u_flow_ease;
255
299
  uniform float u_flow_enabled;
256
-
257
- // Fresnel uniforms
258
300
  uniform float u_fresnel_enabled;
259
301
  uniform float u_fresnel_power;
260
302
  uniform float u_fresnel_intensity;
261
303
  uniform vec3 u_fresnel_color;
262
- `;
304
+ uniform float u_shape_type;
305
+ uniform float u_flat_shading;`;
263
306
  }
264
- function ze() {
307
+ function mt() {
265
308
  return `precision highp float;
266
-
267
309
  varying vec2 vUv;
268
310
  varying vec2 vFlowUv;
311
+ varying vec4 v_new_position;
269
312
  varying vec3 v_color;
270
313
  varying float v_displacement_amount;
271
-
314
+ varying vec3 vViewPosition;
315
+ varying vec3 vNormal;
316
+ varying vec3 vPosition;
272
317
  uniform float u_time;
273
318
  uniform vec2 u_resolution;
274
319
  uniform float u_plane_height;
275
-
276
320
  uniform float u_shadows;
277
321
  uniform float u_highlights;
278
322
  uniform float u_saturation;
279
323
  uniform float u_brightness;
280
- uniform float u_grain_intensity;
281
- uniform float u_grain_sparsity;
282
- uniform float u_grain_scale;
283
- uniform float u_grain_speed;
284
-
324
+ uniform float u_grain_intensity;
325
+ uniform float u_grain_sparsity;
326
+ uniform float u_grain_scale;
327
+ uniform float u_grain_speed;
285
328
  uniform float u_y_offset;
286
329
  uniform float u_y_offset_color_multiplier;
287
-
288
- // Flow field uniforms
289
330
  uniform float u_flow_distortion_a;
290
331
  uniform float u_flow_distortion_b;
291
332
  uniform float u_flow_scale;
292
-
293
- // Procedural texture uniforms
294
333
  uniform sampler2D u_procedural_texture;
295
334
  uniform float u_enable_procedural_texture;
296
335
  uniform float u_texture_ease;
297
-
298
- // Domain warping uniforms
299
336
  uniform float u_domain_warp_enabled;
300
337
  uniform float u_domain_warp_intensity;
301
338
  uniform float u_domain_warp_scale;
302
-
303
- // Vignette uniforms
304
339
  uniform float u_vignette_intensity;
305
340
  uniform float u_vignette_radius;
306
-
307
- // Fresnel uniforms (fragment side)
308
341
  uniform float u_fresnel_enabled;
309
342
  uniform float u_fresnel_power;
310
343
  uniform float u_fresnel_intensity;
311
344
  uniform vec3 u_fresnel_color;
312
-
313
-
314
-
315
- // Iridescence uniforms
316
345
  uniform float u_iridescence_enabled;
317
346
  uniform float u_iridescence_intensity;
318
347
  uniform float u_iridescence_speed;
319
-
320
- // Bloom uniforms
321
348
  uniform float u_bloom_intensity;
322
349
  uniform float u_bloom_threshold;
323
-
324
- // Chromatic aberration
325
350
  uniform float u_chromatic_aberration;
326
- `;
351
+ uniform float u_shape_type;
352
+ uniform float u_transparent_texture_void;
353
+ uniform float u_silhouette_fade;
354
+ uniform float u_cylinder_fade;
355
+ uniform float u_ribbon_fade;
356
+ uniform float u_flat_shading;`;
327
357
  }
328
- function Y() {
329
- return `
330
- // 1. REPLACEMENT PERMUTE:
331
- // Uses a hash function (fract/sin) instead of a modular lookup table.
332
- vec4 permute(vec4 x) {
333
- return floor(fract(sin(x) * 43758.5453123) * 289.0);
358
+ function se() {
359
+ return `vec4 permute(vec4 x) {
360
+ return floor(fract(sin(x) * 43758.5453123) * 289.0);
334
361
  }
335
-
336
- // Taylor Inverse Sqrt
337
362
  vec4 taylorInvSqrt(vec4 r) {
338
- return 1.79284291400159 - 0.85373472095314 * r;
363
+ return 1.79284291400159 - 0.85373472095314 * r;
339
364
  }
340
-
341
- // Fade function
342
365
  vec3 fade(vec3 t) {
343
- return t*t*t*(t*(t*6.0-15.0)+10.0);
366
+ return t*t*t*(t*(t*6.0-15.0)+10.0);
344
367
  }
345
-
346
- // 3D Simplex Noise
347
368
  float snoise(vec3 v) {
348
- const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
349
- const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
350
-
351
- // First corner
352
- vec3 i = floor(v + dot(v, C.yyy) );
353
- vec3 x0 = v - i + dot(i, C.xxx) ;
354
-
355
- // Other corners
356
- vec3 g = step(x0.yzx, x0.xyz);
357
- vec3 l = 1.0 - g;
358
- vec3 i1 = min( g.xyz, l.zxy );
359
- vec3 i2 = max( g.xyz, l.zxy );
360
-
361
- vec3 x1 = x0 - i1 + C.xxx;
362
- vec3 x2 = x0 - i2 + C.yyy;
363
- vec3 x3 = x0 - D.yyy;
364
-
365
- // Permutations
366
- vec4 p = permute( permute( permute(
367
- i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
368
- + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
369
- + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
370
-
371
- // Gradients
372
- float n_ = 0.142857142857; // 1.0/7.0
373
- vec3 ns = n_ * D.wyz - D.xzx;
374
-
375
- vec4 j = p - 49.0 * floor(p * ns.z * ns.z);
376
-
377
- vec4 x_ = floor(j * ns.z);
378
- vec4 y_ = floor(j - 7.0 * x_ );
379
-
380
- vec4 x = x_ *ns.x + ns.yyyy;
381
- vec4 y = y_ *ns.x + ns.yyyy;
382
- vec4 h = 1.0 - abs(x) - abs(y);
383
-
384
- vec4 b0 = vec4( x.xy, y.xy );
385
- vec4 b1 = vec4( x.zw, y.zw );
386
-
387
- vec4 s0 = floor(b0)*2.0 + 1.0;
388
- vec4 s1 = floor(b1)*2.0 + 1.0;
389
- vec4 sh = -step(h, vec4(0.0));
390
-
391
- vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
392
- vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
393
-
394
- vec3 p0 = vec3(a0.xy,h.x);
395
- vec3 p1 = vec3(a0.zw,h.y);
396
- vec3 p2 = vec3(a1.xy,h.z);
397
- vec3 p3 = vec3(a1.zw,h.w);
398
-
399
- // Normalise gradients
400
- vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
401
- p0 *= norm.x;
402
- p1 *= norm.y;
403
- p2 *= norm.z;
404
- p3 *= norm.w;
405
-
406
- // Mix final noise value
407
- vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
408
- m = m * m;
409
- return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
410
- dot(p2,x2), dot(p3,x3) ) );
369
+ const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
370
+ const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
371
+ vec3 i = floor(v + dot(v, C.yyy) );
372
+ vec3 x0 = v - i + dot(i, C.xxx) ;
373
+ vec3 g = step(x0.yzx, x0.xyz);
374
+ vec3 l = 1.0 - g;
375
+ vec3 i1 = min( g.xyz, l.zxy );
376
+ vec3 i2 = max( g.xyz, l.zxy );
377
+ vec3 x1 = x0 - i1 + C.xxx;
378
+ vec3 x2 = x0 - i2 + C.yyy;
379
+ vec3 x3 = x0 - D.yyy;
380
+ vec4 p = permute( permute( permute(
381
+ i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
382
+ + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
383
+ + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
384
+ float n_ = 0.142857142857;
385
+ vec3 ns = n_ * D.wyz - D.xzx;
386
+ vec4 j = p - 49.0 * floor(p * ns.z * ns.z);
387
+ vec4 x_ = floor(j * ns.z);
388
+ vec4 y_ = floor(j - 7.0 * x_ );
389
+ vec4 x = x_ *ns.x + ns.yyyy;
390
+ vec4 y = y_ *ns.x + ns.yyyy;
391
+ vec4 h = 1.0 - abs(x) - abs(y);
392
+ vec4 b0 = vec4( x.xy, y.xy );
393
+ vec4 b1 = vec4( x.zw, y.zw );
394
+ vec4 s0 = floor(b0)*2.0 + 1.0;
395
+ vec4 s1 = floor(b1)*2.0 + 1.0;
396
+ vec4 sh = -step(h, vec4(0.0));
397
+ vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
398
+ vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
399
+ vec3 p0 = vec3(a0.xy,h.x);
400
+ vec3 p1 = vec3(a0.zw,h.y);
401
+ vec3 p2 = vec3(a1.xy,h.z);
402
+ vec3 p3 = vec3(a1.zw,h.w);
403
+ vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
404
+ p0 *= norm.x;
405
+ p1 *= norm.y;
406
+ p2 *= norm.z;
407
+ p3 *= norm.w;
408
+ vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
409
+ m = m * m;
410
+ return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
411
+ dot(p2,x2), dot(p3,x3) ) );
411
412
  }
412
-
413
- // Classic Perlin noise
414
413
  float cnoise(vec3 P)
415
414
  {
416
- vec3 Pi0 = floor(P);
417
- vec3 Pi1 = Pi0 + vec3(1.0);
418
-
419
- vec3 Pf0 = fract(P);
420
- vec3 Pf1 = Pf0 - vec3(1.0);
421
- vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
422
- vec4 iy = vec4(Pi0.yy, Pi1.yy);
423
- vec4 iz0 = Pi0.zzzz;
424
- vec4 iz1 = Pi1.zzzz;
425
-
426
- vec4 ixy = permute(permute(ix) + iy);
427
- vec4 ixy0 = permute(ixy + iz0);
428
- vec4 ixy1 = permute(ixy + iz1);
429
-
430
- vec4 gx0 = ixy0 * (1.0 / 7.0);
431
- vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;
432
- gx0 = fract(gx0);
433
- vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
434
- vec4 sz0 = step(gz0, vec4(0.0));
435
- gx0 -= sz0 * (step(0.0, gx0) - 0.5);
436
- gy0 -= sz0 * (step(0.0, gy0) - 0.5);
437
-
438
- vec4 gx1 = ixy1 * (1.0 / 7.0);
439
- vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;
440
- gx1 = fract(gx1);
441
- vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
442
- vec4 sz1 = step(gz1, vec4(0.0));
443
- gx1 -= sz1 * (step(0.0, gx1) - 0.5);
444
- gy1 -= sz1 * (step(0.0, gy1) - 0.5);
445
-
446
- vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
447
- vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
448
- vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
449
- vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
450
- vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
451
- vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
452
- vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
453
- vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
454
-
455
- vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
456
- g000 *= norm0.x;
457
- g010 *= norm0.y;
458
- g100 *= norm0.z;
459
- g110 *= norm0.w;
460
- vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
461
- g001 *= norm1.x;
462
- g011 *= norm1.y;
463
- g101 *= norm1.z;
464
- g111 *= norm1.w;
465
-
466
- float n000 = dot(g000, Pf0);
467
- float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
468
- float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
469
- float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
470
- float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
471
- float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
472
- float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
473
- float n111 = dot(g111, Pf1);
474
-
475
- vec3 fade_xyz = fade(Pf0);
476
- vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
477
- vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
478
- float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
479
- return 2.2 * n_xyz;
480
- }
481
- `;
415
+ vec3 Pi0 = floor(P);
416
+ vec3 Pi1 = Pi0 + vec3(1.0);
417
+ vec3 Pf0 = fract(P);
418
+ vec3 Pf1 = Pf0 - vec3(1.0);
419
+ vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
420
+ vec4 iy = vec4(Pi0.yy, Pi1.yy);
421
+ vec4 iz0 = Pi0.zzzz;
422
+ vec4 iz1 = Pi1.zzzz;
423
+ vec4 ixy = permute(permute(ix) + iy);
424
+ vec4 ixy0 = permute(ixy + iz0);
425
+ vec4 ixy1 = permute(ixy + iz1);
426
+ vec4 gx0 = ixy0 * (1.0 / 7.0);
427
+ vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;
428
+ gx0 = fract(gx0);
429
+ vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
430
+ vec4 sz0 = step(gz0, vec4(0.0));
431
+ gx0 -= sz0 * (step(0.0, gx0) - 0.5);
432
+ gy0 -= sz0 * (step(0.0, gy0) - 0.5);
433
+ vec4 gx1 = ixy1 * (1.0 / 7.0);
434
+ vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;
435
+ gx1 = fract(gx1);
436
+ vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
437
+ vec4 sz1 = step(gz1, vec4(0.0));
438
+ gx1 -= sz1 * (step(0.0, gx1) - 0.5);
439
+ gy1 -= sz1 * (step(0.0, gy1) - 0.5);
440
+ vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
441
+ vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
442
+ vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
443
+ vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
444
+ vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
445
+ vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
446
+ vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
447
+ vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
448
+ vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
449
+ g000 *= norm0.x;
450
+ g010 *= norm0.y;
451
+ g100 *= norm0.z;
452
+ g110 *= norm0.w;
453
+ vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
454
+ g001 *= norm1.x;
455
+ g011 *= norm1.y;
456
+ g101 *= norm1.z;
457
+ g111 *= norm1.w;
458
+ float n000 = dot(g000, Pf0);
459
+ float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
460
+ float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
461
+ float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
462
+ float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
463
+ float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
464
+ float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
465
+ float n111 = dot(g111, Pf1);
466
+ vec3 fade_xyz = fade(Pf0);
467
+ vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
468
+ vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
469
+ float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
470
+ return 2.2 * n_xyz;
471
+ }`;
482
472
  }
483
- function j() {
484
- return `
485
- vec3 saturation(vec3 rgb, float adjustment) {
486
- const vec3 W = vec3(0.2125, 0.7154, 0.0721);
487
- vec3 intensity = vec3(dot(rgb, W));
488
- return mix(intensity, rgb, adjustment);
473
+ function re() {
474
+ return `vec3 saturation(vec3 rgb, float adjustment) {
475
+ const vec3 W = vec3(0.2125, 0.7154, 0.0721);
476
+ vec3 intensity = vec3(dot(rgb, W));
477
+ return mix(intensity, rgb, adjustment);
478
+ }`;
489
479
  }
490
- `;
491
- }
492
- class J {
480
+ class he {
493
481
  elements;
494
482
  constructor() {
495
483
  this.elements = new Float32Array([
@@ -511,15 +499,27 @@ class J {
511
499
  1
512
500
  ]);
513
501
  }
514
- translate(e, r, s) {
515
- return this.elements[12] += this.elements[0] * e + this.elements[4] * r + this.elements[8] * s, this.elements[13] += this.elements[1] * e + this.elements[5] * r + this.elements[9] * s, this.elements[14] += this.elements[2] * e + this.elements[6] * r + this.elements[10] * s, this.elements[15] += this.elements[3] * e + this.elements[7] * r + this.elements[11] * s, this;
502
+ identity() {
503
+ const e = this.elements;
504
+ 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;
505
+ }
506
+ translate(e, i, r) {
507
+ 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;
516
508
  }
517
509
  rotateX(e) {
518
- const r = Math.cos(e), s = Math.sin(e), t = this.elements[4], S = this.elements[5], y = this.elements[6], a = this.elements[7], p = this.elements[8], v = this.elements[9], T = this.elements[10], x = this.elements[11];
519
- return this.elements[4] = r * t + s * p, this.elements[5] = r * S + s * v, this.elements[6] = r * y + s * T, this.elements[7] = r * a + s * x, this.elements[8] = r * p - s * t, this.elements[9] = r * v - s * S, this.elements[10] = r * T - s * y, this.elements[11] = r * x - s * a, this;
510
+ 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];
511
+ 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;
512
+ }
513
+ rotateY(e) {
514
+ 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];
515
+ 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;
516
+ }
517
+ rotateZ(e) {
518
+ 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];
519
+ 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;
520
520
  }
521
521
  }
522
- class Fe {
522
+ class pt {
523
523
  left;
524
524
  right;
525
525
  top;
@@ -528,67 +528,205 @@ class Fe {
528
528
  far;
529
529
  position;
530
530
  projectionMatrix;
531
- constructor(e, r, s, t, S, y) {
532
- this.left = e, this.right = r, this.top = s, this.bottom = t, this.near = S, this.far = y, this.position = [0, 0, 0], this.projectionMatrix = new J(), this.updateProjectionMatrix();
531
+ zoom;
532
+ constructor(e, i, r, t, y, v) {
533
+ 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 he(), this.updateProjectionMatrix();
533
534
  }
534
535
  updateProjectionMatrix() {
535
- const e = 1 / (this.right - this.left), r = 1 / (this.top - this.bottom), s = 1 / (this.far - this.near), t = (this.right + this.left) * e, S = (this.top + this.bottom) * r, y = (this.far + this.near) * s;
536
+ 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;
536
537
  this.projectionMatrix.elements = new Float32Array([
537
538
  2 * e,
538
539
  0,
539
540
  0,
540
541
  0,
541
542
  0,
542
- 2 * r,
543
+ 2 * i,
543
544
  0,
544
545
  0,
545
546
  0,
546
547
  0,
547
- -2 * s,
548
+ -2 * r,
548
549
  0,
549
550
  -t,
550
- -S,
551
551
  -y,
552
+ -v,
552
553
  1
553
554
  ]);
554
555
  }
555
556
  }
556
- function H(l, e, r, s = 50, t = 50) {
557
- const a = e * r / 1e6 * s * t / 1.5, p = e / r, v = Math.sqrt(a * p), T = a / v;
558
- let x = -s / 2, h = Math.min((x + v) / 1.5, s / 2), b = t / 4, R = Math.max((b - T) / 2, -t / 4);
559
- if (p < 1) {
560
- const E = p;
561
- x = x * E, h = h * E;
562
- const g = 1.05;
563
- x = x * g, h = h * g, b = b * g, R = R * g;
564
- }
565
- l.left = x, l.right = h, l.top = b, l.bottom = R, l.near = -100, l.far = 1e3, l.updateProjectionMatrix();
557
+ function j(n, e, i, r = 50, t = 50, y = "plane", v = 1) {
558
+ n.zoom = v;
559
+ const s = e / i;
560
+ if (y === "plane") {
561
+ const b = e * i / 1e6 * r * t / 1.5, a = Math.sqrt(b * s), h = b / a;
562
+ let p = -r / 2, c = Math.min((p + a) / 1.5, r / 2), d = t / 4, R = Math.max((d - h) / 2, -t / 4);
563
+ if (s < 1) {
564
+ const g = s;
565
+ p = p * g, c = c * g;
566
+ const x = 1.05;
567
+ p = p * x, c = c * x, d = d * x, R = R * x;
568
+ }
569
+ n.left = p, n.right = c, n.top = d, n.bottom = R;
570
+ } else {
571
+ let l = 25;
572
+ if (y === "sphere" ? l = 30 : y === "torus" ? l = 35 : y === "cylinder" && (l = 30), s >= 1)
573
+ n.left = -l * s, n.right = l * s, n.top = l, n.bottom = -l;
574
+ else {
575
+ n.left = -l, n.right = l, n.top = l / s, n.bottom = -l / s;
576
+ const _ = 1.05;
577
+ n.left *= _, n.right *= _, n.top *= _, n.bottom *= _;
578
+ }
579
+ }
580
+ n.left /= v, n.right /= v, n.top /= v, n.bottom /= v, n.near = -100, n.far = 1e3, n.updateProjectionMatrix();
566
581
  }
567
- function Ie(l, e, r, s) {
568
- const t = l / 2, S = e / 2, y = Math.floor(r), a = Math.floor(s), p = y + 1, v = a + 1, T = l / y, x = e / a, h = [], b = [], R = [], E = [];
569
- for (let _ = 0; _ < v; _++) {
570
- const u = _ * x - S;
571
- for (let m = 0; m < p; m++) {
572
- const n = m * T - t;
573
- b.push(n, -u, 0), R.push(0, 0, 1), E.push(m / y), E.push(1 - _ / a);
582
+ function oe(n, e, i, r) {
583
+ 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 = [];
584
+ for (let x = 0; x < _; x++) {
585
+ const w = x * a - y;
586
+ for (let u = 0; u < l; u++) {
587
+ const T = u * b - t;
588
+ p.push(T, -w, 0), c.push(0, 0, 1), d.push(u / v), d.push(1 - x / s);
574
589
  }
575
590
  }
576
- for (let _ = 0; _ < a; _++)
577
- for (let u = 0; u < y; u++) {
578
- const m = u + p * _, n = u + p * (_ + 1), f = u + 1 + p * (_ + 1), c = u + 1 + p * _;
579
- h.push(m, n, c), h.push(n, f, c);
591
+ for (let x = 0; x < s; x++)
592
+ for (let w = 0; w < v; w++) {
593
+ const u = w + l * x, T = w + l * (x + 1), A = w + 1 + l * (x + 1), D = w + 1 + l * x;
594
+ h.push(u, T, D), h.push(T, A, D);
580
595
  }
581
- const g = b.length / 3 > 65535, A = [];
582
- for (let _ = 0; _ < h.length; _ += 3) {
583
- const u = h[_], m = h[_ + 1], n = h[_ + 2];
584
- A.push(u, m, m, n, n, u);
596
+ const R = p.length / 3 > 65535, g = [];
597
+ for (let x = 0; x < h.length; x += 3) {
598
+ const w = h[x], u = h[x + 1], T = h[x + 2];
599
+ g.push(w, u, u, T, T, w);
585
600
  }
586
601
  return {
587
- position: new Float32Array(b),
588
- normal: new Float32Array(R),
589
- uv: new Float32Array(E),
590
- index: g ? new Uint32Array(h) : new Uint16Array(h),
591
- wireframeIndex: g ? new Uint32Array(A) : new Uint16Array(A)
602
+ position: new Float32Array(p),
603
+ normal: new Float32Array(c),
604
+ uv: new Float32Array(d),
605
+ index: R ? new Uint32Array(h) : new Uint16Array(h),
606
+ wireframeIndex: R ? new Uint32Array(g) : new Uint16Array(g)
607
+ };
608
+ }
609
+ function ne(n, e, i) {
610
+ const r = [], t = [], y = [], v = [], s = Math.floor(e), l = Math.floor(i);
611
+ for (let a = 0; a <= l; a++) {
612
+ const h = a / l, p = h * Math.PI;
613
+ for (let c = 0; c <= s; c++) {
614
+ 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);
615
+ r.push(g, x, w);
616
+ const u = Math.sqrt(g * g + x * x + w * w);
617
+ t.push(g / u, x / u, w / u), y.push(d, 1 - h);
618
+ }
619
+ }
620
+ for (let a = 0; a < l; a++)
621
+ for (let h = 0; h < s; h++) {
622
+ 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;
623
+ v.push(p, c, R), v.push(c, d, R);
624
+ }
625
+ const _ = r.length / 3 > 65535, b = [];
626
+ for (let a = 0; a < v.length; a += 3) {
627
+ const h = v[a], p = v[a + 1], c = v[a + 2];
628
+ b.push(h, p, p, c, c, h);
629
+ }
630
+ return {
631
+ position: new Float32Array(r),
632
+ normal: new Float32Array(t),
633
+ uv: new Float32Array(y),
634
+ index: _ ? new Uint32Array(v) : new Uint16Array(v),
635
+ wireframeIndex: _ ? new Uint32Array(b) : new Uint16Array(b)
636
+ };
637
+ }
638
+ function ae(n, e, i, r) {
639
+ const t = [], y = [], v = [], s = [], l = Math.floor(i), _ = Math.floor(r);
640
+ for (let h = 0; h <= l; h++) {
641
+ const p = h / l * Math.PI * 2;
642
+ for (let c = 0; c <= _; c++) {
643
+ 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);
644
+ t.push(R, g, x);
645
+ 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);
646
+ y.push(T / m, A / m, D / m), v.push(c / _, h / l);
647
+ }
648
+ }
649
+ for (let h = 1; h <= l; h++)
650
+ for (let p = 1; p <= _; p++) {
651
+ const c = (_ + 1) * h + p - 1, d = (_ + 1) * (h - 1) + p - 1, R = (_ + 1) * (h - 1) + p, g = (_ + 1) * h + p;
652
+ s.push(c, d, g), s.push(d, R, g);
653
+ }
654
+ const b = t.length / 3 > 65535, a = [];
655
+ for (let h = 0; h < s.length; h += 3) {
656
+ const p = s[h], c = s[h + 1], d = s[h + 2];
657
+ a.push(p, c, c, d, d, p);
658
+ }
659
+ return {
660
+ position: new Float32Array(t),
661
+ normal: new Float32Array(y),
662
+ uv: new Float32Array(v),
663
+ index: b ? new Uint32Array(s) : new Uint16Array(s),
664
+ wireframeIndex: b ? new Uint32Array(a) : new Uint16Array(a)
665
+ };
666
+ }
667
+ function le(n, e, i, r, t) {
668
+ const y = [], v = [], s = [], l = [], _ = Math.floor(r), b = Math.floor(t), a = i / 2;
669
+ for (let c = 0; c <= b; c++) {
670
+ const d = c / b, R = d * i - a, g = d * (e - n) + n;
671
+ for (let x = 0; x <= _; x++) {
672
+ const w = x / _, u = w * Math.PI * 2, T = Math.sin(u), A = Math.cos(u);
673
+ y.push(g * T, -R, g * A), v.push(T, 0, A), s.push(w, 1 - d);
674
+ }
675
+ }
676
+ for (let c = 0; c < b; c++)
677
+ for (let d = 0; d < _; d++) {
678
+ const R = d + (_ + 1) * c, g = d + (_ + 1) * (c + 1), x = d + 1 + (_ + 1) * (c + 1), w = d + 1 + (_ + 1) * c;
679
+ l.push(R, g, w), l.push(g, x, w);
680
+ }
681
+ const h = y.length / 3 > 65535, p = [];
682
+ for (let c = 0; c < l.length; c += 3) {
683
+ const d = l[c], R = l[c + 1], g = l[c + 2];
684
+ p.push(d, R, R, g, g, d);
685
+ }
686
+ return {
687
+ position: new Float32Array(y),
688
+ normal: new Float32Array(v),
689
+ uv: new Float32Array(s),
690
+ index: h ? new Uint32Array(l) : new Uint16Array(l),
691
+ wireframeIndex: h ? new Uint32Array(p) : new Uint16Array(p)
692
+ };
693
+ }
694
+ function ue(n, e, i, r, t, y) {
695
+ 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 = [];
696
+ for (let u = 0; u < a; u++) {
697
+ const T = u * p - s;
698
+ for (let A = 0; A < b; A++) {
699
+ const D = A * h - v;
700
+ let m = D, F = T, C = 0, z = 0, M = 0, P = 1;
701
+ if (Math.abs(t) > 1e-3) {
702
+ const E = n / t, S = D / E;
703
+ m = E * Math.sin(S), C = E * (1 - Math.cos(S)), z = Math.sin(S), P = Math.cos(S);
704
+ }
705
+ if (Math.abs(y) > 1e-3) {
706
+ const E = T / e * y, S = Math.cos(E), U = Math.sin(E), B = m * S - C * U, O = m * U + C * S;
707
+ m = B, C = O;
708
+ const I = z * S - P * U, Y = z * U + P * S;
709
+ z = I, P = Y;
710
+ }
711
+ c.push(m, -F, C), d.push(z, M, P), R.push(A / l), R.push(1 - u / _);
712
+ }
713
+ }
714
+ for (let u = 0; u < _; u++)
715
+ for (let T = 0; T < l; T++) {
716
+ const A = T + b * u, D = T + b * (u + 1), m = T + 1 + b * (u + 1), F = T + 1 + b * u;
717
+ g.push(A, D, F), g.push(D, m, F);
718
+ }
719
+ const x = c.length / 3 > 65535, w = [];
720
+ for (let u = 0; u < g.length; u += 3) {
721
+ const T = g[u], A = g[u + 1], D = g[u + 2];
722
+ w.push(T, A, A, D, D, T);
723
+ }
724
+ return {
725
+ position: new Float32Array(c),
726
+ normal: new Float32Array(d),
727
+ uv: new Float32Array(R),
728
+ index: x ? new Uint32Array(g) : new Uint16Array(g),
729
+ wireframeIndex: x ? new Uint32Array(w) : new Uint16Array(w)
592
730
  };
593
731
  }
594
732
  console.info(
@@ -601,8 +739,8 @@ https://neat.firecms.co`,
601
739
  "font-weight: bold; font-size: 14px; color: #FF5772;",
602
740
  "color: inherit;"
603
741
  );
604
- const $ = 50, K = 80, O = 6, Me = Le();
605
- class We {
742
+ const X = 50, N = 80, $ = 6, gt = xt();
743
+ class wt {
606
744
  _ref;
607
745
  _speed = -1;
608
746
  _horizontalPressure = -1;
@@ -619,6 +757,7 @@ class We {
619
757
  _grainSparsity = -1;
620
758
  _grainSpeed = -1;
621
759
  _colorBlending = -1;
760
+ _resolution = 1;
622
761
  _colors = [];
623
762
  _wireframe = !1;
624
763
  _backgroundColor = "#FFFFFF";
@@ -638,6 +777,7 @@ class We {
638
777
  _textureColorBlending = 0.01;
639
778
  _textureSeed = 333;
640
779
  _textureEase = 0.5;
780
+ _transparentTextureVoid = !1;
641
781
  _domainWarpEnabled = !1;
642
782
  _domainWarpIntensity = 0.5;
643
783
  _domainWarpScale = 1;
@@ -654,6 +794,31 @@ class We {
654
794
  _bloomIntensity = 0;
655
795
  _bloomThreshold = 0.7;
656
796
  _chromaticAberration = 0;
797
+ _silhouetteFade = 0.25;
798
+ _cylinderFade = 0.08;
799
+ _ribbonFade = 0.05;
800
+ _flatShading = !0;
801
+ _shapeType = "plane";
802
+ _shapeRotationX = 0;
803
+ _shapeRotationY = 0;
804
+ _shapeRotationZ = 0;
805
+ _shapeAutoRotateSpeedX = 0;
806
+ _shapeAutoRotateSpeedY = 0;
807
+ _sphereRadius = 15;
808
+ _torusRadius = 15;
809
+ _torusTube = 5;
810
+ _cylinderRadius = 10;
811
+ _cylinderHeight = 40;
812
+ _planeBend = 0;
813
+ _planeTwist = 0;
814
+ _cameraLock = !1;
815
+ _cameraX = 0;
816
+ _cameraY = 0;
817
+ _cameraZ = 0;
818
+ _cameraRotationX = 0;
819
+ _cameraRotationY = 0;
820
+ _cameraRotationZ = 0;
821
+ _cameraZoom = 1;
657
822
  _proceduralTexture = null;
658
823
  _proceduralBackgroundColor = "#000000";
659
824
  _textureShapeTriangles = 20;
@@ -669,186 +834,363 @@ class We {
669
834
  _yOffsetWaveMultiplier = 4e-3;
670
835
  _yOffsetColorMultiplier = 4e-3;
671
836
  _yOffsetFlowMultiplier = 4e-3;
837
+ _sourceCanvas = null;
838
+ _sourceCtx = null;
839
+ _maskedCanvas = null;
840
+ _maskedCtx = null;
672
841
  _resizeTimeoutId = null;
673
842
  _textureNeedsUpdate = !1;
674
843
  _linkCheckCounter = 0;
675
844
  _colorsChanged = !0;
676
845
  _uniformsDirty = !0;
677
846
  _textureDirty = !0;
847
+ _yOffsetDirty = !1;
848
+ _modelViewMatrix = new he();
849
+ _isVisible = !0;
850
+ _visibilityObserver = null;
851
+ _visibilityHandler = null;
678
852
  constructor(e) {
679
853
  const {
680
- ref: r,
681
- speed: s = 4,
854
+ ref: i,
855
+ speed: r = 4,
682
856
  horizontalPressure: t = 3,
683
- verticalPressure: S = 3,
684
- waveFrequencyX: y = 5,
685
- waveFrequencyY: a = 5,
686
- waveAmplitude: p = 3,
687
- colors: v,
688
- highlights: T = 4,
689
- shadows: x = 4,
857
+ verticalPressure: y = 3,
858
+ waveFrequencyX: v = 5,
859
+ waveFrequencyY: s = 5,
860
+ waveAmplitude: l = 3,
861
+ colors: _,
862
+ highlights: b = 4,
863
+ shadows: a = 4,
690
864
  colorSaturation: h = 0,
691
- colorBrightness: b = 1,
692
- colorBlending: R = 5,
693
- grainScale: E = 2,
694
- grainIntensity: g = 0.55,
695
- grainSparsity: A = 0,
696
- grainSpeed: _ = 0.1,
697
- wireframe: u = !1,
698
- backgroundColor: m = "#FFFFFF",
699
- backgroundAlpha: n = 1,
700
- resolution: f = 1,
701
- seed: c,
702
- yOffset: d = 0,
703
- yOffsetWaveMultiplier: C = 4,
704
- yOffsetColorMultiplier: D = 4,
705
- yOffsetFlowMultiplier: F = 4,
706
- flowDistortionA: I = 0,
707
- flowDistortionB: N = 0,
708
- flowScale: W = 1,
709
- flowEase: z = 0,
710
- flowEnabled: w = !0,
711
- enableProceduralTexture: M = !1,
712
- textureVoidLikelihood: Q = 0.45,
713
- textureVoidWidthMin: ee = 200,
714
- textureVoidWidthMax: te = 486,
715
- textureBandDensity: ie = 2.15,
716
- textureColorBlending: re = 0.01,
717
- textureSeed: oe = 333,
718
- textureEase: se = 0.5,
719
- proceduralBackgroundColor: ne = "#000000",
720
- textureShapeTriangles: ae = 20,
721
- textureShapeCircles: le = 15,
722
- textureShapeBars: ue = 15,
723
- textureShapeSquiggles: fe = 10,
724
- domainWarpEnabled: _e = !1,
725
- domainWarpIntensity: ce = 0.5,
726
- domainWarpScale: he = 1,
727
- vignetteIntensity: de = 0.5,
728
- vignetteRadius: me = 0.8,
729
- fresnelEnabled: pe = !1,
730
- fresnelPower: ge = 2,
731
- fresnelIntensity: xe = 0.5,
732
- fresnelColor: ye = "#FFFFFF",
733
- iridescenceEnabled: ve = !1,
734
- iridescenceIntensity: be = 0.5,
735
- iridescenceSpeed: we = 1,
736
- bloomIntensity: Se = 0,
737
- bloomThreshold: Ee = 0.7,
738
- chromaticAberration: Te = 0
865
+ colorBrightness: p = 1,
866
+ colorBlending: c = 5,
867
+ grainScale: d = 2,
868
+ grainIntensity: R = 0.55,
869
+ grainSparsity: g = 0,
870
+ grainSpeed: x = 0.1,
871
+ wireframe: w = !1,
872
+ backgroundColor: u = "#FFFFFF",
873
+ backgroundAlpha: T = 1,
874
+ resolution: A = 1,
875
+ seed: D,
876
+ yOffset: m = 0,
877
+ yOffsetWaveMultiplier: F = 4,
878
+ yOffsetColorMultiplier: C = 4,
879
+ yOffsetFlowMultiplier: z = 4,
880
+ flowDistortionA: M = 0,
881
+ flowDistortionB: P = 0,
882
+ flowScale: E = 1,
883
+ flowEase: S = 0,
884
+ flowEnabled: U = !0,
885
+ enableProceduralTexture: B = !1,
886
+ textureVoidLikelihood: O = 0.45,
887
+ textureVoidWidthMin: I = 200,
888
+ textureVoidWidthMax: Y = 486,
889
+ textureBandDensity: fe = 2.15,
890
+ textureColorBlending: de = 0.01,
891
+ textureSeed: me = 333,
892
+ textureEase: pe = 0.5,
893
+ proceduralBackgroundColor: ge = "#000000",
894
+ transparentTextureVoid: ye = !1,
895
+ textureShapeTriangles: ve = 20,
896
+ textureShapeCircles: xe = 15,
897
+ textureShapeBars: be = 15,
898
+ textureShapeSquiggles: we = 10,
899
+ domainWarpEnabled: Se = !1,
900
+ domainWarpIntensity: Re = 0.5,
901
+ domainWarpScale: Te = 1,
902
+ vignetteIntensity: Ee = 0,
903
+ vignetteRadius: Ae = 0.8,
904
+ fresnelEnabled: Fe = !1,
905
+ fresnelPower: ze = 2,
906
+ fresnelIntensity: De = 0.5,
907
+ fresnelColor: Me = "#FFFFFF",
908
+ iridescenceEnabled: Ce = !1,
909
+ iridescenceIntensity: Pe = 0.5,
910
+ iridescenceSpeed: Ue = 1,
911
+ bloomIntensity: Ie = 0,
912
+ bloomThreshold: Be = 0.7,
913
+ chromaticAberration: Le = 0,
914
+ silhouetteFade: Oe = 0.25,
915
+ cylinderFade: We = 0.08,
916
+ ribbonFade: Xe = 0.05,
917
+ flatShading: Ne = !0,
918
+ cameraLock: Ye = !1,
919
+ cameraX: ke = 0,
920
+ cameraY: Ve = 0,
921
+ cameraZ: qe = 0,
922
+ cameraRotationX: Ze = 0,
923
+ cameraRotationY: He = 0,
924
+ cameraRotationZ: Ge = 0,
925
+ cameraZoom: je = 1,
926
+ shapeType: $e = "plane",
927
+ shapeRotationX: Ke = 0,
928
+ shapeRotationY: Je = 0,
929
+ shapeRotationZ: Qe = 0,
930
+ shapeAutoRotateSpeedX: et = 0,
931
+ shapeAutoRotateSpeedY: tt = 0,
932
+ sphereRadius: it = 15,
933
+ torusRadius: st = 15,
934
+ torusTube: rt = 5,
935
+ cylinderRadius: ot = 10,
936
+ cylinderHeight: nt = 40,
937
+ planeBend: at = 0,
938
+ planeTwist: lt = 0
739
939
  } = e;
740
- this._ref = r, this.destroy = this.destroy.bind(this), this._initScene = this._initScene.bind(this), this.speed = s, this.horizontalPressure = t, this.verticalPressure = S, this.waveFrequencyX = y, this.waveFrequencyY = a, this.waveAmplitude = p, this.colorBlending = R, this.grainScale = E, this.grainIntensity = g, this.grainSparsity = A, this.grainSpeed = _, this.colors = v, this.shadows = x, this.highlights = T, this.colorSaturation = h, this.colorBrightness = b, this.wireframe = u, this.backgroundColor = m, this.backgroundAlpha = n, this.yOffset = d, this.yOffsetWaveMultiplier = C, this.yOffsetColorMultiplier = D, this.yOffsetFlowMultiplier = F, this.flowDistortionA = I, this.flowDistortionB = N, this.flowScale = W, this.flowEase = z, this.flowEnabled = w, this.enableProceduralTexture = M, this.textureVoidLikelihood = Q, this.textureVoidWidthMin = ee, this.textureVoidWidthMax = te, this.textureBandDensity = ie, this.textureColorBlending = re, this.textureSeed = oe, this.textureEase = se, this._proceduralBackgroundColor = ne, this._textureShapeTriangles = ae, this._textureShapeCircles = le, this._textureShapeBars = ue, this._textureShapeSquiggles = fe, this.domainWarpEnabled = _e, this.domainWarpIntensity = ce, this.domainWarpScale = he, this.vignetteIntensity = de, this.vignetteRadius = me, this.fresnelEnabled = pe, this.fresnelPower = ge, this.fresnelIntensity = xe, this.fresnelColor = ye, this.iridescenceEnabled = ve, this.iridescenceIntensity = be, this.iridescenceSpeed = we, this.bloomIntensity = Se, this.bloomThreshold = Ee, this.chromaticAberration = Te, this.glState = this._initScene(f), Ne();
741
- let k = c !== void 0 ? c : Be(), q = performance.now();
742
- const V = () => {
743
- const { gl: i, program: B, locations: o, indexCount: U, indexType: L } = this.glState;
744
- if (this._linkCheckCounter++, this._linkCheckCounter >= 300 && (this._linkCheckCounter = 0, (!this._linkElement || !document.contains(this._linkElement)) && (this._linkElement = Ue(r))), this._initialized) {
745
- const X = performance.now();
746
- if (k += (X - q) / 1e3 * this._speed, q = X, i.useProgram(B), i.uniform1f(o.uniforms.u_time, k), this._uniformsDirty && (i.uniform2f(o.uniforms.u_resolution, this._ref.clientWidth, this._ref.clientHeight), i.uniform2f(o.uniforms.u_color_pressure, this._horizontalPressure, this._verticalPressure), i.uniform1f(o.uniforms.u_wave_frequency_x, this._waveFrequencyX), i.uniform1f(o.uniforms.u_wave_frequency_y, this._waveFrequencyY), i.uniform1f(o.uniforms.u_wave_amplitude, this._waveAmplitude), i.uniform1f(o.uniforms.u_color_blending, this._colorBlending), i.uniform1f(o.uniforms.u_shadows, this._shadows), i.uniform1f(o.uniforms.u_highlights, this._highlights), i.uniform1f(o.uniforms.u_saturation, this._saturation), i.uniform1f(o.uniforms.u_brightness, this._brightness), i.uniform1f(o.uniforms.u_grain_intensity, this._grainIntensity), i.uniform1f(o.uniforms.u_grain_sparsity, this._grainSparsity), i.uniform1f(o.uniforms.u_grain_speed, this._grainSpeed), i.uniform1f(o.uniforms.u_grain_scale, this._grainScale), i.uniform1f(o.uniforms.u_y_offset, this._yOffset), i.uniform1f(o.uniforms.u_y_offset_wave_multiplier, this._yOffsetWaveMultiplier), i.uniform1f(o.uniforms.u_y_offset_color_multiplier, this._yOffsetColorMultiplier), i.uniform1f(o.uniforms.u_y_offset_flow_multiplier, this._yOffsetFlowMultiplier), i.uniform1f(o.uniforms.u_flow_distortion_a, this._flowDistortionA), i.uniform1f(o.uniforms.u_flow_distortion_b, this._flowDistortionB), i.uniform1f(o.uniforms.u_flow_scale, this._flowScale), i.uniform1f(o.uniforms.u_flow_ease, this._flowEase), i.uniform1f(o.uniforms.u_flow_enabled, this._flowEnabled ? 1 : 0), i.uniform1f(o.uniforms.u_enable_procedural_texture, this._enableProceduralTexture ? 1 : 0), i.uniform1f(o.uniforms.u_texture_ease, this._textureEase), i.uniform1f(o.uniforms.u_domain_warp_enabled, this._domainWarpEnabled ? 1 : 0), i.uniform1f(o.uniforms.u_domain_warp_intensity, this._domainWarpIntensity), i.uniform1f(o.uniforms.u_domain_warp_scale, this._domainWarpScale), i.uniform1f(o.uniforms.u_vignette_intensity, this._vignetteIntensity), i.uniform1f(o.uniforms.u_vignette_radius, this._vignetteRadius), i.uniform1f(o.uniforms.u_fresnel_enabled, this._fresnelEnabled ? 1 : 0), i.uniform1f(o.uniforms.u_fresnel_power, this._fresnelPower), i.uniform1f(o.uniforms.u_fresnel_intensity, this._fresnelIntensity), i.uniform3fv(o.uniforms.u_fresnel_color, this._fresnelColorRgb), i.uniform1f(o.uniforms.u_iridescence_enabled, this._iridescenceEnabled ? 1 : 0), i.uniform1f(o.uniforms.u_iridescence_intensity, this._iridescenceIntensity), i.uniform1f(o.uniforms.u_iridescence_speed, this._iridescenceSpeed), i.uniform1f(o.uniforms.u_bloom_intensity, this._bloomIntensity), i.uniform1f(o.uniforms.u_bloom_threshold, this._bloomThreshold), i.uniform1f(o.uniforms.u_chromatic_aberration, this._chromaticAberration), this._uniformsDirty = !1), this._textureNeedsUpdate && this._enableProceduralTexture && (this._proceduralTexture && i.deleteTexture(this._proceduralTexture), this._proceduralTexture = this._createProceduralTexture(i), this._textureNeedsUpdate = !1, this._textureDirty = !0), this._textureDirty && this._proceduralTexture && (i.activeTexture(i.TEXTURE1), i.bindTexture(i.TEXTURE_2D, this._proceduralTexture), i.uniform1i(o.uniforms.u_procedural_texture, 1), this._textureDirty = !1), this._colorsChanged) {
940
+ 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 = fe, this.textureColorBlending = de, this.textureSeed = me, this.textureEase = pe, this._proceduralBackgroundColor = ge, this.transparentTextureVoid = ye, this._textureShapeTriangles = ve, this._textureShapeCircles = xe, this._textureShapeBars = be, this._textureShapeSquiggles = we, this.domainWarpEnabled = Se, this.domainWarpIntensity = Re, this.domainWarpScale = Te, this.vignetteIntensity = Ee, this.vignetteRadius = Ae, this.fresnelEnabled = Fe, this.fresnelPower = ze, this.fresnelIntensity = De, this.fresnelColor = Me, this.iridescenceEnabled = Ce, this.iridescenceIntensity = Pe, this.iridescenceSpeed = Ue, this.bloomIntensity = Ie, this.bloomThreshold = Be, this.chromaticAberration = Le, this.silhouetteFade = Oe, this.cylinderFade = We, this.ribbonFade = Xe, this._flatShading = Ne, this._cameraLock = Ye, this._cameraX = ke, this._cameraY = Ve, this._cameraZ = qe, this._cameraRotationX = Ze, this._cameraRotationY = He, this._cameraRotationZ = Ge, this._cameraZoom = je, this._shapeType = $e, this._shapeRotationX = Ke, this._shapeRotationY = Je, this._shapeRotationZ = Qe, this._shapeAutoRotateSpeedX = et, this._shapeAutoRotateSpeedY = tt, this._sphereRadius = it, this._torusRadius = st, this._torusTube = rt, this._cylinderRadius = ot, this._cylinderHeight = nt, this._planeBend = at, this._planeTwist = lt, this.glState = this._initScene(A), bt();
941
+ let Z = D !== void 0 ? D : vt(), H = performance.now();
942
+ const G = () => {
943
+ const { gl: o, program: k, locations: f, indexCount: V, indexType: q } = this.glState;
944
+ if (this._linkCheckCounter++, this._linkCheckCounter >= 300 && (this._linkCheckCounter = 0, (!this._linkElement || !document.contains(this._linkElement)) && (this._linkElement = yt(i))), this._initialized) {
945
+ const Q = performance.now();
946
+ Z += (Q - H) / 1e3 * this._speed, H = Q, o.useProgram(k), o.uniform1f(f.uniforms.u_time, Z);
947
+ const K = this.glState.camera, W = this._modelViewMatrix;
948
+ W.identity(), W.translate(
949
+ -K.position[0] - this._cameraX,
950
+ -K.position[1] - this._cameraY,
951
+ -K.position[2] - this._cameraZ
952
+ ), W.translate(0, 0, -1), W.rotateX(-this._cameraRotationX), W.rotateY(-this._cameraRotationY), W.rotateZ(-this._cameraRotationZ);
953
+ let J = this._shapeRotationX, ee = this._shapeRotationY, _t = this._shapeRotationZ;
954
+ this._shapeAutoRotateSpeedX !== 0 && (J += Z * this._shapeAutoRotateSpeedX * 0.1), this._shapeAutoRotateSpeedY !== 0 && (ee += Z * this._shapeAutoRotateSpeedY * 0.1), this._shapeType === "plane" || this._shapeType === "ribbon" ? W.rotateX(J - Math.PI / 3.5) : W.rotateX(J), W.rotateY(ee), W.rotateZ(_t);
955
+ const te = f.uniforms.modelViewMatrix;
956
+ if (te && o.uniformMatrix4fv(te, !1, W.elements), this._yOffsetDirty && !this._uniformsDirty && (o.uniform1f(f.uniforms.u_y_offset, this._yOffset), this._yOffsetDirty = !1), this._uniformsDirty) {
957
+ 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);
958
+ let L = 0;
959
+ 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;
960
+ }
961
+ 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) {
747
962
  this._colorsChanged = !1;
748
- for (let P = 0; P < O; P++)
749
- if (P < this._colors.length) {
750
- const G = this._colors[P], Ae = this._cachedColorRgb[P] || [0, 0, 0];
751
- i.uniform1f(o.uniforms[`u_colors[${P}].is_active`], G.enabled ? 1 : 0), i.uniform3fv(o.uniforms[`u_colors[${P}].color`], Ae), i.uniform1f(o.uniforms[`u_colors[${P}].influence`], G.influence || 0);
963
+ for (let L = 0; L < $; L++)
964
+ if (L < this._colors.length) {
965
+ const ie = this._colors[L], ct = this._cachedColorRgb[L] || [0, 0, 0];
966
+ o.uniform1f(f.uniforms[`u_colors[${L}].is_active`], ie.enabled ? 1 : 0), o.uniform3fv(f.uniforms[`u_colors[${L}].color`], ct), o.uniform1f(f.uniforms[`u_colors[${L}].influence`], ie.influence || 0);
752
967
  } else
753
- i.uniform1f(o.uniforms[`u_colors[${P}].is_active`], 0);
754
- i.uniform1i(o.uniforms.u_colors_count, O);
968
+ o.uniform1f(f.uniforms[`u_colors[${L}].is_active`], 0);
969
+ o.uniform1i(f.uniforms.u_colors_count, $);
755
970
  }
756
971
  }
757
- i.clearColor(
972
+ o.clearColor(
758
973
  this._backgroundColorRgb[0],
759
974
  this._backgroundColorRgb[1],
760
975
  this._backgroundColorRgb[2],
761
976
  this._backgroundAlpha
762
- ), i.clear(i.COLOR_BUFFER_BIT | i.DEPTH_BUFFER_BIT), this._wireframe ? (i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, this.glState.buffers.wireframeIndex), i.drawElements(i.LINES, this.glState.wireframeIndexCount, L, 0), i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, this.glState.buffers.index)) : i.drawElements(i.TRIANGLES, U, L, 0), this.requestRef = requestAnimationFrame(V);
763
- }, Re = () => {
764
- const { gl: i, camera: B } = this.glState, o = this._ref.clientWidth, U = this._ref.clientHeight;
765
- this._ref.width = o, this._ref.height = U, i.viewport(0, 0, o, U), H(B, o, U);
766
- const L = i.getUniformLocation(this.glState.program, "projectionMatrix");
767
- i.useProgram(this.glState.program), i.uniformMatrix4fv(L, !1, B.projectionMatrix.elements);
977
+ ), 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, q, 0), o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, this.glState.buffers.index)) : o.drawElements(o.TRIANGLES, V, q, 0), this._isVisible && (this.requestRef = requestAnimationFrame(G));
978
+ };
979
+ this._visibilityObserver = new IntersectionObserver((o) => {
980
+ const k = this._isVisible;
981
+ this._isVisible = o[0].isIntersecting && document.visibilityState !== "hidden", this._isVisible && !k && (H = performance.now(), this.requestRef = requestAnimationFrame(G));
982
+ }, { threshold: 0 }), this._visibilityObserver.observe(i), this._visibilityHandler = () => {
983
+ const o = this._isVisible;
984
+ document.visibilityState === "hidden" ? this._isVisible = !1 : (this._isVisible = !0, o || (H = performance.now(), this.requestRef = requestAnimationFrame(G)));
985
+ }, document.addEventListener("visibilitychange", this._visibilityHandler);
986
+ const ut = () => {
987
+ const { gl: o, camera: k } = this.glState, f = this._ref.clientWidth, V = this._ref.clientHeight;
988
+ this._ref.width = f, this._ref.height = V, o.viewport(0, 0, f, V), j(k, f, V, X, N, this._shapeType, this._cameraZoom);
989
+ const q = this.glState.locations.uniforms.projectionMatrix;
990
+ o.useProgram(this.glState.program), q && o.uniformMatrix4fv(q, !1, k.projectionMatrix.elements);
768
991
  };
769
992
  this.sizeObserver = new ResizeObserver(() => {
770
993
  this._resizeTimeoutId !== null && clearTimeout(this._resizeTimeoutId), this._resizeTimeoutId = window.setTimeout(() => {
771
- Re(), this._resizeTimeoutId = null;
994
+ ut(), this._resizeTimeoutId = null;
772
995
  }, 100);
773
- }), this.sizeObserver.observe(r), V();
996
+ }), this.sizeObserver.observe(i), G();
774
997
  }
775
998
  destroy() {
776
- 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) {
999
+ 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) {
777
1000
  const e = this.glState.gl;
778
1001
  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);
779
1002
  }
780
1003
  this._proceduralTexture && this.glState && this.glState.gl.deleteTexture(this._proceduralTexture);
781
1004
  }
782
1005
  downloadAsPNG(e = "neat.png") {
783
- const r = this._ref.toDataURL("image/png");
784
- Oe(r, e);
1006
+ const i = this._ref.toDataURL("image/png");
1007
+ ce(i, e);
1008
+ }
1009
+ recordVideo(e = {}) {
1010
+ const {
1011
+ durationMs: i = 5e3,
1012
+ filename: r = "neat.firecms.co",
1013
+ format: t,
1014
+ onProgress: y,
1015
+ onComplete: v
1016
+ } = e, s = this._ref, l = e.width || s.width || s.clientWidth, _ = e.height || s.height || s.clientHeight, b = document.createElement("canvas");
1017
+ b.width = l, b.height = _;
1018
+ const a = b.getContext("2d"), h = b.captureStream(0), p = h.getVideoTracks()[0], c = [
1019
+ "video/mp4;codecs=avc1",
1020
+ "video/mp4;codecs=avc1,opus",
1021
+ "video/mp4"
1022
+ ], d = [
1023
+ "video/webm;codecs=vp9,opus",
1024
+ "video/webm;codecs=vp9",
1025
+ "video/webm;codecs=vp8,opus",
1026
+ "video/webm"
1027
+ ];
1028
+ let R;
1029
+ t === "mp4" ? R = [...c, ...d] : t === "webm" ? R = [...d, ...c] : R = [...c, ...d];
1030
+ let g = "video/webm";
1031
+ for (const E of R)
1032
+ if (MediaRecorder.isTypeSupported(E)) {
1033
+ g = E;
1034
+ break;
1035
+ }
1036
+ const x = l * _, w = 8e6, u = 1280 * 720, T = Math.round(w * Math.max(1, x / u)), A = new MediaRecorder(h, {
1037
+ mimeType: g,
1038
+ videoBitsPerSecond: T
1039
+ }), D = [];
1040
+ A.ondataavailable = (E) => {
1041
+ E.data.size > 0 && D.push(E.data);
1042
+ };
1043
+ let m = !1, F;
1044
+ const C = performance.now();
1045
+ let z = 0;
1046
+ const M = () => {
1047
+ if (m)
1048
+ return;
1049
+ a.clearRect(0, 0, l, _), a.drawImage(s, 0, 0, l, _);
1050
+ const E = Math.max(14, Math.round(_ * 0.025));
1051
+ 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 * 0.8, _ - E * 0.5), a.shadowColor = "transparent", a.shadowBlur = 0, a.shadowOffsetX = 0, a.shadowOffsetY = 0, p.requestFrame && p.requestFrame(), y) {
1052
+ const S = performance.now();
1053
+ S - z > 250 && (z = S, y(Math.min(0.99, (S - C) / i)));
1054
+ }
1055
+ F = requestAnimationFrame(M);
1056
+ };
1057
+ A.onstop = () => {
1058
+ m = !0, cancelAnimationFrame(F);
1059
+ 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);
1060
+ ce(I, B), setTimeout(() => URL.revokeObjectURL(I), 3e4), y?.(1), v?.();
1061
+ }, M(), A.start(100);
1062
+ const P = window.setTimeout(() => {
1063
+ A.state === "recording" && A.stop();
1064
+ }, i);
1065
+ return () => {
1066
+ clearTimeout(P), A.state === "recording" && A.stop();
1067
+ };
1068
+ }
1069
+ get speed() {
1070
+ return this._speed * 20;
785
1071
  }
786
1072
  set speed(e) {
787
1073
  this._uniformsDirty = !0, this._speed = e / 20;
788
1074
  }
1075
+ get horizontalPressure() {
1076
+ return this._horizontalPressure * 4;
1077
+ }
789
1078
  set horizontalPressure(e) {
790
1079
  this._uniformsDirty = !0, this._horizontalPressure = e / 4;
791
1080
  }
1081
+ get verticalPressure() {
1082
+ return this._verticalPressure * 4;
1083
+ }
792
1084
  set verticalPressure(e) {
793
1085
  this._uniformsDirty = !0, this._verticalPressure = e / 4;
794
1086
  }
1087
+ get waveFrequencyX() {
1088
+ return this._waveFrequencyX / 0.04;
1089
+ }
795
1090
  set waveFrequencyX(e) {
796
1091
  this._uniformsDirty = !0, this._waveFrequencyX = e * 0.04;
797
1092
  }
1093
+ get waveFrequencyY() {
1094
+ return this._waveFrequencyY / 0.04;
1095
+ }
798
1096
  set waveFrequencyY(e) {
799
1097
  this._uniformsDirty = !0, this._waveFrequencyY = e * 0.04;
800
1098
  }
1099
+ get waveAmplitude() {
1100
+ return this._waveAmplitude / 0.75;
1101
+ }
801
1102
  set waveAmplitude(e) {
802
1103
  this._uniformsDirty = !0, this._waveAmplitude = e * 0.75;
803
1104
  }
1105
+ get colors() {
1106
+ return this._colors;
1107
+ }
804
1108
  set colors(e) {
805
- this._uniformsDirty = !0, this._colors = e, this._cachedColorRgb = e.map((r) => this._hexToRgb(r.color)), this._colorsChanged = !0;
1109
+ this._uniformsDirty = !0, this._colors = e, this._cachedColorRgb = e.map((i) => this._hexToRgb(i.color)), this._colorsChanged = !0;
1110
+ }
1111
+ get highlights() {
1112
+ return this._highlights * 100;
806
1113
  }
807
1114
  set highlights(e) {
808
1115
  this._uniformsDirty = !0, this._highlights = e / 100;
809
1116
  }
1117
+ get shadows() {
1118
+ return this._shadows * 100;
1119
+ }
810
1120
  set shadows(e) {
811
1121
  this._uniformsDirty = !0, this._shadows = e / 100;
812
1122
  }
1123
+ get colorSaturation() {
1124
+ return this._saturation * 10;
1125
+ }
813
1126
  set colorSaturation(e) {
814
1127
  this._uniformsDirty = !0, this._saturation = e / 10;
815
1128
  }
1129
+ get colorBrightness() {
1130
+ return this._brightness;
1131
+ }
816
1132
  set colorBrightness(e) {
817
1133
  this._uniformsDirty = !0, this._brightness = e;
818
1134
  }
1135
+ get colorBlending() {
1136
+ return this._colorBlending * 10;
1137
+ }
819
1138
  set colorBlending(e) {
820
1139
  this._uniformsDirty = !0, this._colorBlending = e / 10;
821
1140
  }
1141
+ get grainScale() {
1142
+ return this._grainScale;
1143
+ }
822
1144
  set grainScale(e) {
823
1145
  this._uniformsDirty = !0, this._grainScale = e == 0 ? 1 : e;
824
1146
  }
1147
+ get grainIntensity() {
1148
+ return this._grainIntensity;
1149
+ }
825
1150
  set grainIntensity(e) {
826
1151
  this._uniformsDirty = !0, this._grainIntensity = e;
827
1152
  }
1153
+ get grainSparsity() {
1154
+ return this._grainSparsity;
1155
+ }
828
1156
  set grainSparsity(e) {
829
1157
  this._uniformsDirty = !0, this._grainSparsity = e;
830
1158
  }
1159
+ get grainSpeed() {
1160
+ return this._grainSpeed;
1161
+ }
831
1162
  set grainSpeed(e) {
832
1163
  this._uniformsDirty = !0, this._grainSpeed = e;
833
1164
  }
1165
+ get wireframe() {
1166
+ return this._wireframe;
1167
+ }
834
1168
  set wireframe(e) {
835
1169
  this._uniformsDirty = !0, this._wireframe = e;
836
1170
  }
1171
+ get resolution() {
1172
+ return this._resolution;
1173
+ }
837
1174
  set resolution(e) {
838
- if (this._uniformsDirty = !0, this.glState) {
839
- const r = this.glState.gl;
840
- r.deleteProgram(this.glState.program), r.deleteBuffer(this.glState.buffers.position), r.deleteBuffer(this.glState.buffers.normal), r.deleteBuffer(this.glState.buffers.uv), r.deleteBuffer(this.glState.buffers.index), r.deleteBuffer(this.glState.buffers.wireframeIndex);
841
- }
842
- this.glState = this._initScene(e);
1175
+ this._resolution !== e && (this._resolution = e, this._updateGeometry());
1176
+ }
1177
+ get backgroundColor() {
1178
+ return this._backgroundColor;
843
1179
  }
844
1180
  set backgroundColor(e) {
845
1181
  this._uniformsDirty = !0, this._backgroundColor = e, this._backgroundColorRgb = this._hexToRgb(e);
846
1182
  }
1183
+ get backgroundAlpha() {
1184
+ return this._backgroundAlpha;
1185
+ }
847
1186
  set backgroundAlpha(e) {
848
1187
  this._uniformsDirty = !0, this._backgroundAlpha = e;
849
1188
  }
1189
+ get yOffset() {
1190
+ return this._yOffset;
1191
+ }
850
1192
  set yOffset(e) {
851
- this._uniformsDirty = !0, this._yOffset = e;
1193
+ this._yOffset !== e && (this._yOffsetDirty = !0, this._yOffset = e);
852
1194
  }
853
1195
  get yOffsetWaveMultiplier() {
854
1196
  return this._yOffsetWaveMultiplier * 1e3;
@@ -868,15 +1210,27 @@ class We {
868
1210
  set yOffsetFlowMultiplier(e) {
869
1211
  this._uniformsDirty = !0, this._yOffsetFlowMultiplier = e / 1e3;
870
1212
  }
1213
+ get flowDistortionA() {
1214
+ return this._flowDistortionA;
1215
+ }
871
1216
  set flowDistortionA(e) {
872
1217
  this._uniformsDirty = !0, this._flowDistortionA = e;
873
1218
  }
1219
+ get flowDistortionB() {
1220
+ return this._flowDistortionB;
1221
+ }
874
1222
  set flowDistortionB(e) {
875
1223
  this._uniformsDirty = !0, this._flowDistortionB = e;
876
1224
  }
1225
+ get flowScale() {
1226
+ return this._flowScale;
1227
+ }
877
1228
  set flowScale(e) {
878
1229
  this._uniformsDirty = !0, this._flowScale = e;
879
1230
  }
1231
+ get flowEase() {
1232
+ return this._flowEase;
1233
+ }
880
1234
  set flowEase(e) {
881
1235
  this._uniformsDirty = !0, this._flowEase = e;
882
1236
  }
@@ -886,24 +1240,45 @@ class We {
886
1240
  get flowEnabled() {
887
1241
  return this._flowEnabled;
888
1242
  }
1243
+ get enableProceduralTexture() {
1244
+ return this._enableProceduralTexture;
1245
+ }
889
1246
  set enableProceduralTexture(e) {
890
1247
  this._uniformsDirty = !0, this._enableProceduralTexture = e, e && !this._proceduralTexture && (this._textureNeedsUpdate = !0);
891
1248
  }
1249
+ get textureVoidLikelihood() {
1250
+ return this._textureVoidLikelihood;
1251
+ }
892
1252
  set textureVoidLikelihood(e) {
893
1253
  this._uniformsDirty = !0, this._textureVoidLikelihood = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
894
1254
  }
1255
+ get textureVoidWidthMin() {
1256
+ return this._textureVoidWidthMin;
1257
+ }
895
1258
  set textureVoidWidthMin(e) {
896
1259
  this._uniformsDirty = !0, this._textureVoidWidthMin = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
897
1260
  }
1261
+ get textureVoidWidthMax() {
1262
+ return this._textureVoidWidthMax;
1263
+ }
898
1264
  set textureVoidWidthMax(e) {
899
1265
  this._uniformsDirty = !0, this._textureVoidWidthMax = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
900
1266
  }
1267
+ get textureBandDensity() {
1268
+ return this._textureBandDensity;
1269
+ }
901
1270
  set textureBandDensity(e) {
902
1271
  this._uniformsDirty = !0, this._textureBandDensity = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
903
1272
  }
1273
+ get textureColorBlending() {
1274
+ return this._textureColorBlending;
1275
+ }
904
1276
  set textureColorBlending(e) {
905
1277
  this._uniformsDirty = !0, this._textureColorBlending = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
906
1278
  }
1279
+ get textureSeed() {
1280
+ return this._textureSeed;
1281
+ }
907
1282
  set textureSeed(e) {
908
1283
  this._uniformsDirty = !0, this._textureSeed = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
909
1284
  }
@@ -913,77 +1288,111 @@ class We {
913
1288
  set textureEase(e) {
914
1289
  this._uniformsDirty = !0, this._textureEase = e;
915
1290
  }
1291
+ get transparentTextureVoid() {
1292
+ return this._transparentTextureVoid;
1293
+ }
1294
+ set transparentTextureVoid(e) {
1295
+ this._uniformsDirty = !0, this._transparentTextureVoid = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
1296
+ }
1297
+ get proceduralBackgroundColor() {
1298
+ return this._proceduralBackgroundColor;
1299
+ }
916
1300
  set proceduralBackgroundColor(e) {
917
1301
  this._uniformsDirty = !0, this._proceduralBackgroundColor = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
918
1302
  }
1303
+ get textureShapeTriangles() {
1304
+ return this._textureShapeTriangles;
1305
+ }
919
1306
  set textureShapeTriangles(e) {
920
1307
  this._uniformsDirty = !0, this._textureShapeTriangles = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
921
1308
  }
1309
+ get textureShapeCircles() {
1310
+ return this._textureShapeCircles;
1311
+ }
922
1312
  set textureShapeCircles(e) {
923
1313
  this._uniformsDirty = !0, this._textureShapeCircles = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
924
1314
  }
1315
+ get textureShapeBars() {
1316
+ return this._textureShapeBars;
1317
+ }
925
1318
  set textureShapeBars(e) {
926
1319
  this._uniformsDirty = !0, this._textureShapeBars = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
927
1320
  }
1321
+ get textureShapeSquiggles() {
1322
+ return this._textureShapeSquiggles;
1323
+ }
928
1324
  set textureShapeSquiggles(e) {
929
1325
  this._uniformsDirty = !0, this._textureShapeSquiggles = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
930
1326
  }
1327
+ _updateGeometry() {
1328
+ if (!this.glState)
1329
+ return;
1330
+ const e = this.glState.gl, i = this._resolution || 1;
1331
+ let r;
1332
+ this._shapeType === "sphere" ? r = ne(this._sphereRadius, 120 * i, 120 * i) : this._shapeType === "torus" ? r = ae(this._torusRadius, this._torusTube, 120 * i, 120 * i) : this._shapeType === "cylinder" ? r = le(this._cylinderRadius, this._cylinderRadius, this._cylinderHeight, 120 * i, 120 * i) : this._shapeType === "ribbon" ? r = ue(X, N, 240 * i, 240 * i, this._planeBend, this._planeTwist) : r = oe(X, N, 240 * i, 240 * i);
1333
+ const { position: t, normal: y, uv: v, index: s, wireframeIndex: l } = r;
1334
+ 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;
1335
+ const _ = this._ref.clientWidth, b = this._ref.clientHeight;
1336
+ j(this.glState.camera, _, b, X, N, this._shapeType, this._cameraZoom);
1337
+ const a = this.glState.locations.uniforms.projectionMatrix;
1338
+ e.useProgram(this.glState.program), a && e.uniformMatrix4fv(a, !1, this.glState.camera.projectionMatrix.elements), this._uniformsDirty = !0;
1339
+ }
931
1340
  _hexToRgb(e) {
932
- const r = parseInt(e.replace("#", ""), 16);
1341
+ const i = parseInt(e.replace("#", ""), 16);
933
1342
  return [
934
- (r >> 16 & 255) / 255,
935
- (r >> 8 & 255) / 255,
936
- (r & 255) / 255
1343
+ (i >> 16 & 255) / 255,
1344
+ (i >> 8 & 255) / 255,
1345
+ (i & 255) / 255
937
1346
  ];
938
1347
  }
939
1348
  _initScene(e) {
940
- const r = this._ref.clientWidth, s = this._ref.clientHeight, t = this._ref.getContext("webgl2", { alpha: !0, preserveDrawingBuffer: !0, antialias: !0 }) || this._ref.getContext("webgl", { alpha: !0, preserveDrawingBuffer: !0, antialias: !0 });
1349
+ 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 });
941
1350
  if (!t)
942
1351
  throw new Error("WebGL not supported");
943
- t.getExtension("OES_standard_derivatives"), t.getExtension("OES_element_index_uint"), t.viewport(0, 0, r, s);
944
- const { position: S, normal: y, uv: a, index: p, wireframeIndex: v } = Ie($, K, 240 * e, 240 * e), T = t.createBuffer();
945
- t.bindBuffer(t.ARRAY_BUFFER, T), t.bufferData(t.ARRAY_BUFFER, S, t.STATIC_DRAW);
946
- const x = t.createBuffer();
947
- t.bindBuffer(t.ARRAY_BUFFER, x), t.bufferData(t.ARRAY_BUFFER, y, t.STATIC_DRAW);
1352
+ t.getExtension("OES_standard_derivatives"), t.getExtension("OES_element_index_uint"), t.viewport(0, 0, i, r);
1353
+ let y;
1354
+ this._shapeType === "sphere" ? y = ne(this._sphereRadius, 120 * e, 120 * e) : this._shapeType === "torus" ? y = ae(this._torusRadius, this._torusTube, 120 * e, 120 * e) : this._shapeType === "cylinder" ? y = le(this._cylinderRadius, this._cylinderRadius, this._cylinderHeight, 120 * e, 120 * e) : this._shapeType === "ribbon" ? y = ue(X, N, 240 * e, 240 * e, this._planeBend, this._planeTwist) : y = oe(X, N, 240 * e, 240 * e);
1355
+ const { position: v, normal: s, uv: l, index: _, wireframeIndex: b } = y, a = t.createBuffer();
1356
+ t.bindBuffer(t.ARRAY_BUFFER, a), t.bufferData(t.ARRAY_BUFFER, v, t.STATIC_DRAW);
948
1357
  const h = t.createBuffer();
949
- t.bindBuffer(t.ARRAY_BUFFER, h), t.bufferData(t.ARRAY_BUFFER, a, t.STATIC_DRAW);
950
- const b = t.createBuffer();
951
- t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, b), t.bufferData(t.ELEMENT_ARRAY_BUFFER, p, t.STATIC_DRAW);
952
- const R = t.createBuffer();
953
- t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, R), t.bufferData(t.ELEMENT_ARRAY_BUFFER, v, t.STATIC_DRAW), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, b);
954
- const E = De() + `
955
- ` + Y() + `
956
- ` + j() + `
957
- ` + Ce, g = t.createShader(t.VERTEX_SHADER);
958
- t.shaderSource(g, E), t.compileShader(g), t.getShaderParameter(g, t.COMPILE_STATUS) || (console.log("VERTEX_SHADER_ERROR_START"), console.log("Vertex shader error: ", t.getShaderInfoLog(g)), console.log("GL Error Code:", t.getError()), console.log("Vertex Shader Source Dump:"), console.log(E.split(`
959
- `).map((w, M) => `${M + 1}: ${w}`).join(`
1358
+ t.bindBuffer(t.ARRAY_BUFFER, h), t.bufferData(t.ARRAY_BUFFER, s, t.STATIC_DRAW);
1359
+ const p = t.createBuffer();
1360
+ t.bindBuffer(t.ARRAY_BUFFER, p), t.bufferData(t.ARRAY_BUFFER, l, t.STATIC_DRAW);
1361
+ const c = t.createBuffer();
1362
+ t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, c), t.bufferData(t.ELEMENT_ARRAY_BUFFER, _, t.STATIC_DRAW);
1363
+ const d = t.createBuffer();
1364
+ t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, d), t.bufferData(t.ELEMENT_ARRAY_BUFFER, b, t.STATIC_DRAW), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, c);
1365
+ const R = dt() + `
1366
+ ` + se() + `
1367
+ ` + re() + `
1368
+ ` + ht, g = t.createShader(t.VERTEX_SHADER);
1369
+ 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(`
1370
+ `).map((S, U) => `${U + 1}: ${S}`).join(`
960
1371
  `)), console.log("VERTEX_SHADER_ERROR_END"));
961
- const A = ze() + `
962
- ` + j() + `
963
- ` + Y() + `
964
- ` + Pe, _ = t.createShader(t.FRAGMENT_SHADER);
965
- t.shaderSource(_, A), t.compileShader(_), t.getShaderParameter(_, t.COMPILE_STATUS) || (console.log("FRAGMENT_SHADER_ERROR_START"), console.log("Fragment shader error: ", t.getShaderInfoLog(_)), console.log("GL Error Code:", t.getError()), console.log("Fragment Shader Source Dump:"), console.log(A.split(`
966
- `).map((w, M) => `${M + 1}: ${w}`).join(`
1372
+ const x = mt() + `
1373
+ ` + re() + `
1374
+ ` + se() + `
1375
+ ` + ft, w = t.createShader(t.FRAGMENT_SHADER);
1376
+ 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(`
1377
+ `).map((S, U) => `${U + 1}: ${S}`).join(`
967
1378
  `)), console.log("FRAGMENT_SHADER_ERROR_END"));
968
1379
  const u = t.createProgram();
969
- t.attachShader(u, g), t.attachShader(u, _), t.linkProgram(u), t.getProgramParameter(u, t.LINK_STATUS) || (console.log("PROGRAM_LINK_ERROR_START"), console.log("Program linking error: ", t.getProgramInfoLog(u)), console.log("GL Error Code:", t.getError()), console.log("PROGRAM_LINK_ERROR_END")), t.useProgram(u);
970
- const m = new Fe(0, 0, 0, 0, 0, 1e3);
971
- m.position = [0, 0, 5], H(m, r, s);
972
- const n = t.getAttribLocation(u, "position"), f = t.getAttribLocation(u, "normal"), c = t.getAttribLocation(u, "uv");
973
- t.enableVertexAttribArray(n), t.bindBuffer(t.ARRAY_BUFFER, T), t.vertexAttribPointer(n, 3, t.FLOAT, !1, 0, 0), t.enableVertexAttribArray(f), t.bindBuffer(t.ARRAY_BUFFER, x), t.vertexAttribPointer(f, 3, t.FLOAT, !1, 0, 0), t.enableVertexAttribArray(c), t.bindBuffer(t.ARRAY_BUFFER, h), t.vertexAttribPointer(c, 2, t.FLOAT, !1, 0, 0), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, b);
974
- const d = new J();
975
- d.translate(-m.position[0], -m.position[1], -m.position[2]), d.translate(0, 0, -1), d.rotateX(-Math.PI / 3.5);
976
- const C = t.getUniformLocation(u, "modelViewMatrix");
977
- t.uniformMatrix4fv(C, !1, d.elements);
978
- const D = t.getUniformLocation(u, "projectionMatrix");
979
- t.uniformMatrix4fv(D, !1, m.projectionMatrix.elements);
980
- const F = t.getUniformLocation(u, "u_plane_width");
981
- t.uniform1f(F, $);
982
- const I = t.getUniformLocation(u, "u_plane_height");
983
- t.uniform1f(I, K);
984
- const N = t.getUniformLocation(u, "u_colors_count");
985
- t.uniform1i(N, O);
986
- const W = [
1380
+ 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);
1381
+ const T = new pt(0, 0, 0, 0, 0, 1e3);
1382
+ T.position = [0, 0, 5], j(T, i, r, X, N, this._shapeType, this._cameraZoom);
1383
+ const A = t.getAttribLocation(u, "position"), D = t.getAttribLocation(u, "normal"), m = t.getAttribLocation(u, "uv");
1384
+ 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);
1385
+ const F = t.getUniformLocation(u, "projectionMatrix");
1386
+ t.uniformMatrix4fv(F, !1, T.projectionMatrix.elements);
1387
+ const C = t.getUniformLocation(u, "u_plane_width");
1388
+ t.uniform1f(C, X);
1389
+ const z = t.getUniformLocation(u, "u_plane_height");
1390
+ t.uniform1f(z, N);
1391
+ const M = t.getUniformLocation(u, "u_colors_count");
1392
+ t.uniform1i(M, $);
1393
+ const P = [
1394
+ "projectionMatrix",
1395
+ "modelViewMatrix",
987
1396
  "u_time",
988
1397
  "u_resolution",
989
1398
  "u_color_pressure",
@@ -1011,6 +1420,7 @@ class We {
1011
1420
  "u_procedural_texture",
1012
1421
  "u_enable_procedural_texture",
1013
1422
  "u_texture_ease",
1423
+ "u_transparent_texture_void",
1014
1424
  "u_saturation",
1015
1425
  "u_brightness",
1016
1426
  "u_color_blending",
@@ -1028,221 +1438,452 @@ class We {
1028
1438
  "u_iridescence_speed",
1029
1439
  "u_bloom_intensity",
1030
1440
  "u_bloom_threshold",
1031
- "u_chromatic_aberration"
1032
- ], z = {
1033
- attributes: { position: n, normal: f, uv: c },
1441
+ "u_chromatic_aberration",
1442
+ "u_shape_type",
1443
+ "u_silhouette_fade",
1444
+ "u_cylinder_fade",
1445
+ "u_ribbon_fade",
1446
+ "u_flat_shading"
1447
+ ], E = {
1448
+ attributes: { position: A, normal: D, uv: m },
1034
1449
  uniforms: {}
1035
1450
  };
1036
- W.forEach((w) => {
1037
- z.uniforms[w] = t.getUniformLocation(u, w);
1451
+ P.forEach((S) => {
1452
+ E.uniforms[S] = t.getUniformLocation(u, S);
1038
1453
  });
1039
- for (let w = 0; w < O; w++)
1040
- z.uniforms[`u_colors[${w}].is_active`] = t.getUniformLocation(u, `u_colors[${w}].is_active`), z.uniforms[`u_colors[${w}].color`] = t.getUniformLocation(u, `u_colors[${w}].color`), z.uniforms[`u_colors[${w}].influence`] = t.getUniformLocation(u, `u_colors[${w}].influence`);
1454
+ for (let S = 0; S < $; S++)
1455
+ 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`);
1041
1456
  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), {
1042
1457
  gl: t,
1043
1458
  program: u,
1044
1459
  buffers: {
1045
- position: T,
1046
- normal: x,
1047
- uv: h,
1048
- index: b,
1049
- wireframeIndex: R
1460
+ position: a,
1461
+ normal: h,
1462
+ uv: p,
1463
+ index: c,
1464
+ wireframeIndex: d
1050
1465
  },
1051
- locations: z,
1052
- camera: m,
1053
- indexCount: p.length,
1054
- wireframeIndexCount: v.length,
1055
- indexType: p instanceof Uint32Array ? t.UNSIGNED_INT : t.UNSIGNED_SHORT
1466
+ locations: E,
1467
+ camera: T,
1468
+ indexCount: _.length,
1469
+ wireframeIndexCount: b.length,
1470
+ indexType: _ instanceof Uint32Array ? t.UNSIGNED_INT : t.UNSIGNED_SHORT
1056
1471
  };
1057
1472
  }
1058
1473
  _createProceduralTexture(e) {
1059
- const s = document.createElement("canvas");
1060
- s.width = 1024, s.height = 1024;
1061
- const t = s.getContext("2d", { willReadFrequently: !0 });
1474
+ this._sourceCanvas || (this._sourceCanvas = document.createElement("canvas"), this._sourceCanvas.width = 1024, this._sourceCanvas.height = 1024, this._sourceCtx = this._sourceCanvas.getContext("2d"));
1475
+ const r = this._sourceCanvas, t = this._sourceCtx;
1062
1476
  if (!t)
1063
1477
  return null;
1064
- let S = this._textureSeed;
1065
- const y = this._textureSeed;
1066
- function a() {
1067
- const n = Math.sin(S++) * 1e4;
1068
- return n - Math.floor(n);
1478
+ let y = this._textureSeed;
1479
+ const v = this._textureSeed;
1480
+ function s() {
1481
+ const m = Math.sin(y++) * 1e4;
1482
+ return m - Math.floor(m);
1069
1483
  }
1070
- const p = (n) => {
1071
- S = y + n;
1072
- }, v = this._colors.filter((n) => n.enabled).map((n) => n.color);
1073
- if (v.length === 0)
1484
+ const l = (m) => {
1485
+ y = v + m;
1486
+ }, _ = this._colors.filter((m) => m.enabled).map((m) => m.color);
1487
+ if (_.length === 0)
1074
1488
  return null;
1075
- function T(n) {
1076
- const f = parseInt(n.replace("#", ""), 16);
1489
+ const b = this._shapeType !== "plane", a = b ? [-1, 0, 1] : [0], h = b ? [-1, 0, 1] : [0];
1490
+ function p(m) {
1491
+ const F = parseInt(m.replace("#", ""), 16);
1077
1492
  return {
1078
- r: f >> 16 & 255,
1079
- g: f >> 8 & 255,
1080
- b: f & 255
1493
+ r: F >> 16 & 255,
1494
+ g: F >> 8 & 255,
1495
+ b: F & 255
1081
1496
  };
1082
1497
  }
1083
- function x(n, f, c) {
1084
- return "#" + ((1 << 24) + (Math.round(n) << 16) + (Math.round(f) << 8) + Math.round(c)).toString(16).slice(1).padStart(6, "0");
1498
+ function c(m, F, C) {
1499
+ return "#" + ((1 << 24) + (Math.round(m) << 16) + (Math.round(F) << 8) + Math.round(C)).toString(16).slice(1).padStart(6, "0");
1085
1500
  }
1086
- const h = () => {
1087
- const n = v[Math.floor(a() * v.length)], f = v[Math.floor(a() * v.length)], c = a() * this._textureColorBlending, d = T(n), C = T(f), D = d.r + (C.r - d.r) * c, F = d.g + (C.g - d.g) * c, I = d.b + (C.b - d.b) * c;
1088
- return x(D, F, I);
1089
- }, b = this._proceduralBackgroundColor || "#000000";
1090
- t.fillStyle = b, t.fillRect(0, 0, 1024, 1024);
1091
- const R = t.createLinearGradient(0, 0, 0, 1024);
1092
- R.addColorStop(0, h()), R.addColorStop(1, h()), t.fillStyle = R, t.fillRect(0, 0, 1024, 1024);
1093
- for (let n = 0; n < this._textureShapeTriangles; n++) {
1094
- t.fillStyle = h(), t.beginPath();
1095
- const f = a() * 1024, c = a() * 1024, d = 100 + a() * 300;
1096
- t.moveTo(f, c), t.lineTo(f + (a() - 0.5) * d, c + (a() - 0.5) * d), t.lineTo(f + (a() - 0.5) * d, c + (a() - 0.5) * d), t.fill();
1501
+ const d = () => {
1502
+ 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;
1503
+ return c(P, E, S);
1504
+ }, R = this._proceduralBackgroundColor || "#000000";
1505
+ t.fillStyle = R, t.fillRect(0, 0, 1024, 1024);
1506
+ const g = t.createLinearGradient(0, 0, 0, 1024);
1507
+ g.addColorStop(0, d()), g.addColorStop(1, d()), t.fillStyle = g, t.fillRect(0, 0, 1024, 1024);
1508
+ for (let m = 0; m < this._textureShapeTriangles; m++) {
1509
+ const F = d(), C = s() * 1024, z = s() * 1024, M = 100 + s() * 300, P = (s() - 0.5) * M, E = (s() - 0.5) * M, S = (s() - 0.5) * M, U = (s() - 0.5) * M;
1510
+ for (const B of a)
1511
+ for (const O of h) {
1512
+ t.fillStyle = F, t.beginPath();
1513
+ const I = C + B * 1024, Y = z + O * 1024;
1514
+ t.moveTo(I, Y), t.lineTo(I + P, Y + E), t.lineTo(I + S, Y + U), t.fill();
1515
+ }
1516
+ }
1517
+ for (let m = 0; m < this._textureShapeCircles; m++) {
1518
+ const F = d(), C = 10 + s() * 50, z = s() * 1024, M = s() * 1024, P = 50 + s() * 150;
1519
+ for (const E of a)
1520
+ for (const S of h)
1521
+ t.strokeStyle = F, t.lineWidth = C, t.beginPath(), t.arc(z + E * 1024, M + S * 1024, P, 0, Math.PI * 2), t.stroke();
1097
1522
  }
1098
- for (let n = 0; n < this._textureShapeCircles; n++) {
1099
- t.strokeStyle = h(), t.lineWidth = 10 + a() * 50, t.beginPath();
1100
- const f = a() * 1024, c = a() * 1024, d = 50 + a() * 150;
1101
- t.arc(f, c, d, 0, Math.PI * 2), t.stroke();
1523
+ for (let m = 0; m < this._textureShapeBars; m++) {
1524
+ const F = d(), C = s() * 1024, z = s() * 1024, M = s() * Math.PI;
1525
+ for (const P of a)
1526
+ for (const E of h)
1527
+ t.fillStyle = F, t.save(), t.translate(C + P * 1024, z + E * 1024), t.rotate(M), t.fillRect(-150, -25, 300, 50), t.restore();
1102
1528
  }
1103
- for (let n = 0; n < this._textureShapeBars; n++)
1104
- t.fillStyle = h(), t.save(), t.translate(a() * 1024, a() * 1024), t.rotate(a() * Math.PI), t.fillRect(-150, -25, 300, 50), t.restore();
1105
1529
  t.lineWidth = 15, t.lineCap = "round";
1106
- for (let n = 0; n < this._textureShapeSquiggles; n++) {
1107
- t.strokeStyle = h(), t.beginPath();
1108
- let f = a() * 1024, c = a() * 1024;
1109
- t.moveTo(f, c);
1110
- for (let d = 0; d < 4; d++)
1111
- t.bezierCurveTo(
1112
- f + (a() - 0.5) * 300,
1113
- c + (a() - 0.5) * 300,
1114
- f + (a() - 0.5) * 300,
1115
- c + (a() - 0.5) * 300,
1116
- f + (a() - 0.5) * 300,
1117
- c + (a() - 0.5) * 300
1118
- ), f += (a() - 0.5) * 300, c += (a() - 0.5) * 300;
1119
- t.stroke();
1530
+ for (let m = 0; m < this._textureShapeSquiggles; m++) {
1531
+ const F = d(), C = s() * 1024, z = s() * 1024, M = [];
1532
+ let P = 0, E = 0;
1533
+ for (let S = 0; S < 4; S++) {
1534
+ const U = P + (s() - 0.5) * 300, B = E + (s() - 0.5) * 300;
1535
+ M.push({
1536
+ cx1: P + (s() - 0.5) * 300,
1537
+ cy1: E + (s() - 0.5) * 300,
1538
+ cx2: P + (s() - 0.5) * 300,
1539
+ cy2: E + (s() - 0.5) * 300,
1540
+ ex: U,
1541
+ ey: B
1542
+ }), P = U, E = B;
1543
+ }
1544
+ for (const S of a)
1545
+ for (const U of h) {
1546
+ t.strokeStyle = F, t.beginPath();
1547
+ const B = C + S * 1024, O = z + U * 1024;
1548
+ t.moveTo(B, O);
1549
+ for (const I of M)
1550
+ t.bezierCurveTo(
1551
+ B + I.cx1,
1552
+ O + I.cy1,
1553
+ B + I.cx2,
1554
+ O + I.cy2,
1555
+ B + I.ex,
1556
+ O + I.ey
1557
+ );
1558
+ t.stroke();
1559
+ }
1120
1560
  }
1121
- p(5e4);
1122
- const E = document.createElement("canvas");
1123
- E.width = 1024, E.height = 1024;
1124
- const g = E.getContext("2d", { willReadFrequently: !0 });
1125
- if (!g)
1561
+ l(5e4), this._maskedCanvas || (this._maskedCanvas = document.createElement("canvas"), this._maskedCanvas.width = 1024, this._maskedCanvas.height = 1024, this._maskedCtx = this._maskedCanvas.getContext("2d"));
1562
+ const x = this._maskedCanvas, w = this._maskedCtx;
1563
+ if (!w)
1126
1564
  return null;
1127
- g.fillStyle = b, g.fillRect(0, 0, 1024, 1024);
1128
- let A = 0;
1129
- const _ = [];
1130
- for (; A < 1024; )
1131
- if (a() < this._textureVoidLikelihood) {
1132
- const f = this._textureVoidWidthMin + a() * (this._textureVoidWidthMax - this._textureVoidWidthMin);
1133
- _.push({ type: "void", x: A, width: f }), A += f;
1565
+ this._transparentTextureVoid ? w.clearRect(0, 0, 1024, 1024) : (w.fillStyle = R, w.fillRect(0, 0, 1024, 1024));
1566
+ let u = 0;
1567
+ const T = [];
1568
+ for (; u < 1024; )
1569
+ if (s() < this._textureVoidLikelihood) {
1570
+ const F = this._textureVoidWidthMin + s() * (this._textureVoidWidthMax - this._textureVoidWidthMin);
1571
+ T.push({ type: "void", x: u, width: F }), u += F;
1134
1572
  } else {
1135
- const f = 50 + a() * 200;
1136
- _.push({ type: "matter", x: A, width: f }), A += f;
1573
+ const F = 50 + s() * 200;
1574
+ T.push({ type: "matter", x: u, width: F }), u += F;
1137
1575
  }
1138
- for (const n of _)
1139
- if (n.type === "matter") {
1140
- const f = n.x, c = Math.min(n.x + n.width, 1024);
1141
- let d = f;
1142
- for (; d < c; ) {
1143
- const C = (2 + a() * 20) / this._textureBandDensity, D = Math.floor(a() * 1024);
1144
- g.drawImage(
1145
- s,
1146
- D,
1576
+ for (const m of T)
1577
+ if (m.type === "matter") {
1578
+ const F = m.x, C = Math.min(m.x + m.width, 1024);
1579
+ let z = F;
1580
+ for (; z < C; ) {
1581
+ const M = (2 + s() * 20) / this._textureBandDensity, P = Math.floor(s() * 1024);
1582
+ w.drawImage(
1583
+ r,
1584
+ P,
1147
1585
  0,
1148
- C,
1586
+ M,
1149
1587
  1024,
1150
- d,
1588
+ z,
1151
1589
  0,
1152
- C,
1590
+ M,
1153
1591
  1024
1154
- ), d += C;
1592
+ ), z += M;
1155
1593
  }
1156
1594
  }
1157
- const u = e.createTexture();
1158
- e.bindTexture(e.TEXTURE_2D, u), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, E), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.REPEAT), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.REPEAT), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR_MIPMAP_LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.generateMipmap(e.TEXTURE_2D);
1159
- const m = e.getExtension("EXT_texture_filter_anisotropic") || e.getExtension("MOZ_EXT_texture_filter_anisotropic") || e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
1160
- if (m) {
1161
- const n = e.getParameter(m.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
1162
- e.texParameterf(e.TEXTURE_2D, m.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(16, n));
1595
+ const A = e.createTexture();
1596
+ 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);
1597
+ const D = e.getExtension("EXT_texture_filter_anisotropic") || e.getExtension("MOZ_EXT_texture_filter_anisotropic") || e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
1598
+ if (D) {
1599
+ const m = e.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
1600
+ e.texParameterf(e.TEXTURE_2D, D.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(16, m));
1163
1601
  }
1164
- return u;
1602
+ return A;
1603
+ }
1604
+ get silhouetteFade() {
1605
+ return this._silhouetteFade;
1606
+ }
1607
+ set silhouetteFade(e) {
1608
+ this._silhouetteFade !== e && (this._silhouetteFade = e, this._uniformsDirty = !0);
1609
+ }
1610
+ get cylinderFade() {
1611
+ return this._cylinderFade;
1612
+ }
1613
+ set cylinderFade(e) {
1614
+ this._cylinderFade !== e && (this._cylinderFade = e, this._uniformsDirty = !0);
1615
+ }
1616
+ get ribbonFade() {
1617
+ return this._ribbonFade;
1618
+ }
1619
+ set ribbonFade(e) {
1620
+ this._ribbonFade !== e && (this._ribbonFade = e, this._uniformsDirty = !0);
1621
+ }
1622
+ get flatShading() {
1623
+ return this._flatShading;
1624
+ }
1625
+ set flatShading(e) {
1626
+ this._flatShading !== e && (this._flatShading = e, this._uniformsDirty = !0);
1627
+ }
1628
+ get domainWarpEnabled() {
1629
+ return this._domainWarpEnabled;
1165
1630
  }
1166
1631
  set domainWarpEnabled(e) {
1167
1632
  this._domainWarpEnabled !== e && (this._domainWarpEnabled = e, this._uniformsDirty = !0);
1168
1633
  }
1634
+ get domainWarpIntensity() {
1635
+ return this._domainWarpIntensity;
1636
+ }
1169
1637
  set domainWarpIntensity(e) {
1170
1638
  this._domainWarpIntensity !== e && (this._domainWarpIntensity = e, this._uniformsDirty = !0);
1171
1639
  }
1640
+ get domainWarpScale() {
1641
+ return this._domainWarpScale;
1642
+ }
1172
1643
  set domainWarpScale(e) {
1173
1644
  this._domainWarpScale !== e && (this._domainWarpScale = e, this._uniformsDirty = !0);
1174
1645
  }
1646
+ get vignetteIntensity() {
1647
+ return this._vignetteIntensity;
1648
+ }
1175
1649
  set vignetteIntensity(e) {
1176
1650
  this._vignetteIntensity !== e && (this._vignetteIntensity = e, this._uniformsDirty = !0);
1177
1651
  }
1652
+ get vignetteRadius() {
1653
+ return this._vignetteRadius;
1654
+ }
1178
1655
  set vignetteRadius(e) {
1179
1656
  this._vignetteRadius !== e && (this._vignetteRadius = e, this._uniformsDirty = !0);
1180
1657
  }
1658
+ get fresnelEnabled() {
1659
+ return this._fresnelEnabled;
1660
+ }
1181
1661
  set fresnelEnabled(e) {
1182
1662
  this._fresnelEnabled !== e && (this._fresnelEnabled = e, this._uniformsDirty = !0);
1183
1663
  }
1664
+ get fresnelPower() {
1665
+ return this._fresnelPower;
1666
+ }
1184
1667
  set fresnelPower(e) {
1185
1668
  this._fresnelPower !== e && (this._fresnelPower = e, this._uniformsDirty = !0);
1186
1669
  }
1670
+ get fresnelIntensity() {
1671
+ return this._fresnelIntensity;
1672
+ }
1187
1673
  set fresnelIntensity(e) {
1188
1674
  this._fresnelIntensity !== e && (this._fresnelIntensity = e, this._uniformsDirty = !0);
1189
1675
  }
1676
+ get fresnelColor() {
1677
+ return this._fresnelColor;
1678
+ }
1190
1679
  set fresnelColor(e) {
1191
1680
  this._fresnelColor !== e && (this._fresnelColor = e, this._fresnelColorRgb = this._hexToRgb(e), this._uniformsDirty = !0);
1192
1681
  }
1682
+ get iridescenceEnabled() {
1683
+ return this._iridescenceEnabled;
1684
+ }
1193
1685
  set iridescenceEnabled(e) {
1194
1686
  this._iridescenceEnabled !== e && (this._iridescenceEnabled = e, this._uniformsDirty = !0);
1195
1687
  }
1688
+ get iridescenceIntensity() {
1689
+ return this._iridescenceIntensity;
1690
+ }
1196
1691
  set iridescenceIntensity(e) {
1197
1692
  this._iridescenceIntensity !== e && (this._iridescenceIntensity = e, this._uniformsDirty = !0);
1198
1693
  }
1694
+ get iridescenceSpeed() {
1695
+ return this._iridescenceSpeed;
1696
+ }
1199
1697
  set iridescenceSpeed(e) {
1200
1698
  this._iridescenceSpeed !== e && (this._iridescenceSpeed = e, this._uniformsDirty = !0);
1201
1699
  }
1700
+ get bloomIntensity() {
1701
+ return this._bloomIntensity;
1702
+ }
1202
1703
  set bloomIntensity(e) {
1203
1704
  this._bloomIntensity !== e && (this._bloomIntensity = e, this._uniformsDirty = !0);
1204
1705
  }
1706
+ get bloomThreshold() {
1707
+ return this._bloomThreshold;
1708
+ }
1205
1709
  set bloomThreshold(e) {
1206
1710
  this._bloomThreshold !== e && (this._bloomThreshold = e, this._uniformsDirty = !0);
1207
1711
  }
1712
+ get chromaticAberration() {
1713
+ return this._chromaticAberration;
1714
+ }
1208
1715
  set chromaticAberration(e) {
1209
1716
  this._chromaticAberration !== e && (this._chromaticAberration = e, this._uniformsDirty = !0);
1210
1717
  }
1718
+ get shapeType() {
1719
+ return this._shapeType;
1720
+ }
1721
+ set shapeType(e) {
1722
+ this._shapeType !== e && (this._shapeType = e, this._updateGeometry());
1723
+ }
1724
+ get shapeRotationX() {
1725
+ return this._shapeRotationX;
1726
+ }
1727
+ set shapeRotationX(e) {
1728
+ this._shapeRotationX = e, this._uniformsDirty = !0;
1729
+ }
1730
+ get shapeRotationY() {
1731
+ return this._shapeRotationY;
1732
+ }
1733
+ set shapeRotationY(e) {
1734
+ this._shapeRotationY = e, this._uniformsDirty = !0;
1735
+ }
1736
+ get shapeRotationZ() {
1737
+ return this._shapeRotationZ;
1738
+ }
1739
+ set shapeRotationZ(e) {
1740
+ this._shapeRotationZ = e, this._uniformsDirty = !0;
1741
+ }
1742
+ get shapeAutoRotateSpeedX() {
1743
+ return this._shapeAutoRotateSpeedX;
1744
+ }
1745
+ set shapeAutoRotateSpeedX(e) {
1746
+ this._shapeAutoRotateSpeedX = e, this._uniformsDirty = !0;
1747
+ }
1748
+ get shapeAutoRotateSpeedY() {
1749
+ return this._shapeAutoRotateSpeedY;
1750
+ }
1751
+ set shapeAutoRotateSpeedY(e) {
1752
+ this._shapeAutoRotateSpeedY = e, this._uniformsDirty = !0;
1753
+ }
1754
+ get sphereRadius() {
1755
+ return this._sphereRadius;
1756
+ }
1757
+ set sphereRadius(e) {
1758
+ this._sphereRadius !== e && (this._sphereRadius = e, this._updateGeometry());
1759
+ }
1760
+ get torusRadius() {
1761
+ return this._torusRadius;
1762
+ }
1763
+ set torusRadius(e) {
1764
+ this._torusRadius !== e && (this._torusRadius = e, this._updateGeometry());
1765
+ }
1766
+ get torusTube() {
1767
+ return this._torusTube;
1768
+ }
1769
+ set torusTube(e) {
1770
+ this._torusTube !== e && (this._torusTube = e, this._updateGeometry());
1771
+ }
1772
+ get cylinderRadius() {
1773
+ return this._cylinderRadius;
1774
+ }
1775
+ set cylinderRadius(e) {
1776
+ this._cylinderRadius !== e && (this._cylinderRadius = e, this._updateGeometry());
1777
+ }
1778
+ get cylinderHeight() {
1779
+ return this._cylinderHeight;
1780
+ }
1781
+ set cylinderHeight(e) {
1782
+ this._cylinderHeight !== e && (this._cylinderHeight = e, this._updateGeometry());
1783
+ }
1784
+ get planeBend() {
1785
+ return this._planeBend;
1786
+ }
1787
+ set planeBend(e) {
1788
+ this._planeBend !== e && (this._planeBend = e, this._updateGeometry());
1789
+ }
1790
+ get planeTwist() {
1791
+ return this._planeTwist;
1792
+ }
1793
+ set planeTwist(e) {
1794
+ this._planeTwist !== e && (this._planeTwist = e, this._updateGeometry());
1795
+ }
1796
+ get cameraLock() {
1797
+ return this._cameraLock;
1798
+ }
1799
+ set cameraLock(e) {
1800
+ this._cameraLock = e;
1801
+ }
1802
+ get cameraX() {
1803
+ return this._cameraX;
1804
+ }
1805
+ set cameraX(e) {
1806
+ this._cameraX = e, this._uniformsDirty = !0;
1807
+ }
1808
+ get cameraY() {
1809
+ return this._cameraY;
1810
+ }
1811
+ set cameraY(e) {
1812
+ this._cameraY = e, this._uniformsDirty = !0;
1813
+ }
1814
+ get cameraZ() {
1815
+ return this._cameraZ;
1816
+ }
1817
+ set cameraZ(e) {
1818
+ this._cameraZ = e, this._uniformsDirty = !0;
1819
+ }
1820
+ get cameraRotationX() {
1821
+ return this._cameraRotationX;
1822
+ }
1823
+ set cameraRotationX(e) {
1824
+ this._cameraRotationX = e, this._uniformsDirty = !0;
1825
+ }
1826
+ get cameraRotationY() {
1827
+ return this._cameraRotationY;
1828
+ }
1829
+ set cameraRotationY(e) {
1830
+ this._cameraRotationY = e, this._uniformsDirty = !0;
1831
+ }
1832
+ get cameraRotationZ() {
1833
+ return this._cameraRotationZ;
1834
+ }
1835
+ set cameraRotationZ(e) {
1836
+ this._cameraRotationZ = e, this._uniformsDirty = !0;
1837
+ }
1838
+ get cameraZoom() {
1839
+ return this._cameraZoom;
1840
+ }
1841
+ set cameraZoom(e) {
1842
+ this._cameraZoom !== e && (this._cameraZoom = e, this._updateCameraFrustum());
1843
+ }
1844
+ _updateCameraFrustum() {
1845
+ if (!this.glState)
1846
+ return;
1847
+ const e = this.glState.gl, i = this._ref.clientWidth, r = this._ref.clientHeight;
1848
+ j(this.glState.camera, i, r, X, N, this._shapeType, this._cameraZoom);
1849
+ const t = this.glState.locations.uniforms.projectionMatrix;
1850
+ e.useProgram(this.glState.program), t && e.uniformMatrix4fv(t, !1, this.glState.camera.projectionMatrix.elements), this._uniformsDirty = !0;
1851
+ }
1211
1852
  }
1212
- const Z = (l) => {
1213
- l.id = Me, l.href = "https://neat.firecms.co", l.target = "_blank", l.style.position = "absolute", l.style.display = "block", l.style.bottom = "0", l.style.right = "0", l.style.padding = "10px", l.style.color = "#dcdcdc", l.style.opacity = "0.8", l.style.fontFamily = "sans-serif", l.style.fontSize = "16px", l.style.fontWeight = "bold", l.style.textDecoration = "none", l.style.zIndex = "10000", l.style.pointerEvents = "auto", l.setAttribute("data-n", "1"), l.innerHTML = "NEAT";
1214
- }, Ue = (l) => {
1215
- const e = l.parentElement;
1853
+ const _e = (n) => {
1854
+ n.id = gt, 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";
1855
+ }, yt = (n) => {
1856
+ const e = n.parentElement;
1216
1857
  if (e && getComputedStyle(e).position === "static" && (e.style.position = "relative"), e) {
1217
- const s = e.querySelector("a[data-n]");
1218
- if (s)
1219
- return Z(s), s;
1858
+ const r = e.querySelector("a[data-n]");
1859
+ if (r)
1860
+ return _e(r), r;
1220
1861
  }
1221
- const r = document.createElement("a");
1222
- return Z(r), e?.appendChild(r), r;
1862
+ const i = document.createElement("a");
1863
+ return _e(i), e?.appendChild(i), i;
1223
1864
  };
1224
- function Be() {
1225
- const l = new Date(), e = l.getMinutes(), r = l.getSeconds();
1226
- return e * 60 + r;
1865
+ function vt() {
1866
+ const n = new Date(), e = n.getMinutes(), i = n.getSeconds();
1867
+ return e * 60 + i;
1227
1868
  }
1228
- function Le(l = 6) {
1869
+ function xt(n = 6) {
1229
1870
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
1230
- let r = "";
1231
- for (let s = 0; s < l; s++) {
1871
+ let i = "";
1872
+ for (let r = 0; r < n; r++) {
1232
1873
  const t = Math.floor(Math.random() * e.length);
1233
- r += e.charAt(t);
1874
+ i += e.charAt(t);
1234
1875
  }
1235
- return r;
1876
+ return i;
1236
1877
  }
1237
- function Oe(l, e) {
1238
- const r = document.createElement("a");
1239
- r.download = e, r.href = l, document.body.appendChild(r), r.click(), document.body.removeChild(r);
1878
+ function ce(n, e) {
1879
+ const i = document.createElement("a");
1880
+ i.download = e, i.href = n, document.body.appendChild(i), i.click(), document.body.removeChild(i);
1240
1881
  }
1241
- function Ne() {
1882
+ function bt() {
1242
1883
  if (document.getElementById("neat-seo-schema"))
1243
1884
  return;
1244
- const l = document.createElement("script");
1245
- l.id = "neat-seo-schema", l.type = "application/ld+json", l.text = JSON.stringify({
1885
+ const n = document.createElement("script");
1886
+ n.id = "neat-seo-schema", n.type = "application/ld+json", n.text = JSON.stringify({
1246
1887
  "@context": "https://schema.org",
1247
1888
  "@type": "WebSite",
1248
1889
  name: "NEAT Gradient",
@@ -1253,19 +1894,19 @@ function Ne() {
1253
1894
  url: "https://firecms.co"
1254
1895
  },
1255
1896
  description: "Beautiful, fast, heavily customizable, WebGL based gradients."
1256
- }), document.head.appendChild(l);
1897
+ }), document.head.appendChild(n);
1257
1898
  const e = document.createElement("div");
1258
1899
  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";
1259
1900
  try {
1260
- const r = e.attachShadow({ mode: "closed" }), s = document.createElement("a");
1261
- s.href = "https://firecms.co", s.textContent = "FireCMS", r.appendChild(s);
1901
+ const i = e.attachShadow({ mode: "closed" }), r = document.createElement("a");
1902
+ r.href = "https://firecms.co", r.textContent = "FireCMS", i.appendChild(r);
1262
1903
  } catch {
1263
- const s = document.createElement("a");
1264
- s.href = "https://firecms.co", s.textContent = "FireCMS", e.appendChild(s);
1904
+ const r = document.createElement("a");
1905
+ r.href = "https://firecms.co", r.textContent = "FireCMS", e.appendChild(r);
1265
1906
  }
1266
1907
  document.body.appendChild(e);
1267
1908
  }
1268
1909
  export {
1269
- We as NeatGradient
1910
+ wt as NeatGradient
1270
1911
  };
1271
1912
  //# sourceMappingURL=index.es.js.map