@firecms/neat 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NeatGradient.d.ts +8 -0
- package/dist/NeatGradient.js +73 -7
- package/dist/NeatGradient.js.map +1 -1
- package/dist/index.es.js +315 -285
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +31 -29
- package/dist/index.umd.js.map +1 -1
- package/dist/math.d.ts +1 -0
- package/dist/math.js +20 -0
- package/dist/math.js.map +1 -1
- package/dist/shaders.d.ts +2 -2
- package/dist/shaders.js +19 -17
- package/dist/shaders.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +4 -1
- package/src/NeatGradient.ts +77 -6
- package/src/math.ts +8 -0
- package/src/shaders.ts +19 -17
- package/src/types.ts +1 -0
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ht = `void main() {
|
|
2
2
|
vUv = uv;
|
|
3
3
|
vPosition = position;
|
|
4
4
|
float waveOffset = -u_y_offset * u_y_offset_wave_multiplier;
|
|
@@ -26,7 +26,7 @@ flowUv = mix(baseUv, vec2(baseUv.x * (1.0 - u_flow_ease) + r * u_flow_ease, base
|
|
|
26
26
|
vFlowUv = flowUv;
|
|
27
27
|
vec3 color = u_colors[0].color;
|
|
28
28
|
vec3 distortedPos = position;
|
|
29
|
-
if (
|
|
29
|
+
if (u_flat_shading < 0.5) {
|
|
30
30
|
if (u_flow_enabled > 0.5) {
|
|
31
31
|
if (u_flow_ease > 0.0 || u_flow_distortion_a > 0.0) {
|
|
32
32
|
vec3 ppp = position / 25.0;
|
|
@@ -44,7 +44,7 @@ position.z * (1.0 - u_flow_ease) + r * u_flow_ease * 25.0
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
vec3 noise_cord;
|
|
47
|
-
if (
|
|
47
|
+
if (u_flat_shading < 0.5) {
|
|
48
48
|
noise_cord = vec3(distortedPos.x / 50.0, (distortedPos.y + colorOffset) / 50.0, distortedPos.z / 50.0);
|
|
49
49
|
} else {
|
|
50
50
|
vec2 adjustedUv = flowUv;
|
|
@@ -60,7 +60,7 @@ float noiseFlow = (1. + float(i)) / 30.;
|
|
|
60
60
|
float noiseSpeed = (1. + float(i)) * 0.11;
|
|
61
61
|
float noiseSeed = 13. + float(i) * 7.;
|
|
62
62
|
float noise_z = u_time * noiseSpeed;
|
|
63
|
-
if (
|
|
63
|
+
if (u_flat_shading < 0.5) {
|
|
64
64
|
noise_z = noise_cord.z * u_color_pressure.x * u_color_pressure.x + u_time * noiseSpeed;
|
|
65
65
|
}
|
|
66
66
|
float noise = snoise(
|
|
@@ -82,14 +82,14 @@ vViewPosition = mvPosition.xyz;
|
|
|
82
82
|
vNormal = normalize((modelViewMatrix * vec4(normal, 0.0)).xyz);
|
|
83
83
|
gl_Position = projectionMatrix * mvPosition;
|
|
84
84
|
v_new_position = gl_Position;
|
|
85
|
-
}`,
|
|
85
|
+
}`, ft = `float random(vec2 p) {
|
|
86
86
|
return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453);
|
|
87
87
|
}
|
|
88
88
|
float fbm(vec3 x) {
|
|
89
89
|
float value = 0.0;
|
|
90
90
|
float amplitude = 0.5;
|
|
91
91
|
float frequency = 1.0;
|
|
92
|
-
for (int i = 0; i <
|
|
92
|
+
for (int i = 0; i < 2; i++) {
|
|
93
93
|
value += amplitude * snoise(x * frequency);
|
|
94
94
|
frequency *= 2.0;
|
|
95
95
|
amplitude *= 0.5;
|
|
@@ -105,7 +105,7 @@ vec2 finalUv = vFlowUv;
|
|
|
105
105
|
vec3 baseColor;
|
|
106
106
|
float texAlpha = 1.0;
|
|
107
107
|
if (u_enable_procedural_texture > 0.5) {
|
|
108
|
-
if (
|
|
108
|
+
if (u_flat_shading < 0.5) {
|
|
109
109
|
float parallaxFactor = 0.25;
|
|
110
110
|
float scrollOffset = (u_y_offset * u_y_offset_color_multiplier) * parallaxFactor;
|
|
111
111
|
vec3 scrolledPos = vPosition;
|
|
@@ -114,9 +114,9 @@ vec3 p = (scrolledPos * 1.5) / 50.0;
|
|
|
114
114
|
vec2 uvX = p.yz + vec2(0.5);
|
|
115
115
|
vec2 uvY = p.zx + vec2(0.5);
|
|
116
116
|
vec2 uvZ = p.xy + vec2(0.5);
|
|
117
|
-
vec4 colX = texture2D(u_procedural_texture,
|
|
118
|
-
vec4 colY = texture2D(u_procedural_texture,
|
|
119
|
-
vec4 colZ = texture2D(u_procedural_texture,
|
|
117
|
+
vec4 colX = texture2D(u_procedural_texture, uvX);
|
|
118
|
+
vec4 colY = texture2D(u_procedural_texture, uvY);
|
|
119
|
+
vec4 colZ = texture2D(u_procedural_texture, uvZ);
|
|
120
120
|
vec3 n = normalize(vNormal);
|
|
121
121
|
vec3 blendWeights = abs(n);
|
|
122
122
|
blendWeights = blendWeights / (blendWeights.x + blendWeights.y + blendWeights.z + 0.0001);
|
|
@@ -138,7 +138,7 @@ vec2 texUv = vec2(vx, vy);
|
|
|
138
138
|
float parallaxFactor = 0.25;
|
|
139
139
|
texUv.y -= (u_y_offset * u_y_offset_color_multiplier / u_plane_height) * parallaxFactor;
|
|
140
140
|
texUv *= 1.5;
|
|
141
|
-
vec4 texSample = texture2D(u_procedural_texture,
|
|
141
|
+
vec4 texSample = texture2D(u_procedural_texture, texUv);
|
|
142
142
|
baseColor = texSample.rgb;
|
|
143
143
|
if (u_transparent_texture_void > 0.5) {
|
|
144
144
|
texAlpha = texSample.a;
|
|
@@ -150,7 +150,7 @@ baseColor = v_color;
|
|
|
150
150
|
vec3 color = baseColor;
|
|
151
151
|
if (u_domain_warp_enabled > 0.5) {
|
|
152
152
|
vec3 p;
|
|
153
|
-
if (
|
|
153
|
+
if (u_flat_shading < 0.5) {
|
|
154
154
|
p = vec3((vPosition / 50.0 + vec3(0.5)) * u_domain_warp_scale);
|
|
155
155
|
p.z += u_time * 0.15;
|
|
156
156
|
} else {
|
|
@@ -179,7 +179,7 @@ vec3 lightDir = normalize(vec3(1.0, 1.0, 1.0));
|
|
|
179
179
|
float diffuse = max(dot(normal, lightDir), 0.0);
|
|
180
180
|
vec3 halfDir = normalize(lightDir + viewDir);
|
|
181
181
|
float specular = pow(max(dot(normal, halfDir), 0.0), 32.0);
|
|
182
|
-
if (
|
|
182
|
+
if (u_flat_shading > 0.5) {
|
|
183
183
|
color += v_displacement_amount * u_highlights;
|
|
184
184
|
float heightShadow = 1.0 - v_displacement_amount;
|
|
185
185
|
color -= heightShadow * heightShadow * u_shadows;
|
|
@@ -204,7 +204,7 @@ color += u_fresnel_color * fresnel * u_fresnel_intensity;
|
|
|
204
204
|
}
|
|
205
205
|
if (u_vignette_intensity > 0.0) {
|
|
206
206
|
vec2 vigUv = vUv;
|
|
207
|
-
if (
|
|
207
|
+
if (u_flat_shading < 0.5) {
|
|
208
208
|
vigUv = (v_new_position.xy / v_new_position.w) * 0.5 + vec2(0.5);
|
|
209
209
|
}
|
|
210
210
|
float dist = length(vigUv - vec2(0.5));
|
|
@@ -219,7 +219,7 @@ color += color * bloomMask * u_bloom_intensity;
|
|
|
219
219
|
if (u_chromatic_aberration > 0.0) {
|
|
220
220
|
float caAmount = u_chromatic_aberration * 0.008;
|
|
221
221
|
vec2 caUv = vUv;
|
|
222
|
-
if (
|
|
222
|
+
if (u_flat_shading < 0.5) {
|
|
223
223
|
caUv = (v_new_position.xy / v_new_position.w) * 0.5 + vec2(0.5);
|
|
224
224
|
}
|
|
225
225
|
float dist = length(caUv - vec2(0.5));
|
|
@@ -231,7 +231,7 @@ color.b *= 1.0 - bShift * caAmount * 10.0;
|
|
|
231
231
|
float grain = 0.0;
|
|
232
232
|
if (u_grain_intensity > 0.0) {
|
|
233
233
|
vec2 noiseCoords = gl_FragCoord.xy / u_grain_scale;
|
|
234
|
-
if (u_grain_speed != 0.0 ||
|
|
234
|
+
if (u_grain_speed != 0.0 || u_flat_shading > 0.5) {
|
|
235
235
|
grain = fbm(vec3(noiseCoords, u_time * u_grain_speed));
|
|
236
236
|
} else {
|
|
237
237
|
grain = random(noiseCoords) - 0.5;
|
|
@@ -243,7 +243,7 @@ grain *= u_grain_intensity;
|
|
|
243
243
|
}
|
|
244
244
|
color += vec3(grain);
|
|
245
245
|
float edgeAlpha = 1.0;
|
|
246
|
-
if (
|
|
246
|
+
if (u_silhouette_fade > 0.0 && u_flat_shading < 0.5) {
|
|
247
247
|
edgeAlpha = smoothstep(0.0, u_silhouette_fade, ndotv);
|
|
248
248
|
}
|
|
249
249
|
if (u_shape_type == 3.0) {
|
|
@@ -257,7 +257,7 @@ edgeAlpha *= uFade * vFade;
|
|
|
257
257
|
edgeAlpha *= texAlpha;
|
|
258
258
|
gl_FragColor = vec4(color, edgeAlpha);
|
|
259
259
|
}`;
|
|
260
|
-
function
|
|
260
|
+
function dt() {
|
|
261
261
|
return `precision highp float;
|
|
262
262
|
attribute vec3 position;
|
|
263
263
|
attribute vec3 normal;
|
|
@@ -301,9 +301,10 @@ uniform float u_fresnel_enabled;
|
|
|
301
301
|
uniform float u_fresnel_power;
|
|
302
302
|
uniform float u_fresnel_intensity;
|
|
303
303
|
uniform vec3 u_fresnel_color;
|
|
304
|
-
uniform float u_shape_type
|
|
304
|
+
uniform float u_shape_type;
|
|
305
|
+
uniform float u_flat_shading;`;
|
|
305
306
|
}
|
|
306
|
-
function
|
|
307
|
+
function mt() {
|
|
307
308
|
return `precision highp float;
|
|
308
309
|
varying vec2 vUv;
|
|
309
310
|
varying vec2 vFlowUv;
|
|
@@ -351,9 +352,10 @@ uniform float u_shape_type;
|
|
|
351
352
|
uniform float u_transparent_texture_void;
|
|
352
353
|
uniform float u_silhouette_fade;
|
|
353
354
|
uniform float u_cylinder_fade;
|
|
354
|
-
uniform float u_ribbon_fade
|
|
355
|
+
uniform float u_ribbon_fade;
|
|
356
|
+
uniform float u_flat_shading;`;
|
|
355
357
|
}
|
|
356
|
-
function
|
|
358
|
+
function se() {
|
|
357
359
|
return `vec4 permute(vec4 x) {
|
|
358
360
|
return floor(fract(sin(x) * 43758.5453123) * 289.0);
|
|
359
361
|
}
|
|
@@ -497,23 +499,27 @@ class he {
|
|
|
497
499
|
1
|
|
498
500
|
]);
|
|
499
501
|
}
|
|
502
|
+
identity() {
|
|
503
|
+
const e = this.elements;
|
|
504
|
+
return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, this;
|
|
505
|
+
}
|
|
500
506
|
translate(e, i, r) {
|
|
501
507
|
return this.elements[12] += this.elements[0] * e + this.elements[4] * i + this.elements[8] * r, this.elements[13] += this.elements[1] * e + this.elements[5] * i + this.elements[9] * r, this.elements[14] += this.elements[2] * e + this.elements[6] * i + this.elements[10] * r, this.elements[15] += this.elements[3] * e + this.elements[7] * i + this.elements[11] * r, this;
|
|
502
508
|
}
|
|
503
509
|
rotateX(e) {
|
|
504
|
-
const i = Math.cos(e), r = Math.sin(e), t = this.elements[4], y = this.elements[5],
|
|
505
|
-
return this.elements[4] = i * t + r * l, this.elements[5] = i * y + r * _, this.elements[6] = i *
|
|
510
|
+
const i = Math.cos(e), r = Math.sin(e), t = this.elements[4], y = this.elements[5], v = this.elements[6], s = this.elements[7], l = this.elements[8], _ = this.elements[9], b = this.elements[10], a = this.elements[11];
|
|
511
|
+
return this.elements[4] = i * t + r * l, this.elements[5] = i * y + r * _, this.elements[6] = i * v + r * b, this.elements[7] = i * s + r * a, this.elements[8] = i * l - r * t, this.elements[9] = i * _ - r * y, this.elements[10] = i * b - r * v, this.elements[11] = i * a - r * s, this;
|
|
506
512
|
}
|
|
507
513
|
rotateY(e) {
|
|
508
|
-
const i = Math.cos(e), r = Math.sin(e), t = this.elements[0], y = this.elements[1],
|
|
509
|
-
return this.elements[0] = i * t - r * l, this.elements[1] = i * y - r * _, this.elements[2] = i *
|
|
514
|
+
const i = Math.cos(e), r = Math.sin(e), t = this.elements[0], y = this.elements[1], v = this.elements[2], s = this.elements[3], l = this.elements[8], _ = this.elements[9], b = this.elements[10], a = this.elements[11];
|
|
515
|
+
return this.elements[0] = i * t - r * l, this.elements[1] = i * y - r * _, this.elements[2] = i * v - r * b, this.elements[3] = i * s - r * a, this.elements[8] = r * t + i * l, this.elements[9] = r * y + i * _, this.elements[10] = r * v + i * b, this.elements[11] = r * s + i * a, this;
|
|
510
516
|
}
|
|
511
517
|
rotateZ(e) {
|
|
512
|
-
const i = Math.cos(e), r = Math.sin(e), t = this.elements[0], y = this.elements[1],
|
|
513
|
-
return this.elements[0] = i * t + r * l, this.elements[1] = i * y + r * _, this.elements[2] = i *
|
|
518
|
+
const i = Math.cos(e), r = Math.sin(e), t = this.elements[0], y = this.elements[1], v = this.elements[2], s = this.elements[3], l = this.elements[4], _ = this.elements[5], b = this.elements[6], a = this.elements[7];
|
|
519
|
+
return this.elements[0] = i * t + r * l, this.elements[1] = i * y + r * _, this.elements[2] = i * v + r * b, this.elements[3] = i * s + r * a, this.elements[4] = -r * t + i * l, this.elements[5] = -r * y + i * _, this.elements[6] = -r * v + i * b, this.elements[7] = -r * s + i * a, this;
|
|
514
520
|
}
|
|
515
521
|
}
|
|
516
|
-
class
|
|
522
|
+
class pt {
|
|
517
523
|
left;
|
|
518
524
|
right;
|
|
519
525
|
top;
|
|
@@ -523,11 +529,11 @@ class mt {
|
|
|
523
529
|
position;
|
|
524
530
|
projectionMatrix;
|
|
525
531
|
zoom;
|
|
526
|
-
constructor(e, i, r, t, y,
|
|
527
|
-
this.left = e, this.right = i, this.top = r, this.bottom = t, this.near = y, this.far =
|
|
532
|
+
constructor(e, i, r, t, y, v) {
|
|
533
|
+
this.left = e, this.right = i, this.top = r, this.bottom = t, this.near = y, this.far = v, this.position = [0, 0, 0], this.zoom = 1, this.projectionMatrix = new he(), this.updateProjectionMatrix();
|
|
528
534
|
}
|
|
529
535
|
updateProjectionMatrix() {
|
|
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,
|
|
536
|
+
const e = 1 / (this.right - this.left), i = 1 / (this.top - this.bottom), r = 1 / (this.far - this.near), t = (this.right + this.left) * e, y = (this.top + this.bottom) * i, v = (this.far + this.near) * r;
|
|
531
537
|
this.projectionMatrix.elements = new Float32Array([
|
|
532
538
|
2 * e,
|
|
533
539
|
0,
|
|
@@ -543,184 +549,184 @@ class mt {
|
|
|
543
549
|
0,
|
|
544
550
|
-t,
|
|
545
551
|
-y,
|
|
546
|
-
-
|
|
552
|
+
-v,
|
|
547
553
|
1
|
|
548
554
|
]);
|
|
549
555
|
}
|
|
550
556
|
}
|
|
551
|
-
function
|
|
552
|
-
|
|
553
|
-
const
|
|
557
|
+
function j(n, e, i, r = 50, t = 50, y = "plane", v = 1) {
|
|
558
|
+
n.zoom = v;
|
|
559
|
+
const s = e / i;
|
|
554
560
|
if (y === "plane") {
|
|
555
|
-
const b = e * i / 1e6 * r * t / 1.5, a = Math.sqrt(b *
|
|
556
|
-
let p = -r / 2, c = Math.min((p + a) / 1.5, r / 2),
|
|
557
|
-
if (
|
|
558
|
-
const g =
|
|
561
|
+
const b = e * i / 1e6 * r * t / 1.5, a = Math.sqrt(b * s), h = b / a;
|
|
562
|
+
let p = -r / 2, c = Math.min((p + a) / 1.5, r / 2), d = t / 4, R = Math.max((d - h) / 2, -t / 4);
|
|
563
|
+
if (s < 1) {
|
|
564
|
+
const g = s;
|
|
559
565
|
p = p * g, c = c * g;
|
|
560
|
-
const
|
|
561
|
-
p = p *
|
|
566
|
+
const x = 1.05;
|
|
567
|
+
p = p * x, c = c * x, d = d * x, R = R * x;
|
|
562
568
|
}
|
|
563
|
-
|
|
569
|
+
n.left = p, n.right = c, n.top = d, n.bottom = R;
|
|
564
570
|
} else {
|
|
565
571
|
let l = 25;
|
|
566
|
-
if (y === "sphere" ? l = 30 : y === "torus" ? l = 35 : y === "cylinder" && (l = 30),
|
|
567
|
-
|
|
572
|
+
if (y === "sphere" ? l = 30 : y === "torus" ? l = 35 : y === "cylinder" && (l = 30), s >= 1)
|
|
573
|
+
n.left = -l * s, n.right = l * s, n.top = l, n.bottom = -l;
|
|
568
574
|
else {
|
|
569
|
-
|
|
575
|
+
n.left = -l, n.right = l, n.top = l / s, n.bottom = -l / s;
|
|
570
576
|
const _ = 1.05;
|
|
571
|
-
|
|
577
|
+
n.left *= _, n.right *= _, n.top *= _, n.bottom *= _;
|
|
572
578
|
}
|
|
573
579
|
}
|
|
574
|
-
|
|
580
|
+
n.left /= v, n.right /= v, n.top /= v, n.bottom /= v, n.near = -100, n.far = 1e3, n.updateProjectionMatrix();
|
|
575
581
|
}
|
|
576
|
-
function
|
|
577
|
-
const t =
|
|
578
|
-
for (let
|
|
579
|
-
const w =
|
|
582
|
+
function oe(n, e, i, r) {
|
|
583
|
+
const t = n / 2, y = e / 2, v = Math.floor(i), s = Math.floor(r), l = v + 1, _ = s + 1, b = n / v, a = e / s, h = [], p = [], c = [], d = [];
|
|
584
|
+
for (let x = 0; x < _; x++) {
|
|
585
|
+
const w = x * a - y;
|
|
580
586
|
for (let u = 0; u < l; u++) {
|
|
581
587
|
const T = u * b - t;
|
|
582
|
-
p.push(T, -w, 0), c.push(0, 0, 1),
|
|
588
|
+
p.push(T, -w, 0), c.push(0, 0, 1), d.push(u / v), d.push(1 - x / s);
|
|
583
589
|
}
|
|
584
590
|
}
|
|
585
|
-
for (let
|
|
586
|
-
for (let w = 0; w <
|
|
587
|
-
const u = w + l *
|
|
588
|
-
h.push(u, T,
|
|
591
|
+
for (let x = 0; x < s; x++)
|
|
592
|
+
for (let w = 0; w < v; w++) {
|
|
593
|
+
const u = w + l * x, T = w + l * (x + 1), A = w + 1 + l * (x + 1), D = w + 1 + l * x;
|
|
594
|
+
h.push(u, T, D), h.push(T, A, D);
|
|
589
595
|
}
|
|
590
596
|
const R = p.length / 3 > 65535, g = [];
|
|
591
|
-
for (let
|
|
592
|
-
const w = h[
|
|
597
|
+
for (let x = 0; x < h.length; x += 3) {
|
|
598
|
+
const w = h[x], u = h[x + 1], T = h[x + 2];
|
|
593
599
|
g.push(w, u, u, T, T, w);
|
|
594
600
|
}
|
|
595
601
|
return {
|
|
596
602
|
position: new Float32Array(p),
|
|
597
603
|
normal: new Float32Array(c),
|
|
598
|
-
uv: new Float32Array(
|
|
604
|
+
uv: new Float32Array(d),
|
|
599
605
|
index: R ? new Uint32Array(h) : new Uint16Array(h),
|
|
600
606
|
wireframeIndex: R ? new Uint32Array(g) : new Uint16Array(g)
|
|
601
607
|
};
|
|
602
608
|
}
|
|
603
|
-
function ne(
|
|
604
|
-
const r = [], t = [], y = [],
|
|
609
|
+
function ne(n, e, i) {
|
|
610
|
+
const r = [], t = [], y = [], v = [], s = Math.floor(e), l = Math.floor(i);
|
|
605
611
|
for (let a = 0; a <= l; a++) {
|
|
606
612
|
const h = a / l, p = h * Math.PI;
|
|
607
|
-
for (let c = 0; c <=
|
|
608
|
-
const
|
|
609
|
-
r.push(g,
|
|
610
|
-
const u = Math.sqrt(g * g +
|
|
611
|
-
t.push(g / u,
|
|
613
|
+
for (let c = 0; c <= s; c++) {
|
|
614
|
+
const d = c / s, R = d * Math.PI * 2, g = -n * Math.sin(p) * Math.cos(R), x = n * Math.cos(p), w = n * Math.sin(p) * Math.sin(R);
|
|
615
|
+
r.push(g, x, w);
|
|
616
|
+
const u = Math.sqrt(g * g + x * x + w * w);
|
|
617
|
+
t.push(g / u, x / u, w / u), y.push(d, 1 - h);
|
|
612
618
|
}
|
|
613
619
|
}
|
|
614
620
|
for (let a = 0; a < l; a++)
|
|
615
|
-
for (let h = 0; h <
|
|
616
|
-
const p = h + (
|
|
617
|
-
|
|
621
|
+
for (let h = 0; h < s; h++) {
|
|
622
|
+
const p = h + (s + 1) * a, c = h + (s + 1) * (a + 1), d = h + 1 + (s + 1) * (a + 1), R = h + 1 + (s + 1) * a;
|
|
623
|
+
v.push(p, c, R), v.push(c, d, R);
|
|
618
624
|
}
|
|
619
625
|
const _ = r.length / 3 > 65535, b = [];
|
|
620
|
-
for (let a = 0; a <
|
|
621
|
-
const h =
|
|
626
|
+
for (let a = 0; a < v.length; a += 3) {
|
|
627
|
+
const h = v[a], p = v[a + 1], c = v[a + 2];
|
|
622
628
|
b.push(h, p, p, c, c, h);
|
|
623
629
|
}
|
|
624
630
|
return {
|
|
625
631
|
position: new Float32Array(r),
|
|
626
632
|
normal: new Float32Array(t),
|
|
627
633
|
uv: new Float32Array(y),
|
|
628
|
-
index: _ ? new Uint32Array(
|
|
634
|
+
index: _ ? new Uint32Array(v) : new Uint16Array(v),
|
|
629
635
|
wireframeIndex: _ ? new Uint32Array(b) : new Uint16Array(b)
|
|
630
636
|
};
|
|
631
637
|
}
|
|
632
|
-
function ae(
|
|
633
|
-
const t = [], y = [],
|
|
638
|
+
function ae(n, e, i, r) {
|
|
639
|
+
const t = [], y = [], v = [], s = [], l = Math.floor(i), _ = Math.floor(r);
|
|
634
640
|
for (let h = 0; h <= l; h++) {
|
|
635
641
|
const p = h / l * Math.PI * 2;
|
|
636
642
|
for (let c = 0; c <= _; c++) {
|
|
637
|
-
const
|
|
638
|
-
t.push(R, g,
|
|
639
|
-
const w =
|
|
640
|
-
y.push(T / m, A / m,
|
|
643
|
+
const d = c / _ * Math.PI * 2, R = (n + e * Math.cos(p)) * Math.cos(d), g = (n + e * Math.cos(p)) * Math.sin(d), x = e * Math.sin(p);
|
|
644
|
+
t.push(R, g, x);
|
|
645
|
+
const w = n * Math.cos(d), u = n * Math.sin(d), T = R - w, A = g - u, D = x, m = Math.sqrt(T * T + A * A + D * D);
|
|
646
|
+
y.push(T / m, A / m, D / m), v.push(c / _, h / l);
|
|
641
647
|
}
|
|
642
648
|
}
|
|
643
649
|
for (let h = 1; h <= l; h++)
|
|
644
650
|
for (let p = 1; p <= _; p++) {
|
|
645
|
-
const c = (_ + 1) * h + p - 1,
|
|
646
|
-
|
|
651
|
+
const c = (_ + 1) * h + p - 1, d = (_ + 1) * (h - 1) + p - 1, R = (_ + 1) * (h - 1) + p, g = (_ + 1) * h + p;
|
|
652
|
+
s.push(c, d, g), s.push(d, R, g);
|
|
647
653
|
}
|
|
648
654
|
const b = t.length / 3 > 65535, a = [];
|
|
649
|
-
for (let h = 0; h <
|
|
650
|
-
const p =
|
|
651
|
-
a.push(p, c, c,
|
|
655
|
+
for (let h = 0; h < s.length; h += 3) {
|
|
656
|
+
const p = s[h], c = s[h + 1], d = s[h + 2];
|
|
657
|
+
a.push(p, c, c, d, d, p);
|
|
652
658
|
}
|
|
653
659
|
return {
|
|
654
660
|
position: new Float32Array(t),
|
|
655
661
|
normal: new Float32Array(y),
|
|
656
|
-
uv: new Float32Array(
|
|
657
|
-
index: b ? new Uint32Array(
|
|
662
|
+
uv: new Float32Array(v),
|
|
663
|
+
index: b ? new Uint32Array(s) : new Uint16Array(s),
|
|
658
664
|
wireframeIndex: b ? new Uint32Array(a) : new Uint16Array(a)
|
|
659
665
|
};
|
|
660
666
|
}
|
|
661
|
-
function le(
|
|
662
|
-
const y = [],
|
|
667
|
+
function le(n, e, i, r, t) {
|
|
668
|
+
const y = [], v = [], s = [], l = [], _ = Math.floor(r), b = Math.floor(t), a = i / 2;
|
|
663
669
|
for (let c = 0; c <= b; c++) {
|
|
664
|
-
const
|
|
665
|
-
for (let
|
|
666
|
-
const w =
|
|
667
|
-
y.push(g * T, -R, g * A),
|
|
670
|
+
const d = c / b, R = d * i - a, g = d * (e - n) + n;
|
|
671
|
+
for (let x = 0; x <= _; x++) {
|
|
672
|
+
const w = x / _, u = w * Math.PI * 2, T = Math.sin(u), A = Math.cos(u);
|
|
673
|
+
y.push(g * T, -R, g * A), v.push(T, 0, A), s.push(w, 1 - d);
|
|
668
674
|
}
|
|
669
675
|
}
|
|
670
676
|
for (let c = 0; c < b; c++)
|
|
671
|
-
for (let
|
|
672
|
-
const R =
|
|
673
|
-
l.push(R, g, w), l.push(g,
|
|
677
|
+
for (let d = 0; d < _; d++) {
|
|
678
|
+
const R = d + (_ + 1) * c, g = d + (_ + 1) * (c + 1), x = d + 1 + (_ + 1) * (c + 1), w = d + 1 + (_ + 1) * c;
|
|
679
|
+
l.push(R, g, w), l.push(g, x, w);
|
|
674
680
|
}
|
|
675
681
|
const h = y.length / 3 > 65535, p = [];
|
|
676
682
|
for (let c = 0; c < l.length; c += 3) {
|
|
677
|
-
const
|
|
678
|
-
p.push(
|
|
683
|
+
const d = l[c], R = l[c + 1], g = l[c + 2];
|
|
684
|
+
p.push(d, R, R, g, g, d);
|
|
679
685
|
}
|
|
680
686
|
return {
|
|
681
687
|
position: new Float32Array(y),
|
|
682
|
-
normal: new Float32Array(
|
|
683
|
-
uv: new Float32Array(
|
|
688
|
+
normal: new Float32Array(v),
|
|
689
|
+
uv: new Float32Array(s),
|
|
684
690
|
index: h ? new Uint32Array(l) : new Uint16Array(l),
|
|
685
691
|
wireframeIndex: h ? new Uint32Array(p) : new Uint16Array(p)
|
|
686
692
|
};
|
|
687
693
|
}
|
|
688
|
-
function ue(
|
|
689
|
-
const
|
|
694
|
+
function ue(n, e, i, r, t, y) {
|
|
695
|
+
const v = n / 2, s = e / 2, l = Math.floor(i), _ = Math.floor(r), b = l + 1, a = _ + 1, h = n / l, p = e / _, c = [], d = [], R = [], g = [];
|
|
690
696
|
for (let u = 0; u < a; u++) {
|
|
691
|
-
const T = u * p -
|
|
697
|
+
const T = u * p - s;
|
|
692
698
|
for (let A = 0; A < b; A++) {
|
|
693
|
-
const
|
|
694
|
-
let m =
|
|
699
|
+
const D = A * h - v;
|
|
700
|
+
let m = D, F = T, C = 0, z = 0, M = 0, P = 1;
|
|
695
701
|
if (Math.abs(t) > 1e-3) {
|
|
696
|
-
const E =
|
|
697
|
-
m = E * Math.sin(S),
|
|
702
|
+
const E = n / t, S = D / E;
|
|
703
|
+
m = E * Math.sin(S), C = E * (1 - Math.cos(S)), z = Math.sin(S), P = Math.cos(S);
|
|
698
704
|
}
|
|
699
705
|
if (Math.abs(y) > 1e-3) {
|
|
700
|
-
const E = T / e * y, S = Math.cos(E), U = Math.sin(E), B = m * S -
|
|
701
|
-
m = B,
|
|
702
|
-
const I = z * S - P * U,
|
|
703
|
-
z = I, P =
|
|
706
|
+
const E = T / e * y, S = Math.cos(E), U = Math.sin(E), B = m * S - C * U, O = m * U + C * S;
|
|
707
|
+
m = B, C = O;
|
|
708
|
+
const I = z * S - P * U, Y = z * U + P * S;
|
|
709
|
+
z = I, P = Y;
|
|
704
710
|
}
|
|
705
|
-
c.push(m, -F,
|
|
711
|
+
c.push(m, -F, C), d.push(z, M, P), R.push(A / l), R.push(1 - u / _);
|
|
706
712
|
}
|
|
707
713
|
}
|
|
708
714
|
for (let u = 0; u < _; u++)
|
|
709
715
|
for (let T = 0; T < l; T++) {
|
|
710
|
-
const A = T + b * u,
|
|
711
|
-
g.push(A,
|
|
716
|
+
const A = T + b * u, D = T + b * (u + 1), m = T + 1 + b * (u + 1), F = T + 1 + b * u;
|
|
717
|
+
g.push(A, D, F), g.push(D, m, F);
|
|
712
718
|
}
|
|
713
|
-
const
|
|
719
|
+
const x = c.length / 3 > 65535, w = [];
|
|
714
720
|
for (let u = 0; u < g.length; u += 3) {
|
|
715
|
-
const T = g[u], A = g[u + 1],
|
|
716
|
-
w.push(T, A, A,
|
|
721
|
+
const T = g[u], A = g[u + 1], D = g[u + 2];
|
|
722
|
+
w.push(T, A, A, D, D, T);
|
|
717
723
|
}
|
|
718
724
|
return {
|
|
719
725
|
position: new Float32Array(c),
|
|
720
|
-
normal: new Float32Array(
|
|
726
|
+
normal: new Float32Array(d),
|
|
721
727
|
uv: new Float32Array(R),
|
|
722
|
-
index:
|
|
723
|
-
wireframeIndex:
|
|
728
|
+
index: x ? new Uint32Array(g) : new Uint16Array(g),
|
|
729
|
+
wireframeIndex: x ? new Uint32Array(w) : new Uint16Array(w)
|
|
724
730
|
};
|
|
725
731
|
}
|
|
726
732
|
console.info(
|
|
@@ -733,8 +739,8 @@ https://neat.firecms.co`,
|
|
|
733
739
|
"font-weight: bold; font-size: 14px; color: #FF5772;",
|
|
734
740
|
"color: inherit;"
|
|
735
741
|
);
|
|
736
|
-
const
|
|
737
|
-
class
|
|
742
|
+
const X = 50, N = 80, $ = 6, gt = xt();
|
|
743
|
+
class wt {
|
|
738
744
|
_ref;
|
|
739
745
|
_speed = -1;
|
|
740
746
|
_horizontalPressure = -1;
|
|
@@ -791,6 +797,7 @@ class bt {
|
|
|
791
797
|
_silhouetteFade = 0.25;
|
|
792
798
|
_cylinderFade = 0.08;
|
|
793
799
|
_ribbonFade = 0.05;
|
|
800
|
+
_flatShading = !0;
|
|
794
801
|
_shapeType = "plane";
|
|
795
802
|
_shapeRotationX = 0;
|
|
796
803
|
_shapeRotationY = 0;
|
|
@@ -837,14 +844,19 @@ class bt {
|
|
|
837
844
|
_colorsChanged = !0;
|
|
838
845
|
_uniformsDirty = !0;
|
|
839
846
|
_textureDirty = !0;
|
|
847
|
+
_yOffsetDirty = !1;
|
|
848
|
+
_modelViewMatrix = new he();
|
|
849
|
+
_isVisible = !0;
|
|
850
|
+
_visibilityObserver = null;
|
|
851
|
+
_visibilityHandler = null;
|
|
840
852
|
constructor(e) {
|
|
841
853
|
const {
|
|
842
854
|
ref: i,
|
|
843
855
|
speed: r = 4,
|
|
844
856
|
horizontalPressure: t = 3,
|
|
845
857
|
verticalPressure: y = 3,
|
|
846
|
-
waveFrequencyX:
|
|
847
|
-
waveFrequencyY:
|
|
858
|
+
waveFrequencyX: v = 5,
|
|
859
|
+
waveFrequencyY: s = 5,
|
|
848
860
|
waveAmplitude: l = 3,
|
|
849
861
|
colors: _,
|
|
850
862
|
highlights: b = 4,
|
|
@@ -852,18 +864,18 @@ class bt {
|
|
|
852
864
|
colorSaturation: h = 0,
|
|
853
865
|
colorBrightness: p = 1,
|
|
854
866
|
colorBlending: c = 5,
|
|
855
|
-
grainScale:
|
|
867
|
+
grainScale: d = 2,
|
|
856
868
|
grainIntensity: R = 0.55,
|
|
857
869
|
grainSparsity: g = 0,
|
|
858
|
-
grainSpeed:
|
|
870
|
+
grainSpeed: x = 0.1,
|
|
859
871
|
wireframe: w = !1,
|
|
860
872
|
backgroundColor: u = "#FFFFFF",
|
|
861
873
|
backgroundAlpha: T = 1,
|
|
862
874
|
resolution: A = 1,
|
|
863
|
-
seed:
|
|
875
|
+
seed: D,
|
|
864
876
|
yOffset: m = 0,
|
|
865
877
|
yOffsetWaveMultiplier: F = 4,
|
|
866
|
-
yOffsetColorMultiplier:
|
|
878
|
+
yOffsetColorMultiplier: C = 4,
|
|
867
879
|
yOffsetFlowMultiplier: z = 4,
|
|
868
880
|
flowDistortionA: M = 0,
|
|
869
881
|
flowDistortionB: P = 0,
|
|
@@ -871,17 +883,17 @@ class bt {
|
|
|
871
883
|
flowEase: S = 0,
|
|
872
884
|
flowEnabled: U = !0,
|
|
873
885
|
enableProceduralTexture: B = !1,
|
|
874
|
-
textureVoidLikelihood:
|
|
886
|
+
textureVoidLikelihood: O = 0.45,
|
|
875
887
|
textureVoidWidthMin: I = 200,
|
|
876
|
-
textureVoidWidthMax:
|
|
888
|
+
textureVoidWidthMax: Y = 486,
|
|
877
889
|
textureBandDensity: fe = 2.15,
|
|
878
890
|
textureColorBlending: de = 0.01,
|
|
879
891
|
textureSeed: me = 333,
|
|
880
892
|
textureEase: pe = 0.5,
|
|
881
893
|
proceduralBackgroundColor: ge = "#000000",
|
|
882
894
|
transparentTextureVoid: ye = !1,
|
|
883
|
-
textureShapeTriangles:
|
|
884
|
-
textureShapeCircles:
|
|
895
|
+
textureShapeTriangles: ve = 20,
|
|
896
|
+
textureShapeCircles: xe = 15,
|
|
885
897
|
textureShapeBars: be = 15,
|
|
886
898
|
textureShapeSquiggles: we = 10,
|
|
887
899
|
domainWarpEnabled: Se = !1,
|
|
@@ -891,91 +903,100 @@ class bt {
|
|
|
891
903
|
vignetteRadius: Ae = 0.8,
|
|
892
904
|
fresnelEnabled: Fe = !1,
|
|
893
905
|
fresnelPower: ze = 2,
|
|
894
|
-
fresnelIntensity:
|
|
906
|
+
fresnelIntensity: De = 0.5,
|
|
895
907
|
fresnelColor: Me = "#FFFFFF",
|
|
896
|
-
iridescenceEnabled:
|
|
908
|
+
iridescenceEnabled: Ce = !1,
|
|
897
909
|
iridescenceIntensity: Pe = 0.5,
|
|
898
910
|
iridescenceSpeed: Ue = 1,
|
|
899
911
|
bloomIntensity: Ie = 0,
|
|
900
912
|
bloomThreshold: Be = 0.7,
|
|
901
913
|
chromaticAberration: Le = 0,
|
|
902
|
-
silhouetteFade:
|
|
903
|
-
cylinderFade:
|
|
904
|
-
ribbonFade:
|
|
914
|
+
silhouetteFade: Oe = 0.25,
|
|
915
|
+
cylinderFade: We = 0.08,
|
|
916
|
+
ribbonFade: Xe = 0.05,
|
|
917
|
+
flatShading: Ne = !0,
|
|
905
918
|
cameraLock: Ye = !1,
|
|
906
|
-
cameraX:
|
|
907
|
-
cameraY:
|
|
908
|
-
cameraZ:
|
|
909
|
-
cameraRotationX:
|
|
910
|
-
cameraRotationY:
|
|
919
|
+
cameraX: ke = 0,
|
|
920
|
+
cameraY: Ve = 0,
|
|
921
|
+
cameraZ: qe = 0,
|
|
922
|
+
cameraRotationX: Ze = 0,
|
|
923
|
+
cameraRotationY: He = 0,
|
|
911
924
|
cameraRotationZ: Ge = 0,
|
|
912
925
|
cameraZoom: je = 1,
|
|
913
|
-
shapeType:
|
|
914
|
-
shapeRotationX:
|
|
915
|
-
shapeRotationY:
|
|
916
|
-
shapeRotationZ:
|
|
917
|
-
shapeAutoRotateSpeedX:
|
|
918
|
-
shapeAutoRotateSpeedY:
|
|
919
|
-
sphereRadius:
|
|
920
|
-
torusRadius:
|
|
921
|
-
torusTube:
|
|
922
|
-
cylinderRadius:
|
|
923
|
-
cylinderHeight:
|
|
924
|
-
planeBend:
|
|
925
|
-
planeTwist:
|
|
926
|
+
shapeType: $e = "plane",
|
|
927
|
+
shapeRotationX: Ke = 0,
|
|
928
|
+
shapeRotationY: Je = 0,
|
|
929
|
+
shapeRotationZ: Qe = 0,
|
|
930
|
+
shapeAutoRotateSpeedX: et = 0,
|
|
931
|
+
shapeAutoRotateSpeedY: tt = 0,
|
|
932
|
+
sphereRadius: it = 15,
|
|
933
|
+
torusRadius: st = 15,
|
|
934
|
+
torusTube: rt = 5,
|
|
935
|
+
cylinderRadius: ot = 10,
|
|
936
|
+
cylinderHeight: nt = 40,
|
|
937
|
+
planeBend: at = 0,
|
|
938
|
+
planeTwist: lt = 0
|
|
926
939
|
} = e;
|
|
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 =
|
|
928
|
-
let
|
|
929
|
-
const
|
|
930
|
-
const { gl:
|
|
931
|
-
if (this._linkCheckCounter++, this._linkCheckCounter >= 300 && (this._linkCheckCounter = 0, (!this._linkElement || !document.contains(this._linkElement)) && (this._linkElement =
|
|
940
|
+
this._ref = i, this.destroy = this.destroy.bind(this), this._initScene = this._initScene.bind(this), this.speed = r, this.horizontalPressure = t, this.verticalPressure = y, this.waveFrequencyX = v, this.waveFrequencyY = s, this.waveAmplitude = l, this.colorBlending = c, this._resolution = A, this.grainScale = d, this.grainIntensity = R, this.grainSparsity = g, this.grainSpeed = x, this.colors = _, this.shadows = a, this.highlights = b, this.colorSaturation = h, this.colorBrightness = p, this.wireframe = w, this.backgroundColor = u, this.backgroundAlpha = T, this.yOffset = m, this.yOffsetWaveMultiplier = F, this.yOffsetColorMultiplier = C, this.yOffsetFlowMultiplier = z, this.flowDistortionA = M, this.flowDistortionB = P, this.flowScale = E, this.flowEase = S, this.flowEnabled = U, this.enableProceduralTexture = B, this.textureVoidLikelihood = O, this.textureVoidWidthMin = I, this.textureVoidWidthMax = Y, this.textureBandDensity = fe, this.textureColorBlending = de, this.textureSeed = me, this.textureEase = pe, this._proceduralBackgroundColor = ge, this.transparentTextureVoid = ye, this._textureShapeTriangles = ve, this._textureShapeCircles = xe, this._textureShapeBars = be, this._textureShapeSquiggles = we, this.domainWarpEnabled = Se, this.domainWarpIntensity = Re, this.domainWarpScale = Te, this.vignetteIntensity = Ee, this.vignetteRadius = Ae, this.fresnelEnabled = Fe, this.fresnelPower = ze, this.fresnelIntensity = De, this.fresnelColor = Me, this.iridescenceEnabled = Ce, this.iridescenceIntensity = Pe, this.iridescenceSpeed = Ue, this.bloomIntensity = Ie, this.bloomThreshold = Be, this.chromaticAberration = Le, this.silhouetteFade = Oe, this.cylinderFade = We, this.ribbonFade = Xe, this._flatShading = Ne, this._cameraLock = Ye, this._cameraX = ke, this._cameraY = Ve, this._cameraZ = qe, this._cameraRotationX = Ze, this._cameraRotationY = He, this._cameraRotationZ = Ge, this._cameraZoom = je, this._shapeType = $e, this._shapeRotationX = Ke, this._shapeRotationY = Je, this._shapeRotationZ = Qe, this._shapeAutoRotateSpeedX = et, this._shapeAutoRotateSpeedY = tt, this._sphereRadius = it, this._torusRadius = st, this._torusTube = rt, this._cylinderRadius = ot, this._cylinderHeight = nt, this._planeBend = at, this._planeTwist = lt, this.glState = this._initScene(A), bt();
|
|
941
|
+
let Z = D !== void 0 ? D : vt(), H = performance.now();
|
|
942
|
+
const G = () => {
|
|
943
|
+
const { gl: o, program: k, locations: f, indexCount: V, indexType: q } = this.glState;
|
|
944
|
+
if (this._linkCheckCounter++, this._linkCheckCounter >= 300 && (this._linkCheckCounter = 0, (!this._linkElement || !document.contains(this._linkElement)) && (this._linkElement = yt(i))), this._initialized) {
|
|
932
945
|
const Q = performance.now();
|
|
933
|
-
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
-
|
|
937
|
-
-
|
|
938
|
-
-
|
|
939
|
-
),
|
|
940
|
-
let
|
|
941
|
-
this._shapeAutoRotateSpeedX !== 0 && (
|
|
942
|
-
const te =
|
|
943
|
-
if (te &&
|
|
944
|
-
|
|
946
|
+
Z += (Q - H) / 1e3 * this._speed, H = Q, o.useProgram(k), o.uniform1f(f.uniforms.u_time, Z);
|
|
947
|
+
const K = this.glState.camera, W = this._modelViewMatrix;
|
|
948
|
+
W.identity(), W.translate(
|
|
949
|
+
-K.position[0] - this._cameraX,
|
|
950
|
+
-K.position[1] - this._cameraY,
|
|
951
|
+
-K.position[2] - this._cameraZ
|
|
952
|
+
), W.translate(0, 0, -1), W.rotateX(-this._cameraRotationX), W.rotateY(-this._cameraRotationY), W.rotateZ(-this._cameraRotationZ);
|
|
953
|
+
let J = this._shapeRotationX, ee = this._shapeRotationY, _t = this._shapeRotationZ;
|
|
954
|
+
this._shapeAutoRotateSpeedX !== 0 && (J += Z * this._shapeAutoRotateSpeedX * 0.1), this._shapeAutoRotateSpeedY !== 0 && (ee += Z * this._shapeAutoRotateSpeedY * 0.1), this._shapeType === "plane" || this._shapeType === "ribbon" ? W.rotateX(J - Math.PI / 3.5) : W.rotateX(J), W.rotateY(ee), W.rotateZ(_t);
|
|
955
|
+
const te = f.uniforms.modelViewMatrix;
|
|
956
|
+
if (te && o.uniformMatrix4fv(te, !1, W.elements), this._yOffsetDirty && !this._uniformsDirty && (o.uniform1f(f.uniforms.u_y_offset, this._yOffset), this._yOffsetDirty = !1), this._uniformsDirty) {
|
|
957
|
+
o.uniform2f(f.uniforms.u_resolution, this._ref.clientWidth, this._ref.clientHeight), o.uniform2f(f.uniforms.u_color_pressure, this._horizontalPressure, this._verticalPressure), o.uniform1f(f.uniforms.u_wave_frequency_x, this._waveFrequencyX), o.uniform1f(f.uniforms.u_wave_frequency_y, this._waveFrequencyY), o.uniform1f(f.uniforms.u_wave_amplitude, this._waveAmplitude), o.uniform1f(f.uniforms.u_color_blending, this._colorBlending), o.uniform1f(f.uniforms.u_shadows, this._shadows), o.uniform1f(f.uniforms.u_highlights, this._highlights), o.uniform1f(f.uniforms.u_saturation, this._saturation), o.uniform1f(f.uniforms.u_brightness, this._brightness), o.uniform1f(f.uniforms.u_grain_intensity, this._grainIntensity), o.uniform1f(f.uniforms.u_grain_sparsity, this._grainSparsity), o.uniform1f(f.uniforms.u_grain_speed, this._grainSpeed), o.uniform1f(f.uniforms.u_grain_scale, this._grainScale), o.uniform1f(f.uniforms.u_y_offset, this._yOffset), o.uniform1f(f.uniforms.u_y_offset_wave_multiplier, this._yOffsetWaveMultiplier), o.uniform1f(f.uniforms.u_y_offset_color_multiplier, this._yOffsetColorMultiplier), o.uniform1f(f.uniforms.u_y_offset_flow_multiplier, this._yOffsetFlowMultiplier), o.uniform1f(f.uniforms.u_flow_distortion_a, this._flowDistortionA), o.uniform1f(f.uniforms.u_flow_distortion_b, this._flowDistortionB), o.uniform1f(f.uniforms.u_flow_scale, this._flowScale), o.uniform1f(f.uniforms.u_flow_ease, this._flowEase), o.uniform1f(f.uniforms.u_flow_enabled, this._flowEnabled ? 1 : 0);
|
|
945
958
|
let L = 0;
|
|
946
|
-
this._shapeType === "sphere" ? L = 1 : this._shapeType === "torus" ? L = 2 : this._shapeType === "cylinder" ? L = 3 : this._shapeType === "ribbon" && (L = 4),
|
|
959
|
+
this._shapeType === "sphere" ? L = 1 : this._shapeType === "torus" ? L = 2 : this._shapeType === "cylinder" ? L = 3 : this._shapeType === "ribbon" && (L = 4), o.uniform1f(f.uniforms.u_shape_type, L), o.uniform1f(f.uniforms.u_enable_procedural_texture, this._enableProceduralTexture ? 1 : 0), o.uniform1f(f.uniforms.u_texture_ease, this._textureEase), o.uniform1f(f.uniforms.u_transparent_texture_void, this._transparentTextureVoid ? 1 : 0), o.uniform1f(f.uniforms.u_domain_warp_enabled, this._domainWarpEnabled ? 1 : 0), o.uniform1f(f.uniforms.u_domain_warp_intensity, this._domainWarpIntensity), o.uniform1f(f.uniforms.u_domain_warp_scale, this._domainWarpScale), o.uniform1f(f.uniforms.u_vignette_intensity, this._vignetteIntensity), o.uniform1f(f.uniforms.u_vignette_radius, this._vignetteRadius), o.uniform1f(f.uniforms.u_fresnel_enabled, this._fresnelEnabled ? 1 : 0), o.uniform1f(f.uniforms.u_fresnel_power, this._fresnelPower), o.uniform1f(f.uniforms.u_fresnel_intensity, this._fresnelIntensity), o.uniform3fv(f.uniforms.u_fresnel_color, this._fresnelColorRgb), o.uniform1f(f.uniforms.u_iridescence_enabled, this._iridescenceEnabled ? 1 : 0), o.uniform1f(f.uniforms.u_iridescence_intensity, this._iridescenceIntensity), o.uniform1f(f.uniforms.u_iridescence_speed, this._iridescenceSpeed), o.uniform1f(f.uniforms.u_bloom_intensity, this._bloomIntensity), o.uniform1f(f.uniforms.u_bloom_threshold, this._bloomThreshold), o.uniform1f(f.uniforms.u_chromatic_aberration, this._chromaticAberration), o.uniform1f(f.uniforms.u_silhouette_fade, this._silhouetteFade), o.uniform1f(f.uniforms.u_cylinder_fade, this._cylinderFade), o.uniform1f(f.uniforms.u_ribbon_fade, this._ribbonFade), o.uniform1f(f.uniforms.u_flat_shading, this._flatShading ? 1 : 0), this._uniformsDirty = !1, this._yOffsetDirty = !1;
|
|
947
960
|
}
|
|
948
|
-
if (this._textureNeedsUpdate && this._enableProceduralTexture && (this._proceduralTexture &&
|
|
961
|
+
if (this._textureNeedsUpdate && this._enableProceduralTexture && (this._proceduralTexture && o.deleteTexture(this._proceduralTexture), this._proceduralTexture = this._createProceduralTexture(o), this._textureNeedsUpdate = !1, this._textureDirty = !0), this._textureDirty && this._proceduralTexture && (o.activeTexture(o.TEXTURE1), o.bindTexture(o.TEXTURE_2D, this._proceduralTexture), o.uniform1i(f.uniforms.u_procedural_texture, 1), this._textureDirty = !1), this._colorsChanged) {
|
|
949
962
|
this._colorsChanged = !1;
|
|
950
|
-
for (let L = 0; L <
|
|
963
|
+
for (let L = 0; L < $; L++)
|
|
951
964
|
if (L < this._colors.length) {
|
|
952
|
-
const ie = this._colors[L],
|
|
953
|
-
|
|
965
|
+
const ie = this._colors[L], ct = this._cachedColorRgb[L] || [0, 0, 0];
|
|
966
|
+
o.uniform1f(f.uniforms[`u_colors[${L}].is_active`], ie.enabled ? 1 : 0), o.uniform3fv(f.uniforms[`u_colors[${L}].color`], ct), o.uniform1f(f.uniforms[`u_colors[${L}].influence`], ie.influence || 0);
|
|
954
967
|
} else
|
|
955
|
-
|
|
956
|
-
|
|
968
|
+
o.uniform1f(f.uniforms[`u_colors[${L}].is_active`], 0);
|
|
969
|
+
o.uniform1i(f.uniforms.u_colors_count, $);
|
|
957
970
|
}
|
|
958
971
|
}
|
|
959
|
-
|
|
972
|
+
o.clearColor(
|
|
960
973
|
this._backgroundColorRgb[0],
|
|
961
974
|
this._backgroundColorRgb[1],
|
|
962
975
|
this._backgroundColorRgb[2],
|
|
963
976
|
this._backgroundAlpha
|
|
964
|
-
),
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
977
|
+
), o.clear(o.COLOR_BUFFER_BIT | o.DEPTH_BUFFER_BIT), this._wireframe ? (o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, this.glState.buffers.wireframeIndex), o.drawElements(o.LINES, this.glState.wireframeIndexCount, q, 0), o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, this.glState.buffers.index)) : o.drawElements(o.TRIANGLES, V, q, 0), this._isVisible && (this.requestRef = requestAnimationFrame(G));
|
|
978
|
+
};
|
|
979
|
+
this._visibilityObserver = new IntersectionObserver((o) => {
|
|
980
|
+
const k = this._isVisible;
|
|
981
|
+
this._isVisible = o[0].isIntersecting && document.visibilityState !== "hidden", this._isVisible && !k && (H = performance.now(), this.requestRef = requestAnimationFrame(G));
|
|
982
|
+
}, { threshold: 0 }), this._visibilityObserver.observe(i), this._visibilityHandler = () => {
|
|
983
|
+
const o = this._isVisible;
|
|
984
|
+
document.visibilityState === "hidden" ? this._isVisible = !1 : (this._isVisible = !0, o || (H = performance.now(), this.requestRef = requestAnimationFrame(G)));
|
|
985
|
+
}, document.addEventListener("visibilitychange", this._visibilityHandler);
|
|
986
|
+
const ut = () => {
|
|
987
|
+
const { gl: o, camera: k } = this.glState, f = this._ref.clientWidth, V = this._ref.clientHeight;
|
|
988
|
+
this._ref.width = f, this._ref.height = V, o.viewport(0, 0, f, V), j(k, f, V, X, N, this._shapeType, this._cameraZoom);
|
|
989
|
+
const q = this.glState.locations.uniforms.projectionMatrix;
|
|
990
|
+
o.useProgram(this.glState.program), q && o.uniformMatrix4fv(q, !1, k.projectionMatrix.elements);
|
|
970
991
|
};
|
|
971
992
|
this.sizeObserver = new ResizeObserver(() => {
|
|
972
993
|
this._resizeTimeoutId !== null && clearTimeout(this._resizeTimeoutId), this._resizeTimeoutId = window.setTimeout(() => {
|
|
973
|
-
|
|
994
|
+
ut(), this._resizeTimeoutId = null;
|
|
974
995
|
}, 100);
|
|
975
|
-
}), this.sizeObserver.observe(i),
|
|
996
|
+
}), this.sizeObserver.observe(i), G();
|
|
976
997
|
}
|
|
977
998
|
destroy() {
|
|
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) {
|
|
999
|
+
if (cancelAnimationFrame(this.requestRef), this.sizeObserver.disconnect(), this._visibilityObserver && (this._visibilityObserver.disconnect(), this._visibilityObserver = null), this._visibilityHandler && (document.removeEventListener("visibilitychange", this._visibilityHandler), this._visibilityHandler = null), this._resizeTimeoutId !== null && (clearTimeout(this._resizeTimeoutId), this._resizeTimeoutId = null), this._linkElement && this._linkElement.parentElement && (this._linkElement.parentElement.removeChild(this._linkElement), this._linkElement = null), this.glState) {
|
|
979
1000
|
const e = this.glState.gl;
|
|
980
1001
|
e.deleteProgram(this.glState.program), e.deleteBuffer(this.glState.buffers.position), e.deleteBuffer(this.glState.buffers.normal), e.deleteBuffer(this.glState.buffers.uv), e.deleteBuffer(this.glState.buffers.index), e.deleteBuffer(this.glState.buffers.wireframeIndex);
|
|
981
1002
|
}
|
|
@@ -991,52 +1012,52 @@ class bt {
|
|
|
991
1012
|
filename: r = "neat.firecms.co",
|
|
992
1013
|
format: t,
|
|
993
1014
|
onProgress: y,
|
|
994
|
-
onComplete:
|
|
995
|
-
} = e,
|
|
1015
|
+
onComplete: v
|
|
1016
|
+
} = e, s = this._ref, l = e.width || s.width || s.clientWidth, _ = e.height || s.height || s.clientHeight, b = document.createElement("canvas");
|
|
996
1017
|
b.width = l, b.height = _;
|
|
997
1018
|
const a = b.getContext("2d"), h = b.captureStream(0), p = h.getVideoTracks()[0], c = [
|
|
998
1019
|
"video/mp4;codecs=avc1",
|
|
999
1020
|
"video/mp4;codecs=avc1,opus",
|
|
1000
1021
|
"video/mp4"
|
|
1001
|
-
],
|
|
1022
|
+
], d = [
|
|
1002
1023
|
"video/webm;codecs=vp9,opus",
|
|
1003
1024
|
"video/webm;codecs=vp9",
|
|
1004
1025
|
"video/webm;codecs=vp8,opus",
|
|
1005
1026
|
"video/webm"
|
|
1006
1027
|
];
|
|
1007
1028
|
let R;
|
|
1008
|
-
t === "mp4" ? R = [...c, ...
|
|
1029
|
+
t === "mp4" ? R = [...c, ...d] : t === "webm" ? R = [...d, ...c] : R = [...c, ...d];
|
|
1009
1030
|
let g = "video/webm";
|
|
1010
1031
|
for (const E of R)
|
|
1011
1032
|
if (MediaRecorder.isTypeSupported(E)) {
|
|
1012
1033
|
g = E;
|
|
1013
1034
|
break;
|
|
1014
1035
|
}
|
|
1015
|
-
const
|
|
1036
|
+
const x = l * _, w = 8e6, u = 1280 * 720, T = Math.round(w * Math.max(1, x / u)), A = new MediaRecorder(h, {
|
|
1016
1037
|
mimeType: g,
|
|
1017
1038
|
videoBitsPerSecond: T
|
|
1018
|
-
}),
|
|
1039
|
+
}), D = [];
|
|
1019
1040
|
A.ondataavailable = (E) => {
|
|
1020
|
-
E.data.size > 0 &&
|
|
1041
|
+
E.data.size > 0 && D.push(E.data);
|
|
1021
1042
|
};
|
|
1022
1043
|
let m = !1, F;
|
|
1023
|
-
const
|
|
1044
|
+
const C = performance.now();
|
|
1024
1045
|
let z = 0;
|
|
1025
1046
|
const M = () => {
|
|
1026
1047
|
if (m)
|
|
1027
1048
|
return;
|
|
1028
|
-
a.clearRect(0, 0, l, _), a.drawImage(
|
|
1049
|
+
a.clearRect(0, 0, l, _), a.drawImage(s, 0, 0, l, _);
|
|
1029
1050
|
const E = Math.max(14, Math.round(_ * 0.025));
|
|
1030
1051
|
if (a.font = `bold ${E}px "Sofia Sans", sans-serif`, a.textAlign = "right", a.textBaseline = "bottom", a.shadowColor = "rgba(0,0,0,0.5)", a.shadowBlur = 4, a.shadowOffsetX = 1, a.shadowOffsetY = 1, a.fillStyle = "rgba(255,255,255,0.7)", a.fillText("NEAT", l - E * 0.8, _ - E * 0.5), a.shadowColor = "transparent", a.shadowBlur = 0, a.shadowOffsetX = 0, a.shadowOffsetY = 0, p.requestFrame && p.requestFrame(), y) {
|
|
1031
1052
|
const S = performance.now();
|
|
1032
|
-
S - z > 250 && (z = S, y(Math.min(0.99, (S -
|
|
1053
|
+
S - z > 250 && (z = S, y(Math.min(0.99, (S - C) / i)));
|
|
1033
1054
|
}
|
|
1034
1055
|
F = requestAnimationFrame(M);
|
|
1035
1056
|
};
|
|
1036
1057
|
A.onstop = () => {
|
|
1037
1058
|
m = !0, cancelAnimationFrame(F);
|
|
1038
|
-
const E = g.startsWith("video/mp4"), S = E ? ".mp4" : ".webm", U = E ? "video/mp4" : "video/webm", B = r + S,
|
|
1039
|
-
ce(I, B), setTimeout(() => URL.revokeObjectURL(I), 3e4), y?.(1),
|
|
1059
|
+
const E = g.startsWith("video/mp4"), S = E ? ".mp4" : ".webm", U = E ? "video/mp4" : "video/webm", B = r + S, O = new Blob(D, { type: U }), I = URL.createObjectURL(O);
|
|
1060
|
+
ce(I, B), setTimeout(() => URL.revokeObjectURL(I), 3e4), y?.(1), v?.();
|
|
1040
1061
|
}, M(), A.start(100);
|
|
1041
1062
|
const P = window.setTimeout(() => {
|
|
1042
1063
|
A.state === "recording" && A.stop();
|
|
@@ -1169,7 +1190,7 @@ class bt {
|
|
|
1169
1190
|
return this._yOffset;
|
|
1170
1191
|
}
|
|
1171
1192
|
set yOffset(e) {
|
|
1172
|
-
this.
|
|
1193
|
+
this._yOffset !== e && (this._yOffsetDirty = !0, this._yOffset = e);
|
|
1173
1194
|
}
|
|
1174
1195
|
get yOffsetWaveMultiplier() {
|
|
1175
1196
|
return this._yOffsetWaveMultiplier * 1e3;
|
|
@@ -1308,11 +1329,11 @@ class bt {
|
|
|
1308
1329
|
return;
|
|
1309
1330
|
const e = this.glState.gl, i = this._resolution || 1;
|
|
1310
1331
|
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(
|
|
1312
|
-
const { position: t, normal: y, uv:
|
|
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,
|
|
1332
|
+
this._shapeType === "sphere" ? r = ne(this._sphereRadius, 120 * i, 120 * i) : this._shapeType === "torus" ? r = ae(this._torusRadius, this._torusTube, 120 * i, 120 * i) : this._shapeType === "cylinder" ? r = le(this._cylinderRadius, this._cylinderRadius, this._cylinderHeight, 120 * i, 120 * i) : this._shapeType === "ribbon" ? r = ue(X, N, 240 * i, 240 * i, this._planeBend, this._planeTwist) : r = oe(X, N, 240 * i, 240 * i);
|
|
1333
|
+
const { position: t, normal: y, uv: v, index: s, wireframeIndex: l } = r;
|
|
1334
|
+
e.bindBuffer(e.ARRAY_BUFFER, this.glState.buffers.position), e.bufferData(e.ARRAY_BUFFER, t, e.STATIC_DRAW), e.bindBuffer(e.ARRAY_BUFFER, this.glState.buffers.normal), e.bufferData(e.ARRAY_BUFFER, y, e.STATIC_DRAW), e.bindBuffer(e.ARRAY_BUFFER, this.glState.buffers.uv), e.bufferData(e.ARRAY_BUFFER, v, e.STATIC_DRAW), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this.glState.buffers.index), e.bufferData(e.ELEMENT_ARRAY_BUFFER, s, e.STATIC_DRAW), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this.glState.buffers.wireframeIndex), e.bufferData(e.ELEMENT_ARRAY_BUFFER, l, e.STATIC_DRAW), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this.glState.buffers.index), this.glState.indexCount = s.length, this.glState.wireframeIndexCount = l.length, this.glState.indexType = s instanceof Uint32Array ? e.UNSIGNED_INT : e.UNSIGNED_SHORT;
|
|
1314
1335
|
const _ = this._ref.clientWidth, b = this._ref.clientHeight;
|
|
1315
|
-
|
|
1336
|
+
j(this.glState.camera, _, b, X, N, this._shapeType, this._cameraZoom);
|
|
1316
1337
|
const a = this.glState.locations.uniforms.projectionMatrix;
|
|
1317
1338
|
e.useProgram(this.glState.program), a && e.uniformMatrix4fv(a, !1, this.glState.camera.projectionMatrix.elements), this._uniformsDirty = !0;
|
|
1318
1339
|
}
|
|
@@ -1330,45 +1351,45 @@ class bt {
|
|
|
1330
1351
|
throw new Error("WebGL not supported");
|
|
1331
1352
|
t.getExtension("OES_standard_derivatives"), t.getExtension("OES_element_index_uint"), t.viewport(0, 0, i, r);
|
|
1332
1353
|
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(
|
|
1334
|
-
const { position:
|
|
1335
|
-
t.bindBuffer(t.ARRAY_BUFFER, a), t.bufferData(t.ARRAY_BUFFER,
|
|
1354
|
+
this._shapeType === "sphere" ? y = ne(this._sphereRadius, 120 * e, 120 * e) : this._shapeType === "torus" ? y = ae(this._torusRadius, this._torusTube, 120 * e, 120 * e) : this._shapeType === "cylinder" ? y = le(this._cylinderRadius, this._cylinderRadius, this._cylinderHeight, 120 * e, 120 * e) : this._shapeType === "ribbon" ? y = ue(X, N, 240 * e, 240 * e, this._planeBend, this._planeTwist) : y = oe(X, N, 240 * e, 240 * e);
|
|
1355
|
+
const { position: v, normal: s, uv: l, index: _, wireframeIndex: b } = y, a = t.createBuffer();
|
|
1356
|
+
t.bindBuffer(t.ARRAY_BUFFER, a), t.bufferData(t.ARRAY_BUFFER, v, t.STATIC_DRAW);
|
|
1336
1357
|
const h = t.createBuffer();
|
|
1337
|
-
t.bindBuffer(t.ARRAY_BUFFER, h), t.bufferData(t.ARRAY_BUFFER,
|
|
1358
|
+
t.bindBuffer(t.ARRAY_BUFFER, h), t.bufferData(t.ARRAY_BUFFER, s, t.STATIC_DRAW);
|
|
1338
1359
|
const p = t.createBuffer();
|
|
1339
1360
|
t.bindBuffer(t.ARRAY_BUFFER, p), t.bufferData(t.ARRAY_BUFFER, l, t.STATIC_DRAW);
|
|
1340
1361
|
const c = t.createBuffer();
|
|
1341
1362
|
t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, c), t.bufferData(t.ELEMENT_ARRAY_BUFFER, _, t.STATIC_DRAW);
|
|
1342
|
-
const
|
|
1343
|
-
t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,
|
|
1344
|
-
const R =
|
|
1345
|
-
` +
|
|
1363
|
+
const d = t.createBuffer();
|
|
1364
|
+
t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, d), t.bufferData(t.ELEMENT_ARRAY_BUFFER, b, t.STATIC_DRAW), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, c);
|
|
1365
|
+
const R = dt() + `
|
|
1366
|
+
` + se() + `
|
|
1346
1367
|
` + re() + `
|
|
1347
|
-
` +
|
|
1368
|
+
` + ht, g = t.createShader(t.VERTEX_SHADER);
|
|
1348
1369
|
t.shaderSource(g, R), t.compileShader(g), t.getShaderParameter(g, t.COMPILE_STATUS) || (console.log("VERTEX_SHADER_ERROR_START"), console.log("Vertex shader error: ", t.getShaderInfoLog(g)), console.log("GL Error Code:", t.getError()), console.log("Vertex Shader Source Dump:"), console.log(R.split(`
|
|
1349
1370
|
`).map((S, U) => `${U + 1}: ${S}`).join(`
|
|
1350
1371
|
`)), console.log("VERTEX_SHADER_ERROR_END"));
|
|
1351
|
-
const
|
|
1372
|
+
const x = mt() + `
|
|
1352
1373
|
` + re() + `
|
|
1353
|
-
` +
|
|
1354
|
-
` +
|
|
1355
|
-
t.shaderSource(w,
|
|
1374
|
+
` + se() + `
|
|
1375
|
+
` + ft, w = t.createShader(t.FRAGMENT_SHADER);
|
|
1376
|
+
t.shaderSource(w, x), t.compileShader(w), t.getShaderParameter(w, t.COMPILE_STATUS) || (console.log("FRAGMENT_SHADER_ERROR_START"), console.log("Fragment shader error: ", t.getShaderInfoLog(w)), console.log("GL Error Code:", t.getError()), console.log("Fragment Shader Source Dump:"), console.log(x.split(`
|
|
1356
1377
|
`).map((S, U) => `${U + 1}: ${S}`).join(`
|
|
1357
1378
|
`)), console.log("FRAGMENT_SHADER_ERROR_END"));
|
|
1358
1379
|
const u = t.createProgram();
|
|
1359
1380
|
t.attachShader(u, g), t.attachShader(u, w), t.linkProgram(u), t.getProgramParameter(u, t.LINK_STATUS) || (console.log("PROGRAM_LINK_ERROR_START"), console.log("Program linking error: ", t.getProgramInfoLog(u)), console.log("GL Error Code:", t.getError()), console.log("PROGRAM_LINK_ERROR_END")), t.useProgram(u);
|
|
1360
|
-
const T = new
|
|
1361
|
-
T.position = [0, 0, 5],
|
|
1362
|
-
const A = t.getAttribLocation(u, "position"),
|
|
1363
|
-
t.enableVertexAttribArray(A), t.bindBuffer(t.ARRAY_BUFFER, a), t.vertexAttribPointer(A, 3, t.FLOAT, !1, 0, 0), t.enableVertexAttribArray(
|
|
1381
|
+
const T = new pt(0, 0, 0, 0, 0, 1e3);
|
|
1382
|
+
T.position = [0, 0, 5], j(T, i, r, X, N, this._shapeType, this._cameraZoom);
|
|
1383
|
+
const A = t.getAttribLocation(u, "position"), D = t.getAttribLocation(u, "normal"), m = t.getAttribLocation(u, "uv");
|
|
1384
|
+
t.enableVertexAttribArray(A), t.bindBuffer(t.ARRAY_BUFFER, a), t.vertexAttribPointer(A, 3, t.FLOAT, !1, 0, 0), t.enableVertexAttribArray(D), t.bindBuffer(t.ARRAY_BUFFER, h), t.vertexAttribPointer(D, 3, t.FLOAT, !1, 0, 0), t.enableVertexAttribArray(m), t.bindBuffer(t.ARRAY_BUFFER, p), t.vertexAttribPointer(m, 2, t.FLOAT, !1, 0, 0), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, c);
|
|
1364
1385
|
const F = t.getUniformLocation(u, "projectionMatrix");
|
|
1365
1386
|
t.uniformMatrix4fv(F, !1, T.projectionMatrix.elements);
|
|
1366
|
-
const
|
|
1367
|
-
t.uniform1f(
|
|
1387
|
+
const C = t.getUniformLocation(u, "u_plane_width");
|
|
1388
|
+
t.uniform1f(C, X);
|
|
1368
1389
|
const z = t.getUniformLocation(u, "u_plane_height");
|
|
1369
|
-
t.uniform1f(z,
|
|
1390
|
+
t.uniform1f(z, N);
|
|
1370
1391
|
const M = t.getUniformLocation(u, "u_colors_count");
|
|
1371
|
-
t.uniform1i(M,
|
|
1392
|
+
t.uniform1i(M, $);
|
|
1372
1393
|
const P = [
|
|
1373
1394
|
"projectionMatrix",
|
|
1374
1395
|
"modelViewMatrix",
|
|
@@ -1421,15 +1442,16 @@ class bt {
|
|
|
1421
1442
|
"u_shape_type",
|
|
1422
1443
|
"u_silhouette_fade",
|
|
1423
1444
|
"u_cylinder_fade",
|
|
1424
|
-
"u_ribbon_fade"
|
|
1445
|
+
"u_ribbon_fade",
|
|
1446
|
+
"u_flat_shading"
|
|
1425
1447
|
], E = {
|
|
1426
|
-
attributes: { position: A, normal:
|
|
1448
|
+
attributes: { position: A, normal: D, uv: m },
|
|
1427
1449
|
uniforms: {}
|
|
1428
1450
|
};
|
|
1429
1451
|
P.forEach((S) => {
|
|
1430
1452
|
E.uniforms[S] = t.getUniformLocation(u, S);
|
|
1431
1453
|
});
|
|
1432
|
-
for (let S = 0; S <
|
|
1454
|
+
for (let S = 0; S < $; S++)
|
|
1433
1455
|
E.uniforms[`u_colors[${S}].is_active`] = t.getUniformLocation(u, `u_colors[${S}].is_active`), E.uniforms[`u_colors[${S}].color`] = t.getUniformLocation(u, `u_colors[${S}].color`), E.uniforms[`u_colors[${S}].influence`] = t.getUniformLocation(u, `u_colors[${S}].influence`);
|
|
1434
1456
|
return this._initialized = !0, this._uniformsDirty = !0, this._colorsChanged = !0, this._textureDirty = !0, t.enable(t.BLEND), t.blendFunc(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA), t.enable(t.DEPTH_TEST), {
|
|
1435
1457
|
gl: t,
|
|
@@ -1439,7 +1461,7 @@ class bt {
|
|
|
1439
1461
|
normal: h,
|
|
1440
1462
|
uv: p,
|
|
1441
1463
|
index: c,
|
|
1442
|
-
wireframeIndex:
|
|
1464
|
+
wireframeIndex: d
|
|
1443
1465
|
},
|
|
1444
1466
|
locations: E,
|
|
1445
1467
|
camera: T,
|
|
@@ -1454,13 +1476,13 @@ class bt {
|
|
|
1454
1476
|
if (!t)
|
|
1455
1477
|
return null;
|
|
1456
1478
|
let y = this._textureSeed;
|
|
1457
|
-
const
|
|
1458
|
-
function
|
|
1479
|
+
const v = this._textureSeed;
|
|
1480
|
+
function s() {
|
|
1459
1481
|
const m = Math.sin(y++) * 1e4;
|
|
1460
1482
|
return m - Math.floor(m);
|
|
1461
1483
|
}
|
|
1462
1484
|
const l = (m) => {
|
|
1463
|
-
y =
|
|
1485
|
+
y = v + m;
|
|
1464
1486
|
}, _ = this._colors.filter((m) => m.enabled).map((m) => m.color);
|
|
1465
1487
|
if (_.length === 0)
|
|
1466
1488
|
return null;
|
|
@@ -1473,48 +1495,48 @@ class bt {
|
|
|
1473
1495
|
b: F & 255
|
|
1474
1496
|
};
|
|
1475
1497
|
}
|
|
1476
|
-
function c(m, F,
|
|
1477
|
-
return "#" + ((1 << 24) + (Math.round(m) << 16) + (Math.round(F) << 8) + Math.round(
|
|
1498
|
+
function c(m, F, C) {
|
|
1499
|
+
return "#" + ((1 << 24) + (Math.round(m) << 16) + (Math.round(F) << 8) + Math.round(C)).toString(16).slice(1).padStart(6, "0");
|
|
1478
1500
|
}
|
|
1479
|
-
const
|
|
1480
|
-
const m = _[Math.floor(
|
|
1501
|
+
const d = () => {
|
|
1502
|
+
const m = _[Math.floor(s() * _.length)], F = _[Math.floor(s() * _.length)], C = s() * this._textureColorBlending, z = p(m), M = p(F), P = z.r + (M.r - z.r) * C, E = z.g + (M.g - z.g) * C, S = z.b + (M.b - z.b) * C;
|
|
1481
1503
|
return c(P, E, S);
|
|
1482
1504
|
}, R = this._proceduralBackgroundColor || "#000000";
|
|
1483
1505
|
t.fillStyle = R, t.fillRect(0, 0, 1024, 1024);
|
|
1484
1506
|
const g = t.createLinearGradient(0, 0, 0, 1024);
|
|
1485
|
-
g.addColorStop(0,
|
|
1507
|
+
g.addColorStop(0, d()), g.addColorStop(1, d()), t.fillStyle = g, t.fillRect(0, 0, 1024, 1024);
|
|
1486
1508
|
for (let m = 0; m < this._textureShapeTriangles; m++) {
|
|
1487
|
-
const F =
|
|
1509
|
+
const F = d(), C = s() * 1024, z = s() * 1024, M = 100 + s() * 300, P = (s() - 0.5) * M, E = (s() - 0.5) * M, S = (s() - 0.5) * M, U = (s() - 0.5) * M;
|
|
1488
1510
|
for (const B of a)
|
|
1489
|
-
for (const
|
|
1511
|
+
for (const O of h) {
|
|
1490
1512
|
t.fillStyle = F, t.beginPath();
|
|
1491
|
-
const I =
|
|
1492
|
-
t.moveTo(I,
|
|
1513
|
+
const I = C + B * 1024, Y = z + O * 1024;
|
|
1514
|
+
t.moveTo(I, Y), t.lineTo(I + P, Y + E), t.lineTo(I + S, Y + U), t.fill();
|
|
1493
1515
|
}
|
|
1494
1516
|
}
|
|
1495
1517
|
for (let m = 0; m < this._textureShapeCircles; m++) {
|
|
1496
|
-
const F =
|
|
1518
|
+
const F = d(), C = 10 + s() * 50, z = s() * 1024, M = s() * 1024, P = 50 + s() * 150;
|
|
1497
1519
|
for (const E of a)
|
|
1498
1520
|
for (const S of h)
|
|
1499
|
-
t.strokeStyle = F, t.lineWidth =
|
|
1521
|
+
t.strokeStyle = F, t.lineWidth = C, t.beginPath(), t.arc(z + E * 1024, M + S * 1024, P, 0, Math.PI * 2), t.stroke();
|
|
1500
1522
|
}
|
|
1501
1523
|
for (let m = 0; m < this._textureShapeBars; m++) {
|
|
1502
|
-
const F =
|
|
1524
|
+
const F = d(), C = s() * 1024, z = s() * 1024, M = s() * Math.PI;
|
|
1503
1525
|
for (const P of a)
|
|
1504
1526
|
for (const E of h)
|
|
1505
|
-
t.fillStyle = F, t.save(), t.translate(
|
|
1527
|
+
t.fillStyle = F, t.save(), t.translate(C + P * 1024, z + E * 1024), t.rotate(M), t.fillRect(-150, -25, 300, 50), t.restore();
|
|
1506
1528
|
}
|
|
1507
1529
|
t.lineWidth = 15, t.lineCap = "round";
|
|
1508
1530
|
for (let m = 0; m < this._textureShapeSquiggles; m++) {
|
|
1509
|
-
const F =
|
|
1531
|
+
const F = d(), C = s() * 1024, z = s() * 1024, M = [];
|
|
1510
1532
|
let P = 0, E = 0;
|
|
1511
1533
|
for (let S = 0; S < 4; S++) {
|
|
1512
|
-
const U = P + (
|
|
1534
|
+
const U = P + (s() - 0.5) * 300, B = E + (s() - 0.5) * 300;
|
|
1513
1535
|
M.push({
|
|
1514
|
-
cx1: P + (
|
|
1515
|
-
cy1: E + (
|
|
1516
|
-
cx2: P + (
|
|
1517
|
-
cy2: E + (
|
|
1536
|
+
cx1: P + (s() - 0.5) * 300,
|
|
1537
|
+
cy1: E + (s() - 0.5) * 300,
|
|
1538
|
+
cx2: P + (s() - 0.5) * 300,
|
|
1539
|
+
cy2: E + (s() - 0.5) * 300,
|
|
1518
1540
|
ex: U,
|
|
1519
1541
|
ey: B
|
|
1520
1542
|
}), P = U, E = B;
|
|
@@ -1522,41 +1544,41 @@ class bt {
|
|
|
1522
1544
|
for (const S of a)
|
|
1523
1545
|
for (const U of h) {
|
|
1524
1546
|
t.strokeStyle = F, t.beginPath();
|
|
1525
|
-
const B =
|
|
1526
|
-
t.moveTo(B,
|
|
1547
|
+
const B = C + S * 1024, O = z + U * 1024;
|
|
1548
|
+
t.moveTo(B, O);
|
|
1527
1549
|
for (const I of M)
|
|
1528
1550
|
t.bezierCurveTo(
|
|
1529
1551
|
B + I.cx1,
|
|
1530
|
-
|
|
1552
|
+
O + I.cy1,
|
|
1531
1553
|
B + I.cx2,
|
|
1532
|
-
|
|
1554
|
+
O + I.cy2,
|
|
1533
1555
|
B + I.ex,
|
|
1534
|
-
|
|
1556
|
+
O + I.ey
|
|
1535
1557
|
);
|
|
1536
1558
|
t.stroke();
|
|
1537
1559
|
}
|
|
1538
1560
|
}
|
|
1539
1561
|
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
|
|
1562
|
+
const x = this._maskedCanvas, w = this._maskedCtx;
|
|
1541
1563
|
if (!w)
|
|
1542
1564
|
return null;
|
|
1543
1565
|
this._transparentTextureVoid ? w.clearRect(0, 0, 1024, 1024) : (w.fillStyle = R, w.fillRect(0, 0, 1024, 1024));
|
|
1544
1566
|
let u = 0;
|
|
1545
1567
|
const T = [];
|
|
1546
1568
|
for (; u < 1024; )
|
|
1547
|
-
if (
|
|
1548
|
-
const F = this._textureVoidWidthMin +
|
|
1569
|
+
if (s() < this._textureVoidLikelihood) {
|
|
1570
|
+
const F = this._textureVoidWidthMin + s() * (this._textureVoidWidthMax - this._textureVoidWidthMin);
|
|
1549
1571
|
T.push({ type: "void", x: u, width: F }), u += F;
|
|
1550
1572
|
} else {
|
|
1551
|
-
const F = 50 +
|
|
1573
|
+
const F = 50 + s() * 200;
|
|
1552
1574
|
T.push({ type: "matter", x: u, width: F }), u += F;
|
|
1553
1575
|
}
|
|
1554
1576
|
for (const m of T)
|
|
1555
1577
|
if (m.type === "matter") {
|
|
1556
|
-
const F = m.x,
|
|
1578
|
+
const F = m.x, C = Math.min(m.x + m.width, 1024);
|
|
1557
1579
|
let z = F;
|
|
1558
|
-
for (; z <
|
|
1559
|
-
const M = (2 +
|
|
1580
|
+
for (; z < C; ) {
|
|
1581
|
+
const M = (2 + s() * 20) / this._textureBandDensity, P = Math.floor(s() * 1024);
|
|
1560
1582
|
w.drawImage(
|
|
1561
1583
|
r,
|
|
1562
1584
|
P,
|
|
@@ -1571,11 +1593,11 @@ class bt {
|
|
|
1571
1593
|
}
|
|
1572
1594
|
}
|
|
1573
1595
|
const A = e.createTexture();
|
|
1574
|
-
e.bindTexture(e.TEXTURE_2D, A), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE,
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1577
|
-
const m = e.getParameter(
|
|
1578
|
-
e.texParameterf(e.TEXTURE_2D,
|
|
1596
|
+
e.bindTexture(e.TEXTURE_2D, A), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, x), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.REPEAT), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.REPEAT), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR_MIPMAP_LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.generateMipmap(e.TEXTURE_2D);
|
|
1597
|
+
const D = e.getExtension("EXT_texture_filter_anisotropic") || e.getExtension("MOZ_EXT_texture_filter_anisotropic") || e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
|
|
1598
|
+
if (D) {
|
|
1599
|
+
const m = e.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
|
|
1600
|
+
e.texParameterf(e.TEXTURE_2D, D.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(16, m));
|
|
1579
1601
|
}
|
|
1580
1602
|
return A;
|
|
1581
1603
|
}
|
|
@@ -1597,6 +1619,12 @@ class bt {
|
|
|
1597
1619
|
set ribbonFade(e) {
|
|
1598
1620
|
this._ribbonFade !== e && (this._ribbonFade = e, this._uniformsDirty = !0);
|
|
1599
1621
|
}
|
|
1622
|
+
get flatShading() {
|
|
1623
|
+
return this._flatShading;
|
|
1624
|
+
}
|
|
1625
|
+
set flatShading(e) {
|
|
1626
|
+
this._flatShading !== e && (this._flatShading = e, this._uniformsDirty = !0);
|
|
1627
|
+
}
|
|
1600
1628
|
get domainWarpEnabled() {
|
|
1601
1629
|
return this._domainWarpEnabled;
|
|
1602
1630
|
}
|
|
@@ -1817,15 +1845,17 @@ class bt {
|
|
|
1817
1845
|
if (!this.glState)
|
|
1818
1846
|
return;
|
|
1819
1847
|
const e = this.glState.gl, i = this._ref.clientWidth, r = this._ref.clientHeight;
|
|
1820
|
-
|
|
1848
|
+
j(this.glState.camera, i, r, X, N, this._shapeType, this._cameraZoom);
|
|
1821
1849
|
const t = this.glState.locations.uniforms.projectionMatrix;
|
|
1822
1850
|
e.useProgram(this.glState.program), t && e.uniformMatrix4fv(t, !1, this.glState.camera.projectionMatrix.elements), this._uniformsDirty = !0;
|
|
1823
1851
|
}
|
|
1824
1852
|
}
|
|
1825
|
-
const _e = (
|
|
1826
|
-
|
|
1827
|
-
},
|
|
1828
|
-
|
|
1853
|
+
const _e = (n) => {
|
|
1854
|
+
n.id = gt, n.href = "https://neat.firecms.co", n.target = "_blank", n.style.position = "absolute", n.style.display = "block", n.style.bottom = "0", n.style.right = "0", n.style.padding = "10px", n.style.color = "#dcdcdc", n.style.opacity = "0.8", n.style.fontFamily = "sans-serif", n.style.fontSize = "16px", n.style.fontWeight = "bold", n.style.textDecoration = "none", n.style.zIndex = "10000", n.style.pointerEvents = "auto", n.setAttribute("data-n", "1"), n.innerHTML = "NEAT";
|
|
1855
|
+
}, yt = (n) => {
|
|
1856
|
+
let e = n.parentElement;
|
|
1857
|
+
for (; e && getComputedStyle(e).display === "contents"; )
|
|
1858
|
+
e = e.parentElement;
|
|
1829
1859
|
if (e && getComputedStyle(e).position === "static" && (e.style.position = "relative"), e) {
|
|
1830
1860
|
const r = e.querySelector("a[data-n]");
|
|
1831
1861
|
if (r)
|
|
@@ -1834,28 +1864,28 @@ const _e = (s) => {
|
|
|
1834
1864
|
const i = document.createElement("a");
|
|
1835
1865
|
return _e(i), e?.appendChild(i), i;
|
|
1836
1866
|
};
|
|
1837
|
-
function
|
|
1838
|
-
const
|
|
1867
|
+
function vt() {
|
|
1868
|
+
const n = new Date(), e = n.getMinutes(), i = n.getSeconds();
|
|
1839
1869
|
return e * 60 + i;
|
|
1840
1870
|
}
|
|
1841
|
-
function xt(
|
|
1871
|
+
function xt(n = 6) {
|
|
1842
1872
|
const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1843
1873
|
let i = "";
|
|
1844
|
-
for (let r = 0; r <
|
|
1874
|
+
for (let r = 0; r < n; r++) {
|
|
1845
1875
|
const t = Math.floor(Math.random() * e.length);
|
|
1846
1876
|
i += e.charAt(t);
|
|
1847
1877
|
}
|
|
1848
1878
|
return i;
|
|
1849
1879
|
}
|
|
1850
|
-
function ce(
|
|
1880
|
+
function ce(n, e) {
|
|
1851
1881
|
const i = document.createElement("a");
|
|
1852
|
-
i.download = e, i.href =
|
|
1882
|
+
i.download = e, i.href = n, document.body.appendChild(i), i.click(), document.body.removeChild(i);
|
|
1853
1883
|
}
|
|
1854
|
-
function
|
|
1884
|
+
function bt() {
|
|
1855
1885
|
if (document.getElementById("neat-seo-schema"))
|
|
1856
1886
|
return;
|
|
1857
|
-
const
|
|
1858
|
-
|
|
1887
|
+
const n = document.createElement("script");
|
|
1888
|
+
n.id = "neat-seo-schema", n.type = "application/ld+json", n.text = JSON.stringify({
|
|
1859
1889
|
"@context": "https://schema.org",
|
|
1860
1890
|
"@type": "WebSite",
|
|
1861
1891
|
name: "NEAT Gradient",
|
|
@@ -1866,7 +1896,7 @@ function vt() {
|
|
|
1866
1896
|
url: "https://firecms.co"
|
|
1867
1897
|
},
|
|
1868
1898
|
description: "Beautiful, fast, heavily customizable, WebGL based gradients."
|
|
1869
|
-
}), document.head.appendChild(
|
|
1899
|
+
}), document.head.appendChild(n);
|
|
1870
1900
|
const e = document.createElement("div");
|
|
1871
1901
|
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";
|
|
1872
1902
|
try {
|
|
@@ -1879,6 +1909,6 @@ function vt() {
|
|
|
1879
1909
|
document.body.appendChild(e);
|
|
1880
1910
|
}
|
|
1881
1911
|
export {
|
|
1882
|
-
|
|
1912
|
+
wt as NeatGradient
|
|
1883
1913
|
};
|
|
1884
1914
|
//# sourceMappingURL=index.es.js.map
|