@frybynite/image-cloud 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/image-cloud.js
CHANGED
|
@@ -252,7 +252,7 @@ function rt(n, t) {
|
|
|
252
252
|
const e = { ...n };
|
|
253
253
|
return t.border !== void 0 && (e.border = { ...n.border, ...t.border }), t.borderTop !== void 0 && (e.borderTop = { ...n.borderTop, ...t.borderTop }), t.borderRight !== void 0 && (e.borderRight = { ...n.borderRight, ...t.borderRight }), t.borderBottom !== void 0 && (e.borderBottom = { ...n.borderBottom, ...t.borderBottom }), t.borderLeft !== void 0 && (e.borderLeft = { ...n.borderLeft, ...t.borderLeft }), t.filter !== void 0 && (e.filter = { ...n.filter, ...t.filter }), t.outline !== void 0 && (e.outline = { ...n.outline, ...t.outline }), t.shadow !== void 0 && (e.shadow = t.shadow), t.opacity !== void 0 && (e.opacity = t.opacity), t.cursor !== void 0 && (e.cursor = t.cursor), t.className !== void 0 && (e.className = t.className), t.objectFit !== void 0 && (e.objectFit = t.objectFit), t.aspectRatio !== void 0 && (e.aspectRatio = t.aspectRatio), t.borderRadiusTopLeft !== void 0 && (e.borderRadiusTopLeft = t.borderRadiusTopLeft), t.borderRadiusTopRight !== void 0 && (e.borderRadiusTopRight = t.borderRadiusTopRight), t.borderRadiusBottomRight !== void 0 && (e.borderRadiusBottomRight = t.borderRadiusBottomRight), t.borderRadiusBottomLeft !== void 0 && (e.borderRadiusBottomLeft = t.borderRadiusBottomLeft), e;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function kt(n, t) {
|
|
256
256
|
if (!t) return { ...n };
|
|
257
257
|
const e = rt(n.default, t.default), i = rt(
|
|
258
258
|
rt(e, n.hover),
|
|
@@ -267,7 +267,7 @@ function Gt(n, t) {
|
|
|
267
267
|
focused: o
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function Gt(n, t) {
|
|
271
271
|
var i, o, s, c, a, h, l, g;
|
|
272
272
|
if (!t) return { ...n };
|
|
273
273
|
const e = { ...n };
|
|
@@ -322,12 +322,12 @@ function qt(n = {}) {
|
|
|
322
322
|
}));
|
|
323
323
|
const o = {
|
|
324
324
|
loader: { ...b.loader },
|
|
325
|
-
image:
|
|
325
|
+
image: Gt($t, i),
|
|
326
326
|
layout: { ...b.layout },
|
|
327
327
|
animation: { ...b.animation },
|
|
328
328
|
interaction: { ...b.interaction },
|
|
329
329
|
rendering: { ...b.rendering },
|
|
330
|
-
styling:
|
|
330
|
+
styling: kt(Lt, n.styling),
|
|
331
331
|
debug: b.debug
|
|
332
332
|
};
|
|
333
333
|
return n.loader && (o.loader = {
|
|
@@ -674,14 +674,14 @@ function ne(n) {
|
|
|
674
674
|
startRotation: d,
|
|
675
675
|
scaleConfig: f,
|
|
676
676
|
startScale: y
|
|
677
|
-
} = n, p = o.type, u = d !== void 0 && d !== h, m = (r == null ? void 0 : r.mode) === "wobble", w = (r == null ? void 0 : r.wobble) || { amplitude: 15, frequency: 3, decay: !0 }, v = u || m, E = y !== void 0 && y !== l,
|
|
678
|
-
if ((p === "linear" || p === "arc") && !v && !(E ||
|
|
677
|
+
} = n, p = o.type, u = d !== void 0 && d !== h, m = (r == null ? void 0 : r.mode) === "wobble", w = (r == null ? void 0 : r.wobble) || { amplitude: 15, frequency: 3, decay: !0 }, v = u || m, E = y !== void 0 && y !== l, z = (f == null ? void 0 : f.mode) === "pop", x = (f == null ? void 0 : f.pop) || { overshoot: 1.2, bounces: 1 };
|
|
678
|
+
if ((p === "linear" || p === "arc") && !v && !(E || z)) {
|
|
679
679
|
g && g();
|
|
680
680
|
return;
|
|
681
681
|
}
|
|
682
|
-
const
|
|
683
|
-
function
|
|
684
|
-
const F =
|
|
682
|
+
const k = performance.now(), j = -c / 2, U = -a / 2;
|
|
683
|
+
function P(G) {
|
|
684
|
+
const F = G - k, I = Math.min(F / s, 1);
|
|
685
685
|
let A;
|
|
686
686
|
switch (p) {
|
|
687
687
|
case "bounce": {
|
|
@@ -715,12 +715,12 @@ function ne(n) {
|
|
|
715
715
|
};
|
|
716
716
|
}
|
|
717
717
|
const O = A.x - i.x, S = A.y - i.y;
|
|
718
|
-
let z;
|
|
719
|
-
m ? z = ee(I, h, w) : u ? z = st(d, h, I) : z = h;
|
|
720
718
|
let T;
|
|
721
|
-
|
|
719
|
+
m ? T = ee(I, h, w) : u ? T = st(d, h, I) : T = h;
|
|
720
|
+
let M;
|
|
721
|
+
z ? M = ie(I, l, x) : E ? M = st(y, l, I) : M = l, t.style.transform = `translate(${j}px, ${U}px) translate(${O}px, ${S}px) rotate(${T}deg) scale(${M})`, I < 1 ? requestAnimationFrame(P) : (t.style.transform = `translate(${j}px, ${U}px) rotate(${h}deg) scale(${l})`, g && g());
|
|
722
722
|
}
|
|
723
|
-
requestAnimationFrame(
|
|
723
|
+
requestAnimationFrame(P);
|
|
724
724
|
}
|
|
725
725
|
function oe(n) {
|
|
726
726
|
return n === "bounce" || n === "elastic" || n === "wave";
|
|
@@ -1089,15 +1089,15 @@ class re {
|
|
|
1089
1089
|
* @returns Array of layout objects with position, rotation, scale
|
|
1090
1090
|
*/
|
|
1091
1091
|
generate(t, e, i = {}) {
|
|
1092
|
-
var x, L,
|
|
1093
|
-
const o = [], { width: s, height: c } = e, a = this.config.spacing.padding, h = i.fixedHeight ?? this.config.sizing.base, l = ((x = this.imageConfig.rotation) == null ? void 0 : x.mode) ?? "none", g = ((
|
|
1092
|
+
var x, L, k, j, U, P, G, F, I;
|
|
1093
|
+
const o = [], { width: s, height: c } = e, a = this.config.spacing.padding, h = i.fixedHeight ?? this.config.sizing.base, l = ((x = this.imageConfig.rotation) == null ? void 0 : x.mode) ?? "none", g = ((k = (L = this.imageConfig.rotation) == null ? void 0 : L.range) == null ? void 0 : k.min) ?? -15, r = ((U = (j = this.imageConfig.rotation) == null ? void 0 : j.range) == null ? void 0 : U.max) ?? 15, d = ((G = (P = this.imageConfig.sizing) == null ? void 0 : P.variance) == null ? void 0 : G.min) ?? 1, f = ((I = (F = this.imageConfig.sizing) == null ? void 0 : F.variance) == null ? void 0 : I.max) ?? 1, y = d !== 1 || f !== 1, u = h * 1.5 / 2, m = h / 2, w = s - a - u, v = c - a - m, E = a + u, z = a + m;
|
|
1094
1094
|
for (let A = 0; A < t; A++) {
|
|
1095
|
-
const O = this.random(E, w), S = this.random(
|
|
1095
|
+
const O = this.random(E, w), S = this.random(z, v), T = l === "random" ? this.random(g, r) : 0, M = y ? this.random(d, f) : 1, D = h * M, Z = {
|
|
1096
1096
|
id: A,
|
|
1097
1097
|
x: O,
|
|
1098
1098
|
y: S,
|
|
1099
|
-
rotation:
|
|
1100
|
-
scale:
|
|
1099
|
+
rotation: T,
|
|
1100
|
+
scale: M,
|
|
1101
1101
|
baseSize: D
|
|
1102
1102
|
};
|
|
1103
1103
|
o.push(Z);
|
|
@@ -1126,10 +1126,10 @@ class ce {
|
|
|
1126
1126
|
* @returns Array of layout objects with position, rotation, scale
|
|
1127
1127
|
*/
|
|
1128
1128
|
generate(t, e, i = {}) {
|
|
1129
|
-
var L,
|
|
1130
|
-
const o = [], { width: s, height: c } = e, { debugRadials: a } = this.config, h = this.config.sizing.base, l = ((L = this.imageConfig.rotation) == null ? void 0 : L.mode) ?? "none", g = ((j = (
|
|
1129
|
+
var L, k, j, U, P, G, F, I, A, O;
|
|
1130
|
+
const o = [], { width: s, height: c } = e, { debugRadials: a } = this.config, h = this.config.sizing.base, l = ((L = this.imageConfig.rotation) == null ? void 0 : L.mode) ?? "none", g = ((j = (k = this.imageConfig.rotation) == null ? void 0 : k.range) == null ? void 0 : j.min) ?? -15, r = ((P = (U = this.imageConfig.rotation) == null ? void 0 : U.range) == null ? void 0 : P.max) ?? 15, d = ((F = (G = this.imageConfig.sizing) == null ? void 0 : G.variance) == null ? void 0 : F.min) ?? 1, f = ((A = (I = this.imageConfig.sizing) == null ? void 0 : I.variance) == null ? void 0 : A.max) ?? 1, y = d !== 1 || f !== 1, p = ((O = this.imageConfig.sizing) == null ? void 0 : O.scaleDecay) ?? 0, u = ["green", "blue", "red", "yellow", "orange", "purple"], m = i.fixedHeight ?? h, w = s / 2, v = c / 2, E = Math.ceil(Math.sqrt(t));
|
|
1131
1131
|
if (t > 0) {
|
|
1132
|
-
const S = y ? this.random(d, f) : 1,
|
|
1132
|
+
const S = y ? this.random(d, f) : 1, T = m * S;
|
|
1133
1133
|
o.push({
|
|
1134
1134
|
id: 0,
|
|
1135
1135
|
x: w,
|
|
@@ -1137,28 +1137,28 @@ class ce {
|
|
|
1137
1137
|
rotation: l === "random" ? this.random(g * 0.33, r * 0.33) : 0,
|
|
1138
1138
|
// Less rotation for center
|
|
1139
1139
|
scale: S,
|
|
1140
|
-
baseSize:
|
|
1140
|
+
baseSize: T,
|
|
1141
1141
|
zIndex: 100,
|
|
1142
1142
|
// Center image is highest
|
|
1143
1143
|
borderColor: a ? "cyan" : void 0
|
|
1144
1144
|
});
|
|
1145
1145
|
}
|
|
1146
|
-
let
|
|
1147
|
-
for (;
|
|
1148
|
-
const S = x / E,
|
|
1146
|
+
let z = 1, x = 1;
|
|
1147
|
+
for (; z < t; ) {
|
|
1148
|
+
const S = x / E, T = p > 0 ? 1 - S * p * 0.5 : 1, M = x * (m * 0.8), D = M * 1.5, Z = Math.PI * (3 * (D + M) - Math.sqrt((3 * D + M) * (D + 3 * M))), et = this.estimateWidth(m), W = Math.floor(Z / (et * 0.7));
|
|
1149
1149
|
if (W === 0) {
|
|
1150
1150
|
x++;
|
|
1151
1151
|
continue;
|
|
1152
1152
|
}
|
|
1153
1153
|
const N = 2 * Math.PI / W, it = x * (20 * Math.PI / 180);
|
|
1154
|
-
for (let Q = 0; Q < W &&
|
|
1155
|
-
const B = Q * N + it, q = y ? this.random(d, f) : 1, nt =
|
|
1156
|
-
let C = w + Math.cos(B) * D, H = v + Math.sin(B) *
|
|
1154
|
+
for (let Q = 0; Q < W && z < t; Q++) {
|
|
1155
|
+
const B = Q * N + it, q = y ? this.random(d, f) : 1, nt = T * q, V = m * nt;
|
|
1156
|
+
let C = w + Math.cos(B) * D, H = v + Math.sin(B) * M;
|
|
1157
1157
|
const $ = this.config.spacing.padding ?? 50, K = V * 1.5 / 2, _ = V / 2;
|
|
1158
1158
|
C - K < $ ? C = $ + K : C + K > s - $ && (C = s - $ - K), H - _ < $ ? H = $ + _ : H + _ > c - $ && (H = c - $ - _);
|
|
1159
1159
|
const tt = l === "random" ? this.random(g, r) : 0;
|
|
1160
1160
|
o.push({
|
|
1161
|
-
id:
|
|
1161
|
+
id: z,
|
|
1162
1162
|
x: C,
|
|
1163
1163
|
y: H,
|
|
1164
1164
|
rotation: tt,
|
|
@@ -1167,7 +1167,7 @@ class ce {
|
|
|
1167
1167
|
zIndex: Math.max(1, 100 - x),
|
|
1168
1168
|
// Outer rings have lower z-index
|
|
1169
1169
|
borderColor: a ? u[(x - 1) % u.length] : void 0
|
|
1170
|
-
}),
|
|
1170
|
+
}), z++;
|
|
1171
1171
|
}
|
|
1172
1172
|
x++;
|
|
1173
1173
|
}
|
|
@@ -1192,7 +1192,6 @@ class ce {
|
|
|
1192
1192
|
return Math.random() * (e - t) + t;
|
|
1193
1193
|
}
|
|
1194
1194
|
}
|
|
1195
|
-
console.log("[GridPlacementGenerator] Module loaded");
|
|
1196
1195
|
const le = {
|
|
1197
1196
|
columns: "auto",
|
|
1198
1197
|
rows: "auto",
|
|
@@ -1240,21 +1239,21 @@ class he {
|
|
|
1240
1239
|
p,
|
|
1241
1240
|
l,
|
|
1242
1241
|
a
|
|
1243
|
-
), w = a.stagger === "row", v = a.stagger === "column", E = w ? u + 0.5 : u,
|
|
1244
|
-
|
|
1242
|
+
), w = a.stagger === "row", v = a.stagger === "column", E = w ? u + 0.5 : u, z = v ? m + 0.5 : m, x = (y - a.gap * (u - 1)) / E, L = (p - a.gap * (m - 1)) / z, k = w ? x / 2 : 0, j = v ? L / 2 : 0, U = 1 + a.overlap, P = Math.min(x, L) * U, G = i.fixedHeight ? Math.min(i.fixedHeight, P) : P, F = u * x + (u - 1) * a.gap + k, I = m * L + (m - 1) * a.gap + j, A = h + (y - F) / 2, O = h + (p - I) / 2, S = u * m, T = a.columns !== "auto" && a.rows !== "auto", M = T && t > S;
|
|
1243
|
+
typeof window < "u" && (window.__gridOverflowDebug = {
|
|
1245
1244
|
gridConfigColumns: a.columns,
|
|
1246
1245
|
gridConfigRows: a.rows,
|
|
1247
1246
|
columns: u,
|
|
1248
1247
|
rows: m,
|
|
1249
1248
|
cellCount: S,
|
|
1250
|
-
hasFixedGrid:
|
|
1249
|
+
hasFixedGrid: T,
|
|
1251
1250
|
imageCount: t,
|
|
1252
|
-
isOverflowMode:
|
|
1251
|
+
isOverflowMode: M
|
|
1253
1252
|
});
|
|
1254
|
-
const D =
|
|
1253
|
+
const D = M ? new Array(S).fill(0) : [], Z = Math.min(x, L) * a.overflowOffset;
|
|
1255
1254
|
for (let C = 0; C < t; C++) {
|
|
1256
1255
|
let H, $, Y = 0;
|
|
1257
|
-
if (
|
|
1256
|
+
if (M && C >= S) {
|
|
1258
1257
|
const J = C - S, X = J % S;
|
|
1259
1258
|
Y = Math.floor(J / S) + 1, D[X]++, a.fillDirection === "row" ? (H = X % u, $ = Math.floor(X / u)) : ($ = X % m, H = Math.floor(X / m));
|
|
1260
1259
|
} else
|
|
@@ -1269,7 +1268,7 @@ class he {
|
|
|
1269
1268
|
K += this.random(-J, J), _ += this.random(-X, X);
|
|
1270
1269
|
}
|
|
1271
1270
|
let tt = K, ot = _;
|
|
1272
|
-
if (!
|
|
1271
|
+
if (!M && a.fillDirection === "row") {
|
|
1273
1272
|
const J = t % u || u;
|
|
1274
1273
|
if ($ === Math.floor((t - 1) / u) && J < u) {
|
|
1275
1274
|
const At = J * x + (J - 1) * a.gap;
|
|
@@ -1277,15 +1276,15 @@ class he {
|
|
|
1277
1276
|
a.alignment === "center" ? xt = (F - At) / 2 : a.alignment === "end" && (xt = F - At), tt += xt;
|
|
1278
1277
|
}
|
|
1279
1278
|
}
|
|
1280
|
-
const ft = f ? this.random(r, d) : 1, at =
|
|
1281
|
-
tt = Math.max(yt, Math.min(tt, bt)), ot = Math.max(
|
|
1279
|
+
const ft = f ? this.random(r, d) : 1, at = G * ft, dt = at * 1.5 / 2, gt = at / 2, yt = h + dt, bt = s - h - dt, Ut = h + gt, Pt = c - h - gt;
|
|
1280
|
+
tt = Math.max(yt, Math.min(tt, bt)), ot = Math.max(Ut, Math.min(ot, Pt));
|
|
1282
1281
|
let vt = 0;
|
|
1283
1282
|
if (g === "random") {
|
|
1284
1283
|
const J = ((q = (B = this.imageConfig.rotation) == null ? void 0 : B.range) == null ? void 0 : q.min) ?? -15, X = ((V = (nt = this.imageConfig.rotation) == null ? void 0 : nt.range) == null ? void 0 : V.max) ?? 15;
|
|
1285
1284
|
a.jitter > 0 ? vt = this.random(J * a.jitter, X * a.jitter) : vt = this.random(J, X);
|
|
1286
1285
|
}
|
|
1287
1286
|
let wt;
|
|
1288
|
-
|
|
1287
|
+
M && Y > 0 ? wt = 50 - Y : wt = M ? 100 + C : C + 1, o.push({
|
|
1289
1288
|
id: C,
|
|
1290
1289
|
x: tt,
|
|
1291
1290
|
y: ot,
|
|
@@ -1341,8 +1340,8 @@ class ue {
|
|
|
1341
1340
|
* @returns Array of layout objects with position, rotation, scale
|
|
1342
1341
|
*/
|
|
1343
1342
|
generate(t, e, i = {}) {
|
|
1344
|
-
var
|
|
1345
|
-
const o = [], { width: s, height: c } = e, a = { ...ge, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ?? this.config.sizing.base, g = ((
|
|
1343
|
+
var z, x, L, k, j, U, P, G, F, I;
|
|
1344
|
+
const o = [], { width: s, height: c } = e, a = { ...ge, ...this.config.spiral }, h = this.config.spacing.padding, l = i.fixedHeight ?? this.config.sizing.base, g = ((z = this.imageConfig.rotation) == null ? void 0 : z.mode) ?? "none", r = ((L = (x = this.imageConfig.rotation) == null ? void 0 : x.range) == null ? void 0 : L.min) ?? -15, d = ((j = (k = this.imageConfig.rotation) == null ? void 0 : k.range) == null ? void 0 : j.max) ?? 15, f = ((P = (U = this.imageConfig.sizing) == null ? void 0 : U.variance) == null ? void 0 : P.min) ?? 1, y = ((F = (G = this.imageConfig.sizing) == null ? void 0 : G.variance) == null ? void 0 : F.max) ?? 1, p = f !== 1 || y !== 1, u = ((I = this.imageConfig.sizing) == null ? void 0 : I.scaleDecay) ?? a.scaleDecay, m = s / 2, w = c / 2, v = Math.min(
|
|
1346
1345
|
m - h - l / 2,
|
|
1347
1346
|
w - h - l / 2
|
|
1348
1347
|
), E = a.direction === "clockwise" ? -1 : 1;
|
|
@@ -1357,7 +1356,7 @@ class ue {
|
|
|
1357
1356
|
const _ = A * 0.3 * a.tightness;
|
|
1358
1357
|
O = _ * E + a.startAngle, S = this.calculateLogarithmicRadius(_, t, v, a.tightness);
|
|
1359
1358
|
}
|
|
1360
|
-
const
|
|
1359
|
+
const T = m + Math.cos(O) * S, M = w + Math.sin(O) * S, D = S / v, Z = u > 0 ? 1 - D * u * 0.5 : 1, et = p ? this.random(f, y) : 1, W = Z * et, N = l * W, Q = N * 1.5 / 2, B = N / 2, q = h + Q, nt = s - h - Q, V = h + B, C = c - h - B, H = Math.max(q, Math.min(T, nt)), $ = Math.max(V, Math.min(M, C));
|
|
1361
1360
|
let Y = 0;
|
|
1362
1361
|
if (g === "random") {
|
|
1363
1362
|
const _ = O * 180 / Math.PI % 360, tt = this.random(r, d);
|
|
@@ -1444,8 +1443,8 @@ class fe {
|
|
|
1444
1443
|
* @returns Array of layout objects with position, rotation, scale
|
|
1445
1444
|
*/
|
|
1446
1445
|
generate(t, e, i = {}) {
|
|
1447
|
-
var E,
|
|
1448
|
-
const o = [], { width: s, height: c } = e, a = { ...me, ...this.config.cluster }, h = this.config.spacing.padding, l = i.fixedHeight ?? this.config.sizing.base, g = ((E = this.imageConfig.rotation) == null ? void 0 : E.mode) ?? "none", r = ((x = (
|
|
1446
|
+
var E, z, x, L, k, j, U, P, G;
|
|
1447
|
+
const o = [], { width: s, height: c } = e, a = { ...me, ...this.config.cluster }, h = this.config.spacing.padding, l = i.fixedHeight ?? this.config.sizing.base, g = ((E = this.imageConfig.rotation) == null ? void 0 : E.mode) ?? "none", r = ((x = (z = this.imageConfig.rotation) == null ? void 0 : z.range) == null ? void 0 : x.min) ?? -15, d = ((k = (L = this.imageConfig.rotation) == null ? void 0 : L.range) == null ? void 0 : k.max) ?? 15, f = ((U = (j = this.imageConfig.sizing) == null ? void 0 : j.variance) == null ? void 0 : U.min) ?? 1, y = ((G = (P = this.imageConfig.sizing) == null ? void 0 : P.variance) == null ? void 0 : G.max) ?? 1, p = f !== 1 || y !== 1, u = this.calculateClusterCount(
|
|
1449
1448
|
t,
|
|
1450
1449
|
a.clusterCount,
|
|
1451
1450
|
s,
|
|
@@ -1464,20 +1463,20 @@ class fe {
|
|
|
1464
1463
|
for (let F = 0; F < u; F++) {
|
|
1465
1464
|
const I = m[F], A = w[F];
|
|
1466
1465
|
for (let O = 0; O < A; O++) {
|
|
1467
|
-
let S,
|
|
1466
|
+
let S, T;
|
|
1468
1467
|
if (a.distribution === "gaussian")
|
|
1469
|
-
S = this.gaussianRandom() * I.spread,
|
|
1468
|
+
S = this.gaussianRandom() * I.spread, T = this.gaussianRandom() * I.spread;
|
|
1470
1469
|
else {
|
|
1471
1470
|
const $ = this.random(0, Math.PI * 2), Y = this.random(0, I.spread);
|
|
1472
|
-
S = Math.cos($) * Y,
|
|
1471
|
+
S = Math.cos($) * Y, T = Math.sin($) * Y;
|
|
1473
1472
|
}
|
|
1474
|
-
const
|
|
1475
|
-
S /=
|
|
1473
|
+
const M = 1 + a.overlap * 0.5, D = 1 + a.overlap * 0.3;
|
|
1474
|
+
S /= M, T /= M;
|
|
1476
1475
|
const Z = p ? this.random(f, y) : 1, et = D * Z, W = l * et;
|
|
1477
|
-
let N = I.x + S, it = I.y +
|
|
1476
|
+
let N = I.x + S, it = I.y + T;
|
|
1478
1477
|
const B = W * 1.5 / 2, q = W / 2;
|
|
1479
1478
|
N = Math.max(h + B, Math.min(N, s - h - B)), it = Math.max(h + q, Math.min(it, c - h - q));
|
|
1480
|
-
const nt = g === "random" ? this.random(r, d) : 0, C = Math.sqrt(S * S +
|
|
1479
|
+
const nt = g === "random" ? this.random(r, d) : 0, C = Math.sqrt(S * S + T * T) / I.spread, H = Math.round((1 - C) * 50) + 1;
|
|
1481
1480
|
o.push({
|
|
1482
1481
|
id: v,
|
|
1483
1482
|
x: N,
|
|
@@ -1517,8 +1516,8 @@ class fe {
|
|
|
1517
1516
|
};
|
|
1518
1517
|
let m = 1 / 0;
|
|
1519
1518
|
for (const w of c) {
|
|
1520
|
-
const v = u.x - w.x, E = u.y - w.y,
|
|
1521
|
-
m = Math.min(m,
|
|
1519
|
+
const v = u.x - w.x, E = u.y - w.y, z = Math.sqrt(v * v + E * E);
|
|
1520
|
+
m = Math.min(m, z);
|
|
1522
1521
|
}
|
|
1523
1522
|
if ((c.length === 0 || m > y) && (f = u, y = m), m >= s.clusterSpacing)
|
|
1524
1523
|
break;
|
|
@@ -1563,30 +1562,30 @@ class pe {
|
|
|
1563
1562
|
* @returns Array of layout objects with position, rotation, scale
|
|
1564
1563
|
*/
|
|
1565
1564
|
generate(t, e, i = {}) {
|
|
1566
|
-
var
|
|
1567
|
-
const o = [], { width: s, height: c } = e, a = this.config.sizing.base, h = this.config.spacing.padding ?? 50, l = ((
|
|
1565
|
+
var M, D, Z, et, W, N, it, Q, B;
|
|
1566
|
+
const o = [], { width: s, height: c } = e, a = this.config.sizing.base, h = this.config.spacing.padding ?? 50, l = ((M = this.imageConfig.rotation) == null ? void 0 : M.mode) ?? "none", g = ((Z = (D = this.imageConfig.rotation) == null ? void 0 : D.range) == null ? void 0 : Z.min) ?? -15, r = ((W = (et = this.imageConfig.rotation) == null ? void 0 : et.range) == null ? void 0 : W.max) ?? 15, d = ((it = (N = this.imageConfig.sizing) == null ? void 0 : N.variance) == null ? void 0 : it.min) ?? 1, f = ((B = (Q = this.imageConfig.sizing) == null ? void 0 : Q.variance) == null ? void 0 : B.max) ?? 1, y = d !== 1 || f !== 1, p = i.fixedHeight ?? a, u = {
|
|
1568
1567
|
...Ht,
|
|
1569
1568
|
...this.config.wave
|
|
1570
|
-
}, { rows: m, amplitude: w, frequency: v, phaseShift: E, synchronization:
|
|
1571
|
-
let
|
|
1572
|
-
for (let q = 0; q < m &&
|
|
1569
|
+
}, { rows: m, amplitude: w, frequency: v, phaseShift: E, synchronization: z } = u, x = Math.ceil(t / m), j = p * 1.5 / 2, U = h + j, P = s - h - j, G = P - U, F = x > 1 ? G / (x - 1) : 0, I = h + w + p / 2, A = c - h - w - p / 2, O = A - I, S = m > 1 ? O / (m - 1) : 0;
|
|
1570
|
+
let T = 0;
|
|
1571
|
+
for (let q = 0; q < m && T < t; q++) {
|
|
1573
1572
|
const nt = m === 1 ? (I + A) / 2 : I + q * S;
|
|
1574
1573
|
let V = 0;
|
|
1575
|
-
|
|
1576
|
-
for (let C = 0; C < x &&
|
|
1577
|
-
const H = x === 1 ? (
|
|
1574
|
+
z === "offset" ? V = q * E : z === "alternating" && (V = q * Math.PI);
|
|
1575
|
+
for (let C = 0; C < x && T < t; C++) {
|
|
1576
|
+
const H = x === 1 ? (U + P) / 2 : U + C * F, $ = this.calculateWaveY(H, s, w, v, V), Y = H, K = nt + $, _ = y ? this.random(d, f) : 1, tt = p * _;
|
|
1578
1577
|
let ot = 0;
|
|
1579
1578
|
l === "tangent" ? ot = this.calculateRotation(H, s, w, v, V) : l === "random" && (ot = this.random(g, r));
|
|
1580
1579
|
const at = tt * 1.5 / 2, pt = tt / 2, dt = h + at, gt = s - h - at, yt = h + pt, bt = c - h - pt;
|
|
1581
1580
|
o.push({
|
|
1582
|
-
id:
|
|
1581
|
+
id: T,
|
|
1583
1582
|
x: Math.max(dt, Math.min(Y, gt)),
|
|
1584
1583
|
y: Math.max(yt, Math.min(K, bt)),
|
|
1585
1584
|
rotation: ot,
|
|
1586
1585
|
scale: _,
|
|
1587
1586
|
baseSize: tt,
|
|
1588
|
-
zIndex:
|
|
1589
|
-
}),
|
|
1587
|
+
zIndex: T + 1
|
|
1588
|
+
}), T++;
|
|
1590
1589
|
}
|
|
1591
1590
|
}
|
|
1592
1591
|
return o;
|
|
@@ -2084,7 +2083,7 @@ class xe {
|
|
|
2084
2083
|
height: t.offsetHeight
|
|
2085
2084
|
};
|
|
2086
2085
|
if (this.incoming) {
|
|
2087
|
-
const E = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0),
|
|
2086
|
+
const E = this.animationEngine.cancelAnimation(this.incoming.animationHandle, !0), z = {
|
|
2088
2087
|
x: E.x,
|
|
2089
2088
|
y: E.y,
|
|
2090
2089
|
rotation: E.rotation,
|
|
@@ -2097,7 +2096,7 @@ class xe {
|
|
|
2097
2096
|
this.outgoing = this.startUnfocusAnimation(
|
|
2098
2097
|
this.incoming.element,
|
|
2099
2098
|
this.incoming.originalState,
|
|
2100
|
-
|
|
2099
|
+
z,
|
|
2101
2100
|
x
|
|
2102
2101
|
);
|
|
2103
2102
|
} else
|
|
@@ -2990,7 +2989,7 @@ class Ae {
|
|
|
2990
2989
|
i,
|
|
2991
2990
|
g,
|
|
2992
2991
|
t.length
|
|
2993
|
-
), E = this.entryAnimationEngine.calculateStartRotation(d.rotation),
|
|
2992
|
+
), E = this.entryAnimationEngine.calculateStartRotation(d.rotation), z = this.entryAnimationEngine.calculateStartScale(d.scale), x = this.entryAnimationEngine.buildFinalTransform(
|
|
2994
2993
|
d.rotation,
|
|
2995
2994
|
d.scale,
|
|
2996
2995
|
u,
|
|
@@ -3003,7 +3002,7 @@ class Ae {
|
|
|
3003
3002
|
u,
|
|
3004
3003
|
e,
|
|
3005
3004
|
E,
|
|
3006
|
-
|
|
3005
|
+
z
|
|
3007
3006
|
);
|
|
3008
3007
|
this.fullConfig.debug && g < 3 && console.log(`Image ${g}:`, {
|
|
3009
3008
|
finalPosition: m,
|
|
@@ -3013,7 +3012,7 @@ class Ae {
|
|
|
3013
3012
|
finalTransform: x,
|
|
3014
3013
|
renderedWidth: u,
|
|
3015
3014
|
renderedHeight: e
|
|
3016
|
-
}), r.style.transform = L, r.dataset.finalTransform = x, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== d.rotation ||
|
|
3015
|
+
}), r.style.transform = L, r.dataset.finalTransform = x, (this.entryAnimationEngine.requiresJSAnimation() || this.entryAnimationEngine.requiresJSRotation() || this.entryAnimationEngine.requiresJSScale() || E !== d.rotation || z !== d.scale) && (r.dataset.startX = String(v.x), r.dataset.startY = String(v.y), r.dataset.endX = String(m.x), r.dataset.endY = String(m.y), r.dataset.imageWidth = String(u), r.dataset.imageHeight = String(e), r.dataset.rotation = String(d.rotation), r.dataset.scale = String(d.scale), r.dataset.startRotation = String(E), r.dataset.startScale = String(z)), this.displayQueue.push(r);
|
|
3017
3016
|
}, r.onerror = () => c++, r.src = l;
|
|
3018
3017
|
});
|
|
3019
3018
|
}
|