@s25studio/sinth 1.0.2 → 1.0.4
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/README.md +4 -4
- package/dist/esm/sinth.js +472 -447
- package/dist/{sinth-1.0.2.min.js → sinth-1.0.4.min.js} +3 -3
- package/dist/sinth.min.js +3 -3
- package/dist/three-0.184.0.min.js +2 -2
- package/dist/three.min.js +2 -2
- package/package.json +2 -2
package/dist/esm/sinth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! Sinth 1.0.
|
|
1
|
+
/*! Sinth 1.0.4 (v53) · @s25studio/sinth@1.0.4 · https://unpkg.com/@s25studio/sinth@1.0.4
|
|
2
2
|
* Copyright (c) 2026 S25 Studio. Licensed, not sold — see LICENSE.md in the
|
|
3
|
-
* package or https://unpkg.com/@s25studio/sinth@1.0.
|
|
3
|
+
* package or https://unpkg.com/@s25studio/sinth@1.0.4/LICENSE.md
|
|
4
4
|
*
|
|
5
5
|
* Bundles three.js addons and, via TTFLoader, opentype.js — both MIT. The
|
|
6
6
|
* script build three.min.js inlines three.js itself.
|
|
@@ -235,19 +235,19 @@ var E = class extends ee {
|
|
|
235
235
|
set alphaToCoverage(e) {
|
|
236
236
|
this.defines && (e === !0 !== this.alphaToCoverage && (this.needsUpdate = !0), e === !0 ? this.defines.USE_ALPHA_TO_COVERAGE = "" : delete this.defines.USE_ALPHA_TO_COVERAGE);
|
|
237
237
|
}
|
|
238
|
-
}, D = new ne(), se = new T(), ce = new T(), O = new ne(), k = new ne(), A = new ne(),
|
|
238
|
+
}, D = new ne(), se = new T(), ce = new T(), O = new ne(), k = new ne(), A = new ne(), j = new T(), le = new y(), M = new _(), ue = new T(), de = new d(), fe = new S(), N = new ne(), P, pe;
|
|
239
239
|
function me(e, t, n) {
|
|
240
|
-
return
|
|
240
|
+
return N.set(0, 0, -t, 1).applyMatrix4(e.projectionMatrix), N.multiplyScalar(1 / N.w), N.x = pe / n.width, N.y = pe / n.height, N.applyMatrix4(e.projectionMatrixInverse), N.multiplyScalar(1 / N.w), Math.abs(Math.max(N.x, N.y));
|
|
241
241
|
}
|
|
242
242
|
function he(e, t) {
|
|
243
243
|
let n = e.matrixWorld, r = e.geometry, i = r.attributes.instanceStart, a = r.attributes.instanceEnd, o = Math.min(r.instanceCount, i.count);
|
|
244
244
|
for (let r = 0, s = o; r < s; r++) {
|
|
245
|
-
|
|
245
|
+
M.start.fromBufferAttribute(i, r), M.end.fromBufferAttribute(a, r), M.applyMatrix4(n);
|
|
246
246
|
let o = new T(), s = new T();
|
|
247
|
-
|
|
247
|
+
P.distanceSqToSegment(M.start, M.end, s, o), s.distanceTo(o) < pe * .5 && t.push({
|
|
248
248
|
point: s,
|
|
249
249
|
pointOnLine: o,
|
|
250
|
-
distance:
|
|
250
|
+
distance: P.origin.distanceTo(s),
|
|
251
251
|
object: e,
|
|
252
252
|
face: null,
|
|
253
253
|
faceIndex: r,
|
|
@@ -258,9 +258,9 @@ function he(e, t) {
|
|
|
258
258
|
}
|
|
259
259
|
function ge(e, t, n) {
|
|
260
260
|
let r = t.projectionMatrix, i = e.material.resolution, a = e.matrixWorld, o = e.geometry, s = o.attributes.instanceStart, c = o.attributes.instanceEnd, l = Math.min(o.instanceCount, s.count), u = -t.near;
|
|
261
|
-
|
|
261
|
+
P.at(1, A), A.w = 1, A.applyMatrix4(t.matrixWorldInverse), A.applyMatrix4(r), A.multiplyScalar(1 / A.w), A.x *= i.x / 2, A.y *= i.y / 2, A.z = 0, j.copy(A), le.multiplyMatrices(t.matrixWorldInverse, a);
|
|
262
262
|
for (let t = 0, o = l; t < o; t++) {
|
|
263
|
-
if (O.fromBufferAttribute(s, t), k.fromBufferAttribute(c, t), O.w = 1, k.w = 1, O.applyMatrix4(
|
|
263
|
+
if (O.fromBufferAttribute(s, t), k.fromBufferAttribute(c, t), O.w = 1, k.w = 1, O.applyMatrix4(le), k.applyMatrix4(le), O.z > u && k.z > u) continue;
|
|
264
264
|
if (O.z > u) {
|
|
265
265
|
let e = O.z - k.z, t = (O.z - u) / e;
|
|
266
266
|
O.lerp(k, t);
|
|
@@ -268,17 +268,17 @@ function ge(e, t, n) {
|
|
|
268
268
|
let e = k.z - O.z, t = (k.z - u) / e;
|
|
269
269
|
k.lerp(O, t);
|
|
270
270
|
}
|
|
271
|
-
O.applyMatrix4(r), k.applyMatrix4(r), O.multiplyScalar(1 / O.w), k.multiplyScalar(1 / k.w), O.x *= i.x / 2, O.y *= i.y / 2, k.x *= i.x / 2, k.y *= i.y / 2,
|
|
272
|
-
let o =
|
|
273
|
-
|
|
274
|
-
let l = v.lerp(O.z, k.z, o), d = l >= -1 && l <= 1, f =
|
|
271
|
+
O.applyMatrix4(r), k.applyMatrix4(r), O.multiplyScalar(1 / O.w), k.multiplyScalar(1 / k.w), O.x *= i.x / 2, O.y *= i.y / 2, k.x *= i.x / 2, k.y *= i.y / 2, M.start.copy(O), M.start.z = 0, M.end.copy(k), M.end.z = 0;
|
|
272
|
+
let o = M.closestPointToPointParameter(j, !0);
|
|
273
|
+
M.at(o, ue);
|
|
274
|
+
let l = v.lerp(O.z, k.z, o), d = l >= -1 && l <= 1, f = j.distanceTo(ue) < pe * .5;
|
|
275
275
|
if (d && f) {
|
|
276
|
-
|
|
276
|
+
M.start.fromBufferAttribute(s, t), M.end.fromBufferAttribute(c, t), M.start.applyMatrix4(a), M.end.applyMatrix4(a);
|
|
277
277
|
let r = new T(), i = new T();
|
|
278
|
-
|
|
278
|
+
P.distanceSqToSegment(M.start, M.end, i, r), n.push({
|
|
279
279
|
point: i,
|
|
280
280
|
pointOnLine: r,
|
|
281
|
-
distance:
|
|
281
|
+
distance: P.origin.distanceTo(i),
|
|
282
282
|
object: e,
|
|
283
283
|
face: null,
|
|
284
284
|
faceIndex: t,
|
|
@@ -302,14 +302,14 @@ var _e = class extends b {
|
|
|
302
302
|
let n = this.material.worldUnits, r = e.camera;
|
|
303
303
|
r === null && !n && console.error("LineSegments2: \"Raycaster.camera\" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.");
|
|
304
304
|
let i = e.params.Line2 === void 0 ? 0 : e.params.Line2.threshold || 0;
|
|
305
|
-
|
|
305
|
+
P = e.ray;
|
|
306
306
|
let a = this.matrixWorld, o = this.geometry, s = this.material;
|
|
307
|
-
|
|
307
|
+
pe = s.linewidth + i, o.boundingSphere === null && o.computeBoundingSphere(), fe.copy(o.boundingSphere).applyMatrix4(a);
|
|
308
308
|
let c;
|
|
309
|
-
if (c = n ?
|
|
310
|
-
o.boundingBox === null && o.computeBoundingBox(),
|
|
309
|
+
if (c = n ? pe * .5 : me(r, Math.max(r.near, fe.distanceToPoint(P.origin)), s.resolution), fe.radius += c, P.intersectsSphere(fe) === !1) return;
|
|
310
|
+
o.boundingBox === null && o.computeBoundingBox(), de.copy(o.boundingBox).applyMatrix4(a);
|
|
311
311
|
let l;
|
|
312
|
-
l = n ?
|
|
312
|
+
l = n ? pe * .5 : me(r, Math.max(r.near, de.distanceToPoint(P.origin)), s.resolution), de.expandByScalar(l), P.intersectsBox(de) !== !1 && (n ? he(this, t) : ge(this, r, t));
|
|
313
313
|
}
|
|
314
314
|
onBeforeRender(e) {
|
|
315
315
|
let t = this.material.uniforms;
|
|
@@ -761,8 +761,8 @@ function qe(e) {
|
|
|
761
761
|
ringIndex: 0,
|
|
762
762
|
pathProgress: 0,
|
|
763
763
|
spinProgress: 0,
|
|
764
|
-
alignDir:
|
|
765
|
-
alignUp:
|
|
764
|
+
alignDir: K(e, Math.PI / Math.max(1, Math.round(r)) + Math.PI / 2, !1),
|
|
765
|
+
alignUp: q(e, !1)
|
|
766
766
|
}], a = Math.max(0, Math.round(t));
|
|
767
767
|
for (let t = 1; t <= a; t += 1) {
|
|
768
768
|
let a = t * n, o = Math.max(1, Math.round(t * r)), s = t % 2 == 0 ? 0 : Math.PI / o;
|
|
@@ -779,8 +779,8 @@ function qe(e) {
|
|
|
779
779
|
ringIndex: t,
|
|
780
780
|
pathProgress: o === 1 ? 0 : n / o,
|
|
781
781
|
spinProgress: o === 1 ? 0 : n / o,
|
|
782
|
-
alignDir:
|
|
783
|
-
alignUp:
|
|
782
|
+
alignDir: K(e, r + Math.PI / 2, !1),
|
|
783
|
+
alignUp: q(e, !1)
|
|
784
784
|
});
|
|
785
785
|
}
|
|
786
786
|
}
|
|
@@ -791,7 +791,7 @@ function Je(e) {
|
|
|
791
791
|
for (let t = 0; t < o; t += 1) {
|
|
792
792
|
let c = U(e, t, o);
|
|
793
793
|
for (let o = 0; o < a; o += 1) {
|
|
794
|
-
let l = at(e, t), u = a === 1 ? 0 : ot(o / a + l), d = u * Math.PI * 2, f =
|
|
794
|
+
let l = at(e, t), u = a === 1 ? 0 : ot(o / a + l), d = u * Math.PI * 2, f = G(e, Math.cos(d) * n, c, Math.sin(d) * n), p = r ? d + Math.PI / 2 : 0, m = t * a + o;
|
|
795
795
|
i.push({
|
|
796
796
|
x: f.x,
|
|
797
797
|
z: f.z,
|
|
@@ -803,8 +803,8 @@ function Je(e) {
|
|
|
803
803
|
ringIndex: t,
|
|
804
804
|
pathProgress: u,
|
|
805
805
|
spinProgress: s === 1 ? 0 : m / s,
|
|
806
|
-
alignDir:
|
|
807
|
-
alignUp:
|
|
806
|
+
alignDir: K(e, d + Math.PI / 2, !0),
|
|
807
|
+
alignUp: q(e, !0)
|
|
808
808
|
});
|
|
809
809
|
}
|
|
810
810
|
}
|
|
@@ -815,7 +815,7 @@ function Ye(e) {
|
|
|
815
815
|
for (let t = 0; t < o; t += 1) {
|
|
816
816
|
let c = U(e, t, o), l = at(e, t);
|
|
817
817
|
for (let o = 0; o < a; o += 1) {
|
|
818
|
-
let u = a === 1 ? 0 : W(o / (a - 1) + l), d = tt(e, u), f =
|
|
818
|
+
let u = a === 1 ? 0 : W(o / (a - 1) + l), d = tt(e, u), f = G(e, d.x, c, d.z), p = Math.sqrt(d.x * d.x + d.z * d.z), m = r ? n + d.tangentAngle : 0, h = t * a + o;
|
|
819
819
|
i.push({
|
|
820
820
|
x: f.x,
|
|
821
821
|
z: f.z,
|
|
@@ -827,8 +827,8 @@ function Ye(e) {
|
|
|
827
827
|
ringIndex: t,
|
|
828
828
|
pathProgress: u,
|
|
829
829
|
spinProgress: s === 1 ? 0 : h / s,
|
|
830
|
-
alignDir:
|
|
831
|
-
alignUp:
|
|
830
|
+
alignDir: K(e, n + d.tangentAngle, !0),
|
|
831
|
+
alignUp: q(e, !0)
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
834
|
}
|
|
@@ -839,7 +839,7 @@ function Xe(e) {
|
|
|
839
839
|
for (let t = 0; t < a; t += 1) {
|
|
840
840
|
let s = U(e, t, a), c = at(e, t);
|
|
841
841
|
for (let a = 0; a < i; a += 1) {
|
|
842
|
-
let l = i === 1 ? 0 : W(a / (i - 1) + c), u = nt(e, l), d =
|
|
842
|
+
let l = i === 1 ? 0 : W(a / (i - 1) + c), u = nt(e, l), d = G(e, u.x, s, u.z), f = t * i + a;
|
|
843
843
|
r.push({
|
|
844
844
|
x: d.x,
|
|
845
845
|
z: d.z,
|
|
@@ -851,8 +851,8 @@ function Xe(e) {
|
|
|
851
851
|
ringIndex: t,
|
|
852
852
|
pathProgress: l,
|
|
853
853
|
spinProgress: o === 1 ? 0 : f / (o - 1),
|
|
854
|
-
alignDir:
|
|
855
|
-
alignUp:
|
|
854
|
+
alignDir: K(e, u.tangentAngle, !0),
|
|
855
|
+
alignUp: q(e, !0)
|
|
856
856
|
});
|
|
857
857
|
}
|
|
858
858
|
}
|
|
@@ -873,7 +873,7 @@ function Ze(e) {
|
|
|
873
873
|
ringIndex: 0,
|
|
874
874
|
pathProgress: t,
|
|
875
875
|
spinProgress: t,
|
|
876
|
-
alignDir:
|
|
876
|
+
alignDir: ct(p, m, h)
|
|
877
877
|
});
|
|
878
878
|
}
|
|
879
879
|
return a;
|
|
@@ -881,7 +881,7 @@ function Ze(e) {
|
|
|
881
881
|
function Qe(e) {
|
|
882
882
|
let { pathInstanceCount: t, pathRadius: n, pathLength: r } = e, i = [], a = Math.max(1, Math.round(t)), o = Math.max(1e-4, r), s = o * .35, c = -o, l = s - c;
|
|
883
883
|
for (let t = 0; t < a; t += 1) {
|
|
884
|
-
let r = a === 1 ? 0 : t / a, o = Math.sqrt(st(t, 1)) * n, s = st(t, 2) * Math.PI * 2, u = st(t, 3), d =
|
|
884
|
+
let r = a === 1 ? 0 : t / a, o = Math.sqrt(st(t, 1)) * n, s = st(t, 2) * Math.PI * 2, u = st(t, 3), d = G(e, Math.cos(s) * o, (st(t, 4) * 2 - 1) * n, c + u * l), f = Math.sqrt(d.x * d.x + d.y * d.y + d.z * d.z);
|
|
885
885
|
i.push({
|
|
886
886
|
x: d.x,
|
|
887
887
|
z: d.z,
|
|
@@ -903,7 +903,7 @@ function $e(e) {
|
|
|
903
903
|
for (let t = 0; t < a; t += 1) {
|
|
904
904
|
let s = U(e, t, a), c = at(e, t);
|
|
905
905
|
for (let a = 0; a < i; a += 1) {
|
|
906
|
-
let l = i === 1 ? 0 : W(a / (i - 1) + c), u = it(e, l), d =
|
|
906
|
+
let l = i === 1 ? 0 : W(a / (i - 1) + c), u = it(e, l), d = G(e, u.x, s, u.z), f = t * i + a;
|
|
907
907
|
r.push({
|
|
908
908
|
x: d.x,
|
|
909
909
|
z: d.z,
|
|
@@ -915,8 +915,8 @@ function $e(e) {
|
|
|
915
915
|
ringIndex: t,
|
|
916
916
|
pathProgress: l,
|
|
917
917
|
spinProgress: o === 1 ? 0 : f / (o - 1),
|
|
918
|
-
alignDir:
|
|
919
|
-
alignUp:
|
|
918
|
+
alignDir: K(e, u.tangentAngle, !0),
|
|
919
|
+
alignUp: q(e, !0)
|
|
920
920
|
});
|
|
921
921
|
}
|
|
922
922
|
}
|
|
@@ -989,24 +989,24 @@ function st(e, t) {
|
|
|
989
989
|
let n = Math.sin((e + 1) * 12.9898 + t * 78.233) * 43758.5453;
|
|
990
990
|
return n - Math.floor(n);
|
|
991
991
|
}
|
|
992
|
-
function
|
|
992
|
+
function G(e, t, n, r) {
|
|
993
993
|
return new u.Vector3(t, n, r).applyEuler(new u.Euler(e.pathOrientationX, e.pathOrientationY, e.pathOrientationZ));
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function K(e, t, n) {
|
|
996
996
|
let r = Math.cos(t), i = Math.sin(t);
|
|
997
997
|
if (!n) return {
|
|
998
998
|
x: r,
|
|
999
999
|
y: 0,
|
|
1000
1000
|
z: i
|
|
1001
1001
|
};
|
|
1002
|
-
let a =
|
|
1002
|
+
let a = G(e, r, 0, i);
|
|
1003
1003
|
return {
|
|
1004
1004
|
x: a.x,
|
|
1005
1005
|
y: a.y,
|
|
1006
1006
|
z: a.z
|
|
1007
1007
|
};
|
|
1008
1008
|
}
|
|
1009
|
-
function
|
|
1009
|
+
function ct(e, t, n) {
|
|
1010
1010
|
let r = Math.hypot(e, t, n);
|
|
1011
1011
|
return r < 1e-6 ? null : {
|
|
1012
1012
|
x: e / r,
|
|
@@ -1014,13 +1014,13 @@ function lt(e, t, n) {
|
|
|
1014
1014
|
z: n / r
|
|
1015
1015
|
};
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1017
|
+
function q(e, t) {
|
|
1018
1018
|
if (!t) return {
|
|
1019
1019
|
x: 0,
|
|
1020
1020
|
y: 1,
|
|
1021
1021
|
z: 0
|
|
1022
1022
|
};
|
|
1023
|
-
let n =
|
|
1023
|
+
let n = G(e, 0, 1, 0);
|
|
1024
1024
|
return {
|
|
1025
1025
|
x: n.x,
|
|
1026
1026
|
y: n.y,
|
|
@@ -1029,7 +1029,7 @@ function K(e, t) {
|
|
|
1029
1029
|
}
|
|
1030
1030
|
//#endregion
|
|
1031
1031
|
//#region src/motion/easing.ts
|
|
1032
|
-
var
|
|
1032
|
+
var J = "0.00, 1.00, 0.00, 1.00", lt = "ease-out", ut = {
|
|
1033
1033
|
"ease-in": {
|
|
1034
1034
|
x1: .42,
|
|
1035
1035
|
y1: 0,
|
|
@@ -1049,67 +1049,67 @@ var q = "0.00, 1.00, 0.00, 1.00", ut = "ease-out", dt = {
|
|
|
1049
1049
|
y2: 1
|
|
1050
1050
|
}
|
|
1051
1051
|
};
|
|
1052
|
-
function
|
|
1052
|
+
function dt(e, t = lt) {
|
|
1053
1053
|
return e === "linear" || e === "ease-in" || e === "ease-out" || e === "ease-in-out" || e === "custom-bezier" ? e : t;
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1056
|
-
return typeof e == "string" &&
|
|
1055
|
+
function ft(e, t = J) {
|
|
1056
|
+
return typeof e == "string" && pt(e) ? e.trim() : t;
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function pt(e) {
|
|
1059
1059
|
let t = e.trim().replace(/^cubic-bezier\(/i, "").replace(/^\(/, "").replace(/\)$/, "").split(",").map((e) => Number(e.trim()));
|
|
1060
1060
|
if (t.length !== 4 || t.some((e) => !Number.isFinite(e))) return null;
|
|
1061
1061
|
let [n, r, i, a] = t;
|
|
1062
1062
|
return {
|
|
1063
|
-
x1:
|
|
1063
|
+
x1: yt(n),
|
|
1064
1064
|
y1: r,
|
|
1065
|
-
x2:
|
|
1065
|
+
x2: yt(i),
|
|
1066
1066
|
y2: a
|
|
1067
1067
|
};
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let r =
|
|
1069
|
+
function mt(e, t, n = J) {
|
|
1070
|
+
let r = yt(e);
|
|
1071
1071
|
if (t === "linear") return r;
|
|
1072
1072
|
if (t === "custom-bezier") {
|
|
1073
|
-
let e =
|
|
1074
|
-
if (e) return
|
|
1073
|
+
let e = pt(n);
|
|
1074
|
+
if (e) return gt(e.x1, e.y1, e.x2, e.y2, r);
|
|
1075
1075
|
}
|
|
1076
|
-
let i = t === "ease-in" || t === "ease-in-out" ?
|
|
1077
|
-
return
|
|
1076
|
+
let i = t === "ease-in" || t === "ease-in-out" ? ut[t] : ut["ease-out"];
|
|
1077
|
+
return gt(i.x1, i.y1, i.x2, i.y2, r);
|
|
1078
1078
|
}
|
|
1079
|
-
function
|
|
1080
|
-
return
|
|
1079
|
+
function ht(e, t, n = J) {
|
|
1080
|
+
return bt(mt((bt(e) + 1) / 2, t, n) * 2 - 1);
|
|
1081
1081
|
}
|
|
1082
|
-
function
|
|
1082
|
+
function gt(e, t, n, r, i) {
|
|
1083
1083
|
let a = i;
|
|
1084
1084
|
for (let t = 0; t < 5; t += 1) {
|
|
1085
|
-
let t =
|
|
1085
|
+
let t = _t(a, e, n), r = vt(a, e, n);
|
|
1086
1086
|
if (Math.abs(r) < 1e-4) break;
|
|
1087
|
-
a =
|
|
1087
|
+
a = yt(a - (t - i) / r);
|
|
1088
1088
|
}
|
|
1089
|
-
return
|
|
1089
|
+
return yt(_t(a, t, r));
|
|
1090
1090
|
}
|
|
1091
|
-
function
|
|
1091
|
+
function _t(e, t, n) {
|
|
1092
1092
|
let r = 1 - e;
|
|
1093
1093
|
return 3 * r * r * e * t + 3 * r * e * e * n + e * e * e;
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function vt(e, t, n) {
|
|
1096
1096
|
let r = 1 - e;
|
|
1097
1097
|
return 3 * r * r * t + 6 * r * e * (n - t) + 3 * e * e * (1 - n);
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function yt(e) {
|
|
1100
1100
|
return Math.min(1, Math.max(0, e));
|
|
1101
1101
|
}
|
|
1102
|
-
function
|
|
1102
|
+
function bt(e) {
|
|
1103
1103
|
return Math.min(1, Math.max(-1, e));
|
|
1104
1104
|
}
|
|
1105
1105
|
//#endregion
|
|
1106
1106
|
//#region src/distribution/animateLayouts.ts
|
|
1107
|
-
function
|
|
1108
|
-
return St(
|
|
1107
|
+
function xt({ layout: e, settings: t, pathTravelProgress: n, ringOrbitProgress: r }) {
|
|
1108
|
+
return Ct(St(e, t, n), t, r);
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1110
|
+
function St(e, t, n) {
|
|
1111
1111
|
if (t.distributionMode === "starfield") {
|
|
1112
|
-
let r = Math.max(1e-4, t.pathLength), i = r * .35, a = -r, o = i - a, s =
|
|
1112
|
+
let r = Math.max(1e-4, t.pathLength), i = r * .35, a = -r, o = i - a, s = Et(e, t, n, e.pathProgress), c = a + s * o, l = t.starfieldCenter ?? new u.Vector3(0, 0, 0), d = t.starfieldRight ?? Dt(t, 1, 0, 0).normalize(), f = t.starfieldUp ?? Dt(t, 0, 1, 0).normalize(), p = t.starfieldForward ?? Dt(t, 0, 0, 1).normalize(), m = Math.max(0, Math.round(e.gridX)), h = Math.sqrt(Ot(m, 1)) * t.pathRadius, g = Ot(m, 2) * Math.PI * 2, _ = Math.cos(g) * h, v = (Ot(m, 4) * 2 - 1) * t.pathRadius, y = l.clone().addScaledVector(d, _).addScaledVector(f, v).addScaledVector(p, c);
|
|
1113
1113
|
return {
|
|
1114
1114
|
...e,
|
|
1115
1115
|
x: y.x,
|
|
@@ -1121,7 +1121,7 @@ function xt(e, t, n) {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
if (n === 0) return e;
|
|
1123
1123
|
if (t.distributionMode === "ring-path") {
|
|
1124
|
-
let r =
|
|
1124
|
+
let r = Et(e, t, n, e.pathProgress), i = r * Math.PI * 2, a = Math.cos(i) * t.pathRadius, o = Math.sin(i) * t.pathRadius, s = Dt(t, a, U(t, e.gridZ, H(t)), o), c = t.alignToPath ? i + Math.PI / 2 : 0;
|
|
1125
1125
|
return {
|
|
1126
1126
|
...e,
|
|
1127
1127
|
x: s.x,
|
|
@@ -1129,12 +1129,12 @@ function xt(e, t, n) {
|
|
|
1129
1129
|
z: s.z,
|
|
1130
1130
|
angle: c,
|
|
1131
1131
|
pathProgress: r,
|
|
1132
|
-
alignDir:
|
|
1133
|
-
alignUp:
|
|
1132
|
+
alignDir: K(t, i + Math.PI / 2, !0),
|
|
1133
|
+
alignUp: q(t, !0)
|
|
1134
1134
|
};
|
|
1135
1135
|
}
|
|
1136
1136
|
if (t.distributionMode === "line-path") {
|
|
1137
|
-
let r =
|
|
1137
|
+
let r = Et(e, t, n, e.pathProgress), i = tt(t, r), a = U(t, e.gridZ, H(t)), o = Dt(t, i.x, a, i.z), s = t.alignToPath ? t.pathAngle + i.tangentAngle : 0;
|
|
1138
1138
|
return {
|
|
1139
1139
|
...e,
|
|
1140
1140
|
x: o.x,
|
|
@@ -1142,12 +1142,12 @@ function xt(e, t, n) {
|
|
|
1142
1142
|
z: o.z,
|
|
1143
1143
|
angle: s,
|
|
1144
1144
|
pathProgress: r,
|
|
1145
|
-
alignDir:
|
|
1146
|
-
alignUp:
|
|
1145
|
+
alignDir: K(t, t.pathAngle + i.tangentAngle, !0),
|
|
1146
|
+
alignUp: q(t, !0)
|
|
1147
1147
|
};
|
|
1148
1148
|
}
|
|
1149
1149
|
if (t.distributionMode === "spiral-path") {
|
|
1150
|
-
let r =
|
|
1150
|
+
let r = Et(e, t, n, e.pathProgress), i = nt(t, r), a = U(t, e.gridZ, H(t)), o = Dt(t, i.x, a, i.z), s = t.alignToPath ? i.tangentAngle : 0;
|
|
1151
1151
|
return {
|
|
1152
1152
|
...e,
|
|
1153
1153
|
x: o.x,
|
|
@@ -1155,12 +1155,12 @@ function xt(e, t, n) {
|
|
|
1155
1155
|
z: o.z,
|
|
1156
1156
|
angle: s,
|
|
1157
1157
|
pathProgress: r,
|
|
1158
|
-
alignDir:
|
|
1159
|
-
alignUp:
|
|
1158
|
+
alignDir: K(t, i.tangentAngle, !0),
|
|
1159
|
+
alignUp: q(t, !0)
|
|
1160
1160
|
};
|
|
1161
1161
|
}
|
|
1162
1162
|
if (t.distributionMode === "spline-path") {
|
|
1163
|
-
let r =
|
|
1163
|
+
let r = Et(e, t, n, e.pathProgress), i = it(t, r), a = U(t, e.gridZ, H(t)), o = Dt(t, i.x, a, i.z), s = t.alignToPath ? i.tangentAngle : 0;
|
|
1164
1164
|
return {
|
|
1165
1165
|
...e,
|
|
1166
1166
|
x: o.x,
|
|
@@ -1168,60 +1168,60 @@ function xt(e, t, n) {
|
|
|
1168
1168
|
z: o.z,
|
|
1169
1169
|
angle: s,
|
|
1170
1170
|
pathProgress: r,
|
|
1171
|
-
alignDir:
|
|
1172
|
-
alignUp:
|
|
1171
|
+
alignDir: K(t, i.tangentAngle, !0),
|
|
1172
|
+
alignUp: q(t, !0)
|
|
1173
1173
|
};
|
|
1174
1174
|
}
|
|
1175
1175
|
return e;
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1177
|
+
function Ct(e, t, n) {
|
|
1178
1178
|
if (t.distributionMode !== "rings" || e.ringIndex === 0 || n === 0) return e;
|
|
1179
|
-
let r = Math.max(1, Math.round(t.ringCount)), i = Math.max(1, r), a = e.ringIndex / i, o =
|
|
1179
|
+
let r = Math.max(1, Math.round(t.ringCount)), i = Math.max(1, r), a = e.ringIndex / i, o = Et(e, t, n * (1 - u.MathUtils.clamp(t.ringOrbitFriction, 0, 4) * a), e.pathProgress) * Math.PI * 2, s = e.ringIndex * t.ringSpacing;
|
|
1180
1180
|
return {
|
|
1181
1181
|
...e,
|
|
1182
1182
|
x: Math.cos(o) * s,
|
|
1183
1183
|
z: Math.sin(o) * s,
|
|
1184
1184
|
angle: o,
|
|
1185
|
-
alignDir:
|
|
1186
|
-
alignUp:
|
|
1185
|
+
alignDir: K(t, o + Math.PI / 2, !1),
|
|
1186
|
+
alignUp: q(t, !1)
|
|
1187
1187
|
};
|
|
1188
1188
|
}
|
|
1189
|
-
var
|
|
1189
|
+
var wt = new Set([
|
|
1190
1190
|
"line-path",
|
|
1191
1191
|
"spiral-path",
|
|
1192
1192
|
"spline-path"
|
|
1193
1193
|
]);
|
|
1194
|
-
function
|
|
1195
|
-
if (!
|
|
1194
|
+
function Tt(e, t) {
|
|
1195
|
+
if (!wt.has(e.distributionMode)) return t;
|
|
1196
1196
|
let n = Math.max(1, Math.round(e.pathInstanceCount));
|
|
1197
1197
|
return n <= 1 ? t : t * ((n - 1) / n);
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1200
|
-
let i =
|
|
1201
|
-
if (t.pathTravelMode !== "stepped") return
|
|
1199
|
+
function Et(e, t, n, r) {
|
|
1200
|
+
let i = Tt(t, r);
|
|
1201
|
+
if (t.pathTravelMode !== "stepped") return kt(i + n);
|
|
1202
1202
|
let a = Math.max(.001, t.pathTravelStepInterval ?? 1), o = Math.max(0, Math.min(a, t.pathTravelStepDuration ?? .25)), s = t.pathTravelStepDistance ?? .1, c = Math.max(0, t.pathTravelStepStagger ?? 0), l = n - (Number.isFinite(e.spinProgress) ? e.spinProgress : r) * c, d = Math.floor(l / a), f = l - d * a;
|
|
1203
|
-
return
|
|
1203
|
+
return kt(i + (d + mt(o <= 0 ? 1 : u.MathUtils.clamp(f / o, 0, 1), t.pathTravelStepEasing ?? "ease-out", t.pathTravelStepCustomBezier ?? "0.00, 1.00, 0.00, 1.00")) * s);
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function Dt(e, t, n, r) {
|
|
1206
1206
|
return new u.Vector3(t, n, r).applyEuler(new u.Euler(e.pathOrientationX, e.pathOrientationY, e.pathOrientationZ));
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function Ot(e, t) {
|
|
1209
1209
|
let n = Math.sin((e + 1) * 12.9898 + t * 78.233) * 43758.5453;
|
|
1210
1210
|
return n - Math.floor(n);
|
|
1211
1211
|
}
|
|
1212
|
-
function
|
|
1212
|
+
function kt(e) {
|
|
1213
1213
|
return (e % 1 + 1) % 1;
|
|
1214
1214
|
}
|
|
1215
1215
|
//#endregion
|
|
1216
1216
|
//#region node_modules/three/examples/jsm/geometries/RoundedBoxGeometry.js
|
|
1217
|
-
var
|
|
1218
|
-
function
|
|
1217
|
+
var At = new T();
|
|
1218
|
+
function Y(e, t, n, r, i, a) {
|
|
1219
1219
|
let o = 2 * Math.PI * i / 4, s = Math.max(a - 2 * i, 0), c = Math.PI / 4;
|
|
1220
|
-
|
|
1221
|
-
let l = .5 * o / (o + s), u = 1 -
|
|
1222
|
-
return Math.sign(
|
|
1220
|
+
At.copy(t), At[r] = 0, At.normalize();
|
|
1221
|
+
let l = .5 * o / (o + s), u = 1 - At.angleTo(e) / c;
|
|
1222
|
+
return Math.sign(At[n]) === 1 ? u * l : s / (o + s) + l + l * (1 - u);
|
|
1223
1223
|
}
|
|
1224
|
-
var
|
|
1224
|
+
var jt = class e extends f {
|
|
1225
1225
|
constructor(e = 1, t = 1, n = 1, r = 2, i = .1) {
|
|
1226
1226
|
let a = r * 2 + 1;
|
|
1227
1227
|
if (i = Math.min(e / 2, t / 2, n / 2, i), super(1, 1, 1, a, a, a), this.type = "RoundedBoxGeometry", this.parameters = {
|
|
@@ -1236,22 +1236,22 @@ var At = class e extends f {
|
|
|
1236
1236
|
let s = new T(), c = new T(), l = new T(e, t, n).divideScalar(2).subScalar(i), u = this.attributes.position.array, d = this.attributes.normal.array, f = this.attributes.uv.array, p = u.length / 6, m = new T(), h = .5 / a;
|
|
1237
1237
|
for (let r = 0, a = 0; r < u.length; r += 3, a += 2) switch (s.fromArray(u, r), c.copy(s), c.x -= Math.sign(c.x) * h, c.y -= Math.sign(c.y) * h, c.z -= Math.sign(c.z) * h, c.normalize(), u[r + 0] = l.x * Math.sign(s.x) + c.x * i, u[r + 1] = l.y * Math.sign(s.y) + c.y * i, u[r + 2] = l.z * Math.sign(s.z) + c.z * i, d[r + 0] = c.x, d[r + 1] = c.y, d[r + 2] = c.z, Math.floor(r / p)) {
|
|
1238
1238
|
case 0:
|
|
1239
|
-
m.set(1, 0, 0), f[a + 0] =
|
|
1239
|
+
m.set(1, 0, 0), f[a + 0] = Y(m, c, "z", "y", i, n), f[a + 1] = 1 - Y(m, c, "y", "z", i, t);
|
|
1240
1240
|
break;
|
|
1241
1241
|
case 1:
|
|
1242
|
-
m.set(-1, 0, 0), f[a + 0] = 1 -
|
|
1242
|
+
m.set(-1, 0, 0), f[a + 0] = 1 - Y(m, c, "z", "y", i, n), f[a + 1] = 1 - Y(m, c, "y", "z", i, t);
|
|
1243
1243
|
break;
|
|
1244
1244
|
case 2:
|
|
1245
|
-
m.set(0, 1, 0), f[a + 0] = 1 -
|
|
1245
|
+
m.set(0, 1, 0), f[a + 0] = 1 - Y(m, c, "x", "z", i, e), f[a + 1] = Y(m, c, "z", "x", i, n);
|
|
1246
1246
|
break;
|
|
1247
1247
|
case 3:
|
|
1248
|
-
m.set(0, -1, 0), f[a + 0] = 1 -
|
|
1248
|
+
m.set(0, -1, 0), f[a + 0] = 1 - Y(m, c, "x", "z", i, e), f[a + 1] = 1 - Y(m, c, "z", "x", i, n);
|
|
1249
1249
|
break;
|
|
1250
1250
|
case 4:
|
|
1251
|
-
m.set(0, 0, 1), f[a + 0] = 1 -
|
|
1251
|
+
m.set(0, 0, 1), f[a + 0] = 1 - Y(m, c, "x", "y", i, e), f[a + 1] = 1 - Y(m, c, "y", "x", i, t);
|
|
1252
1252
|
break;
|
|
1253
1253
|
case 5:
|
|
1254
|
-
m.set(0, 0, -1), f[a + 0] =
|
|
1254
|
+
m.set(0, 0, -1), f[a + 0] = Y(m, c, "x", "y", i, e), f[a + 1] = 1 - Y(m, c, "y", "x", i, t);
|
|
1255
1255
|
break;
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
@@ -1261,7 +1261,7 @@ var At = class e extends f {
|
|
|
1261
1261
|
};
|
|
1262
1262
|
//#endregion
|
|
1263
1263
|
//#region src/instance/createInstanceGeometry.ts
|
|
1264
|
-
function
|
|
1264
|
+
function Mt(e) {
|
|
1265
1265
|
return e === "low" ? {
|
|
1266
1266
|
radial: 12,
|
|
1267
1267
|
sphereWidth: 16,
|
|
@@ -1291,9 +1291,9 @@ function jt(e) {
|
|
|
1291
1291
|
roundedCardCurve: 12
|
|
1292
1292
|
};
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1295
|
-
let { instanceShape: a } = t, { scaleX: o, scaleY: s, scaleZ: c } = e(t), l =
|
|
1296
|
-
if (a === "custom-obj") return n ?
|
|
1294
|
+
function Nt({ settings: t, customObjGeometry: n, customSvgGeometry: r, textGeometry: i }) {
|
|
1295
|
+
let { instanceShape: a } = t, { scaleX: o, scaleY: s, scaleZ: c } = e(t), l = Mt(t.geometryDetail);
|
|
1296
|
+
if (a === "custom-obj") return n ? Ft(n.clone(), o, s, c) : new u.BoxGeometry(o, s, c);
|
|
1297
1297
|
if (a === "svg") {
|
|
1298
1298
|
let e = r?.clone() ?? new u.BoxGeometry(o, s, c);
|
|
1299
1299
|
return r && (e.scale(o, c, t.svgSolidify ? s : 1), e.rotateX(-Math.PI / 2), e.computeVertexNormals(), e.computeBoundingBox(), e.computeBoundingSphere()), e;
|
|
@@ -1302,19 +1302,19 @@ function Mt({ settings: t, customObjGeometry: n, customSvgGeometry: r, textGeome
|
|
|
1302
1302
|
let e = new u.PlaneGeometry(o, c);
|
|
1303
1303
|
return e.rotateX(-Math.PI / 2), e;
|
|
1304
1304
|
}
|
|
1305
|
-
if (a === "cylinder") return
|
|
1306
|
-
if (a === "sphere") return
|
|
1305
|
+
if (a === "cylinder") return Ft(new u.CylinderGeometry(.5, .5, 1, l.radial, 1), o, s, c);
|
|
1306
|
+
if (a === "sphere") return Ft(new u.SphereGeometry(.5, l.sphereWidth, l.sphereHeight), o, s, c);
|
|
1307
1307
|
if (a === "pill") {
|
|
1308
1308
|
let e = Math.max(.01, Math.min(o, c)), t = Math.max(.01, s - e) / e;
|
|
1309
|
-
return
|
|
1309
|
+
return Ft(new u.CapsuleGeometry(.5, t, l.capsuleCap, l.radial), o, e, c);
|
|
1310
1310
|
}
|
|
1311
1311
|
if (a === "rounded-cube") {
|
|
1312
1312
|
let e = Math.min(o, s, c) * Math.min(.5, Math.max(0, t.roundedCardRadius));
|
|
1313
|
-
return new
|
|
1313
|
+
return new jt(o, s, c, l.roundedBoxSegments, e);
|
|
1314
1314
|
}
|
|
1315
|
-
return a === "text" ? i ? i.createTextGeometry(t, i.textFonts, l) : new u.BoxGeometry(o, s, c) : a === "cone" ?
|
|
1315
|
+
return a === "text" ? i ? i.createTextGeometry(t, i.textFonts, l) : new u.BoxGeometry(o, s, c) : a === "cone" ? Ft(new u.ConeGeometry(.5, 1, l.radial, 1), o, s, c) : a === "torus" ? Ft(new u.TorusGeometry(.38, .12, l.torusRadial, l.torusTubular), o, s, c) : a === "rounded-card" ? Pt(t, l) : new u.BoxGeometry(o, s, c);
|
|
1316
1316
|
}
|
|
1317
|
-
function
|
|
1317
|
+
function Pt(t, n) {
|
|
1318
1318
|
let { scaleX: r, scaleY: i, scaleZ: a } = e(t), o = t.roundedCardAxis, s, c, l;
|
|
1319
1319
|
o === "z" ? (s = r, c = i, l = a) : o === "x" ? (s = a, c = i, l = r) : (s = r, c = a, l = i);
|
|
1320
1320
|
let d = Math.min(s, c) * Math.min(.5, Math.max(0, t.roundedCardRadius)), f = s * .5, p = c * .5, m = new u.Shape();
|
|
@@ -1326,16 +1326,16 @@ function Nt(t, n) {
|
|
|
1326
1326
|
});
|
|
1327
1327
|
return h.center(), o === "y" ? h.rotateX(Math.PI / 2) : o === "x" && h.rotateY(Math.PI / 2), h;
|
|
1328
1328
|
}
|
|
1329
|
-
function
|
|
1329
|
+
function Ft(e, t, n, r) {
|
|
1330
1330
|
return e.scale(t, n, r), e;
|
|
1331
1331
|
}
|
|
1332
1332
|
//#endregion
|
|
1333
1333
|
//#region src/engine/Sinth.ts
|
|
1334
|
-
var
|
|
1334
|
+
var It = class extends Error {
|
|
1335
1335
|
constructor() {
|
|
1336
1336
|
super("Custom asset load was superseded by a newer load."), this.name = "StaleCustomAssetLoadError";
|
|
1337
1337
|
}
|
|
1338
|
-
},
|
|
1338
|
+
}, Lt = 20, Rt = Lt / Math.sqrt(3), X = 1e-4, zt = new u.Vector3(0, 1, 0), Z = 6, Bt = Z * 2, Vt = 3, Ht = "#FAFAFA", Ut = "#EBEBEB", Wt = 20, Gt = [
|
|
1339
1339
|
"gridSize",
|
|
1340
1340
|
"gridSpacing",
|
|
1341
1341
|
"gridLayers",
|
|
@@ -1360,7 +1360,7 @@ var Ft = class extends Error {
|
|
|
1360
1360
|
"pathOrientationZ",
|
|
1361
1361
|
"alignToPath",
|
|
1362
1362
|
"alignToPattern"
|
|
1363
|
-
],
|
|
1363
|
+
], Q = {
|
|
1364
1364
|
gridSize: B.gridSize,
|
|
1365
1365
|
instanceLimit: 2,
|
|
1366
1366
|
gridSpacing: B.gridSpacing,
|
|
@@ -1403,13 +1403,13 @@ var Ft = class extends Error {
|
|
|
1403
1403
|
orthographicView: "custom",
|
|
1404
1404
|
orthoScale: 150,
|
|
1405
1405
|
cameraFocalLength: 50,
|
|
1406
|
-
cameraDistance:
|
|
1407
|
-
cameraHeight:
|
|
1406
|
+
cameraDistance: Lt,
|
|
1407
|
+
cameraHeight: Rt,
|
|
1408
1408
|
cameraOrbitAngle: Math.PI / 4,
|
|
1409
|
-
cameraElevation: Math.asin(
|
|
1410
|
-
cameraPositionX:
|
|
1411
|
-
cameraPositionY:
|
|
1412
|
-
cameraPositionZ:
|
|
1409
|
+
cameraElevation: Math.asin(Rt / Lt),
|
|
1410
|
+
cameraPositionX: Rt,
|
|
1411
|
+
cameraPositionY: Rt,
|
|
1412
|
+
cameraPositionZ: Rt,
|
|
1413
1413
|
cameraTargetX: 0,
|
|
1414
1414
|
cameraTargetY: 0,
|
|
1415
1415
|
cameraTargetZ: 0,
|
|
@@ -1429,8 +1429,8 @@ var Ft = class extends Error {
|
|
|
1429
1429
|
pathTravelStepDistance: .1,
|
|
1430
1430
|
pathTravelStepInterval: 1,
|
|
1431
1431
|
pathTravelStepDuration: .25,
|
|
1432
|
-
pathTravelStepEasing:
|
|
1433
|
-
pathTravelStepCustomBezier:
|
|
1432
|
+
pathTravelStepEasing: lt,
|
|
1433
|
+
pathTravelStepCustomBezier: J,
|
|
1434
1434
|
pathTravelStepStagger: 0,
|
|
1435
1435
|
ringOrbitSpeed: 0,
|
|
1436
1436
|
ringOrbitFriction: 0,
|
|
@@ -1439,13 +1439,13 @@ var Ft = class extends Error {
|
|
|
1439
1439
|
waveSpeed: 0,
|
|
1440
1440
|
easingMode: "linear",
|
|
1441
1441
|
easingStrength: 1,
|
|
1442
|
-
easingCustomBezier:
|
|
1442
|
+
easingCustomBezier: J,
|
|
1443
1443
|
fadeDuration: .3,
|
|
1444
|
-
fadeEasing:
|
|
1445
|
-
fadeCustomBezier:
|
|
1444
|
+
fadeEasing: lt,
|
|
1445
|
+
fadeCustomBezier: J,
|
|
1446
1446
|
pathEdgeFadeDuration: .3,
|
|
1447
|
-
pathEdgeFadeEasing:
|
|
1448
|
-
pathEdgeFadeCustomBezier:
|
|
1447
|
+
pathEdgeFadeEasing: lt,
|
|
1448
|
+
pathEdgeFadeCustomBezier: J,
|
|
1449
1449
|
buildFadeEnabled: !1,
|
|
1450
1450
|
buildSceneZoomEnabled: !1,
|
|
1451
1451
|
buildSceneZoomStartScale: .2,
|
|
@@ -1458,8 +1458,8 @@ var Ft = class extends Error {
|
|
|
1458
1458
|
buildRotateOffset: Math.PI,
|
|
1459
1459
|
buildDuration: 1,
|
|
1460
1460
|
buildDelay: 0,
|
|
1461
|
-
buildEasing:
|
|
1462
|
-
buildCustomBezier:
|
|
1461
|
+
buildEasing: lt,
|
|
1462
|
+
buildCustomBezier: J,
|
|
1463
1463
|
staggerAmount: 0,
|
|
1464
1464
|
scaleMode: "constant",
|
|
1465
1465
|
scaleAmount: 0,
|
|
@@ -1488,7 +1488,7 @@ var Ft = class extends Error {
|
|
|
1488
1488
|
backgroundGradientDirection: "y",
|
|
1489
1489
|
backgroundGradientMidpoint: .5,
|
|
1490
1490
|
backgroundGradientEasing: "linear",
|
|
1491
|
-
backgroundGradientCustomBezier:
|
|
1491
|
+
backgroundGradientCustomBezier: J,
|
|
1492
1492
|
backgroundGradientColorA: "#050505",
|
|
1493
1493
|
backgroundGradientColorB: "#3fc6ff",
|
|
1494
1494
|
backgroundImageUrl: "",
|
|
@@ -1499,7 +1499,7 @@ var Ft = class extends Error {
|
|
|
1499
1499
|
gradientDirection: "x",
|
|
1500
1500
|
gradientMidpoint: .5,
|
|
1501
1501
|
gradientEasing: "linear",
|
|
1502
|
-
gradientCustomBezier:
|
|
1502
|
+
gradientCustomBezier: J,
|
|
1503
1503
|
gradientColorA: "#3fc6ff",
|
|
1504
1504
|
gradientColorB: "#f26df9",
|
|
1505
1505
|
materialTextureUrl: "",
|
|
@@ -1526,8 +1526,8 @@ var Ft = class extends Error {
|
|
|
1526
1526
|
renderPixelRatio: F.renderer.maxPixelRatio,
|
|
1527
1527
|
roughness: .72,
|
|
1528
1528
|
metalness: .02
|
|
1529
|
-
},
|
|
1530
|
-
function
|
|
1529
|
+
}, Kt = 26, qt = 26;
|
|
1530
|
+
function Jt(e) {
|
|
1531
1531
|
return {
|
|
1532
1532
|
instance: {
|
|
1533
1533
|
shape: e.instanceShape,
|
|
@@ -1706,40 +1706,40 @@ function qt(e) {
|
|
|
1706
1706
|
}
|
|
1707
1707
|
};
|
|
1708
1708
|
}
|
|
1709
|
-
function Jt(e) {
|
|
1710
|
-
return e === "surface" ? "surface" : $.edgeCompositing;
|
|
1711
|
-
}
|
|
1712
1709
|
function Yt(e) {
|
|
1713
|
-
return e === "
|
|
1710
|
+
return e === "surface" ? "surface" : Q.edgeCompositing;
|
|
1714
1711
|
}
|
|
1715
|
-
function Xt(e
|
|
1716
|
-
return e === "
|
|
1712
|
+
function Xt(e) {
|
|
1713
|
+
return e === "gradient" || e === "texture" ? e : Q.colorMode;
|
|
1717
1714
|
}
|
|
1718
|
-
function Zt(e) {
|
|
1719
|
-
return e === "
|
|
1715
|
+
function Zt(e, t) {
|
|
1716
|
+
return e === "transparent" ? "transparent" : e === "gradient" || e === "image" || e === "solid" ? e === "image" && !t ? Q.backgroundMode : e : t ? "image" : Q.backgroundMode;
|
|
1720
1717
|
}
|
|
1721
1718
|
function Qt(e) {
|
|
1722
|
-
return e === "
|
|
1719
|
+
return e === "object" ? "object" : Q.gradientScope;
|
|
1723
1720
|
}
|
|
1724
1721
|
function $t(e) {
|
|
1725
|
-
return e === "
|
|
1722
|
+
return e === "x" || e === "radial" ? e : Q.backgroundGradientDirection;
|
|
1726
1723
|
}
|
|
1727
1724
|
function en(e) {
|
|
1728
|
-
return e === "
|
|
1725
|
+
return e === "fit" ? "fit" : Q.backgroundImageFit;
|
|
1729
1726
|
}
|
|
1730
1727
|
function tn(e) {
|
|
1731
|
-
return e === "
|
|
1728
|
+
return e === "y" || e === "z" || e === "radial" || e === "path" ? e : Q.gradientDirection;
|
|
1732
1729
|
}
|
|
1733
1730
|
function nn(e) {
|
|
1734
|
-
return e === "
|
|
1731
|
+
return e === "stretch" || e === "fit" || e === "repeat" ? e : Q.materialTextureFit;
|
|
1735
1732
|
}
|
|
1736
1733
|
function rn(e) {
|
|
1737
|
-
return e === "
|
|
1734
|
+
return e === "triplanar" ? e : Q.materialTextureProjection;
|
|
1738
1735
|
}
|
|
1739
1736
|
function an(e) {
|
|
1740
|
-
return e === "
|
|
1737
|
+
return e === "pattern" ? "pattern" : Q.materialTextureScope;
|
|
1738
|
+
}
|
|
1739
|
+
function on(e) {
|
|
1740
|
+
return e === "stepped" ? "stepped" : Q.pathTravelMode;
|
|
1741
1741
|
}
|
|
1742
|
-
var
|
|
1742
|
+
var sn = new Set([
|
|
1743
1743
|
"cube",
|
|
1744
1744
|
"cylinder",
|
|
1745
1745
|
"sphere",
|
|
@@ -1753,43 +1753,43 @@ var on = new Set([
|
|
|
1753
1753
|
"image",
|
|
1754
1754
|
"custom-obj"
|
|
1755
1755
|
]);
|
|
1756
|
-
function sn(e) {
|
|
1757
|
-
return typeof e == "string" && on.has(e) ? e : $.instanceShape;
|
|
1758
|
-
}
|
|
1759
1756
|
function cn(e) {
|
|
1760
|
-
return typeof e == "
|
|
1757
|
+
return typeof e == "string" && sn.has(e) ? e : Q.instanceShape;
|
|
1758
|
+
}
|
|
1759
|
+
function ln(e) {
|
|
1760
|
+
return typeof e == "number" && Number.isFinite(e) ? u.MathUtils.clamp(e, .01, .99) : Q.gradientMidpoint;
|
|
1761
1761
|
}
|
|
1762
|
-
function
|
|
1762
|
+
function un(e, t) {
|
|
1763
1763
|
if (typeof e != "string") return t;
|
|
1764
1764
|
let n = e.trim();
|
|
1765
1765
|
return /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.test(n) ? n : t;
|
|
1766
1766
|
}
|
|
1767
|
-
function un(e) {
|
|
1768
|
-
return e === "x" || e === "z" ? e : $.roundedCardAxis;
|
|
1769
|
-
}
|
|
1770
1767
|
function dn(e) {
|
|
1771
|
-
return e === "x" || e === "
|
|
1768
|
+
return e === "x" || e === "z" ? e : Q.roundedCardAxis;
|
|
1772
1769
|
}
|
|
1773
1770
|
function fn(e) {
|
|
1771
|
+
return e === "x" || e === "y" || e === "z" ? e : Q.buildRotateAxis;
|
|
1772
|
+
}
|
|
1773
|
+
function pn(e) {
|
|
1774
1774
|
return e === "ring-path" || e === "line-path" || e === "spiral-path" || e === "spline-path";
|
|
1775
1775
|
}
|
|
1776
|
-
function
|
|
1776
|
+
function mn(e, t, n) {
|
|
1777
1777
|
let r = e / 2, i = t / 2, a = Math.min(n, r, i), o = new u.Shape();
|
|
1778
1778
|
o.moveTo(-r + a, -i), o.lineTo(r - a, -i), o.quadraticCurveTo(r, -i, r, -i + a), o.lineTo(r, i - a), o.quadraticCurveTo(r, i, r - a, i), o.lineTo(-r + a, i), o.quadraticCurveTo(-r, i, -r, i - a), o.lineTo(-r, -i + a), o.quadraticCurveTo(-r, -i, -r + a, -i);
|
|
1779
1779
|
let s = new u.ShapeGeometry(o, 12), c = s.attributes.position, l = s.attributes.uv;
|
|
1780
1780
|
for (let n = 0; n < c.count; n += 1) l.setXY(n, (c.getX(n) + r) / e, (c.getY(n) + i) / t);
|
|
1781
1781
|
return l.needsUpdate = !0, s;
|
|
1782
1782
|
}
|
|
1783
|
-
function mn(e) {
|
|
1784
|
-
return e === "perspective" ? "perspective" : $.viewMode;
|
|
1785
|
-
}
|
|
1786
1783
|
function hn(e) {
|
|
1787
|
-
return e
|
|
1784
|
+
return e === "perspective" ? "perspective" : Q.viewMode;
|
|
1788
1785
|
}
|
|
1789
1786
|
function gn(e) {
|
|
1790
|
-
return
|
|
1787
|
+
return e ? e.orthographicView ?? Q.orthographicView : Q.orthographicView;
|
|
1791
1788
|
}
|
|
1792
1789
|
function _n(e) {
|
|
1790
|
+
return Array.isArray(e) ? e.map((e) => typeof e == "string" ? e.trim() : "").filter(Boolean).slice(0, Wt) : [];
|
|
1791
|
+
}
|
|
1792
|
+
function vn(e) {
|
|
1793
1793
|
return /^[a-z][a-z\d+.-]*:/i.test(e) ? e : e.split("/").map((e) => {
|
|
1794
1794
|
if (!e) return e;
|
|
1795
1795
|
try {
|
|
@@ -1799,9 +1799,9 @@ function _n(e) {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
}).join("/");
|
|
1801
1801
|
}
|
|
1802
|
-
function
|
|
1803
|
-
let t =
|
|
1804
|
-
distance: L(l?.distance,
|
|
1802
|
+
function yn(e) {
|
|
1803
|
+
let t = Jt(Q), n = e.instance ?? t.instance, i = e.distribution ?? t.distribution, o = e.motion ?? t.motion, c = e.view ?? t.view, l = c.camera ?? t.view.camera, u = Ne({
|
|
1804
|
+
distance: L(l?.distance, Q.cameraDistance, F.camera.distance),
|
|
1805
1805
|
azimuth: l?.azimuth,
|
|
1806
1806
|
elevation: l?.elevation,
|
|
1807
1807
|
target: l?.target ?? {}
|
|
@@ -1832,51 +1832,51 @@ function vn(e) {
|
|
|
1832
1832
|
pathOrientationZ: i.pathOrientationZ,
|
|
1833
1833
|
alignToPath: i.alignToPath
|
|
1834
1834
|
}), p = {
|
|
1835
|
-
scaleX: L(n.scaleX,
|
|
1836
|
-
scaleY: L(n.scaleY,
|
|
1837
|
-
scaleZ: L(n.scaleZ,
|
|
1838
|
-
}, m = r(n.textFontSource), h = L(n.roundedCardRadius,
|
|
1835
|
+
scaleX: L(n.scaleX, Q.scaleX, F.instance.dimension),
|
|
1836
|
+
scaleY: L(n.scaleY, Q.scaleY, F.instance.dimension),
|
|
1837
|
+
scaleZ: L(n.scaleZ, Q.scaleZ, F.instance.dimension)
|
|
1838
|
+
}, m = r(n.textFontSource), h = L(n.roundedCardRadius, Q.roundedCardRadius, F.instance.cornerRadius), g = L(n.imageCornerRadius, Q.imageCornerRadius, F.instance.cornerRadius), _ = L(n.textLineHeight, Q.textLineHeight, F.text.lineHeight), v = Math.round(L(n.textMaxLineLength, Q.textMaxLineLength, F.text.maxLineLength)), y = L(n.assetScale, Q.assetScale, F.instance.assetScale), b = L(n.imageAspectRatio, Q.imageAspectRatio, F.instance.aspectRatio), x = _n(n.imageSetUrls), ee = typeof c.backgroundImageUrl == "string" ? c.backgroundImageUrl.trim() : Q.backgroundImageUrl, S = typeof n.materialTextureUrl == "string" ? n.materialTextureUrl.trim() : Q.materialTextureUrl, C = L(c.orthoScale, Q.orthoScale, F.camera.orthographicScale), w = L(c.cameraFocalLength, Q.cameraFocalLength, F.camera.focalLength);
|
|
1839
1839
|
return {
|
|
1840
1840
|
gridSize: f.gridSize,
|
|
1841
|
-
instanceLimit: Math.round(L(i.instanceLimit,
|
|
1841
|
+
instanceLimit: Math.round(L(i.instanceLimit, Q.instanceLimit, F.distribution.instanceLimit)),
|
|
1842
1842
|
gridSpacing: f.gridSpacing,
|
|
1843
1843
|
gridLayers: f.gridLayers,
|
|
1844
1844
|
gridLayerSpacing: f.gridLayerSpacing,
|
|
1845
1845
|
ringSpacing: f.ringSpacing,
|
|
1846
1846
|
ringCount: f.ringCount,
|
|
1847
1847
|
ringDensity: f.ringDensity,
|
|
1848
|
-
instanceShape:
|
|
1848
|
+
instanceShape: cn(n.shape),
|
|
1849
1849
|
scaleX: p.scaleX,
|
|
1850
1850
|
scaleY: p.scaleY,
|
|
1851
1851
|
scaleZ: p.scaleZ,
|
|
1852
|
-
geometryDetail: n.detail ??
|
|
1853
|
-
roundedCardRatio: I(n.roundedCardRatio,
|
|
1852
|
+
geometryDetail: n.detail ?? Q.geometryDetail,
|
|
1853
|
+
roundedCardRatio: I(n.roundedCardRatio, Q.roundedCardRatio),
|
|
1854
1854
|
roundedCardRadius: h,
|
|
1855
|
-
roundedCardAxis:
|
|
1855
|
+
roundedCardAxis: dn(n.roundedCardAxis),
|
|
1856
1856
|
imageCornerRadius: g,
|
|
1857
|
-
textValue: n.textValue ??
|
|
1857
|
+
textValue: n.textValue ?? Q.textValue,
|
|
1858
1858
|
textFont: s(m),
|
|
1859
1859
|
textFontSource: m,
|
|
1860
1860
|
textCustomFontUrl: a(m),
|
|
1861
|
-
textSolidify: n.textSolidify ??
|
|
1862
|
-
svgSolidify: n.svgSolidify ??
|
|
1863
|
-
textLetterSpacing: I(n.textLetterSpacing,
|
|
1861
|
+
textSolidify: n.textSolidify ?? Q.textSolidify,
|
|
1862
|
+
svgSolidify: n.svgSolidify ?? Q.svgSolidify,
|
|
1863
|
+
textLetterSpacing: I(n.textLetterSpacing, Q.textLetterSpacing),
|
|
1864
1864
|
textLineHeight: _,
|
|
1865
1865
|
textMaxLineLength: v,
|
|
1866
|
-
assetUrl: n.assetUrl ??
|
|
1866
|
+
assetUrl: n.assetUrl ?? Q.assetUrl,
|
|
1867
1867
|
assetScale: y,
|
|
1868
|
-
assetNormalize: n.assetNormalize ??
|
|
1869
|
-
assetDoubleSided: n.assetDoubleSided ??
|
|
1868
|
+
assetNormalize: n.assetNormalize ?? Q.assetNormalize,
|
|
1869
|
+
assetDoubleSided: n.assetDoubleSided ?? Q.assetDoubleSided,
|
|
1870
1870
|
imageSetUrls: x,
|
|
1871
1871
|
imageAspectRatio: b,
|
|
1872
|
-
imagePreserveAspectRatio: n.imagePreserveAspectRatio ??
|
|
1873
|
-
baseY: I(n.baseY,
|
|
1874
|
-
groundAlign: n.groundAlign ??
|
|
1875
|
-
instanceRotationX: I(n.rotation?.x,
|
|
1876
|
-
instanceRotationY: I(n.rotation?.y,
|
|
1877
|
-
instanceRotationZ: I(n.rotation?.z,
|
|
1878
|
-
viewMode:
|
|
1879
|
-
orthographicView:
|
|
1872
|
+
imagePreserveAspectRatio: n.imagePreserveAspectRatio ?? Q.imagePreserveAspectRatio,
|
|
1873
|
+
baseY: I(n.baseY, Q.baseY),
|
|
1874
|
+
groundAlign: n.groundAlign ?? Q.groundAlign,
|
|
1875
|
+
instanceRotationX: I(n.rotation?.x, Q.instanceRotationX),
|
|
1876
|
+
instanceRotationY: I(n.rotation?.y, Q.instanceRotationY),
|
|
1877
|
+
instanceRotationZ: I(n.rotation?.z, Q.instanceRotationZ),
|
|
1878
|
+
viewMode: hn(c.viewMode),
|
|
1879
|
+
orthographicView: gn(c),
|
|
1880
1880
|
orthoScale: C,
|
|
1881
1881
|
cameraFocalLength: w,
|
|
1882
1882
|
cameraDistance: d.cameraDistance,
|
|
@@ -1890,65 +1890,65 @@ function vn(e) {
|
|
|
1890
1890
|
cameraTargetY: d.cameraTargetY,
|
|
1891
1891
|
cameraTargetZ: d.cameraTargetZ,
|
|
1892
1892
|
distributionMode: f.distributionMode,
|
|
1893
|
-
animationMode: o.mode ??
|
|
1894
|
-
instanceSpinX: I(o.instanceSpinX,
|
|
1895
|
-
instanceSpinY: I(o.instanceSpinY,
|
|
1896
|
-
instanceSpinZ: I(o.instanceSpinZ,
|
|
1897
|
-
instanceSpinStagger: I(o.instanceSpinStagger,
|
|
1898
|
-
instanceSpinStaggerMode: o.instanceSpinStaggerMode ??
|
|
1899
|
-
instanceSpinPhaseStagger: I(o.instanceSpinPhaseStagger,
|
|
1900
|
-
pathRotationX: I(o.pathRotationX,
|
|
1901
|
-
pathRotationY: I(o.pathRotationY,
|
|
1902
|
-
pathRotationZ: I(o.pathRotationZ,
|
|
1903
|
-
pathTravelMode:
|
|
1904
|
-
pathTravelSpeed: I(o.pathTravelSpeed,
|
|
1905
|
-
pathTravelStepDistance: I(o.pathTravelStepDistance,
|
|
1906
|
-
pathTravelStepInterval: L(o.pathTravelStepInterval,
|
|
1893
|
+
animationMode: o.mode ?? Q.animationMode,
|
|
1894
|
+
instanceSpinX: I(o.instanceSpinX, Q.instanceSpinX),
|
|
1895
|
+
instanceSpinY: I(o.instanceSpinY, Q.instanceSpinY),
|
|
1896
|
+
instanceSpinZ: I(o.instanceSpinZ, Q.instanceSpinZ),
|
|
1897
|
+
instanceSpinStagger: I(o.instanceSpinStagger, Q.instanceSpinStagger),
|
|
1898
|
+
instanceSpinStaggerMode: o.instanceSpinStaggerMode ?? Q.instanceSpinStaggerMode,
|
|
1899
|
+
instanceSpinPhaseStagger: I(o.instanceSpinPhaseStagger, Q.instanceSpinPhaseStagger),
|
|
1900
|
+
pathRotationX: I(o.pathRotationX, Q.pathRotationX),
|
|
1901
|
+
pathRotationY: I(o.pathRotationY, Q.pathRotationY),
|
|
1902
|
+
pathRotationZ: I(o.pathRotationZ, Q.pathRotationZ),
|
|
1903
|
+
pathTravelMode: on(o.pathTravelMode),
|
|
1904
|
+
pathTravelSpeed: I(o.pathTravelSpeed, Q.pathTravelSpeed),
|
|
1905
|
+
pathTravelStepDistance: I(o.pathTravelStepDistance, Q.pathTravelStepDistance),
|
|
1906
|
+
pathTravelStepInterval: L(o.pathTravelStepInterval, Q.pathTravelStepInterval, {
|
|
1907
1907
|
min: .001,
|
|
1908
1908
|
max: 60
|
|
1909
1909
|
}),
|
|
1910
|
-
pathTravelStepDuration: L(o.pathTravelStepDuration,
|
|
1910
|
+
pathTravelStepDuration: L(o.pathTravelStepDuration, Q.pathTravelStepDuration, {
|
|
1911
1911
|
min: 0,
|
|
1912
1912
|
max: 60
|
|
1913
1913
|
}),
|
|
1914
|
-
pathTravelStepEasing:
|
|
1915
|
-
pathTravelStepCustomBezier:
|
|
1916
|
-
pathTravelStepStagger: L(o.pathTravelStepStagger,
|
|
1914
|
+
pathTravelStepEasing: dt(o.pathTravelStepEasing, Q.pathTravelStepEasing),
|
|
1915
|
+
pathTravelStepCustomBezier: ft(o.pathTravelStepCustomBezier, Q.pathTravelStepCustomBezier),
|
|
1916
|
+
pathTravelStepStagger: L(o.pathTravelStepStagger, Q.pathTravelStepStagger, {
|
|
1917
1917
|
min: 0,
|
|
1918
1918
|
max: 60
|
|
1919
1919
|
}),
|
|
1920
|
-
ringOrbitSpeed: I(o.ringOrbitSpeed,
|
|
1921
|
-
ringOrbitFriction: L(o.ringOrbitFriction,
|
|
1922
|
-
waveAmplitude: I(o.waveAmplitude,
|
|
1923
|
-
waveFrequency: I(o.waveFrequency,
|
|
1924
|
-
waveSpeed: I(o.waveSpeed,
|
|
1925
|
-
easingMode:
|
|
1926
|
-
easingStrength: L(o.easingStrength,
|
|
1927
|
-
easingCustomBezier:
|
|
1928
|
-
fadeDuration: L(o.fadeDuration,
|
|
1929
|
-
fadeEasing:
|
|
1930
|
-
fadeCustomBezier:
|
|
1931
|
-
pathEdgeFadeDuration: L(o.pathEdgeFadeDuration,
|
|
1932
|
-
pathEdgeFadeEasing:
|
|
1933
|
-
pathEdgeFadeCustomBezier:
|
|
1934
|
-
buildFadeEnabled: o.buildFadeEnabled ??
|
|
1935
|
-
buildSceneZoomEnabled: o.buildSceneZoomEnabled ??
|
|
1936
|
-
buildSceneZoomStartScale: L(o.buildSceneZoomStartScale,
|
|
1937
|
-
buildZoomEnabled: o.buildZoomEnabled ??
|
|
1938
|
-
buildZoomStartScale: L(o.buildZoomStartScale,
|
|
1939
|
-
buildDropEnabled: o.buildDropEnabled ??
|
|
1940
|
-
buildDropOffsetY: I(o.buildDropOffsetY,
|
|
1941
|
-
buildRotateEnabled: o.buildRotateEnabled ??
|
|
1942
|
-
buildRotateAxis:
|
|
1943
|
-
buildRotateOffset: I(o.buildRotateOffset,
|
|
1944
|
-
buildDuration: L(o.buildDuration,
|
|
1945
|
-
buildDelay: L(o.buildDelay,
|
|
1946
|
-
buildEasing:
|
|
1947
|
-
buildCustomBezier:
|
|
1948
|
-
staggerAmount: I(o.staggerAmount,
|
|
1949
|
-
scaleMode: o.scaleMode ??
|
|
1950
|
-
scaleAmount: I(o.scaleAmount,
|
|
1951
|
-
ringSpacingFactor: I(i.ringSpacingFactor,
|
|
1920
|
+
ringOrbitSpeed: I(o.ringOrbitSpeed, Q.ringOrbitSpeed),
|
|
1921
|
+
ringOrbitFriction: L(o.ringOrbitFriction, Q.ringOrbitFriction, F.motion.ringOrbitFriction),
|
|
1922
|
+
waveAmplitude: I(o.waveAmplitude, Q.waveAmplitude),
|
|
1923
|
+
waveFrequency: I(o.waveFrequency, Q.waveFrequency),
|
|
1924
|
+
waveSpeed: I(o.waveSpeed, Q.waveSpeed),
|
|
1925
|
+
easingMode: dt(o.easingMode, Q.easingMode),
|
|
1926
|
+
easingStrength: L(o.easingStrength, Q.easingStrength, F.motion.easingStrength),
|
|
1927
|
+
easingCustomBezier: ft(o.easingCustomBezier, Q.easingCustomBezier),
|
|
1928
|
+
fadeDuration: L(o.fadeDuration, Q.fadeDuration, F.motion.fadeDuration),
|
|
1929
|
+
fadeEasing: dt(o.fadeEasing, Q.fadeEasing),
|
|
1930
|
+
fadeCustomBezier: ft(o.fadeCustomBezier, Q.fadeCustomBezier),
|
|
1931
|
+
pathEdgeFadeDuration: L(o.pathEdgeFadeDuration, Q.pathEdgeFadeDuration, F.motion.fadeDuration),
|
|
1932
|
+
pathEdgeFadeEasing: dt(o.pathEdgeFadeEasing, Q.pathEdgeFadeEasing),
|
|
1933
|
+
pathEdgeFadeCustomBezier: ft(o.pathEdgeFadeCustomBezier, Q.pathEdgeFadeCustomBezier),
|
|
1934
|
+
buildFadeEnabled: o.buildFadeEnabled ?? Q.buildFadeEnabled,
|
|
1935
|
+
buildSceneZoomEnabled: o.buildSceneZoomEnabled ?? Q.buildSceneZoomEnabled,
|
|
1936
|
+
buildSceneZoomStartScale: L(o.buildSceneZoomStartScale, Q.buildSceneZoomStartScale, F.motion.buildZoomStartScale),
|
|
1937
|
+
buildZoomEnabled: o.buildZoomEnabled ?? Q.buildZoomEnabled,
|
|
1938
|
+
buildZoomStartScale: L(o.buildZoomStartScale, Q.buildZoomStartScale, F.motion.buildZoomStartScale),
|
|
1939
|
+
buildDropEnabled: o.buildDropEnabled ?? Q.buildDropEnabled,
|
|
1940
|
+
buildDropOffsetY: I(o.buildDropOffsetY, Q.buildDropOffsetY),
|
|
1941
|
+
buildRotateEnabled: o.buildRotateEnabled ?? Q.buildRotateEnabled,
|
|
1942
|
+
buildRotateAxis: fn(o.buildRotateAxis),
|
|
1943
|
+
buildRotateOffset: I(o.buildRotateOffset, Q.buildRotateOffset),
|
|
1944
|
+
buildDuration: L(o.buildDuration, Q.buildDuration, F.motion.fadeDuration),
|
|
1945
|
+
buildDelay: L(o.buildDelay, Q.buildDelay, F.motion.fadeDuration),
|
|
1946
|
+
buildEasing: dt(o.buildEasing, Q.buildEasing),
|
|
1947
|
+
buildCustomBezier: ft(o.buildCustomBezier, Q.buildCustomBezier),
|
|
1948
|
+
staggerAmount: I(o.staggerAmount, Q.staggerAmount),
|
|
1949
|
+
scaleMode: o.scaleMode ?? Q.scaleMode,
|
|
1950
|
+
scaleAmount: I(o.scaleAmount, Q.scaleAmount),
|
|
1951
|
+
ringSpacingFactor: I(i.ringSpacingFactor, Q.ringSpacingFactor),
|
|
1952
1952
|
pathInstanceCount: f.pathInstanceCount,
|
|
1953
1953
|
pathRadius: f.pathRadius,
|
|
1954
1954
|
pathLength: f.pathLength,
|
|
@@ -1966,61 +1966,61 @@ function vn(e) {
|
|
|
1966
1966
|
pathOrientationY: f.pathOrientationY,
|
|
1967
1967
|
pathOrientationZ: f.pathOrientationZ,
|
|
1968
1968
|
alignToPath: f.alignToPath,
|
|
1969
|
-
alignToPattern: i.alignToPattern ??
|
|
1970
|
-
starfieldFaceCamera: i.starfieldFaceCamera ??
|
|
1971
|
-
backgroundColor:
|
|
1972
|
-
backgroundMode:
|
|
1973
|
-
backgroundGradientDirection:
|
|
1974
|
-
backgroundGradientMidpoint:
|
|
1975
|
-
backgroundGradientEasing:
|
|
1976
|
-
backgroundGradientCustomBezier:
|
|
1977
|
-
backgroundGradientColorA:
|
|
1978
|
-
backgroundGradientColorB:
|
|
1969
|
+
alignToPattern: i.alignToPattern ?? Q.alignToPattern,
|
|
1970
|
+
starfieldFaceCamera: i.starfieldFaceCamera ?? Q.starfieldFaceCamera,
|
|
1971
|
+
backgroundColor: un(c.backgroundColor, Q.backgroundColor),
|
|
1972
|
+
backgroundMode: Zt(c.backgroundMode, !!ee),
|
|
1973
|
+
backgroundGradientDirection: $t(c.backgroundGradientDirection),
|
|
1974
|
+
backgroundGradientMidpoint: ln(c.backgroundGradientMidpoint),
|
|
1975
|
+
backgroundGradientEasing: dt(c.backgroundGradientEasing, Q.backgroundGradientEasing),
|
|
1976
|
+
backgroundGradientCustomBezier: ft(c.backgroundGradientCustomBezier, Q.backgroundGradientCustomBezier),
|
|
1977
|
+
backgroundGradientColorA: un(c.backgroundGradientColorA, Q.backgroundGradientColorA),
|
|
1978
|
+
backgroundGradientColorB: un(c.backgroundGradientColorB, Q.backgroundGradientColorB),
|
|
1979
1979
|
backgroundImageUrl: ee,
|
|
1980
|
-
backgroundImageFit:
|
|
1981
|
-
objectColor:
|
|
1982
|
-
colorMode: S ?
|
|
1983
|
-
gradientScope:
|
|
1984
|
-
gradientDirection:
|
|
1985
|
-
gradientMidpoint:
|
|
1986
|
-
gradientEasing:
|
|
1987
|
-
gradientCustomBezier:
|
|
1988
|
-
gradientColorA:
|
|
1989
|
-
gradientColorB:
|
|
1980
|
+
backgroundImageFit: en(c.backgroundImageFit),
|
|
1981
|
+
objectColor: un(n.color, Q.objectColor),
|
|
1982
|
+
colorMode: S ? Xt(n.colorMode) : n.colorMode === "texture" ? Q.colorMode : Xt(n.colorMode),
|
|
1983
|
+
gradientScope: Qt(n.gradientScope),
|
|
1984
|
+
gradientDirection: tn(n.gradientDirection),
|
|
1985
|
+
gradientMidpoint: ln(n.gradientMidpoint),
|
|
1986
|
+
gradientEasing: dt(n.gradientEasing, Q.gradientEasing),
|
|
1987
|
+
gradientCustomBezier: ft(n.gradientCustomBezier, Q.gradientCustomBezier),
|
|
1988
|
+
gradientColorA: un(n.gradientColorA, Q.gradientColorA),
|
|
1989
|
+
gradientColorB: un(n.gradientColorB, Q.gradientColorB),
|
|
1990
1990
|
materialTextureUrl: S,
|
|
1991
|
-
materialTextureScope:
|
|
1992
|
-
materialTextureProjection:
|
|
1993
|
-
materialTextureFit:
|
|
1994
|
-
materialTextureRepeatX: I(n.materialTextureRepeatX,
|
|
1995
|
-
materialTextureRepeatY: I(n.materialTextureRepeatY,
|
|
1996
|
-
materialTextureOffsetX: I(n.materialTextureOffsetX,
|
|
1997
|
-
materialTextureOffsetY: I(n.materialTextureOffsetY,
|
|
1998
|
-
materialTextureRotation: I(n.materialTextureRotation,
|
|
1999
|
-
shadingMode: c.shadingMode ??
|
|
2000
|
-
silhouetteColor: c.silhouetteColor ?? c.outlineColor ??
|
|
2001
|
-
edgeColor: c.edgeColor ?? c.outlineColor ??
|
|
2002
|
-
outlineThickness: L(c.outlineThickness,
|
|
2003
|
-
edgeThickness: L(c.edgeThickness,
|
|
2004
|
-
outlineOpacity: L(c.outlineOpacity,
|
|
2005
|
-
outlineSeeThrough: c.outlineSeeThrough ??
|
|
2006
|
-
edgeCompositing:
|
|
2007
|
-
ambientIntensity: L(c.ambientIntensity,
|
|
2008
|
-
lightIntensity: L(c.lightIntensity,
|
|
2009
|
-
lightAzimuth: I(c.lightAzimuth,
|
|
2010
|
-
lightElevation: L(c.lightElevation,
|
|
2011
|
-
renderPixelRatio: L(c.renderPixelRatio,
|
|
2012
|
-
roughness: L(c.roughness,
|
|
2013
|
-
metalness: L(c.metalness,
|
|
1991
|
+
materialTextureScope: an(n.materialTextureScope),
|
|
1992
|
+
materialTextureProjection: rn(n.materialTextureProjection),
|
|
1993
|
+
materialTextureFit: nn(n.materialTextureFit),
|
|
1994
|
+
materialTextureRepeatX: I(n.materialTextureRepeatX, Q.materialTextureRepeatX),
|
|
1995
|
+
materialTextureRepeatY: I(n.materialTextureRepeatY, Q.materialTextureRepeatY),
|
|
1996
|
+
materialTextureOffsetX: I(n.materialTextureOffsetX, Q.materialTextureOffsetX),
|
|
1997
|
+
materialTextureOffsetY: I(n.materialTextureOffsetY, Q.materialTextureOffsetY),
|
|
1998
|
+
materialTextureRotation: I(n.materialTextureRotation, Q.materialTextureRotation),
|
|
1999
|
+
shadingMode: c.shadingMode ?? Q.shadingMode,
|
|
2000
|
+
silhouetteColor: c.silhouetteColor ?? c.outlineColor ?? Q.silhouetteColor,
|
|
2001
|
+
edgeColor: c.edgeColor ?? c.outlineColor ?? Q.edgeColor,
|
|
2002
|
+
outlineThickness: L(c.outlineThickness, Q.outlineThickness, F.render.thickness),
|
|
2003
|
+
edgeThickness: L(c.edgeThickness, Q.edgeThickness, F.render.thickness),
|
|
2004
|
+
outlineOpacity: L(c.outlineOpacity, Q.outlineOpacity, F.render.opacity),
|
|
2005
|
+
outlineSeeThrough: c.outlineSeeThrough ?? Q.outlineSeeThrough,
|
|
2006
|
+
edgeCompositing: Yt(c.edgeCompositing),
|
|
2007
|
+
ambientIntensity: L(c.ambientIntensity, Q.ambientIntensity, F.render.nonNegativeIntensity),
|
|
2008
|
+
lightIntensity: L(c.lightIntensity, Q.lightIntensity, F.render.nonNegativeIntensity),
|
|
2009
|
+
lightAzimuth: I(c.lightAzimuth, Q.lightAzimuth),
|
|
2010
|
+
lightElevation: L(c.lightElevation, Q.lightElevation, F.render.lightElevation),
|
|
2011
|
+
renderPixelRatio: L(c.renderPixelRatio, Q.renderPixelRatio, F.renderer.pixelRatio),
|
|
2012
|
+
roughness: L(c.roughness, Q.roughness, F.render.materialFactor),
|
|
2013
|
+
metalness: L(c.metalness, Q.metalness, F.render.materialFactor)
|
|
2014
2014
|
};
|
|
2015
2015
|
}
|
|
2016
|
-
function
|
|
2017
|
-
return
|
|
2016
|
+
function bn(e) {
|
|
2017
|
+
return Jt(yn(e));
|
|
2018
2018
|
}
|
|
2019
|
-
var
|
|
2020
|
-
settings = {
|
|
2019
|
+
var xn = class {
|
|
2020
|
+
settings = { ...Q };
|
|
2021
2021
|
assetUrlAliases = /* @__PURE__ */ new Map();
|
|
2022
2022
|
getConfig() {
|
|
2023
|
-
return this.applyAssetUrlAliases(),
|
|
2023
|
+
return this.applyAssetUrlAliases(), Jt(this.settings);
|
|
2024
2024
|
}
|
|
2025
2025
|
replaceAssetUrl(e, t) {
|
|
2026
2026
|
return !e || !t || e === t ? !1 : (this.assetUrlAliases.set(e, t), this.applyAssetUrlAliases(), !0);
|
|
@@ -2038,7 +2038,7 @@ var bn = class {
|
|
|
2038
2038
|
x: !1,
|
|
2039
2039
|
y: !1,
|
|
2040
2040
|
z: !1
|
|
2041
|
-
}, this.customAssetLoadId += 1, this.customObjGeometry?.dispose(), this.customObjGeometry = null, this.customSvgGeometry?.dispose(), this.customSvgGeometry = null, this.imageTexture?.dispose(), this.imageTexture = null, this.materialTexture?.dispose(), this.materialTexture = null, this.materialTextureDisplayTexture?.dispose(), this.materialTextureDisplayTexture = null, this.checkerTexture?.dispose(), this.checkerTexture = null, this.backgroundTexture?.dispose(), this.backgroundTexture = null, this.backgroundImageDisplayTexture?.dispose(), this.backgroundImageDisplayTexture = null, this.backgroundGradientTexture?.dispose(), this.backgroundGradientTexture = null, this.transparentBackgroundPreviewTexture?.dispose(), this.transparentBackgroundPreviewTexture = null, Object.assign(this.settings,
|
|
2041
|
+
}, this.customAssetLoadId += 1, this.customObjGeometry?.dispose(), this.customObjGeometry = null, this.customSvgGeometry?.dispose(), this.customSvgGeometry = null, this.imageTexture?.dispose(), this.imageTexture = null, this.materialTexture?.dispose(), this.materialTexture = null, this.materialTextureDisplayTexture?.dispose(), this.materialTextureDisplayTexture = null, this.checkerTexture?.dispose(), this.checkerTexture = null, this.backgroundTexture?.dispose(), this.backgroundTexture = null, this.backgroundImageDisplayTexture?.dispose(), this.backgroundImageDisplayTexture = null, this.backgroundGradientTexture?.dispose(), this.backgroundGradientTexture = null, this.transparentBackgroundPreviewTexture?.dispose(), this.transparentBackgroundPreviewTexture = null, Object.assign(this.settings, yn(e)), this.modeMemory = new Map([[this.settings.distributionMode, this.snapshotModeSettings()]]), this.settings.assetUrl.startsWith("blob:") && (this.settings.assetUrl = ""), this.settings.imageSetUrls.some((e) => e.startsWith("blob:")) && (this.settings.imageSetUrls = this.settings.imageSetUrls.filter((e) => !e.startsWith("blob:"))), this.settings.backgroundImageUrl.startsWith("blob:") && (this.settings.backgroundImageUrl = ""), this.settings.materialTextureUrl.startsWith("blob:") && (this.settings.materialTextureUrl = ""), this.applySettings(), this.settings.instanceShape === "custom-obj" && this.settings.assetUrl && !this.settings.assetUrl.startsWith("blob:") && this.loadCustomObj().catch((e) => {
|
|
2042
2042
|
console.warn("Unable to load custom OBJ asset.", e);
|
|
2043
2043
|
}), this.settings.instanceShape === "svg" && this.settings.assetUrl && !this.settings.assetUrl.startsWith("blob:") && this.loadSvgAsset().catch((e) => {
|
|
2044
2044
|
console.warn("Unable to load SVG asset.", e);
|
|
@@ -2131,7 +2131,7 @@ var bn = class {
|
|
|
2131
2131
|
observedHeight = 0;
|
|
2132
2132
|
disposed = !1;
|
|
2133
2133
|
constructor(e, n = {}) {
|
|
2134
|
-
this.container = e, this.enableCameraControls = n.enableCameraControls ?? !1, this.previewTransparentBackground = n.previewTransparentBackground ?? !1, n.config && Object.assign(this.settings,
|
|
2134
|
+
this.container = e, this.enableCameraControls = n.enableCameraControls ?? !1, this.previewTransparentBackground = n.previewTransparentBackground ?? !1, n.config && Object.assign(this.settings, yn(n.config)), this.settings.assetUrl.startsWith("blob:") && (this.settings.assetUrl = ""), this.settings.imageSetUrls.some((e) => e.startsWith("blob:")) && (this.settings.imageSetUrls = this.settings.imageSetUrls.filter((e) => !e.startsWith("blob:"))), this.settings.backgroundImageUrl.startsWith("blob:") && (this.settings.backgroundImageUrl = "");
|
|
2135
2135
|
let r = this.settings.instanceShape === "custom-obj" && !!this.settings.assetUrl && !this.settings.assetUrl.startsWith("blob:"), i = this.settings.instanceShape === "image" && (this.settings.imageSetUrls.length > 0 || !!this.settings.assetUrl) && !this.settings.assetUrl.startsWith("blob:"), a = this.settings.instanceShape === "svg" && !!this.settings.assetUrl && !this.settings.assetUrl.startsWith("blob:"), o = !!this.settings.backgroundImageUrl && !this.settings.backgroundImageUrl.startsWith("blob:"), s = !!this.settings.materialTextureUrl && !this.settings.materialTextureUrl.startsWith("blob:");
|
|
2136
2136
|
this.scene = new u.Scene(), this.scene.background = new u.Color(this.settings.backgroundColor), this.viewportGrid = n.enableViewportGrid ? this.createViewportGrid() : null, this.viewportGrid && this.scene.add(this.viewportGrid), this.camera = this.createCamera(), this.updateCamera(), this.renderer = new u.WebGLRenderer({
|
|
2137
2137
|
antialias: !0,
|
|
@@ -2335,7 +2335,7 @@ var bn = class {
|
|
|
2335
2335
|
}
|
|
2336
2336
|
snapshotModeSettings() {
|
|
2337
2337
|
let e = {};
|
|
2338
|
-
for (let t of
|
|
2338
|
+
for (let t of Gt) e[t] = this.settings[t];
|
|
2339
2339
|
return e;
|
|
2340
2340
|
}
|
|
2341
2341
|
applyDistributionModeDefaults(e) {
|
|
@@ -2382,7 +2382,7 @@ var bn = class {
|
|
|
2382
2382
|
}
|
|
2383
2383
|
resetSettings(e) {
|
|
2384
2384
|
e.forEach((e) => {
|
|
2385
|
-
this.settings[e] =
|
|
2385
|
+
this.settings[e] = Q[e];
|
|
2386
2386
|
}), this.updatePattern();
|
|
2387
2387
|
}
|
|
2388
2388
|
resetSpin() {
|
|
@@ -2442,8 +2442,8 @@ var bn = class {
|
|
|
2442
2442
|
cameraDistance: this.settings.cameraDistance,
|
|
2443
2443
|
cameraHeight: this.settings.cameraHeight,
|
|
2444
2444
|
cameraFocalLength: this.settings.cameraFocalLength,
|
|
2445
|
-
referenceZoom:
|
|
2446
|
-
referenceFrustumSize:
|
|
2445
|
+
referenceZoom: Kt,
|
|
2446
|
+
referenceFrustumSize: qt
|
|
2447
2447
|
})), this.settings.viewMode = e, e === "orthographic" && (this.settings.orthographicView = "custom"), this.camera = this.createCamera(), this.updateCamera(), this.renderIdleFrame();
|
|
2448
2448
|
}
|
|
2449
2449
|
setViewportGridVisible(e) {
|
|
@@ -2497,7 +2497,7 @@ var bn = class {
|
|
|
2497
2497
|
let e = this.getSubjectBounds(), t = new u.Vector3(), n = new u.Vector3();
|
|
2498
2498
|
e.getCenter(t), e.getSize(n);
|
|
2499
2499
|
let r = Math.max(.5, n.length() * .5) * 2 * 1.25;
|
|
2500
|
-
if (this.settings.cameraTargetX = t.x, this.settings.cameraTargetY = t.y, this.settings.cameraTargetZ = t.z, this.settings.viewMode === "orthographic") this.settings.orthographicView = "custom", this.settings.orthoScale = u.MathUtils.clamp(
|
|
2500
|
+
if (this.settings.cameraTargetX = t.x, this.settings.cameraTargetY = t.y, this.settings.cameraTargetZ = t.z, this.settings.viewMode === "orthographic") this.settings.orthographicView = "custom", this.settings.orthoScale = u.MathUtils.clamp(qt * Kt / r, F.camera.orthographicScale.min, F.camera.orthographicScale.max);
|
|
2501
2501
|
else {
|
|
2502
2502
|
let e = this.getPerspectiveFovFromFocalLength() * (Math.PI / 180), t = r / (2 * Math.tan(e / 2));
|
|
2503
2503
|
this.settings.cameraDistance = u.MathUtils.clamp(t, F.camera.distance.min, F.camera.distance.max), this.settings.cameraHeight = z(this.settings.cameraDistance, this.settings.cameraElevation);
|
|
@@ -2514,7 +2514,7 @@ var bn = class {
|
|
|
2514
2514
|
};
|
|
2515
2515
|
}
|
|
2516
2516
|
setRenderPixelRatio(e) {
|
|
2517
|
-
this.settings.renderPixelRatio = L(e,
|
|
2517
|
+
this.settings.renderPixelRatio = L(e, Q.renderPixelRatio, F.renderer.pixelRatio), this.applyRendererPixelRatio();
|
|
2518
2518
|
let { width: t, height: n } = this.getContainerSize();
|
|
2519
2519
|
this.renderer.setSize(t, n), this.updateEdgeResolution(t, n), this.renderIdleFrame();
|
|
2520
2520
|
}
|
|
@@ -2541,7 +2541,7 @@ var bn = class {
|
|
|
2541
2541
|
this.adaptiveQualityLowSamples = 0, this.adaptiveQualityHighSamples = 0;
|
|
2542
2542
|
}
|
|
2543
2543
|
pauseMotion() {
|
|
2544
|
-
this.pausedMotionSnapshot ||= this.getMotionPauseSnapshot(), this.settings.instanceSpinX = 0, this.settings.instanceSpinY = 0, this.settings.instanceSpinZ = 0, this.settings.pathRotationX = 0, this.settings.pathRotationY = 0, this.settings.pathRotationZ = 0, this.settings.pathTravelSpeed = 0, this.settings.pathTravelStepDistance = 0, this.settings.ringOrbitSpeed = 0, this.settings.waveAmplitude =
|
|
2544
|
+
this.pausedMotionSnapshot ||= this.getMotionPauseSnapshot(), this.settings.instanceSpinX = 0, this.settings.instanceSpinY = 0, this.settings.instanceSpinZ = 0, this.settings.pathRotationX = 0, this.settings.pathRotationY = 0, this.settings.pathRotationZ = 0, this.settings.pathTravelSpeed = 0, this.settings.pathTravelStepDistance = 0, this.settings.ringOrbitSpeed = 0, this.settings.waveAmplitude = Q.waveAmplitude, this.settings.waveSpeed = 0, this.stop(), this.updatePattern();
|
|
2545
2545
|
}
|
|
2546
2546
|
resumeMotion() {
|
|
2547
2547
|
this.pausedMotionSnapshot && (Object.assign(this.settings, this.pausedMotionSnapshot), this.pausedMotionSnapshot = null, this.updatePattern(), this.start());
|
|
@@ -2566,10 +2566,10 @@ var bn = class {
|
|
|
2566
2566
|
};
|
|
2567
2567
|
}
|
|
2568
2568
|
setCameraDistance(e) {
|
|
2569
|
-
this.settings.cameraDistance = L(Math.abs(e),
|
|
2569
|
+
this.settings.cameraDistance = L(Math.abs(e), Q.cameraDistance, F.camera.distance), this.settings.cameraHeight = z(this.settings.cameraDistance, this.settings.cameraElevation), this.updateCamera(), this.notifyCameraChange(), this.renderIdleFrame();
|
|
2570
2570
|
}
|
|
2571
2571
|
getInstancePresetSnapshot() {
|
|
2572
|
-
return { ...
|
|
2572
|
+
return { ...Jt(this.settings).instance };
|
|
2573
2573
|
}
|
|
2574
2574
|
applyInstancePresetSnapshot(e) {
|
|
2575
2575
|
let t = this.getConfig();
|
|
@@ -2615,7 +2615,7 @@ var bn = class {
|
|
|
2615
2615
|
this.settings.pathRows = e, this.updatePatternAndUseGeneratedLimit();
|
|
2616
2616
|
}
|
|
2617
2617
|
updateCameraOrbit() {
|
|
2618
|
-
let e = L(Number.isFinite(this.settings.cameraDistance) ? Math.abs(this.settings.cameraDistance) :
|
|
2618
|
+
let e = L(Number.isFinite(this.settings.cameraDistance) ? Math.abs(this.settings.cameraDistance) : Q.cameraDistance, Q.cameraDistance, F.camera.distance), t = Number.isFinite(this.settings.cameraElevation) ? this.settings.cameraElevation : Me(e, Q.cameraHeight), n = Number.isFinite(this.settings.cameraOrbitAngle) ? this.settings.cameraOrbitAngle : Q.cameraOrbitAngle, r = this.settings.cameraTargetX, i = this.settings.cameraTargetY, a = this.settings.cameraTargetZ;
|
|
2619
2619
|
this.settings.cameraDistance = e, this.settings.cameraHeight = z(e, t), this.settings.cameraOrbitAngle = Ae(n), this.settings.cameraElevation = t;
|
|
2620
2620
|
let o = Pe({
|
|
2621
2621
|
distance: e,
|
|
@@ -2709,7 +2709,7 @@ var bn = class {
|
|
|
2709
2709
|
let n = this.settings.distributionMode;
|
|
2710
2710
|
if (n === "starfield") return this.settings.starfieldFaceCamera ? this.starfieldBillboardQuaternion(t) : t.identity();
|
|
2711
2711
|
if (!(n === "grid" || n === "cube-grid" || n === "rings" ? this.settings.alignToPattern : this.settings.alignToPath)) return t.identity();
|
|
2712
|
-
if (n === "grid" || n === "cube-grid") return t.setFromAxisAngle(
|
|
2712
|
+
if (n === "grid" || n === "cube-grid") return t.setFromAxisAngle(zt, e.angle);
|
|
2713
2713
|
let r = e.alignDir;
|
|
2714
2714
|
if (!r) return t.identity();
|
|
2715
2715
|
let i = this.alignVecScratch.set(r.x, r.y, r.z);
|
|
@@ -2728,7 +2728,7 @@ var bn = class {
|
|
|
2728
2728
|
return r.lengthSq() < 1e-8 ? e.setFromUnitVectors(this.faceAlignAxis(), t) : (r.normalize(), this.alignMatrixScratch.makeBasis(r, t, n), e.setFromRotationMatrix(this.alignMatrixScratch));
|
|
2729
2729
|
}
|
|
2730
2730
|
faceAlignAxis() {
|
|
2731
|
-
return
|
|
2731
|
+
return zt;
|
|
2732
2732
|
}
|
|
2733
2733
|
updatePatternFromLayouts(e) {
|
|
2734
2734
|
this.layouts = this.applyInstanceLimit(e);
|
|
@@ -2749,16 +2749,16 @@ var bn = class {
|
|
|
2749
2749
|
}), this.finishSurfaceWrites(i), this.outlineMesh.instanceMatrix.needsUpdate = !0, this.renderIdleFrame(), this.animationFrameId === null && (r || this.hasTimeVaryingMotion()) && this.start();
|
|
2750
2750
|
}
|
|
2751
2751
|
getInstanceOpacity(e, t) {
|
|
2752
|
-
let n = performance.now() - (this.instanceBirthTimes[e] ?? performance.now()), r = this.getFadeDurationMs(), i =
|
|
2752
|
+
let n = performance.now() - (this.instanceBirthTimes[e] ?? performance.now()), r = this.getFadeDurationMs(), i = mt(r === 0 ? 1 : u.MathUtils.clamp(n / r, 0, 1), this.settings.fadeEasing, this.settings.fadeCustomBezier);
|
|
2753
2753
|
if (!this.shouldFadePathEdges()) return i;
|
|
2754
|
-
let a = t.pathProgress, o = this.getPathEdgeFadeZone(), s =
|
|
2754
|
+
let a = t.pathProgress, o = this.getPathEdgeFadeZone(), s = mt(this.getOpenPathEdgeOpacity(a, o), this.settings.pathEdgeFadeEasing, this.settings.pathEdgeFadeCustomBezier);
|
|
2755
2755
|
return Math.min(i, Math.max(0, s));
|
|
2756
2756
|
}
|
|
2757
2757
|
getOpenPathEdgeOpacity(e, t) {
|
|
2758
2758
|
return Math.min(1, u.MathUtils.clamp(e / t, 0, 1), u.MathUtils.clamp((1 - e) / t, 0, 1));
|
|
2759
2759
|
}
|
|
2760
2760
|
shouldFadePathEdges() {
|
|
2761
|
-
return (this.settings.distributionMode === "line-path" || this.settings.distributionMode === "spiral-path" || this.settings.distributionMode === "spline-path" || this.settings.distributionMode === "starfield") && (this.settings.pathTravelMode === "stepped" ? Math.abs(this.settings.pathTravelStepDistance) >
|
|
2761
|
+
return (this.settings.distributionMode === "line-path" || this.settings.distributionMode === "spiral-path" || this.settings.distributionMode === "spline-path" || this.settings.distributionMode === "starfield") && (this.settings.pathTravelMode === "stepped" ? Math.abs(this.settings.pathTravelStepDistance) > X : Math.abs(this.settings.pathTravelSpeed) > X);
|
|
2762
2762
|
}
|
|
2763
2763
|
getPathEdgeFadeZone() {
|
|
2764
2764
|
let e = this.settings.pathEdgeFadeDuration, t = (this.settings.pathTravelMode === "stepped" ? Math.abs(this.settings.pathTravelStepDistance) / Math.max(.001, this.settings.pathTravelStepInterval) : Math.abs(this.settings.pathTravelSpeed)) * e;
|
|
@@ -2776,7 +2776,7 @@ var bn = class {
|
|
|
2776
2776
|
getBuildProgress(e) {
|
|
2777
2777
|
if (!this.hasBuildInMotion()) return 1;
|
|
2778
2778
|
let t = Math.max(0, this.settings.buildDuration), n = Math.max(0, this.settings.buildDelay);
|
|
2779
|
-
return e < n ? 0 : t === 0 ? 1 :
|
|
2779
|
+
return e < n ? 0 : t === 0 ? 1 : mt(u.MathUtils.clamp((e - n) / t, 0, 1), this.settings.buildEasing, this.settings.buildCustomBezier);
|
|
2780
2780
|
}
|
|
2781
2781
|
getBuildTransform(e) {
|
|
2782
2782
|
let t = 1 - e;
|
|
@@ -2792,11 +2792,11 @@ var bn = class {
|
|
|
2792
2792
|
}
|
|
2793
2793
|
hasTimeVaryingMotion() {
|
|
2794
2794
|
let e = (performance.now() - this.startTime) / 1e3;
|
|
2795
|
-
return Math.abs(this.settings.instanceSpinX) >
|
|
2795
|
+
return Math.abs(this.settings.instanceSpinX) > X || Math.abs(this.settings.instanceSpinY) > X || Math.abs(this.settings.instanceSpinZ) > X || Math.abs(this.settings.pathRotationX) > X || Math.abs(this.settings.pathRotationY) > X || Math.abs(this.settings.pathRotationZ) > X || Math.abs(this.settings.pathTravelSpeed) > X || this.settings.pathTravelMode === "stepped" && Math.abs(this.settings.pathTravelStepDistance) > X || Math.abs(this.settings.ringOrbitSpeed) > X || performance.now() < this.fadeUntil || this.hasBuildInMotion() && this.getBuildProgress(e) < 1 || Math.abs(this.settings.waveAmplitude) > X && Math.abs(this.settings.waveSpeed) > X;
|
|
2796
2796
|
}
|
|
2797
2797
|
applyInstanceLimit(e) {
|
|
2798
2798
|
let t = Math.max(1, Math.min(this.settings.instanceLimit, e.length));
|
|
2799
|
-
return t >= e.length ? e :
|
|
2799
|
+
return t >= e.length ? e : pn(this.settings.distributionMode) ? this.pickEvenPathLayouts(e, t) : [...e].sort((e, t) => e.distance === t.distance ? e.ringIndex === t.ringIndex ? e.angle - t.angle : e.ringIndex - t.ringIndex : e.distance - t.distance).slice(0, t);
|
|
2800
2800
|
}
|
|
2801
2801
|
pickEvenPathLayouts(e, t) {
|
|
2802
2802
|
let n = [...e].sort((e, t) => e.ringIndex === t.ringIndex ? e.pathProgress - t.pathProgress : e.ringIndex - t.ringIndex), r = [];
|
|
@@ -2902,13 +2902,13 @@ var bn = class {
|
|
|
2902
2902
|
return n <= r ? n / r * .5 : .5 + .5 * ((n - r) / (1 - r));
|
|
2903
2903
|
}
|
|
2904
2904
|
shapeGradientProgress(e) {
|
|
2905
|
-
return
|
|
2905
|
+
return mt(this.remapGradientProgress(e), this.settings.gradientEasing, this.settings.gradientCustomBezier);
|
|
2906
2906
|
}
|
|
2907
2907
|
getGradientEasingModeIndex() {
|
|
2908
2908
|
return this.settings.gradientEasing === "ease-in" ? 1 : this.settings.gradientEasing === "ease-out" ? 2 : this.settings.gradientEasing === "ease-in-out" ? 3 : this.settings.gradientEasing === "custom-bezier" ? 4 : 0;
|
|
2909
2909
|
}
|
|
2910
2910
|
getGradientBezierVector() {
|
|
2911
|
-
let e = (this.settings.gradientEasing === "custom-bezier" ?
|
|
2911
|
+
let e = (this.settings.gradientEasing === "custom-bezier" ? pt(this.settings.gradientCustomBezier) : null) ?? {
|
|
2912
2912
|
x1: 0,
|
|
2913
2913
|
y1: 0,
|
|
2914
2914
|
x2: 1,
|
|
@@ -3029,11 +3029,11 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3029
3029
|
}
|
|
3030
3030
|
setInstanceDimension(e, t) {
|
|
3031
3031
|
this.shapeAutoModified[e] = !1;
|
|
3032
|
-
let n = L(t,
|
|
3033
|
-
e === "x" ? (this.settings.scaleX = n, this.shouldLockImageAspectRatio() && (this.settings.scaleZ = L(n / this.settings.imageAspectRatio,
|
|
3032
|
+
let n = L(t, Q.scaleX, F.instance.dimension);
|
|
3033
|
+
e === "x" ? (this.settings.scaleX = n, this.shouldLockImageAspectRatio() && (this.settings.scaleZ = L(n / this.settings.imageAspectRatio, Q.scaleZ, F.instance.dimension))) : e === "y" ? this.settings.scaleY = n : (this.settings.scaleZ = n, this.shouldLockImageAspectRatio() && (this.settings.scaleX = L(n * this.settings.imageAspectRatio, Q.scaleX, F.instance.dimension))), this.syncRoundedCardRatio(), this.rebuildGeometry();
|
|
3034
3034
|
}
|
|
3035
3035
|
setImagePreserveAspectRatio(e) {
|
|
3036
|
-
this.settings.imagePreserveAspectRatio = e, this.shouldLockImageAspectRatio() && (this.settings.scaleX = L(this.settings.scaleZ * this.settings.imageAspectRatio,
|
|
3036
|
+
this.settings.imagePreserveAspectRatio = e, this.shouldLockImageAspectRatio() && (this.settings.scaleX = L(this.settings.scaleZ * this.settings.imageAspectRatio, Q.scaleX, F.instance.dimension)), this.rebuildGeometry();
|
|
3037
3037
|
}
|
|
3038
3038
|
shouldLockImageAspectRatio() {
|
|
3039
3039
|
return this.settings.instanceShape === "image" && this.settings.imagePreserveAspectRatio && this.settings.imageAspectRatio > 0;
|
|
@@ -3094,7 +3094,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3094
3094
|
}
|
|
3095
3095
|
async loadCustomAsset(e = this.settings.assetUrl, { showPlaceholder: t = !1, source: n = "background" } = {}) {
|
|
3096
3096
|
let r = e.trim();
|
|
3097
|
-
if (n === "background" && this.activeUserCustomAssetLoadId > 0) throw new
|
|
3097
|
+
if (n === "background" && this.activeUserCustomAssetLoadId > 0) throw new It();
|
|
3098
3098
|
let i = ++this.customAssetLoadId;
|
|
3099
3099
|
if (n === "user" && (this.activeUserCustomAssetLoadId = i), this.settings.assetUrl = r, !r) {
|
|
3100
3100
|
this.customObjGeometry?.dispose(), this.customObjGeometry = null, this.activeUserCustomAssetLoadId === i && (this.activeUserCustomAssetLoadId = 0), this.rebuildGeometry();
|
|
@@ -3102,7 +3102,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3102
3102
|
}
|
|
3103
3103
|
t && (this.customObjGeometry?.dispose(), this.customObjGeometry = null, this.settings.instanceShape = "custom-obj", this.rebuildGeometry());
|
|
3104
3104
|
try {
|
|
3105
|
-
let e = await import("./customAssetGeometry-MXHVov4w.js"), t = await e.loadCustomAssetGeometry(
|
|
3105
|
+
let e = await import("./customAssetGeometry-MXHVov4w.js"), t = await e.loadCustomAssetGeometry(vn(r));
|
|
3106
3106
|
this.completeCustomAssetLoad(i, t, e.prepareCustomAssetGeometry);
|
|
3107
3107
|
} catch (e) {
|
|
3108
3108
|
throw this.activeUserCustomAssetLoadId === i && (this.activeUserCustomAssetLoadId = 0), e;
|
|
@@ -3128,7 +3128,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3128
3128
|
this.clearSvgAssetLoad(r);
|
|
3129
3129
|
return;
|
|
3130
3130
|
}
|
|
3131
|
-
let e = await (await import("./svgAssetGeometry-CSnPWwR1.js")).loadSvgAssetGeometry(
|
|
3131
|
+
let e = await (await import("./svgAssetGeometry-CSnPWwR1.js")).loadSvgAssetGeometry(vn(n), this.settings.svgSolidify);
|
|
3132
3132
|
this.completeSvgAssetLoad(r, e);
|
|
3133
3133
|
} catch (e) {
|
|
3134
3134
|
throw this.activeUserCustomAssetLoadId === r && (this.activeUserCustomAssetLoadId = 0), e;
|
|
@@ -3154,7 +3154,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3154
3154
|
this.clearImageAssetLoad(r);
|
|
3155
3155
|
return;
|
|
3156
3156
|
}
|
|
3157
|
-
let e = await this.textureLoader.loadAsync(
|
|
3157
|
+
let e = await this.textureLoader.loadAsync(vn(n));
|
|
3158
3158
|
this.completeImageAssetLoad(r, e);
|
|
3159
3159
|
} catch (e) {
|
|
3160
3160
|
throw this.activeUserCustomAssetLoadId === r && (this.activeUserCustomAssetLoadId = 0), e;
|
|
@@ -3164,13 +3164,13 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3164
3164
|
await this.loadImageAsset(t, n);
|
|
3165
3165
|
}
|
|
3166
3166
|
async loadImageSet(e = this.settings.imageSetUrls, t = {}) {
|
|
3167
|
-
let n =
|
|
3167
|
+
let n = _n(e), r = this.beginCustomAssetLoad(n[0] ?? "", t);
|
|
3168
3168
|
try {
|
|
3169
3169
|
if (n.length === 0) {
|
|
3170
3170
|
this.clearImageAssetLoad(r);
|
|
3171
3171
|
return;
|
|
3172
3172
|
}
|
|
3173
|
-
let e = await Promise.all(n.map((e) => this.textureLoader.loadAsync(
|
|
3173
|
+
let e = await Promise.all(n.map((e) => this.textureLoader.loadAsync(vn(e))));
|
|
3174
3174
|
this.completeImageSetAssetLoad(r, n, e);
|
|
3175
3175
|
} catch (e) {
|
|
3176
3176
|
throw this.activeUserCustomAssetLoadId === r && (this.activeUserCustomAssetLoadId = 0), e;
|
|
@@ -3182,7 +3182,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3182
3182
|
this.clearBackgroundImage();
|
|
3183
3183
|
return;
|
|
3184
3184
|
}
|
|
3185
|
-
let n = await this.textureLoader.loadAsync(
|
|
3185
|
+
let n = await this.textureLoader.loadAsync(vn(t));
|
|
3186
3186
|
this.backgroundTexture?.dispose(), this.backgroundImageDisplayTexture?.dispose(), this.backgroundImageDisplayTexture = null, this.backgroundTexture = n, this.configureImageTexture(n), this.settings.backgroundMode = "image", this.updateSceneBackground(), this.renderIdleFrame();
|
|
3187
3187
|
}
|
|
3188
3188
|
async loadBackgroundImageFile(e, t) {
|
|
@@ -3194,7 +3194,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3194
3194
|
this.clearMaterialTexture();
|
|
3195
3195
|
return;
|
|
3196
3196
|
}
|
|
3197
|
-
let n = await this.textureLoader.loadAsync(
|
|
3197
|
+
let n = await this.textureLoader.loadAsync(vn(t));
|
|
3198
3198
|
this.materialTexture?.dispose(), this.materialTextureDisplayTexture?.dispose(), this.materialTextureDisplayTexture = null, this.materialTexture = n, this.configureImageTexture(n), n.wrapS = u.RepeatWrapping, n.wrapT = u.RepeatWrapping, this.settings.colorMode = "texture", this.updateMaterial(), this.renderIdleFrame();
|
|
3199
3199
|
}
|
|
3200
3200
|
async loadMaterialTextureFile(e, t) {
|
|
@@ -3207,13 +3207,13 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3207
3207
|
this.settings.backgroundImageUrl = "", this.backgroundTexture?.dispose(), this.backgroundTexture = null, this.backgroundImageDisplayTexture?.dispose(), this.backgroundImageDisplayTexture = null, this.updateSceneBackground(), this.renderIdleFrame();
|
|
3208
3208
|
}
|
|
3209
3209
|
clearCustomAsset() {
|
|
3210
|
-
this.customAssetLoadId += 1, this.activeUserCustomAssetLoadId = 0, this.settings.assetUrl = "", this.settings.imageSetUrls = [], this.settings.imageAspectRatio =
|
|
3210
|
+
this.customAssetLoadId += 1, this.activeUserCustomAssetLoadId = 0, this.settings.assetUrl = "", this.settings.imageSetUrls = [], this.settings.imageAspectRatio = Q.imageAspectRatio, this.customObjGeometry?.dispose(), this.customObjGeometry = null, this.customSvgGeometry?.dispose(), this.customSvgGeometry = null, this.imageTexture?.dispose(), this.imageTexture = null, this.disposeImageSetTextures(), this.updateMaterial(), this.rebuildGeometry();
|
|
3211
3211
|
}
|
|
3212
3212
|
clearSvgAssetLoad(e) {
|
|
3213
3213
|
this.customSvgGeometry?.dispose(), this.customSvgGeometry = null, this.activeUserCustomAssetLoadId === e && (this.activeUserCustomAssetLoadId = 0), this.rebuildGeometry();
|
|
3214
3214
|
}
|
|
3215
3215
|
beginCustomAssetLoad(e, { showPlaceholder: t = !1, source: n = "background" }) {
|
|
3216
|
-
if (n === "background" && this.activeUserCustomAssetLoadId > 0) throw new
|
|
3216
|
+
if (n === "background" && this.activeUserCustomAssetLoadId > 0) throw new It();
|
|
3217
3217
|
let r = ++this.customAssetLoadId;
|
|
3218
3218
|
return n === "user" && (this.activeUserCustomAssetLoadId = r), this.settings.assetUrl = e, t && (this.customObjGeometry?.dispose(), this.customObjGeometry = null, this.settings.instanceShape = "custom-obj", this.rebuildGeometry()), r;
|
|
3219
3219
|
}
|
|
@@ -3221,11 +3221,11 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3221
3221
|
this.customObjGeometry?.dispose(), this.customObjGeometry = null, this.activeUserCustomAssetLoadId === e && (this.activeUserCustomAssetLoadId = 0), this.rebuildGeometry();
|
|
3222
3222
|
}
|
|
3223
3223
|
clearImageAssetLoad(e) {
|
|
3224
|
-
this.imageTexture?.dispose(), this.imageTexture = null, this.disposeImageSetTextures(), this.settings.imageAspectRatio =
|
|
3224
|
+
this.imageTexture?.dispose(), this.imageTexture = null, this.disposeImageSetTextures(), this.settings.imageAspectRatio = Q.imageAspectRatio, this.activeUserCustomAssetLoadId === e && (this.activeUserCustomAssetLoadId = 0), this.updateMaterial(), this.rebuildGeometry();
|
|
3225
3225
|
}
|
|
3226
3226
|
completeCustomAssetLoad(e, t, n) {
|
|
3227
3227
|
let r = this.activeUserCustomAssetLoadId === e;
|
|
3228
|
-
if (e !== this.customAssetLoadId && !r) throw t.dispose(), new
|
|
3228
|
+
if (e !== this.customAssetLoadId && !r) throw t.dispose(), new It();
|
|
3229
3229
|
this.customAssetLoadId = e, n(t, {
|
|
3230
3230
|
assetScale: this.settings.assetScale,
|
|
3231
3231
|
assetNormalize: this.settings.assetNormalize
|
|
@@ -3233,22 +3233,22 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3233
3233
|
}
|
|
3234
3234
|
completeSvgAssetLoad(e, t) {
|
|
3235
3235
|
let n = this.activeUserCustomAssetLoadId === e;
|
|
3236
|
-
if (e !== this.customAssetLoadId && !n) throw t.dispose(), new
|
|
3236
|
+
if (e !== this.customAssetLoadId && !n) throw t.dispose(), new It();
|
|
3237
3237
|
this.customAssetLoadId = e, this.customSvgGeometry?.dispose(), this.customSvgGeometry = t, this.customObjGeometry?.dispose(), this.customObjGeometry = null, this.disposeImageSetTextures(), this.imageTexture?.dispose(), this.imageTexture = null, this.settings.imageSetUrls = [], this.settings.instanceShape = "svg", n && (this.activeUserCustomAssetLoadId = 0), this.updateMaterial(), this.rebuildGeometry();
|
|
3238
3238
|
}
|
|
3239
3239
|
completeImageAssetLoad(e, t) {
|
|
3240
3240
|
let n = this.activeUserCustomAssetLoadId === e;
|
|
3241
|
-
if (e !== this.customAssetLoadId && !n) throw t.dispose(), new
|
|
3241
|
+
if (e !== this.customAssetLoadId && !n) throw t.dispose(), new It();
|
|
3242
3242
|
this.customAssetLoadId = e, this.imageTexture?.dispose(), this.disposeImageSetTextures(), this.customSvgGeometry?.dispose(), this.customSvgGeometry = null, this.customObjGeometry?.dispose(), this.customObjGeometry = null, this.configureImageTexture(t), this.imageTexture = t, this.imageSetTextures = [t], this.settings.imageSetUrls = [];
|
|
3243
|
-
let r = t.image, i = r?.width ??
|
|
3244
|
-
this.settings.imageAspectRatio = a > 0 ? Math.max(.01, i / a) :
|
|
3243
|
+
let r = t.image, i = r?.width ?? Q.imageAspectRatio, a = r?.height ?? 1;
|
|
3244
|
+
this.settings.imageAspectRatio = a > 0 ? Math.max(.01, i / a) : Q.imageAspectRatio, this.settings.instanceShape = "image", n && (this.settings.imagePreserveAspectRatio && (this.settings.scaleX = this.settings.scaleZ * this.settings.imageAspectRatio), this.activeUserCustomAssetLoadId = 0), this.updateMaterial(), this.rebuildGeometry();
|
|
3245
3245
|
}
|
|
3246
3246
|
completeImageSetAssetLoad(e, t, n) {
|
|
3247
3247
|
let r = this.activeUserCustomAssetLoadId === e;
|
|
3248
|
-
if (e !== this.customAssetLoadId && !r) throw n.forEach((e) => e.dispose()), new
|
|
3248
|
+
if (e !== this.customAssetLoadId && !r) throw n.forEach((e) => e.dispose()), new It();
|
|
3249
3249
|
this.customAssetLoadId = e, this.imageTexture?.dispose(), this.disposeImageSetTextures(), this.customSvgGeometry?.dispose(), this.customSvgGeometry = null, this.customObjGeometry?.dispose(), this.customObjGeometry = null, n.forEach((e) => this.configureImageTexture(e)), this.imageSetTextures = n, this.imageTexture = n[0] ?? null, this.settings.assetUrl = t[0] ?? "", this.settings.imageSetUrls = t;
|
|
3250
|
-
let i = this.imageTexture?.image, a = i?.width ??
|
|
3251
|
-
this.settings.imageAspectRatio = o > 0 ? Math.max(.01, a / o) :
|
|
3250
|
+
let i = this.imageTexture?.image, a = i?.width ?? Q.imageAspectRatio, o = i?.height ?? 1;
|
|
3251
|
+
this.settings.imageAspectRatio = o > 0 ? Math.max(.01, a / o) : Q.imageAspectRatio, this.settings.instanceShape = "image", r && (this.settings.imagePreserveAspectRatio && (this.settings.scaleX = this.settings.scaleZ * this.settings.imageAspectRatio), this.activeUserCustomAssetLoadId = 0), this.updateMaterial(), this.rebuildGeometry();
|
|
3252
3252
|
}
|
|
3253
3253
|
configureImageTexture(e) {
|
|
3254
3254
|
e.colorSpace = u.SRGBColorSpace, e.needsUpdate = !0;
|
|
@@ -3297,17 +3297,17 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3297
3297
|
return this.backgroundImageDisplayTexture || (this.backgroundImageDisplayTexture = new u.CanvasTexture(o), this.backgroundImageDisplayTexture.colorSpace = u.SRGBColorSpace, this.backgroundImageDisplayTexture.wrapS = u.ClampToEdgeWrapping, this.backgroundImageDisplayTexture.wrapT = u.ClampToEdgeWrapping), this.backgroundImageDisplayTexture.needsUpdate = !0, this.backgroundImageDisplayTexture;
|
|
3298
3298
|
}
|
|
3299
3299
|
drawCheckerBackground(e, t, n) {
|
|
3300
|
-
e.fillStyle =
|
|
3301
|
-
for (let r = 0; r < n; r +=
|
|
3300
|
+
e.fillStyle = Ht, e.fillRect(0, 0, t, n), e.fillStyle = Ut;
|
|
3301
|
+
for (let r = 0; r < n; r += Bt) for (let n = r / Bt % 2 == 0 ? Bt : 0; n < t; n += Bt * 2) e.fillRect(n, r, Bt, Bt);
|
|
3302
3302
|
}
|
|
3303
3303
|
updateBackgroundGradientTexture() {
|
|
3304
3304
|
let e = this.backgroundGradientTexture?.image instanceof HTMLCanvasElement ? this.backgroundGradientTexture.image : document.createElement("canvas");
|
|
3305
3305
|
e.width = 512, e.height = 512;
|
|
3306
3306
|
let t = e.getContext("2d");
|
|
3307
3307
|
if (!t) return new u.Color(this.settings.backgroundColor);
|
|
3308
|
-
let n = t.createImageData(512, 512), r = new u.Color(this.settings.backgroundGradientColorA), i = new u.Color(this.settings.backgroundGradientColorB), a = new u.Color(), o =
|
|
3308
|
+
let n = t.createImageData(512, 512), r = new u.Color(this.settings.backgroundGradientColorA), i = new u.Color(this.settings.backgroundGradientColorB), a = new u.Color(), o = ln(this.settings.backgroundGradientMidpoint), s = 511 * .5, c = Math.max(1e-4, Math.hypot(s, s));
|
|
3309
3309
|
for (let e = 0; e < 512; e += 1) for (let t = 0; t < 512; t += 1) {
|
|
3310
|
-
let l = this.getBackgroundGradientProgress(t, e, 512, s, c), u =
|
|
3310
|
+
let l = this.getBackgroundGradientProgress(t, e, 512, s, c), u = mt(this.remapGradientProgressWithMidpoint(l, o), this.settings.backgroundGradientEasing, this.settings.backgroundGradientCustomBezier);
|
|
3311
3311
|
a.copy(r).lerp(i, u);
|
|
3312
3312
|
let d = (e * 512 + t) * 4;
|
|
3313
3313
|
n.data[d] = Math.round(a.r * 255), n.data[d + 1] = Math.round(a.g * 255), n.data[d + 2] = Math.round(a.b * 255), n.data[d + 3] = 255;
|
|
@@ -3335,7 +3335,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3335
3335
|
}), this.imageSetTextures = [];
|
|
3336
3336
|
}
|
|
3337
3337
|
createGeometry() {
|
|
3338
|
-
return this.settings.instanceShape === "text" && (!this.textGeometryRuntime || !this.textFonts) && this.scheduleTextRuntimeLoad(), this.settings.instanceShape === "image" && this.imageTexture ? this.createImageGeometryForTexture(this.imageTexture) : this.settings.instanceShape === "image" && !this.imageTexture || this.settings.instanceShape === "svg" && !this.customSvgGeometry ? this.createImagePlaceholderGeometry() :
|
|
3338
|
+
return this.settings.instanceShape === "text" && (!this.textGeometryRuntime || !this.textFonts) && this.scheduleTextRuntimeLoad(), this.settings.instanceShape === "image" && this.imageTexture ? this.createImageGeometryForTexture(this.imageTexture) : this.settings.instanceShape === "image" && !this.imageTexture || this.settings.instanceShape === "svg" && !this.customSvgGeometry ? this.createImagePlaceholderGeometry() : Nt({
|
|
3339
3339
|
settings: this.settings,
|
|
3340
3340
|
customObjGeometry: this.customObjGeometry,
|
|
3341
3341
|
customSvgGeometry: this.customSvgGeometry,
|
|
@@ -3411,21 +3411,21 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3411
3411
|
return this.materialTexture ?? this.getCheckerTexture();
|
|
3412
3412
|
}
|
|
3413
3413
|
getMaterialTextureRepeat(e) {
|
|
3414
|
-
return this.materialTexture ? Math.max(.001, e) :
|
|
3414
|
+
return this.materialTexture ? Math.max(.001, e) : Vt;
|
|
3415
3415
|
}
|
|
3416
3416
|
getCheckerTexture() {
|
|
3417
3417
|
if (this.checkerTexture) return this.checkerTexture;
|
|
3418
3418
|
let e = document.createElement("canvas");
|
|
3419
|
-
e.width =
|
|
3419
|
+
e.width = Z * 2, e.height = Z * 2;
|
|
3420
3420
|
let t = e.getContext("2d");
|
|
3421
|
-
return t && (t.fillStyle =
|
|
3421
|
+
return t && (t.fillStyle = Ht, t.fillRect(0, 0, e.width, e.height), t.fillStyle = Ut, t.fillRect(Z, 0, Z, Z), t.fillRect(0, Z, Z, Z)), this.checkerTexture = new u.CanvasTexture(e), this.checkerTexture.colorSpace = u.SRGBColorSpace, this.checkerTexture.wrapS = u.RepeatWrapping, this.checkerTexture.wrapT = u.RepeatWrapping, this.checkerTexture.magFilter = u.NearestFilter, this.checkerTexture.minFilter = u.NearestFilter, this.checkerTexture.repeat.set(Vt, Vt), this.checkerTexture.needsUpdate = !0, this.checkerTexture;
|
|
3422
3422
|
}
|
|
3423
3423
|
getTextureAspectRatio(e) {
|
|
3424
|
-
let t = e.image, n = t?.width ??
|
|
3425
|
-
return r > 0 ? Math.max(.01, n / r) :
|
|
3424
|
+
let t = e.image, n = t?.width ?? Q.imageAspectRatio, r = t?.height ?? 1;
|
|
3425
|
+
return r > 0 ? Math.max(.01, n / r) : Q.imageAspectRatio;
|
|
3426
3426
|
}
|
|
3427
3427
|
createImageGeometryForTexture(e) {
|
|
3428
|
-
let { scaleX: t, scaleZ: n } = this.getInstanceDimensions(), r = this.settings.imagePreserveAspectRatio ? n * this.getTextureAspectRatio(e) : t, i = Math.min(.5, Math.max(0, this.settings.imageCornerRadius)), a = i > 0 ?
|
|
3428
|
+
let { scaleX: t, scaleZ: n } = this.getInstanceDimensions(), r = this.settings.imagePreserveAspectRatio ? n * this.getTextureAspectRatio(e) : t, i = Math.min(.5, Math.max(0, this.settings.imageCornerRadius)), a = i > 0 ? mn(r, n, Math.min(r, n) * i) : new u.PlaneGeometry(r, n);
|
|
3429
3429
|
return a.rotateX(-Math.PI / 2), a;
|
|
3430
3430
|
}
|
|
3431
3431
|
createImagePlaceholderGeometry() {
|
|
@@ -3588,7 +3588,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3588
3588
|
}
|
|
3589
3589
|
}
|
|
3590
3590
|
getOrthographicFrustumSize() {
|
|
3591
|
-
return
|
|
3591
|
+
return qt * (Kt / L(this.settings.orthoScale, Q.orthoScale, F.camera.orthographicFrustumScale));
|
|
3592
3592
|
}
|
|
3593
3593
|
createCamera() {
|
|
3594
3594
|
let { width: e, height: t } = this.getContainerSize(), n = e / t;
|
|
@@ -3668,7 +3668,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3668
3668
|
getSpinStaggerFactor(e, t) {
|
|
3669
3669
|
let n = this.settings.instanceSpinStagger;
|
|
3670
3670
|
if (n === 0) return 1;
|
|
3671
|
-
let r =
|
|
3671
|
+
let r = pn(this.settings.distributionMode) ? e.spinProgress : this.getLayoutProgress(e, t);
|
|
3672
3672
|
if (this.settings.instanceSpinStaggerMode === "alternating") {
|
|
3673
3673
|
let t = e.gridX % 2 == 0 ? 1 : -1;
|
|
3674
3674
|
return Math.max(-4, 1 + t * n * r);
|
|
@@ -3678,7 +3678,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3678
3678
|
getSpinPhaseOffset(e, t) {
|
|
3679
3679
|
let n = this.settings.instanceSpinPhaseStagger;
|
|
3680
3680
|
if (n === 0) return 0;
|
|
3681
|
-
let r =
|
|
3681
|
+
let r = pn(this.settings.distributionMode) ? e.spinProgress : this.getLayoutProgress(e, t);
|
|
3682
3682
|
return this.settings.instanceSpinStaggerMode === "alternating" ? (e.gridX % 2 == 0 ? 1 : -1) * n * r : n * r;
|
|
3683
3683
|
}
|
|
3684
3684
|
getLayoutProgress(e, t) {
|
|
@@ -3723,7 +3723,7 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3723
3723
|
this.clearInstanceColorsForImageSurfaces(), this.ensureInstanceOpacityAttribute(this.mesh), this.ensureInstanceOpacityAttribute(this.outlineMesh), this.imageSetMeshes.forEach((e) => this.ensureInstanceOpacityAttribute(e));
|
|
3724
3724
|
let ae = this.createSurfaceWriteState(), oe = this.getLayoutBounds(this.layouts), E = this.getBuildTransform(this.getBuildProgress(e));
|
|
3725
3725
|
this.layouts.forEach((r, u) => {
|
|
3726
|
-
let d =
|
|
3726
|
+
let d = xt({
|
|
3727
3727
|
layout: r,
|
|
3728
3728
|
settings: T,
|
|
3729
3729
|
pathTravelProgress: t,
|
|
@@ -3731,8 +3731,8 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3731
3731
|
}), f = (d.gridX + d.gridZ) % 2 == 0 ? 1 : -1, p = d.distance;
|
|
3732
3732
|
S === "linear-wave" && (p = d.x + d.z), S === "checker-wave" && (p = d.distance * f), S === "ring-wave" && (p = d.ringIndex);
|
|
3733
3733
|
let m = (d.distance + d.ringIndex) * b, C = e * _ - m, w = Math.sin(p * g - C);
|
|
3734
|
-
w =
|
|
3735
|
-
let te = Math.abs(_) <=
|
|
3734
|
+
w = ht(w, v, y), S === "cross-field" && (w = ht(Math.sin(d.x * g - C) * Math.sin(d.z * g + C), v, y));
|
|
3735
|
+
let te = Math.abs(_) <= X ? 0 : w * h;
|
|
3736
3736
|
this.dummy.position.set(d.x * E.sceneScale, (re + d.y + te) * E.sceneScale + E.offsetY, d.z * E.sceneScale);
|
|
3737
3737
|
let D = this.getInstanceScale(d, x, ee) * E.scale * E.sceneScale;
|
|
3738
3738
|
this.dummy.scale.set(D, D, D);
|
|
@@ -3740,8 +3740,8 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3740
3740
|
this.manualQuatScratch.setFromEuler(this.orientationEulerScratch.set(i + E.rotationX, a + E.rotationY, o + E.rotationZ)), this.spinQuatScratch.setFromEuler(this.orientationEulerScratch.set(e * s * se + (Math.abs(s) > 1e-4 ? ce : 0), e * c * se + (Math.abs(c) > 1e-4 ? ce : 0), e * l * se + (Math.abs(l) > 1e-4 ? ce : 0))), this.dummy.quaternion.copy(O).multiply(this.manualQuatScratch).multiply(this.spinQuatScratch), this.dummy.updateMatrix();
|
|
3741
3741
|
let k = this.getInstanceOpacity(u, d) * E.opacity, A = this.setSurfaceMatrixAt(u, this.dummy.matrix, ae);
|
|
3742
3742
|
this.setInstanceOpacityAt(A.mesh, A.index, k), this.setInstanceColorAt(A.mesh, A.index, this.getInstanceColor(d, oe)), this.dummy.scale.setScalar(D * ne), this.dummy.updateMatrix();
|
|
3743
|
-
let
|
|
3744
|
-
|
|
3743
|
+
let j = this.edgeLines[u];
|
|
3744
|
+
j && (j.matrix.copy(this.dummy.matrix), j.matrixWorldNeedsUpdate = !0, this.setEdgeLineOpacity(j, k)), this.dummy.scale.setScalar(D * (1 + this.settings.outlineThickness)), this.dummy.updateMatrix(), this.outlineMesh.setMatrixAt(u, this.dummy.matrix), this.setInstanceOpacityAt(this.outlineMesh, u, k);
|
|
3745
3745
|
}), this.finishSurfaceWrites(ae), this.outlineMesh.instanceMatrix.needsUpdate = !0, this.renderScene(r);
|
|
3746
3746
|
}
|
|
3747
3747
|
getInstanceScale(e, t, n) {
|
|
@@ -3796,116 +3796,116 @@ ${t.materialTexture ? "vec4 speMaterialTextureColor = getSpeMaterialTextureColor
|
|
|
3796
3796
|
let { width: e, height: t } = this.getContainerSize();
|
|
3797
3797
|
this.applyRendererPixelRatio(), this.renderer.setSize(e, t), this.invalidateBackgroundImageDisplayTexture(), this.invalidateTransparentBackgroundPreviewTexture(), this.updateSceneBackground(), this.updateEdgeResolution(e, t), this.renderIdleFrame();
|
|
3798
3798
|
};
|
|
3799
|
-
},
|
|
3799
|
+
}, Sn = 8, Cn = "300px", wn = /* @__PURE__ */ new Set(), Tn = /* @__PURE__ */ new WeakMap(), En = /* @__PURE__ */ new WeakSet(), Dn = /* @__PURE__ */ new Map(), On = null, kn = Sn, An = 0, jn = !1, Mn = !1, Nn = () => typeof IntersectionObserver < "u", Pn = () => typeof document > "u" || document.visibilityState !== "hidden", Fn = () => {
|
|
3800
3800
|
let e = 0;
|
|
3801
|
-
for (let t of
|
|
3801
|
+
for (let t of wn) t.isMounted() && (e += 1);
|
|
3802
3802
|
return e;
|
|
3803
|
-
},
|
|
3803
|
+
}, In = (e) => {
|
|
3804
3804
|
let t = null;
|
|
3805
|
-
for (let n of
|
|
3805
|
+
for (let n of wn) n === e || !n.isMounted() || !n.evictable || n.visible || (!t || n.lastUsed < t.lastUsed) && (t = n);
|
|
3806
3806
|
return t;
|
|
3807
|
-
},
|
|
3808
|
-
|
|
3809
|
-
},
|
|
3810
|
-
for (;
|
|
3811
|
-
let t =
|
|
3807
|
+
}, Ln = () => {
|
|
3808
|
+
jn || (jn = !0, console.warn(`Sinth: more than ${kn} embeds are on screen at once, so the WebGL context budget cannot be honoured. The browser may drop the oldest context. Show fewer patterns at a time, or raise \`maxLiveContexts\` if the page can afford it.`));
|
|
3809
|
+
}, Rn = (e) => {
|
|
3810
|
+
for (; Fn() >= kn;) {
|
|
3811
|
+
let t = In(e);
|
|
3812
3812
|
if (!t) {
|
|
3813
|
-
|
|
3813
|
+
Ln();
|
|
3814
3814
|
return;
|
|
3815
3815
|
}
|
|
3816
3816
|
t.unmount();
|
|
3817
3817
|
}
|
|
3818
|
-
},
|
|
3819
|
-
|
|
3820
|
-
},
|
|
3818
|
+
}, zn = (e) => {
|
|
3819
|
+
An += 1, e.lastUsed = An, !e.isMounted() && (Rn(e), e.mount());
|
|
3820
|
+
}, Bn = (e, t) => {
|
|
3821
3821
|
if (e.visible = t, !t) {
|
|
3822
3822
|
e.suspend();
|
|
3823
3823
|
return;
|
|
3824
3824
|
}
|
|
3825
|
-
|
|
3826
|
-
}, Bn = () => {
|
|
3827
|
-
let e = Nn();
|
|
3828
|
-
for (let t of Cn) t.isMounted() && (e ? t.visible && t.resume() : t.suspend());
|
|
3825
|
+
zn(e), Pn() && e.resume();
|
|
3829
3826
|
}, Vn = () => {
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3827
|
+
let e = Pn();
|
|
3828
|
+
for (let t of wn) t.isMounted() && (e ? t.visible && t.resume() : t.suspend());
|
|
3829
|
+
}, Hn = () => {
|
|
3830
|
+
Mn || typeof document > "u" || (Mn = !0, document.addEventListener("visibilitychange", Vn));
|
|
3831
|
+
}, Un = (e) => {
|
|
3832
|
+
let t = Dn.get(e);
|
|
3833
3833
|
return t || (t = new IntersectionObserver((e) => {
|
|
3834
3834
|
for (let t of e) {
|
|
3835
|
-
let e =
|
|
3836
|
-
if (e) for (let n of e)
|
|
3835
|
+
let e = Tn.get(t.target);
|
|
3836
|
+
if (e) for (let n of e) Bn(n, t.isIntersecting);
|
|
3837
3837
|
}
|
|
3838
|
-
}, { rootMargin: e }),
|
|
3839
|
-
},
|
|
3840
|
-
if (
|
|
3841
|
-
|
|
3838
|
+
}, { rootMargin: e }), Dn.set(e, t)), t;
|
|
3839
|
+
}, Wn = (e) => {
|
|
3840
|
+
if (En.has(e)) return;
|
|
3841
|
+
En.add(e);
|
|
3842
3842
|
let t = e.id ? `id="${e.id}"` : e.className ? `class="${e.className}"` : "the same element";
|
|
3843
3843
|
console.warn(`Sinth: more than one embed is pointed at ${t}, so they render on top of one another and only the topmost is visible. Each embed needs its own container. This is usually older embed code that looks the container up by name — re-copy the block from the editor (Embed → Copy embed code) and paste it again. The current code finds the container next to its own <script> tag, so it is safe to paste any number of times.`);
|
|
3844
3844
|
};
|
|
3845
|
-
function
|
|
3845
|
+
function Gn(e, t) {
|
|
3846
3846
|
if (typeof t.maxLiveContexts == "number" && Number.isFinite(t.maxLiveContexts)) {
|
|
3847
3847
|
let e = Math.max(1, Math.floor(t.maxLiveContexts));
|
|
3848
|
-
|
|
3848
|
+
On = On === null ? e : Math.min(On, e), kn = On;
|
|
3849
3849
|
}
|
|
3850
|
-
let n =
|
|
3850
|
+
let n = Nn(), r = t.lazy && n, i = {
|
|
3851
3851
|
...e,
|
|
3852
3852
|
evictable: r,
|
|
3853
3853
|
visible: !r,
|
|
3854
3854
|
lastUsed: 0,
|
|
3855
3855
|
rootMargin: t.rootMargin
|
|
3856
3856
|
};
|
|
3857
|
-
if (
|
|
3858
|
-
let t =
|
|
3859
|
-
t ? t.size > 0 &&
|
|
3857
|
+
if (wn.add(i), Hn(), n) {
|
|
3858
|
+
let t = Tn.get(e.container);
|
|
3859
|
+
t ? t.size > 0 && Wn(e.container) : (t = /* @__PURE__ */ new Set(), Tn.set(e.container, t)), t.add(i), Un(i.rootMargin).observe(e.container);
|
|
3860
3860
|
}
|
|
3861
|
-
return r || (
|
|
3861
|
+
return r || (zn(i), Pn() && i.resume()), {
|
|
3862
3862
|
claim: () => {
|
|
3863
|
-
|
|
3863
|
+
zn(i);
|
|
3864
3864
|
},
|
|
3865
3865
|
release: () => {
|
|
3866
|
-
if (
|
|
3867
|
-
let t =
|
|
3868
|
-
t?.delete(i), (!t || t.size === 0) && (
|
|
3866
|
+
if (wn.delete(i), !n) return;
|
|
3867
|
+
let t = Tn.get(e.container);
|
|
3868
|
+
t?.delete(i), (!t || t.size === 0) && (Un(i.rootMargin).unobserve(e.container), Tn.delete(e.container));
|
|
3869
3869
|
}
|
|
3870
3870
|
};
|
|
3871
3871
|
}
|
|
3872
3872
|
//#endregion
|
|
3873
3873
|
//#region src/embed/resolveContainer.ts
|
|
3874
|
-
var
|
|
3875
|
-
|
|
3876
|
-
},
|
|
3874
|
+
var Kn = "sinth", qn = `.${Kn}`, Jn = /* @__PURE__ */ new WeakSet(), Yn = (e) => {
|
|
3875
|
+
Jn.add(e);
|
|
3876
|
+
}, Xn = (e) => Jn.has(e), Zn = (e) => e instanceof HTMLElement && e.matches(qn) && !Jn.has(e), Qn = (e) => {
|
|
3877
3877
|
if (!e) return null;
|
|
3878
|
-
for (let t of e.querySelectorAll(
|
|
3878
|
+
for (let t of e.querySelectorAll(qn)) if (Zn(t)) return t;
|
|
3879
3879
|
return null;
|
|
3880
3880
|
};
|
|
3881
|
-
function
|
|
3882
|
-
if (
|
|
3881
|
+
function $n(e) {
|
|
3882
|
+
if (Zn(e ?? null)) return e;
|
|
3883
3883
|
if (e) {
|
|
3884
|
-
for (let t = e.previousElementSibling; t; t = t.previousElementSibling) if (
|
|
3885
|
-
let t =
|
|
3884
|
+
for (let t = e.previousElementSibling; t; t = t.previousElementSibling) if (Zn(t)) return t;
|
|
3885
|
+
let t = Qn(e.parentElement);
|
|
3886
3886
|
if (t) return t;
|
|
3887
3887
|
}
|
|
3888
|
-
let t =
|
|
3888
|
+
let t = Qn(typeof document > "u" ? null : document);
|
|
3889
3889
|
if (t) return t;
|
|
3890
|
-
throw Error(`Sinth: no free container found for this embed. Every block needs its own element with class "${
|
|
3890
|
+
throw Error(`Sinth: no free container found for this embed. Every block needs its own element with class "${Kn}" — the copied embed code brings one with it, so this usually means the <div> was deleted, or its class was renamed, or another embed has already taken it.`);
|
|
3891
3891
|
}
|
|
3892
3892
|
//#endregion
|
|
3893
3893
|
//#region src/embed/createSinthEmbed.ts
|
|
3894
|
-
var
|
|
3894
|
+
var er = 1e3, tr = async (e) => {
|
|
3895
3895
|
e.rebuildGeometry(), e.updateMaterial(), e.updateColors(), e.updateLights(), e.updateCamera(), e.updatePattern();
|
|
3896
3896
|
};
|
|
3897
|
-
function
|
|
3897
|
+
function nr({ container: e, preset: t, autoStart: n = !0, lazy: r = !0, rootMargin: i = Cn, maxLiveContexts: a }) {
|
|
3898
3898
|
let o = null, s = t, c = n, l = !1, u = !1, d = !1, f = null, p = !1, m = null, h = () => {
|
|
3899
3899
|
let t = e.getBoundingClientRect();
|
|
3900
3900
|
return t.width > 0 && t.height > 0;
|
|
3901
3901
|
};
|
|
3902
|
-
|
|
3902
|
+
Yn(e);
|
|
3903
3903
|
let g = () => {
|
|
3904
|
-
let t = new
|
|
3904
|
+
let t = new xn(e, {
|
|
3905
3905
|
config: s,
|
|
3906
3906
|
autoStart: c && !u
|
|
3907
3907
|
});
|
|
3908
|
-
o = t, s &&
|
|
3908
|
+
o = t, s && tr(t).catch((e) => {
|
|
3909
3909
|
console.error("Unable to initialise the Sinth embed.", e);
|
|
3910
3910
|
});
|
|
3911
3911
|
}, _ = () => {
|
|
@@ -3914,7 +3914,7 @@ function tr({ container: e, preset: t, autoStart: n = !0, lazy: r = !0, rootMarg
|
|
|
3914
3914
|
p = !0;
|
|
3915
3915
|
let t = e.getBoundingClientRect().height === 0 ? "height" : "width";
|
|
3916
3916
|
console.warn(`Sinth: this container has no ${t}, so there is nothing to render into and the embed is waiting. Sinth fills the box it is given — if the container is sized \`${t}: 100%\`, give its parent a ${t} (or set a ${t} on the container itself). It will start on its own the moment the container has one.`, e);
|
|
3917
|
-
},
|
|
3917
|
+
}, er));
|
|
3918
3918
|
}, v = () => {
|
|
3919
3919
|
if (d = !0, _(), !f) {
|
|
3920
3920
|
if (typeof ResizeObserver > "u") {
|
|
@@ -3941,7 +3941,7 @@ function tr({ container: e, preset: t, autoStart: n = !0, lazy: r = !0, rootMarg
|
|
|
3941
3941
|
}
|
|
3942
3942
|
}, b = () => {
|
|
3943
3943
|
d = !1, o &&= (o.dispose(), null);
|
|
3944
|
-
}, x =
|
|
3944
|
+
}, x = Gn({
|
|
3945
3945
|
container: e,
|
|
3946
3946
|
mount: y,
|
|
3947
3947
|
unmount: b,
|
|
@@ -3962,7 +3962,7 @@ function tr({ container: e, preset: t, autoStart: n = !0, lazy: r = !0, rootMarg
|
|
|
3962
3962
|
return o;
|
|
3963
3963
|
},
|
|
3964
3964
|
updatePreset: (e) => {
|
|
3965
|
-
s = e, o && (o.setConfig(e),
|
|
3965
|
+
s = e, o && (o.setConfig(e), tr(o).catch((e) => {
|
|
3966
3966
|
console.error("Unable to update the Sinth embed preset.", e);
|
|
3967
3967
|
}));
|
|
3968
3968
|
},
|
|
@@ -3977,76 +3977,101 @@ function tr({ container: e, preset: t, autoStart: n = !0, lazy: r = !0, rootMarg
|
|
|
3977
3977
|
}
|
|
3978
3978
|
};
|
|
3979
3979
|
}
|
|
3980
|
+
var rr = (e) => e.startsWith("s1:"), ir = (e) => {
|
|
3981
|
+
try {
|
|
3982
|
+
return e(), !0;
|
|
3983
|
+
} catch {
|
|
3984
|
+
return !1;
|
|
3985
|
+
}
|
|
3986
|
+
}, ar, or = () => ar ??= typeof DecompressionStream < "u" && ir(() => new DecompressionStream("deflate-raw")), sr = (e) => {
|
|
3987
|
+
let t = atob(e), n = new Uint8Array(t.length);
|
|
3988
|
+
for (let e = 0; e < t.length; e += 1) n[e] = t.charCodeAt(e);
|
|
3989
|
+
return n;
|
|
3990
|
+
}, cr = async (e, t) => {
|
|
3991
|
+
let n = new Blob([e]).stream().pipeThrough(t);
|
|
3992
|
+
return new Uint8Array(await new Response(n).arrayBuffer());
|
|
3993
|
+
};
|
|
3994
|
+
async function lr(e) {
|
|
3995
|
+
let t = await cr(sr(e.slice(3)), new DecompressionStream("deflate-raw"));
|
|
3996
|
+
return new TextDecoder().decode(t);
|
|
3997
|
+
}
|
|
3980
3998
|
//#endregion
|
|
3981
3999
|
//#region src/embed/autoMount.ts
|
|
3982
|
-
var
|
|
4000
|
+
var ur = `.${Kn}, [data-sinth-preset]`, dr = ":scope > script[type=\"application/json\"]", $ = /* @__PURE__ */ new WeakSet(), fr = !1, pr = (e, t) => {
|
|
3983
4001
|
try {
|
|
3984
4002
|
return JSON.parse(e);
|
|
3985
4003
|
} catch (e) {
|
|
3986
4004
|
return console.error("Sinth: this embed’s preset is not valid JSON, so it was skipped.", t, e), null;
|
|
3987
4005
|
}
|
|
3988
|
-
},
|
|
4006
|
+
}, mr = (e) => {
|
|
3989
4007
|
if (e === null || e.trim() === "") return;
|
|
3990
4008
|
let t = Number(e);
|
|
3991
4009
|
return Number.isFinite(t) ? t : void 0;
|
|
3992
|
-
},
|
|
4010
|
+
}, hr = (e) => {
|
|
3993
4011
|
let t = {};
|
|
3994
4012
|
e.dataset.sinthLazy === "false" && (t.lazy = !1), e.dataset.sinthAutostart === "false" && (t.autoStart = !1), e.dataset.sinthRootMargin && (t.rootMargin = e.dataset.sinthRootMargin);
|
|
3995
|
-
let n =
|
|
4013
|
+
let n = mr(e.dataset.sinthMaxContexts ?? null);
|
|
3996
4014
|
return n !== void 0 && (t.maxLiveContexts = n), t;
|
|
3997
|
-
},
|
|
3998
|
-
if (
|
|
4015
|
+
}, gr = (e, t) => {
|
|
4016
|
+
if (Xn(e)) return null;
|
|
3999
4017
|
try {
|
|
4000
|
-
return
|
|
4018
|
+
return nr({
|
|
4001
4019
|
container: e,
|
|
4002
4020
|
preset: t,
|
|
4003
|
-
...
|
|
4021
|
+
...hr(e)
|
|
4004
4022
|
});
|
|
4005
4023
|
} catch (t) {
|
|
4006
4024
|
return console.error("Sinth: this embed could not be created.", e, t), null;
|
|
4007
4025
|
}
|
|
4008
|
-
},
|
|
4009
|
-
if (
|
|
4010
|
-
let t = e.querySelector(
|
|
4026
|
+
}, _r = (e) => {
|
|
4027
|
+
if (Xn(e) || $.has(e)) return null;
|
|
4028
|
+
let t = e.querySelector(dr);
|
|
4011
4029
|
if (t) {
|
|
4012
|
-
let n =
|
|
4013
|
-
return n ?
|
|
4030
|
+
let n = pr(t.textContent ?? "", e);
|
|
4031
|
+
return n ? gr(e, n) : null;
|
|
4014
4032
|
}
|
|
4015
4033
|
let n = e.dataset.sinthPreset?.trim();
|
|
4016
4034
|
if (!n) return null;
|
|
4035
|
+
if (rr(n)) return or() ? ($.add(e), lr(n).then((t) => {
|
|
4036
|
+
$.delete(e);
|
|
4037
|
+
let n = pr(t, e);
|
|
4038
|
+
n && gr(e, n);
|
|
4039
|
+
}).catch((t) => {
|
|
4040
|
+
$.delete(e), console.error("Sinth: this embed’s preset could not be expanded, so it was skipped.", e, t);
|
|
4041
|
+
}), null) : (console.error("Sinth: this browser cannot expand a compact preset (DecompressionStream with \"deflate-raw\"), so this embed was skipped.", e), null);
|
|
4017
4042
|
if (n.startsWith("{")) {
|
|
4018
|
-
let t =
|
|
4019
|
-
return t ?
|
|
4043
|
+
let t = pr(n, e);
|
|
4044
|
+
return t ? gr(e, t) : null;
|
|
4020
4045
|
}
|
|
4021
|
-
return
|
|
4046
|
+
return $.add(e), fetch(n, { credentials: "omit" }).then((e) => {
|
|
4022
4047
|
if (!e.ok) throw Error(`${e.status} ${e.statusText}`);
|
|
4023
4048
|
return e.json();
|
|
4024
4049
|
}).then((t) => {
|
|
4025
|
-
|
|
4050
|
+
$.delete(e), gr(e, t);
|
|
4026
4051
|
}).catch((t) => {
|
|
4027
|
-
|
|
4052
|
+
$.delete(e), console.error(`Sinth: could not load the preset at "${n}".`, e, t);
|
|
4028
4053
|
}), null;
|
|
4029
4054
|
};
|
|
4030
|
-
function
|
|
4055
|
+
function vr(e = document) {
|
|
4031
4056
|
let t = [];
|
|
4032
|
-
for (let n of e.querySelectorAll(
|
|
4033
|
-
let e =
|
|
4057
|
+
for (let n of e.querySelectorAll(ur)) {
|
|
4058
|
+
let e = _r(n);
|
|
4034
4059
|
e && t.push(e);
|
|
4035
4060
|
}
|
|
4036
4061
|
return t;
|
|
4037
4062
|
}
|
|
4038
|
-
var
|
|
4039
|
-
function
|
|
4040
|
-
if (
|
|
4041
|
-
|
|
4063
|
+
var yr = (e) => e instanceof Element ? e.matches(ur) || e.querySelector(ur) !== null : !1;
|
|
4064
|
+
function br() {
|
|
4065
|
+
if (fr || typeof document > "u" || window.SINTH_AUTO_MOUNT === !1) return;
|
|
4066
|
+
fr = !0;
|
|
4042
4067
|
let e = () => {
|
|
4043
|
-
if (
|
|
4068
|
+
if (vr(document), typeof MutationObserver > "u") return;
|
|
4044
4069
|
let e = !1;
|
|
4045
4070
|
new MutationObserver((t) => {
|
|
4046
4071
|
if (!e) {
|
|
4047
|
-
for (let n of t) for (let t of n.addedNodes) if (
|
|
4072
|
+
for (let n of t) for (let t of n.addedNodes) if (yr(t)) {
|
|
4048
4073
|
e = !0, requestAnimationFrame(() => {
|
|
4049
|
-
e = !1,
|
|
4074
|
+
e = !1, vr(document);
|
|
4050
4075
|
});
|
|
4051
4076
|
return;
|
|
4052
4077
|
}
|
|
@@ -4064,6 +4089,6 @@ function pr() {
|
|
|
4064
4089
|
}
|
|
4065
4090
|
//#endregion
|
|
4066
4091
|
//#region src/version.ts
|
|
4067
|
-
var
|
|
4092
|
+
var xr = "1.0.4", Sr = "v53", Cr = `${xr} · v53`;
|
|
4068
4093
|
//#endregion
|
|
4069
|
-
export {
|
|
4094
|
+
export { Kn as SINTH_CONTAINER_CLASS, Sr as SNAPSHOT, xr as VERSION, Cr as VERSION_LABEL, nr as createSinthEmbed, n as fontBaseUrl, vr as mountAll, bn as normalizeSinthConfig, $n as resolveContainer, l as setFontBaseUrl, br as startAutoMount };
|