@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/NeatGradient.d.ts +162 -0
- package/dist/NeatGradient.js +822 -69
- package/dist/NeatGradient.js.map +1 -1
- package/dist/index.es.js +1347 -706
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +391 -403
- package/dist/index.umd.js.map +1 -1
- package/dist/math.d.ts +33 -1
- package/dist/math.js +339 -24
- package/dist/math.js.map +1 -1
- package/dist/shaders.d.ts +2 -2
- package/dist/shaders.js +179 -34
- package/dist/shaders.js.map +1 -1
- package/dist/types.d.ts +26 -0
- package/package.json +4 -1
- package/src/NeatGradient.ts +945 -75
- package/src/math.ts +381 -28
- package/src/shaders.ts +179 -34
- package/src/types.ts +30 -0
package/dist/index.es.js
CHANGED
|
@@ -1,229 +1,277 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
102
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
-
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|
|
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
|
|
329
|
-
return `
|
|
330
|
-
|
|
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
|
-
|
|
363
|
+
return 1.79284291400159 - 0.85373472095314 * r;
|
|
339
364
|
}
|
|
340
|
-
|
|
341
|
-
// Fade function
|
|
342
365
|
vec3 fade(vec3 t) {
|
|
343
|
-
|
|
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
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
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
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
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
|
|
484
|
-
return `
|
|
485
|
-
vec3
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
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
|
-
|
|
515
|
-
|
|
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
|
|
519
|
-
return this.elements[4] =
|
|
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
|
|
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
|
-
|
|
532
|
-
|
|
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),
|
|
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 *
|
|
543
|
+
2 * i,
|
|
543
544
|
0,
|
|
544
545
|
0,
|
|
545
546
|
0,
|
|
546
547
|
0,
|
|
547
|
-
-2 *
|
|
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
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
if (
|
|
560
|
-
const
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
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
|
|
568
|
-
const t =
|
|
569
|
-
for (let
|
|
570
|
-
const
|
|
571
|
-
for (let
|
|
572
|
-
const
|
|
573
|
-
|
|
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
|
|
577
|
-
for (let
|
|
578
|
-
const
|
|
579
|
-
h.push(
|
|
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
|
|
582
|
-
for (let
|
|
583
|
-
const
|
|
584
|
-
|
|
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(
|
|
588
|
-
normal: new Float32Array(
|
|
589
|
-
uv: new Float32Array(
|
|
590
|
-
index:
|
|
591
|
-
wireframeIndex:
|
|
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
|
|
605
|
-
class
|
|
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:
|
|
681
|
-
speed:
|
|
854
|
+
ref: i,
|
|
855
|
+
speed: r = 4,
|
|
682
856
|
horizontalPressure: t = 3,
|
|
683
|
-
verticalPressure:
|
|
684
|
-
waveFrequencyX:
|
|
685
|
-
waveFrequencyY:
|
|
686
|
-
waveAmplitude:
|
|
687
|
-
colors:
|
|
688
|
-
highlights:
|
|
689
|
-
shadows:
|
|
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:
|
|
692
|
-
colorBlending:
|
|
693
|
-
grainScale:
|
|
694
|
-
grainIntensity:
|
|
695
|
-
grainSparsity:
|
|
696
|
-
grainSpeed:
|
|
697
|
-
wireframe:
|
|
698
|
-
backgroundColor:
|
|
699
|
-
backgroundAlpha:
|
|
700
|
-
resolution:
|
|
701
|
-
seed:
|
|
702
|
-
yOffset:
|
|
703
|
-
yOffsetWaveMultiplier:
|
|
704
|
-
yOffsetColorMultiplier:
|
|
705
|
-
yOffsetFlowMultiplier:
|
|
706
|
-
flowDistortionA:
|
|
707
|
-
flowDistortionB:
|
|
708
|
-
flowScale:
|
|
709
|
-
flowEase:
|
|
710
|
-
flowEnabled:
|
|
711
|
-
enableProceduralTexture:
|
|
712
|
-
textureVoidLikelihood:
|
|
713
|
-
textureVoidWidthMin:
|
|
714
|
-
textureVoidWidthMax:
|
|
715
|
-
textureBandDensity:
|
|
716
|
-
textureColorBlending:
|
|
717
|
-
textureSeed:
|
|
718
|
-
textureEase:
|
|
719
|
-
proceduralBackgroundColor:
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
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 =
|
|
741
|
-
let
|
|
742
|
-
const
|
|
743
|
-
const { gl:
|
|
744
|
-
if (this._linkCheckCounter++, this._linkCheckCounter >= 300 && (this._linkCheckCounter = 0, (!this._linkElement || !document.contains(this._linkElement)) && (this._linkElement =
|
|
745
|
-
const
|
|
746
|
-
|
|
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
|
|
749
|
-
if (
|
|
750
|
-
const
|
|
751
|
-
|
|
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
|
-
|
|
754
|
-
|
|
968
|
+
o.uniform1f(f.uniforms[`u_colors[${L}].is_active`], 0);
|
|
969
|
+
o.uniform1i(f.uniforms.u_colors_count, $);
|
|
755
970
|
}
|
|
756
971
|
}
|
|
757
|
-
|
|
972
|
+
o.clearColor(
|
|
758
973
|
this._backgroundColorRgb[0],
|
|
759
974
|
this._backgroundColorRgb[1],
|
|
760
975
|
this._backgroundColorRgb[2],
|
|
761
976
|
this._backgroundAlpha
|
|
762
|
-
),
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
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
|
-
|
|
994
|
+
ut(), this._resizeTimeoutId = null;
|
|
772
995
|
}, 100);
|
|
773
|
-
}), this.sizeObserver.observe(
|
|
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
|
|
784
|
-
|
|
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((
|
|
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
|
-
|
|
839
|
-
|
|
840
|
-
|
|
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.
|
|
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
|
|
1341
|
+
const i = parseInt(e.replace("#", ""), 16);
|
|
933
1342
|
return [
|
|
934
|
-
(
|
|
935
|
-
(
|
|
936
|
-
(
|
|
1343
|
+
(i >> 16 & 255) / 255,
|
|
1344
|
+
(i >> 8 & 255) / 255,
|
|
1345
|
+
(i & 255) / 255
|
|
937
1346
|
];
|
|
938
1347
|
}
|
|
939
1348
|
_initScene(e) {
|
|
940
|
-
const
|
|
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,
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
const
|
|
947
|
-
t.bindBuffer(t.ARRAY_BUFFER,
|
|
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,
|
|
950
|
-
const
|
|
951
|
-
t.bindBuffer(t.
|
|
952
|
-
const
|
|
953
|
-
t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
` +
|
|
958
|
-
|
|
959
|
-
`
|
|
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
|
|
962
|
-
` +
|
|
963
|
-
` +
|
|
964
|
-
` +
|
|
965
|
-
t.shaderSource(
|
|
966
|
-
`).map((
|
|
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,
|
|
970
|
-
const
|
|
971
|
-
|
|
972
|
-
const
|
|
973
|
-
t.enableVertexAttribArray(
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
const C = t.getUniformLocation(u, "
|
|
977
|
-
t.
|
|
978
|
-
const
|
|
979
|
-
t.
|
|
980
|
-
const
|
|
981
|
-
t.
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
|
|
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
|
-
|
|
1033
|
-
|
|
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
|
-
|
|
1037
|
-
|
|
1451
|
+
P.forEach((S) => {
|
|
1452
|
+
E.uniforms[S] = t.getUniformLocation(u, S);
|
|
1038
1453
|
});
|
|
1039
|
-
for (let
|
|
1040
|
-
|
|
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:
|
|
1046
|
-
normal:
|
|
1047
|
-
uv:
|
|
1048
|
-
index:
|
|
1049
|
-
wireframeIndex:
|
|
1460
|
+
position: a,
|
|
1461
|
+
normal: h,
|
|
1462
|
+
uv: p,
|
|
1463
|
+
index: c,
|
|
1464
|
+
wireframeIndex: d
|
|
1050
1465
|
},
|
|
1051
|
-
locations:
|
|
1052
|
-
camera:
|
|
1053
|
-
indexCount:
|
|
1054
|
-
wireframeIndexCount:
|
|
1055
|
-
indexType:
|
|
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
|
-
|
|
1060
|
-
|
|
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
|
|
1065
|
-
const
|
|
1066
|
-
function
|
|
1067
|
-
const
|
|
1068
|
-
return
|
|
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
|
|
1071
|
-
|
|
1072
|
-
},
|
|
1073
|
-
if (
|
|
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
|
-
|
|
1076
|
-
|
|
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:
|
|
1079
|
-
g:
|
|
1080
|
-
b:
|
|
1493
|
+
r: F >> 16 & 255,
|
|
1494
|
+
g: F >> 8 & 255,
|
|
1495
|
+
b: F & 255
|
|
1081
1496
|
};
|
|
1082
1497
|
}
|
|
1083
|
-
function
|
|
1084
|
-
return "#" + ((1 << 24) + (Math.round(
|
|
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
|
|
1087
|
-
const
|
|
1088
|
-
return
|
|
1089
|
-
},
|
|
1090
|
-
t.fillStyle =
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
for (let
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
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
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
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
|
|
1107
|
-
|
|
1108
|
-
let
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
),
|
|
1119
|
-
|
|
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
|
-
|
|
1122
|
-
const
|
|
1123
|
-
|
|
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
|
-
|
|
1128
|
-
let
|
|
1129
|
-
const
|
|
1130
|
-
for (;
|
|
1131
|
-
if (
|
|
1132
|
-
const
|
|
1133
|
-
|
|
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
|
|
1136
|
-
|
|
1573
|
+
const F = 50 + s() * 200;
|
|
1574
|
+
T.push({ type: "matter", x: u, width: F }), u += F;
|
|
1137
1575
|
}
|
|
1138
|
-
for (const
|
|
1139
|
-
if (
|
|
1140
|
-
const
|
|
1141
|
-
let
|
|
1142
|
-
for (;
|
|
1143
|
-
const
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
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
|
-
|
|
1586
|
+
M,
|
|
1149
1587
|
1024,
|
|
1150
|
-
|
|
1588
|
+
z,
|
|
1151
1589
|
0,
|
|
1152
|
-
|
|
1590
|
+
M,
|
|
1153
1591
|
1024
|
|
1154
|
-
),
|
|
1592
|
+
), z += M;
|
|
1155
1593
|
}
|
|
1156
1594
|
}
|
|
1157
|
-
const
|
|
1158
|
-
e.bindTexture(e.TEXTURE_2D,
|
|
1159
|
-
const
|
|
1160
|
-
if (
|
|
1161
|
-
const
|
|
1162
|
-
e.texParameterf(e.TEXTURE_2D,
|
|
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
|
|
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
|
|
1213
|
-
|
|
1214
|
-
},
|
|
1215
|
-
const e =
|
|
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
|
|
1218
|
-
if (
|
|
1219
|
-
return
|
|
1858
|
+
const r = e.querySelector("a[data-n]");
|
|
1859
|
+
if (r)
|
|
1860
|
+
return _e(r), r;
|
|
1220
1861
|
}
|
|
1221
|
-
const
|
|
1222
|
-
return
|
|
1862
|
+
const i = document.createElement("a");
|
|
1863
|
+
return _e(i), e?.appendChild(i), i;
|
|
1223
1864
|
};
|
|
1224
|
-
function
|
|
1225
|
-
const
|
|
1226
|
-
return e * 60 +
|
|
1865
|
+
function vt() {
|
|
1866
|
+
const n = new Date(), e = n.getMinutes(), i = n.getSeconds();
|
|
1867
|
+
return e * 60 + i;
|
|
1227
1868
|
}
|
|
1228
|
-
function
|
|
1869
|
+
function xt(n = 6) {
|
|
1229
1870
|
const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1230
|
-
let
|
|
1231
|
-
for (let
|
|
1871
|
+
let i = "";
|
|
1872
|
+
for (let r = 0; r < n; r++) {
|
|
1232
1873
|
const t = Math.floor(Math.random() * e.length);
|
|
1233
|
-
|
|
1874
|
+
i += e.charAt(t);
|
|
1234
1875
|
}
|
|
1235
|
-
return
|
|
1876
|
+
return i;
|
|
1236
1877
|
}
|
|
1237
|
-
function
|
|
1238
|
-
const
|
|
1239
|
-
|
|
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
|
|
1882
|
+
function bt() {
|
|
1242
1883
|
if (document.getElementById("neat-seo-schema"))
|
|
1243
1884
|
return;
|
|
1244
|
-
const
|
|
1245
|
-
|
|
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(
|
|
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
|
|
1261
|
-
|
|
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
|
|
1264
|
-
|
|
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
|
-
|
|
1910
|
+
wt as NeatGradient
|
|
1270
1911
|
};
|
|
1271
1912
|
//# sourceMappingURL=index.es.js.map
|