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