@firecms/neat 0.7.1 → 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 +186 -55
- package/dist/NeatGradient.js +900 -65
- package/dist/NeatGradient.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1400 -610
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +411 -339
- 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 +271 -42
- package/dist/shaders.js.map +1 -1
- package/dist/types.d.ts +40 -0
- package/package.json +1 -1
- package/src/NeatGradient.ts +1044 -131
- package/src/index.ts +1 -0
- package/src/math.ts +373 -28
- package/src/shaders.ts +271 -42
- package/src/types.ts +56 -0
package/dist/index.es.js
CHANGED
|
@@ -1,179 +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. VERTEX POSITION
|
|
76
|
-
vec3 newPosition = position + normal * v_displacement_amount * u_wave_amplitude;
|
|
77
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
|
|
78
|
-
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);
|
|
79
24
|
}
|
|
80
|
-
`, de = `float random(vec2 p) {
|
|
81
|
-
return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);
|
|
82
25
|
}
|
|
83
|
-
|
|
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
|
+
}
|
|
84
88
|
float fbm(vec3 x) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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;
|
|
98
|
+
}
|
|
99
|
+
vec3 hsl2rgb(float h, float s, float l) {
|
|
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));
|
|
94
102
|
}
|
|
95
|
-
|
|
96
103
|
void main() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
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;
|
|
159
192
|
}
|
|
160
|
-
|
|
161
|
-
|
|
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;
|
|
218
|
+
}
|
|
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() {
|
|
162
261
|
return `precision highp float;
|
|
163
|
-
|
|
164
262
|
attribute vec3 position;
|
|
165
263
|
attribute vec3 normal;
|
|
166
264
|
attribute vec2 uv;
|
|
167
|
-
|
|
168
265
|
uniform mat4 modelViewMatrix;
|
|
169
266
|
uniform mat4 projectionMatrix;
|
|
170
|
-
|
|
171
267
|
varying vec2 vUv;
|
|
172
268
|
varying vec2 vFlowUv;
|
|
173
269
|
varying vec4 v_new_position;
|
|
174
270
|
varying vec3 v_color;
|
|
175
271
|
varying float v_displacement_amount;
|
|
176
|
-
|
|
272
|
+
varying vec3 vViewPosition;
|
|
273
|
+
varying vec3 vNormal;
|
|
274
|
+
varying vec3 vPosition;
|
|
177
275
|
uniform float u_time;
|
|
178
276
|
uniform vec2 u_resolution;
|
|
179
277
|
uniform vec2 u_color_pressure;
|
|
@@ -183,227 +281,201 @@ uniform float u_wave_amplitude;
|
|
|
183
281
|
uniform float u_plane_width;
|
|
184
282
|
uniform float u_plane_height;
|
|
185
283
|
uniform float u_color_blending;
|
|
186
|
-
|
|
187
284
|
uniform int u_colors_count;
|
|
188
285
|
struct ColorStop {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
286
|
+
float is_active;
|
|
287
|
+
vec3 color;
|
|
288
|
+
float influence;
|
|
192
289
|
};
|
|
193
290
|
uniform ColorStop u_colors[6];
|
|
194
|
-
|
|
195
291
|
uniform float u_y_offset;
|
|
196
292
|
uniform float u_y_offset_wave_multiplier;
|
|
197
293
|
uniform float u_y_offset_color_multiplier;
|
|
198
294
|
uniform float u_y_offset_flow_multiplier;
|
|
199
|
-
|
|
200
|
-
// Flow field uniforms
|
|
201
295
|
uniform float u_flow_distortion_a;
|
|
202
296
|
uniform float u_flow_distortion_b;
|
|
203
297
|
uniform float u_flow_scale;
|
|
204
298
|
uniform float u_flow_ease;
|
|
205
299
|
uniform float u_flow_enabled;
|
|
206
|
-
|
|
300
|
+
uniform float u_fresnel_enabled;
|
|
301
|
+
uniform float u_fresnel_power;
|
|
302
|
+
uniform float u_fresnel_intensity;
|
|
303
|
+
uniform vec3 u_fresnel_color;
|
|
304
|
+
uniform float u_shape_type;`;
|
|
207
305
|
}
|
|
208
|
-
function
|
|
306
|
+
function dt() {
|
|
209
307
|
return `precision highp float;
|
|
210
|
-
|
|
211
308
|
varying vec2 vUv;
|
|
212
309
|
varying vec2 vFlowUv;
|
|
310
|
+
varying vec4 v_new_position;
|
|
213
311
|
varying vec3 v_color;
|
|
214
312
|
varying float v_displacement_amount;
|
|
215
|
-
|
|
313
|
+
varying vec3 vViewPosition;
|
|
314
|
+
varying vec3 vNormal;
|
|
315
|
+
varying vec3 vPosition;
|
|
216
316
|
uniform float u_time;
|
|
317
|
+
uniform vec2 u_resolution;
|
|
217
318
|
uniform float u_plane_height;
|
|
218
|
-
|
|
219
319
|
uniform float u_shadows;
|
|
220
320
|
uniform float u_highlights;
|
|
221
321
|
uniform float u_saturation;
|
|
222
322
|
uniform float u_brightness;
|
|
223
|
-
uniform float u_grain_intensity;
|
|
224
|
-
uniform float u_grain_sparsity;
|
|
225
|
-
uniform float u_grain_scale;
|
|
226
|
-
uniform float u_grain_speed;
|
|
227
|
-
|
|
323
|
+
uniform float u_grain_intensity;
|
|
324
|
+
uniform float u_grain_sparsity;
|
|
325
|
+
uniform float u_grain_scale;
|
|
326
|
+
uniform float u_grain_speed;
|
|
228
327
|
uniform float u_y_offset;
|
|
229
328
|
uniform float u_y_offset_color_multiplier;
|
|
230
|
-
|
|
231
|
-
// Flow field uniforms
|
|
232
329
|
uniform float u_flow_distortion_a;
|
|
233
330
|
uniform float u_flow_distortion_b;
|
|
234
331
|
uniform float u_flow_scale;
|
|
235
|
-
|
|
236
|
-
// Procedural texture uniforms
|
|
237
332
|
uniform sampler2D u_procedural_texture;
|
|
238
333
|
uniform float u_enable_procedural_texture;
|
|
239
334
|
uniform float u_texture_ease;
|
|
240
|
-
|
|
335
|
+
uniform float u_domain_warp_enabled;
|
|
336
|
+
uniform float u_domain_warp_intensity;
|
|
337
|
+
uniform float u_domain_warp_scale;
|
|
338
|
+
uniform float u_vignette_intensity;
|
|
339
|
+
uniform float u_vignette_radius;
|
|
340
|
+
uniform float u_fresnel_enabled;
|
|
341
|
+
uniform float u_fresnel_power;
|
|
342
|
+
uniform float u_fresnel_intensity;
|
|
343
|
+
uniform vec3 u_fresnel_color;
|
|
344
|
+
uniform float u_iridescence_enabled;
|
|
345
|
+
uniform float u_iridescence_intensity;
|
|
346
|
+
uniform float u_iridescence_speed;
|
|
347
|
+
uniform float u_bloom_intensity;
|
|
348
|
+
uniform float u_bloom_threshold;
|
|
349
|
+
uniform float u_chromatic_aberration;
|
|
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;`;
|
|
241
355
|
}
|
|
242
|
-
function
|
|
243
|
-
return `
|
|
244
|
-
|
|
245
|
-
// Uses a hash function (fract/sin) instead of a modular lookup table.
|
|
246
|
-
vec4 permute(vec4 x) {
|
|
247
|
-
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);
|
|
248
359
|
}
|
|
249
|
-
|
|
250
|
-
// Taylor Inverse Sqrt
|
|
251
360
|
vec4 taylorInvSqrt(vec4 r) {
|
|
252
|
-
|
|
361
|
+
return 1.79284291400159 - 0.85373472095314 * r;
|
|
253
362
|
}
|
|
254
|
-
|
|
255
|
-
// Fade function
|
|
256
363
|
vec3 fade(vec3 t) {
|
|
257
|
-
|
|
364
|
+
return t*t*t*(t*(t*6.0-15.0)+10.0);
|
|
258
365
|
}
|
|
259
|
-
|
|
260
|
-
// 3D Simplex Noise
|
|
261
366
|
float snoise(vec3 v) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
|
|
306
|
-
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
|
|
307
|
-
|
|
308
|
-
vec3 p0 = vec3(a0.xy,h.x);
|
|
309
|
-
vec3 p1 = vec3(a0.zw,h.y);
|
|
310
|
-
vec3 p2 = vec3(a1.xy,h.z);
|
|
311
|
-
vec3 p3 = vec3(a1.zw,h.w);
|
|
312
|
-
|
|
313
|
-
// Normalise gradients
|
|
314
|
-
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
|
|
315
|
-
p0 *= norm.x;
|
|
316
|
-
p1 *= norm.y;
|
|
317
|
-
p2 *= norm.z;
|
|
318
|
-
p3 *= norm.w;
|
|
319
|
-
|
|
320
|
-
// Mix final noise value
|
|
321
|
-
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
|
|
322
|
-
m = m * m;
|
|
323
|
-
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
|
|
324
|
-
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) ) );
|
|
325
410
|
}
|
|
326
|
-
|
|
327
|
-
// Classic Perlin noise
|
|
328
411
|
float cnoise(vec3 P)
|
|
329
412
|
{
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
float n111 = dot(g111, Pf1);
|
|
388
|
-
|
|
389
|
-
vec3 fade_xyz = fade(Pf0);
|
|
390
|
-
vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
|
|
391
|
-
vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
|
|
392
|
-
float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
|
|
393
|
-
return 2.2 * n_xyz;
|
|
394
|
-
}
|
|
395
|
-
`;
|
|
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
|
+
}`;
|
|
396
470
|
}
|
|
397
|
-
function
|
|
398
|
-
return `
|
|
399
|
-
vec3
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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
|
+
}`;
|
|
403
477
|
}
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
class J {
|
|
478
|
+
class he {
|
|
407
479
|
elements;
|
|
408
480
|
constructor() {
|
|
409
481
|
this.elements = new Float32Array([
|
|
@@ -425,15 +497,23 @@ class J {
|
|
|
425
497
|
1
|
|
426
498
|
]);
|
|
427
499
|
}
|
|
428
|
-
translate(e, i,
|
|
429
|
-
return this.elements[12] += this.elements[0] * e + this.elements[4] * i + this.elements[8] *
|
|
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;
|
|
430
502
|
}
|
|
431
503
|
rotateX(e) {
|
|
432
|
-
const i = Math.cos(e),
|
|
433
|
-
return this.elements[4] = i * t +
|
|
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;
|
|
434
514
|
}
|
|
435
515
|
}
|
|
436
|
-
class
|
|
516
|
+
class mt {
|
|
437
517
|
left;
|
|
438
518
|
right;
|
|
439
519
|
top;
|
|
@@ -442,11 +522,12 @@ class ge {
|
|
|
442
522
|
far;
|
|
443
523
|
position;
|
|
444
524
|
projectionMatrix;
|
|
445
|
-
|
|
446
|
-
|
|
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();
|
|
447
528
|
}
|
|
448
529
|
updateProjectionMatrix() {
|
|
449
|
-
const e = 1 / (this.right - this.left), i = 1 / (this.top - this.bottom),
|
|
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;
|
|
450
531
|
this.projectionMatrix.elements = new Float32Array([
|
|
451
532
|
2 * e,
|
|
452
533
|
0,
|
|
@@ -458,51 +539,188 @@ class ge {
|
|
|
458
539
|
0,
|
|
459
540
|
0,
|
|
460
541
|
0,
|
|
461
|
-
-2 *
|
|
542
|
+
-2 * r,
|
|
462
543
|
0,
|
|
463
544
|
-t,
|
|
464
|
-
-b,
|
|
465
545
|
-y,
|
|
546
|
+
-x,
|
|
466
547
|
1
|
|
467
548
|
]);
|
|
468
549
|
}
|
|
469
550
|
}
|
|
470
|
-
function
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
if (
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
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();
|
|
575
|
+
}
|
|
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);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
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);
|
|
589
|
+
}
|
|
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);
|
|
594
|
+
}
|
|
595
|
+
return {
|
|
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
|
+
};
|
|
480
660
|
}
|
|
481
|
-
function
|
|
482
|
-
const
|
|
483
|
-
for (let c = 0; c
|
|
484
|
-
const
|
|
485
|
-
for (let
|
|
486
|
-
const
|
|
487
|
-
|
|
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);
|
|
488
668
|
}
|
|
489
669
|
}
|
|
490
|
-
for (let c = 0; c <
|
|
491
|
-
for (let
|
|
492
|
-
const
|
|
493
|
-
|
|
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);
|
|
494
674
|
}
|
|
495
|
-
const
|
|
496
|
-
for (let c = 0; c <
|
|
497
|
-
const
|
|
498
|
-
|
|
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);
|
|
499
679
|
}
|
|
500
680
|
return {
|
|
501
|
-
position: new Float32Array(
|
|
502
|
-
normal: new Float32Array(
|
|
503
|
-
uv: new Float32Array(
|
|
504
|
-
index:
|
|
505
|
-
wireframeIndex:
|
|
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)
|
|
506
724
|
};
|
|
507
725
|
}
|
|
508
726
|
console.info(
|
|
@@ -515,8 +733,8 @@ https://neat.firecms.co`,
|
|
|
515
733
|
"font-weight: bold; font-size: 14px; color: #FF5772;",
|
|
516
734
|
"color: inherit;"
|
|
517
735
|
);
|
|
518
|
-
const
|
|
519
|
-
class
|
|
736
|
+
const N = 50, Y = 80, j = 6, pt = xt();
|
|
737
|
+
class bt {
|
|
520
738
|
_ref;
|
|
521
739
|
_speed = -1;
|
|
522
740
|
_horizontalPressure = -1;
|
|
@@ -533,6 +751,7 @@ class Te {
|
|
|
533
751
|
_grainSparsity = -1;
|
|
534
752
|
_grainSpeed = -1;
|
|
535
753
|
_colorBlending = -1;
|
|
754
|
+
_resolution = 1;
|
|
536
755
|
_colors = [];
|
|
537
756
|
_wireframe = !1;
|
|
538
757
|
_backgroundColor = "#FFFFFF";
|
|
@@ -552,6 +771,47 @@ class Te {
|
|
|
552
771
|
_textureColorBlending = 0.01;
|
|
553
772
|
_textureSeed = 333;
|
|
554
773
|
_textureEase = 0.5;
|
|
774
|
+
_transparentTextureVoid = !1;
|
|
775
|
+
_domainWarpEnabled = !1;
|
|
776
|
+
_domainWarpIntensity = 0.5;
|
|
777
|
+
_domainWarpScale = 1;
|
|
778
|
+
_vignetteIntensity = 0.5;
|
|
779
|
+
_vignetteRadius = 0.8;
|
|
780
|
+
_fresnelEnabled = !1;
|
|
781
|
+
_fresnelPower = 2;
|
|
782
|
+
_fresnelIntensity = 0.5;
|
|
783
|
+
_fresnelColor = "#FFFFFF";
|
|
784
|
+
_fresnelColorRgb = [1, 1, 1];
|
|
785
|
+
_iridescenceEnabled = !1;
|
|
786
|
+
_iridescenceIntensity = 0.5;
|
|
787
|
+
_iridescenceSpeed = 1;
|
|
788
|
+
_bloomIntensity = 0;
|
|
789
|
+
_bloomThreshold = 0.7;
|
|
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;
|
|
555
815
|
_proceduralTexture = null;
|
|
556
816
|
_proceduralBackgroundColor = "#000000";
|
|
557
817
|
_textureShapeTriangles = 20;
|
|
@@ -567,6 +827,10 @@ class Te {
|
|
|
567
827
|
_yOffsetWaveMultiplier = 4e-3;
|
|
568
828
|
_yOffsetColorMultiplier = 4e-3;
|
|
569
829
|
_yOffsetFlowMultiplier = 4e-3;
|
|
830
|
+
_sourceCanvas = null;
|
|
831
|
+
_sourceCtx = null;
|
|
832
|
+
_maskedCanvas = null;
|
|
833
|
+
_maskedCtx = null;
|
|
570
834
|
_resizeTimeoutId = null;
|
|
571
835
|
_textureNeedsUpdate = !1;
|
|
572
836
|
_linkCheckCounter = 0;
|
|
@@ -576,84 +840,139 @@ class Te {
|
|
|
576
840
|
constructor(e) {
|
|
577
841
|
const {
|
|
578
842
|
ref: i,
|
|
579
|
-
speed:
|
|
843
|
+
speed: r = 4,
|
|
580
844
|
horizontalPressure: t = 3,
|
|
581
|
-
verticalPressure:
|
|
582
|
-
waveFrequencyX:
|
|
583
|
-
waveFrequencyY:
|
|
584
|
-
waveAmplitude:
|
|
585
|
-
colors:
|
|
586
|
-
highlights:
|
|
587
|
-
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,
|
|
588
852
|
colorSaturation: h = 0,
|
|
589
|
-
colorBrightness:
|
|
590
|
-
colorBlending:
|
|
591
|
-
grainScale:
|
|
592
|
-
grainIntensity:
|
|
593
|
-
grainSparsity:
|
|
594
|
-
grainSpeed:
|
|
595
|
-
wireframe:
|
|
596
|
-
backgroundColor:
|
|
597
|
-
backgroundAlpha:
|
|
598
|
-
resolution:
|
|
599
|
-
seed:
|
|
600
|
-
yOffset:
|
|
601
|
-
yOffsetWaveMultiplier:
|
|
602
|
-
yOffsetColorMultiplier:
|
|
603
|
-
yOffsetFlowMultiplier:
|
|
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,
|
|
866
|
+
yOffsetColorMultiplier: D = 4,
|
|
867
|
+
yOffsetFlowMultiplier: z = 4,
|
|
604
868
|
flowDistortionA: M = 0,
|
|
605
|
-
flowDistortionB:
|
|
606
|
-
flowScale:
|
|
607
|
-
flowEase:
|
|
608
|
-
flowEnabled:
|
|
609
|
-
enableProceduralTexture:
|
|
610
|
-
textureVoidLikelihood:
|
|
611
|
-
textureVoidWidthMin:
|
|
612
|
-
textureVoidWidthMax:
|
|
613
|
-
textureBandDensity:
|
|
614
|
-
textureColorBlending:
|
|
615
|
-
textureSeed:
|
|
616
|
-
textureEase:
|
|
617
|
-
proceduralBackgroundColor:
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
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
|
|
622
926
|
} = e;
|
|
623
|
-
this._ref = i, this.destroy = this.destroy.bind(this), this._initScene = this._initScene.bind(this), this.speed =
|
|
624
|
-
let
|
|
625
|
-
const
|
|
626
|
-
const { gl:
|
|
627
|
-
if (this._linkCheckCounter++, this._linkCheckCounter >= 300 && (this._linkCheckCounter = 0, (!this._linkElement || !document.contains(this._linkElement)) && (this._linkElement =
|
|
628
|
-
const
|
|
629
|
-
|
|
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) {
|
|
630
949
|
this._colorsChanged = !1;
|
|
631
|
-
for (let
|
|
632
|
-
if (
|
|
633
|
-
const
|
|
634
|
-
|
|
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);
|
|
635
954
|
} else
|
|
636
|
-
|
|
637
|
-
|
|
955
|
+
n.uniform1f(d.uniforms[`u_colors[${L}].is_active`], 0);
|
|
956
|
+
n.uniform1i(d.uniforms.u_colors_count, j);
|
|
638
957
|
}
|
|
639
958
|
}
|
|
640
|
-
|
|
959
|
+
n.clearColor(
|
|
641
960
|
this._backgroundColorRgb[0],
|
|
642
961
|
this._backgroundColorRgb[1],
|
|
643
962
|
this._backgroundColorRgb[2],
|
|
644
963
|
this._backgroundAlpha
|
|
645
|
-
),
|
|
646
|
-
},
|
|
647
|
-
const { gl:
|
|
648
|
-
this._ref.width =
|
|
649
|
-
const
|
|
650
|
-
|
|
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);
|
|
651
970
|
};
|
|
652
971
|
this.sizeObserver = new ResizeObserver(() => {
|
|
653
972
|
this._resizeTimeoutId !== null && clearTimeout(this._resizeTimeoutId), this._resizeTimeoutId = window.setTimeout(() => {
|
|
654
|
-
|
|
973
|
+
lt(), this._resizeTimeoutId = null;
|
|
655
974
|
}, 100);
|
|
656
|
-
}), this.sizeObserver.observe(i),
|
|
975
|
+
}), this.sizeObserver.observe(i), J();
|
|
657
976
|
}
|
|
658
977
|
destroy() {
|
|
659
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) {
|
|
@@ -664,72 +983,191 @@ class Te {
|
|
|
664
983
|
}
|
|
665
984
|
downloadAsPNG(e = "neat.png") {
|
|
666
985
|
const i = this._ref.toDataURL("image/png");
|
|
667
|
-
|
|
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;
|
|
668
1050
|
}
|
|
669
1051
|
set speed(e) {
|
|
670
1052
|
this._uniformsDirty = !0, this._speed = e / 20;
|
|
671
1053
|
}
|
|
1054
|
+
get horizontalPressure() {
|
|
1055
|
+
return this._horizontalPressure * 4;
|
|
1056
|
+
}
|
|
672
1057
|
set horizontalPressure(e) {
|
|
673
1058
|
this._uniformsDirty = !0, this._horizontalPressure = e / 4;
|
|
674
1059
|
}
|
|
1060
|
+
get verticalPressure() {
|
|
1061
|
+
return this._verticalPressure * 4;
|
|
1062
|
+
}
|
|
675
1063
|
set verticalPressure(e) {
|
|
676
1064
|
this._uniformsDirty = !0, this._verticalPressure = e / 4;
|
|
677
1065
|
}
|
|
1066
|
+
get waveFrequencyX() {
|
|
1067
|
+
return this._waveFrequencyX / 0.04;
|
|
1068
|
+
}
|
|
678
1069
|
set waveFrequencyX(e) {
|
|
679
1070
|
this._uniformsDirty = !0, this._waveFrequencyX = e * 0.04;
|
|
680
1071
|
}
|
|
1072
|
+
get waveFrequencyY() {
|
|
1073
|
+
return this._waveFrequencyY / 0.04;
|
|
1074
|
+
}
|
|
681
1075
|
set waveFrequencyY(e) {
|
|
682
1076
|
this._uniformsDirty = !0, this._waveFrequencyY = e * 0.04;
|
|
683
1077
|
}
|
|
1078
|
+
get waveAmplitude() {
|
|
1079
|
+
return this._waveAmplitude / 0.75;
|
|
1080
|
+
}
|
|
684
1081
|
set waveAmplitude(e) {
|
|
685
1082
|
this._uniformsDirty = !0, this._waveAmplitude = e * 0.75;
|
|
686
1083
|
}
|
|
1084
|
+
get colors() {
|
|
1085
|
+
return this._colors;
|
|
1086
|
+
}
|
|
687
1087
|
set colors(e) {
|
|
688
1088
|
this._uniformsDirty = !0, this._colors = e, this._cachedColorRgb = e.map((i) => this._hexToRgb(i.color)), this._colorsChanged = !0;
|
|
689
1089
|
}
|
|
1090
|
+
get highlights() {
|
|
1091
|
+
return this._highlights * 100;
|
|
1092
|
+
}
|
|
690
1093
|
set highlights(e) {
|
|
691
1094
|
this._uniformsDirty = !0, this._highlights = e / 100;
|
|
692
1095
|
}
|
|
1096
|
+
get shadows() {
|
|
1097
|
+
return this._shadows * 100;
|
|
1098
|
+
}
|
|
693
1099
|
set shadows(e) {
|
|
694
1100
|
this._uniformsDirty = !0, this._shadows = e / 100;
|
|
695
1101
|
}
|
|
1102
|
+
get colorSaturation() {
|
|
1103
|
+
return this._saturation * 10;
|
|
1104
|
+
}
|
|
696
1105
|
set colorSaturation(e) {
|
|
697
1106
|
this._uniformsDirty = !0, this._saturation = e / 10;
|
|
698
1107
|
}
|
|
1108
|
+
get colorBrightness() {
|
|
1109
|
+
return this._brightness;
|
|
1110
|
+
}
|
|
699
1111
|
set colorBrightness(e) {
|
|
700
1112
|
this._uniformsDirty = !0, this._brightness = e;
|
|
701
1113
|
}
|
|
1114
|
+
get colorBlending() {
|
|
1115
|
+
return this._colorBlending * 10;
|
|
1116
|
+
}
|
|
702
1117
|
set colorBlending(e) {
|
|
703
1118
|
this._uniformsDirty = !0, this._colorBlending = e / 10;
|
|
704
1119
|
}
|
|
1120
|
+
get grainScale() {
|
|
1121
|
+
return this._grainScale;
|
|
1122
|
+
}
|
|
705
1123
|
set grainScale(e) {
|
|
706
1124
|
this._uniformsDirty = !0, this._grainScale = e == 0 ? 1 : e;
|
|
707
1125
|
}
|
|
1126
|
+
get grainIntensity() {
|
|
1127
|
+
return this._grainIntensity;
|
|
1128
|
+
}
|
|
708
1129
|
set grainIntensity(e) {
|
|
709
1130
|
this._uniformsDirty = !0, this._grainIntensity = e;
|
|
710
1131
|
}
|
|
1132
|
+
get grainSparsity() {
|
|
1133
|
+
return this._grainSparsity;
|
|
1134
|
+
}
|
|
711
1135
|
set grainSparsity(e) {
|
|
712
1136
|
this._uniformsDirty = !0, this._grainSparsity = e;
|
|
713
1137
|
}
|
|
1138
|
+
get grainSpeed() {
|
|
1139
|
+
return this._grainSpeed;
|
|
1140
|
+
}
|
|
714
1141
|
set grainSpeed(e) {
|
|
715
1142
|
this._uniformsDirty = !0, this._grainSpeed = e;
|
|
716
1143
|
}
|
|
1144
|
+
get wireframe() {
|
|
1145
|
+
return this._wireframe;
|
|
1146
|
+
}
|
|
717
1147
|
set wireframe(e) {
|
|
718
1148
|
this._uniformsDirty = !0, this._wireframe = e;
|
|
719
1149
|
}
|
|
1150
|
+
get resolution() {
|
|
1151
|
+
return this._resolution;
|
|
1152
|
+
}
|
|
720
1153
|
set resolution(e) {
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
this.glState = this._initScene(e);
|
|
1154
|
+
this._resolution !== e && (this._resolution = e, this._updateGeometry());
|
|
1155
|
+
}
|
|
1156
|
+
get backgroundColor() {
|
|
1157
|
+
return this._backgroundColor;
|
|
726
1158
|
}
|
|
727
1159
|
set backgroundColor(e) {
|
|
728
1160
|
this._uniformsDirty = !0, this._backgroundColor = e, this._backgroundColorRgb = this._hexToRgb(e);
|
|
729
1161
|
}
|
|
1162
|
+
get backgroundAlpha() {
|
|
1163
|
+
return this._backgroundAlpha;
|
|
1164
|
+
}
|
|
730
1165
|
set backgroundAlpha(e) {
|
|
731
1166
|
this._uniformsDirty = !0, this._backgroundAlpha = e;
|
|
732
1167
|
}
|
|
1168
|
+
get yOffset() {
|
|
1169
|
+
return this._yOffset;
|
|
1170
|
+
}
|
|
733
1171
|
set yOffset(e) {
|
|
734
1172
|
this._uniformsDirty = !0, this._yOffset = e;
|
|
735
1173
|
}
|
|
@@ -751,15 +1189,27 @@ class Te {
|
|
|
751
1189
|
set yOffsetFlowMultiplier(e) {
|
|
752
1190
|
this._uniformsDirty = !0, this._yOffsetFlowMultiplier = e / 1e3;
|
|
753
1191
|
}
|
|
1192
|
+
get flowDistortionA() {
|
|
1193
|
+
return this._flowDistortionA;
|
|
1194
|
+
}
|
|
754
1195
|
set flowDistortionA(e) {
|
|
755
1196
|
this._uniformsDirty = !0, this._flowDistortionA = e;
|
|
756
1197
|
}
|
|
1198
|
+
get flowDistortionB() {
|
|
1199
|
+
return this._flowDistortionB;
|
|
1200
|
+
}
|
|
757
1201
|
set flowDistortionB(e) {
|
|
758
1202
|
this._uniformsDirty = !0, this._flowDistortionB = e;
|
|
759
1203
|
}
|
|
1204
|
+
get flowScale() {
|
|
1205
|
+
return this._flowScale;
|
|
1206
|
+
}
|
|
760
1207
|
set flowScale(e) {
|
|
761
1208
|
this._uniformsDirty = !0, this._flowScale = e;
|
|
762
1209
|
}
|
|
1210
|
+
get flowEase() {
|
|
1211
|
+
return this._flowEase;
|
|
1212
|
+
}
|
|
763
1213
|
set flowEase(e) {
|
|
764
1214
|
this._uniformsDirty = !0, this._flowEase = e;
|
|
765
1215
|
}
|
|
@@ -769,24 +1219,45 @@ class Te {
|
|
|
769
1219
|
get flowEnabled() {
|
|
770
1220
|
return this._flowEnabled;
|
|
771
1221
|
}
|
|
1222
|
+
get enableProceduralTexture() {
|
|
1223
|
+
return this._enableProceduralTexture;
|
|
1224
|
+
}
|
|
772
1225
|
set enableProceduralTexture(e) {
|
|
773
1226
|
this._uniformsDirty = !0, this._enableProceduralTexture = e, e && !this._proceduralTexture && (this._textureNeedsUpdate = !0);
|
|
774
1227
|
}
|
|
1228
|
+
get textureVoidLikelihood() {
|
|
1229
|
+
return this._textureVoidLikelihood;
|
|
1230
|
+
}
|
|
775
1231
|
set textureVoidLikelihood(e) {
|
|
776
1232
|
this._uniformsDirty = !0, this._textureVoidLikelihood = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
777
1233
|
}
|
|
1234
|
+
get textureVoidWidthMin() {
|
|
1235
|
+
return this._textureVoidWidthMin;
|
|
1236
|
+
}
|
|
778
1237
|
set textureVoidWidthMin(e) {
|
|
779
1238
|
this._uniformsDirty = !0, this._textureVoidWidthMin = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
780
1239
|
}
|
|
1240
|
+
get textureVoidWidthMax() {
|
|
1241
|
+
return this._textureVoidWidthMax;
|
|
1242
|
+
}
|
|
781
1243
|
set textureVoidWidthMax(e) {
|
|
782
1244
|
this._uniformsDirty = !0, this._textureVoidWidthMax = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
783
1245
|
}
|
|
1246
|
+
get textureBandDensity() {
|
|
1247
|
+
return this._textureBandDensity;
|
|
1248
|
+
}
|
|
784
1249
|
set textureBandDensity(e) {
|
|
785
1250
|
this._uniformsDirty = !0, this._textureBandDensity = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
786
1251
|
}
|
|
1252
|
+
get textureColorBlending() {
|
|
1253
|
+
return this._textureColorBlending;
|
|
1254
|
+
}
|
|
787
1255
|
set textureColorBlending(e) {
|
|
788
1256
|
this._uniformsDirty = !0, this._textureColorBlending = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
789
1257
|
}
|
|
1258
|
+
get textureSeed() {
|
|
1259
|
+
return this._textureSeed;
|
|
1260
|
+
}
|
|
790
1261
|
set textureSeed(e) {
|
|
791
1262
|
this._uniformsDirty = !0, this._textureSeed = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
792
1263
|
}
|
|
@@ -796,21 +1267,55 @@ class Te {
|
|
|
796
1267
|
set textureEase(e) {
|
|
797
1268
|
this._uniformsDirty = !0, this._textureEase = e;
|
|
798
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
|
+
}
|
|
799
1279
|
set proceduralBackgroundColor(e) {
|
|
800
1280
|
this._uniformsDirty = !0, this._proceduralBackgroundColor = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
801
1281
|
}
|
|
1282
|
+
get textureShapeTriangles() {
|
|
1283
|
+
return this._textureShapeTriangles;
|
|
1284
|
+
}
|
|
802
1285
|
set textureShapeTriangles(e) {
|
|
803
1286
|
this._uniformsDirty = !0, this._textureShapeTriangles = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
804
1287
|
}
|
|
1288
|
+
get textureShapeCircles() {
|
|
1289
|
+
return this._textureShapeCircles;
|
|
1290
|
+
}
|
|
805
1291
|
set textureShapeCircles(e) {
|
|
806
1292
|
this._uniformsDirty = !0, this._textureShapeCircles = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
807
1293
|
}
|
|
1294
|
+
get textureShapeBars() {
|
|
1295
|
+
return this._textureShapeBars;
|
|
1296
|
+
}
|
|
808
1297
|
set textureShapeBars(e) {
|
|
809
1298
|
this._uniformsDirty = !0, this._textureShapeBars = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
810
1299
|
}
|
|
1300
|
+
get textureShapeSquiggles() {
|
|
1301
|
+
return this._textureShapeSquiggles;
|
|
1302
|
+
}
|
|
811
1303
|
set textureShapeSquiggles(e) {
|
|
812
1304
|
this._uniformsDirty = !0, this._textureShapeSquiggles = e, this._enableProceduralTexture && (this._textureNeedsUpdate = !0);
|
|
813
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
|
+
}
|
|
814
1319
|
_hexToRgb(e) {
|
|
815
1320
|
const i = parseInt(e.replace("#", ""), 16);
|
|
816
1321
|
return [
|
|
@@ -820,53 +1325,53 @@ class Te {
|
|
|
820
1325
|
];
|
|
821
1326
|
}
|
|
822
1327
|
_initScene(e) {
|
|
823
|
-
const i = this._ref.clientWidth,
|
|
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 });
|
|
824
1329
|
if (!t)
|
|
825
1330
|
throw new Error("WebGL not supported");
|
|
826
|
-
t.getExtension("OES_standard_derivatives"), t.getExtension("OES_element_index_uint"), t.viewport(0, 0, i,
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const x = t.createBuffer();
|
|
830
|
-
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);
|
|
831
1336
|
const h = t.createBuffer();
|
|
832
|
-
t.bindBuffer(t.ARRAY_BUFFER, h), t.bufferData(t.ARRAY_BUFFER,
|
|
833
|
-
const
|
|
834
|
-
t.bindBuffer(t.
|
|
835
|
-
const
|
|
836
|
-
t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
` +
|
|
841
|
-
|
|
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(`
|
|
842
1349
|
`).map((S, U) => `${U + 1}: ${S}`).join(`
|
|
843
1350
|
`)), console.log("VERTEX_SHADER_ERROR_END"));
|
|
844
|
-
const
|
|
845
|
-
` +
|
|
846
|
-
` +
|
|
847
|
-
` +
|
|
848
|
-
t.shaderSource(
|
|
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(`
|
|
849
1356
|
`).map((S, U) => `${U + 1}: ${S}`).join(`
|
|
850
1357
|
`)), console.log("FRAGMENT_SHADER_ERROR_END"));
|
|
851
|
-
const
|
|
852
|
-
t.attachShader(
|
|
853
|
-
const
|
|
854
|
-
|
|
855
|
-
const
|
|
856
|
-
t.enableVertexAttribArray(
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
const
|
|
860
|
-
t.
|
|
861
|
-
const
|
|
862
|
-
t.
|
|
863
|
-
const
|
|
864
|
-
t.
|
|
865
|
-
const
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
t.uniform1i(N, O);
|
|
869
|
-
const W = [
|
|
1358
|
+
const u = t.createProgram();
|
|
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",
|
|
870
1375
|
"u_time",
|
|
871
1376
|
"u_resolution",
|
|
872
1377
|
"u_color_pressure",
|
|
@@ -894,178 +1399,463 @@ class Te {
|
|
|
894
1399
|
"u_procedural_texture",
|
|
895
1400
|
"u_enable_procedural_texture",
|
|
896
1401
|
"u_texture_ease",
|
|
1402
|
+
"u_transparent_texture_void",
|
|
897
1403
|
"u_saturation",
|
|
898
1404
|
"u_brightness",
|
|
899
|
-
"u_color_blending"
|
|
900
|
-
|
|
901
|
-
|
|
1405
|
+
"u_color_blending",
|
|
1406
|
+
"u_domain_warp_enabled",
|
|
1407
|
+
"u_domain_warp_intensity",
|
|
1408
|
+
"u_domain_warp_scale",
|
|
1409
|
+
"u_vignette_intensity",
|
|
1410
|
+
"u_vignette_radius",
|
|
1411
|
+
"u_fresnel_enabled",
|
|
1412
|
+
"u_fresnel_power",
|
|
1413
|
+
"u_fresnel_intensity",
|
|
1414
|
+
"u_fresnel_color",
|
|
1415
|
+
"u_iridescence_enabled",
|
|
1416
|
+
"u_iridescence_intensity",
|
|
1417
|
+
"u_iridescence_speed",
|
|
1418
|
+
"u_bloom_intensity",
|
|
1419
|
+
"u_bloom_threshold",
|
|
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 },
|
|
902
1427
|
uniforms: {}
|
|
903
1428
|
};
|
|
904
|
-
|
|
905
|
-
|
|
1429
|
+
P.forEach((S) => {
|
|
1430
|
+
E.uniforms[S] = t.getUniformLocation(u, S);
|
|
906
1431
|
});
|
|
907
|
-
for (let S = 0; S <
|
|
908
|
-
|
|
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`);
|
|
909
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), {
|
|
910
1435
|
gl: t,
|
|
911
|
-
program:
|
|
1436
|
+
program: u,
|
|
912
1437
|
buffers: {
|
|
913
|
-
position:
|
|
914
|
-
normal:
|
|
915
|
-
uv:
|
|
916
|
-
index:
|
|
917
|
-
wireframeIndex:
|
|
1438
|
+
position: a,
|
|
1439
|
+
normal: h,
|
|
1440
|
+
uv: p,
|
|
1441
|
+
index: c,
|
|
1442
|
+
wireframeIndex: f
|
|
918
1443
|
},
|
|
919
|
-
locations:
|
|
920
|
-
camera:
|
|
921
|
-
indexCount:
|
|
922
|
-
wireframeIndexCount:
|
|
923
|
-
indexType:
|
|
1444
|
+
locations: E,
|
|
1445
|
+
camera: T,
|
|
1446
|
+
indexCount: _.length,
|
|
1447
|
+
wireframeIndexCount: b.length,
|
|
1448
|
+
indexType: _ instanceof Uint32Array ? t.UNSIGNED_INT : t.UNSIGNED_SHORT
|
|
924
1449
|
};
|
|
925
1450
|
}
|
|
926
1451
|
_createProceduralTexture(e) {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
const t = o.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;
|
|
930
1454
|
if (!t)
|
|
931
1455
|
return null;
|
|
932
|
-
let
|
|
933
|
-
const
|
|
934
|
-
function
|
|
935
|
-
const
|
|
936
|
-
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);
|
|
937
1461
|
}
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
},
|
|
941
|
-
if (
|
|
1462
|
+
const l = (m) => {
|
|
1463
|
+
y = x + m;
|
|
1464
|
+
}, _ = this._colors.filter((m) => m.enabled).map((m) => m.color);
|
|
1465
|
+
if (_.length === 0)
|
|
942
1466
|
return null;
|
|
943
|
-
|
|
944
|
-
|
|
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);
|
|
945
1470
|
return {
|
|
946
|
-
r:
|
|
947
|
-
g:
|
|
948
|
-
b:
|
|
1471
|
+
r: F >> 16 & 255,
|
|
1472
|
+
g: F >> 8 & 255,
|
|
1473
|
+
b: F & 255
|
|
949
1474
|
};
|
|
950
1475
|
}
|
|
951
|
-
function
|
|
952
|
-
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");
|
|
953
1478
|
}
|
|
954
|
-
const
|
|
955
|
-
const
|
|
956
|
-
return
|
|
957
|
-
},
|
|
958
|
-
t.fillStyle =
|
|
959
|
-
const
|
|
960
|
-
|
|
961
|
-
for (let
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
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
|
+
}
|
|
1494
|
+
}
|
|
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();
|
|
965
1500
|
}
|
|
966
|
-
for (let
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
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();
|
|
970
1506
|
}
|
|
971
|
-
for (let s = 0; s < this._textureShapeBars; s++)
|
|
972
|
-
t.fillStyle = h(), t.save(), t.translate(n() * 1024, n() * 1024), t.rotate(n() * Math.PI), t.fillRect(-150, -25, 300, 50), t.restore();
|
|
973
1507
|
t.lineWidth = 15, t.lineCap = "round";
|
|
974
|
-
for (let
|
|
975
|
-
|
|
976
|
-
let
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
),
|
|
987
|
-
|
|
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
|
+
}
|
|
988
1538
|
}
|
|
989
|
-
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
const g = E.getContext("2d", { willReadFrequently: !0 });
|
|
993
|
-
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)
|
|
994
1542
|
return null;
|
|
995
|
-
|
|
996
|
-
let
|
|
997
|
-
const
|
|
998
|
-
for (;
|
|
999
|
-
if (
|
|
1000
|
-
const
|
|
1001
|
-
|
|
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;
|
|
1002
1550
|
} else {
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1551
|
+
const F = 50 + o() * 200;
|
|
1552
|
+
T.push({ type: "matter", x: u, width: F }), u += F;
|
|
1005
1553
|
}
|
|
1006
|
-
for (const
|
|
1007
|
-
if (
|
|
1008
|
-
const
|
|
1009
|
-
let
|
|
1010
|
-
for (;
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
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,
|
|
1015
1563
|
0,
|
|
1016
|
-
|
|
1564
|
+
M,
|
|
1017
1565
|
1024,
|
|
1018
|
-
d,
|
|
1019
|
-
0,
|
|
1020
1566
|
z,
|
|
1567
|
+
0,
|
|
1568
|
+
M,
|
|
1021
1569
|
1024
|
|
1022
|
-
),
|
|
1570
|
+
), z += M;
|
|
1023
1571
|
}
|
|
1024
1572
|
}
|
|
1025
|
-
const
|
|
1026
|
-
e.bindTexture(e.TEXTURE_2D,
|
|
1027
|
-
const
|
|
1028
|
-
if (
|
|
1029
|
-
const
|
|
1030
|
-
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));
|
|
1031
1579
|
}
|
|
1032
|
-
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;
|
|
1602
|
+
}
|
|
1603
|
+
set domainWarpEnabled(e) {
|
|
1604
|
+
this._domainWarpEnabled !== e && (this._domainWarpEnabled = e, this._uniformsDirty = !0);
|
|
1605
|
+
}
|
|
1606
|
+
get domainWarpIntensity() {
|
|
1607
|
+
return this._domainWarpIntensity;
|
|
1608
|
+
}
|
|
1609
|
+
set domainWarpIntensity(e) {
|
|
1610
|
+
this._domainWarpIntensity !== e && (this._domainWarpIntensity = e, this._uniformsDirty = !0);
|
|
1611
|
+
}
|
|
1612
|
+
get domainWarpScale() {
|
|
1613
|
+
return this._domainWarpScale;
|
|
1614
|
+
}
|
|
1615
|
+
set domainWarpScale(e) {
|
|
1616
|
+
this._domainWarpScale !== e && (this._domainWarpScale = e, this._uniformsDirty = !0);
|
|
1617
|
+
}
|
|
1618
|
+
get vignetteIntensity() {
|
|
1619
|
+
return this._vignetteIntensity;
|
|
1620
|
+
}
|
|
1621
|
+
set vignetteIntensity(e) {
|
|
1622
|
+
this._vignetteIntensity !== e && (this._vignetteIntensity = e, this._uniformsDirty = !0);
|
|
1623
|
+
}
|
|
1624
|
+
get vignetteRadius() {
|
|
1625
|
+
return this._vignetteRadius;
|
|
1626
|
+
}
|
|
1627
|
+
set vignetteRadius(e) {
|
|
1628
|
+
this._vignetteRadius !== e && (this._vignetteRadius = e, this._uniformsDirty = !0);
|
|
1629
|
+
}
|
|
1630
|
+
get fresnelEnabled() {
|
|
1631
|
+
return this._fresnelEnabled;
|
|
1632
|
+
}
|
|
1633
|
+
set fresnelEnabled(e) {
|
|
1634
|
+
this._fresnelEnabled !== e && (this._fresnelEnabled = e, this._uniformsDirty = !0);
|
|
1635
|
+
}
|
|
1636
|
+
get fresnelPower() {
|
|
1637
|
+
return this._fresnelPower;
|
|
1638
|
+
}
|
|
1639
|
+
set fresnelPower(e) {
|
|
1640
|
+
this._fresnelPower !== e && (this._fresnelPower = e, this._uniformsDirty = !0);
|
|
1641
|
+
}
|
|
1642
|
+
get fresnelIntensity() {
|
|
1643
|
+
return this._fresnelIntensity;
|
|
1644
|
+
}
|
|
1645
|
+
set fresnelIntensity(e) {
|
|
1646
|
+
this._fresnelIntensity !== e && (this._fresnelIntensity = e, this._uniformsDirty = !0);
|
|
1647
|
+
}
|
|
1648
|
+
get fresnelColor() {
|
|
1649
|
+
return this._fresnelColor;
|
|
1650
|
+
}
|
|
1651
|
+
set fresnelColor(e) {
|
|
1652
|
+
this._fresnelColor !== e && (this._fresnelColor = e, this._fresnelColorRgb = this._hexToRgb(e), this._uniformsDirty = !0);
|
|
1653
|
+
}
|
|
1654
|
+
get iridescenceEnabled() {
|
|
1655
|
+
return this._iridescenceEnabled;
|
|
1656
|
+
}
|
|
1657
|
+
set iridescenceEnabled(e) {
|
|
1658
|
+
this._iridescenceEnabled !== e && (this._iridescenceEnabled = e, this._uniformsDirty = !0);
|
|
1659
|
+
}
|
|
1660
|
+
get iridescenceIntensity() {
|
|
1661
|
+
return this._iridescenceIntensity;
|
|
1662
|
+
}
|
|
1663
|
+
set iridescenceIntensity(e) {
|
|
1664
|
+
this._iridescenceIntensity !== e && (this._iridescenceIntensity = e, this._uniformsDirty = !0);
|
|
1665
|
+
}
|
|
1666
|
+
get iridescenceSpeed() {
|
|
1667
|
+
return this._iridescenceSpeed;
|
|
1668
|
+
}
|
|
1669
|
+
set iridescenceSpeed(e) {
|
|
1670
|
+
this._iridescenceSpeed !== e && (this._iridescenceSpeed = e, this._uniformsDirty = !0);
|
|
1671
|
+
}
|
|
1672
|
+
get bloomIntensity() {
|
|
1673
|
+
return this._bloomIntensity;
|
|
1674
|
+
}
|
|
1675
|
+
set bloomIntensity(e) {
|
|
1676
|
+
this._bloomIntensity !== e && (this._bloomIntensity = e, this._uniformsDirty = !0);
|
|
1677
|
+
}
|
|
1678
|
+
get bloomThreshold() {
|
|
1679
|
+
return this._bloomThreshold;
|
|
1680
|
+
}
|
|
1681
|
+
set bloomThreshold(e) {
|
|
1682
|
+
this._bloomThreshold !== e && (this._bloomThreshold = e, this._uniformsDirty = !0);
|
|
1683
|
+
}
|
|
1684
|
+
get chromaticAberration() {
|
|
1685
|
+
return this._chromaticAberration;
|
|
1686
|
+
}
|
|
1687
|
+
set chromaticAberration(e) {
|
|
1688
|
+
this._chromaticAberration !== e && (this._chromaticAberration = e, this._uniformsDirty = !0);
|
|
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;
|
|
1033
1823
|
}
|
|
1034
1824
|
}
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1037
|
-
},
|
|
1038
|
-
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;
|
|
1039
1829
|
if (e && getComputedStyle(e).position === "static" && (e.style.position = "relative"), e) {
|
|
1040
|
-
const
|
|
1041
|
-
if (
|
|
1042
|
-
return
|
|
1830
|
+
const r = e.querySelector("a[data-n]");
|
|
1831
|
+
if (r)
|
|
1832
|
+
return _e(r), r;
|
|
1043
1833
|
}
|
|
1044
1834
|
const i = document.createElement("a");
|
|
1045
|
-
return
|
|
1835
|
+
return _e(i), e?.appendChild(i), i;
|
|
1046
1836
|
};
|
|
1047
|
-
function
|
|
1048
|
-
const
|
|
1837
|
+
function yt() {
|
|
1838
|
+
const s = new Date(), e = s.getMinutes(), i = s.getSeconds();
|
|
1049
1839
|
return e * 60 + i;
|
|
1050
1840
|
}
|
|
1051
|
-
function
|
|
1841
|
+
function xt(s = 6) {
|
|
1052
1842
|
const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1053
1843
|
let i = "";
|
|
1054
|
-
for (let
|
|
1844
|
+
for (let r = 0; r < s; r++) {
|
|
1055
1845
|
const t = Math.floor(Math.random() * e.length);
|
|
1056
1846
|
i += e.charAt(t);
|
|
1057
1847
|
}
|
|
1058
1848
|
return i;
|
|
1059
1849
|
}
|
|
1060
|
-
function
|
|
1850
|
+
function ce(s, e) {
|
|
1061
1851
|
const i = document.createElement("a");
|
|
1062
|
-
i.download = e, i.href =
|
|
1852
|
+
i.download = e, i.href = s, document.body.appendChild(i), i.click(), document.body.removeChild(i);
|
|
1063
1853
|
}
|
|
1064
|
-
function
|
|
1854
|
+
function vt() {
|
|
1065
1855
|
if (document.getElementById("neat-seo-schema"))
|
|
1066
1856
|
return;
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1857
|
+
const s = document.createElement("script");
|
|
1858
|
+
s.id = "neat-seo-schema", s.type = "application/ld+json", s.text = JSON.stringify({
|
|
1069
1859
|
"@context": "https://schema.org",
|
|
1070
1860
|
"@type": "WebSite",
|
|
1071
1861
|
name: "NEAT Gradient",
|
|
@@ -1076,19 +1866,19 @@ function Ee() {
|
|
|
1076
1866
|
url: "https://firecms.co"
|
|
1077
1867
|
},
|
|
1078
1868
|
description: "Beautiful, fast, heavily customizable, WebGL based gradients."
|
|
1079
|
-
}), document.head.appendChild(
|
|
1869
|
+
}), document.head.appendChild(s);
|
|
1080
1870
|
const e = document.createElement("div");
|
|
1081
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";
|
|
1082
1872
|
try {
|
|
1083
|
-
const i = e.attachShadow({ mode: "closed" }),
|
|
1084
|
-
|
|
1873
|
+
const i = e.attachShadow({ mode: "closed" }), r = document.createElement("a");
|
|
1874
|
+
r.href = "https://firecms.co", r.textContent = "FireCMS", i.appendChild(r);
|
|
1085
1875
|
} catch {
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1876
|
+
const r = document.createElement("a");
|
|
1877
|
+
r.href = "https://firecms.co", r.textContent = "FireCMS", e.appendChild(r);
|
|
1088
1878
|
}
|
|
1089
1879
|
document.body.appendChild(e);
|
|
1090
1880
|
}
|
|
1091
1881
|
export {
|
|
1092
|
-
|
|
1882
|
+
bt as NeatGradient
|
|
1093
1883
|
};
|
|
1094
1884
|
//# sourceMappingURL=index.es.js.map
|