@cliquify.me/animations 10.0.0 → 10.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +403 -350
- package/dist/index.umd.js +6 -6
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { interpolate as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as H, Fragment as vt, jsxs as Vt } from "react/jsx-runtime";
|
|
2
|
+
import q, { useMemo as jt } from "react";
|
|
3
|
+
import { interpolate as G, Easing as E } from "remotion";
|
|
4
|
+
const Ht = () => ({
|
|
5
5
|
scale: (t) => ({ transform: `scale(${t})` }),
|
|
6
6
|
growIn: (t) => ({ transform: `scale(${t})` }),
|
|
7
7
|
shrinkIn: (t) => ({ transform: `scale(${t})` }),
|
|
@@ -93,331 +93,331 @@ const nt = () => ({
|
|
|
93
93
|
borderRadius: `${t}px`,
|
|
94
94
|
overflow: "hidden"
|
|
95
95
|
})
|
|
96
|
-
}),
|
|
97
|
-
const
|
|
98
|
-
for (let
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
-
},
|
|
102
|
-
const { from:
|
|
103
|
-
if (isNaN(
|
|
96
|
+
}), Xt = (t, d = 0) => {
|
|
97
|
+
const n = [], l = t / 5;
|
|
98
|
+
for (let i = 0; i < 6; i += 1)
|
|
99
|
+
n.push(i * l + d);
|
|
100
|
+
return n;
|
|
101
|
+
}, Tt = (t, d, n, l = !1) => {
|
|
102
|
+
const { from: i, to: s, ease: b } = d, h = d.durationInFrames || 30, f = Number(i), o = Number(s), r = Math.max(1, Number(h));
|
|
103
|
+
if (isNaN(f) || isNaN(o))
|
|
104
104
|
return console.error("Invalid animation values:", {
|
|
105
|
-
from:
|
|
106
|
-
to:
|
|
107
|
-
animationDurationInFrames:
|
|
108
|
-
property:
|
|
109
|
-
}),
|
|
110
|
-
|
|
111
|
-
`durationInFrames is undefined for animation: ${
|
|
105
|
+
from: i,
|
|
106
|
+
to: s,
|
|
107
|
+
animationDurationInFrames: h,
|
|
108
|
+
property: d.property
|
|
109
|
+
}), f;
|
|
110
|
+
h === void 0 && console.warn(
|
|
111
|
+
`durationInFrames is undefined for animation: ${d.property}. Using 1 frame as default.`
|
|
112
112
|
);
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
return t <
|
|
116
|
-
let
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
const c = d.delay || 0;
|
|
114
|
+
if (d.property === "hide-show" || d.property === "hide" || d.property === "show")
|
|
115
|
+
return t < c ? f : o;
|
|
116
|
+
let $;
|
|
117
|
+
if (d.property === "moveScaleIn" ? $ = l ? [
|
|
118
|
+
n - r - c,
|
|
119
|
+
n - r * 0.5 - c
|
|
120
120
|
] : [
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
] :
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
c + r * 0.5,
|
|
122
|
+
c + r
|
|
123
|
+
] : d.property === "moveTranslateY" ? $ = l ? [
|
|
124
|
+
n - r * 0.5 - c,
|
|
125
|
+
n - c
|
|
126
126
|
] : [
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
] :
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
c,
|
|
128
|
+
c + r * 0.5
|
|
129
|
+
] : $ = l ? [
|
|
130
|
+
n - r - c,
|
|
131
|
+
n - c
|
|
132
132
|
] : [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
],
|
|
136
|
-
const
|
|
133
|
+
c,
|
|
134
|
+
c + r
|
|
135
|
+
], d.property.includes("shake")) {
|
|
136
|
+
const v = l ? Xt(
|
|
137
137
|
r,
|
|
138
|
-
|
|
139
|
-
) :
|
|
140
|
-
return
|
|
138
|
+
n - r - c
|
|
139
|
+
) : Xt(r, c);
|
|
140
|
+
return G(
|
|
141
141
|
t,
|
|
142
|
-
|
|
143
|
-
[0,
|
|
142
|
+
v,
|
|
143
|
+
[0, f, o, f, o, 0],
|
|
144
144
|
{
|
|
145
145
|
extrapolateLeft: "clamp",
|
|
146
146
|
extrapolateRight: "clamp",
|
|
147
|
-
easing:
|
|
147
|
+
easing: b
|
|
148
148
|
}
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
|
-
return
|
|
151
|
+
return G(t, $, [f, o], {
|
|
152
152
|
extrapolateLeft: "clamp",
|
|
153
153
|
extrapolateRight: "clamp",
|
|
154
|
-
easing:
|
|
154
|
+
easing: b
|
|
155
155
|
});
|
|
156
|
-
},
|
|
156
|
+
}, J = (t) => {
|
|
157
157
|
if (t == null) return 0;
|
|
158
158
|
if (typeof t == "number")
|
|
159
159
|
return Number.isNaN(t) ? 0 : t;
|
|
160
160
|
if (typeof t == "object") {
|
|
161
161
|
if (t.rotate !== void 0 && t.rotate !== null) {
|
|
162
|
-
const
|
|
163
|
-
if (!Number.isNaN(
|
|
162
|
+
const i = parseFloat(String(t.rotate));
|
|
163
|
+
if (!Number.isNaN(i)) return i;
|
|
164
164
|
}
|
|
165
165
|
if (t.rotation !== void 0 && t.rotation !== null) {
|
|
166
|
-
const
|
|
167
|
-
if (!Number.isNaN(
|
|
166
|
+
const i = parseFloat(String(t.rotation));
|
|
167
|
+
if (!Number.isNaN(i)) return i;
|
|
168
168
|
}
|
|
169
|
-
return t.transform ?
|
|
169
|
+
return t.transform ? J(t.transform) : 0;
|
|
170
170
|
}
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
return parseFloat(
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
const [
|
|
179
|
-
return Math.atan2(
|
|
171
|
+
const d = String(t), n = /rotate\((-?[\d.]+)deg\)/.exec(d);
|
|
172
|
+
if (n)
|
|
173
|
+
return parseFloat(n[1]) || 0;
|
|
174
|
+
const l = /matrix\(([^)]+)\)/.exec(d);
|
|
175
|
+
if (l) {
|
|
176
|
+
const i = l[1].split(",").map((s) => parseFloat(s.trim()));
|
|
177
|
+
if (i.length >= 4) {
|
|
178
|
+
const [s, b] = i;
|
|
179
|
+
return Math.atan2(b, s) * (180 / Math.PI);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
return 0;
|
|
183
|
-
},
|
|
184
|
-
var
|
|
185
|
-
const { property:
|
|
186
|
-
if (
|
|
187
|
-
const
|
|
188
|
-
let
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
191
|
-
|
|
183
|
+
}, It = (t, d, n, l, i) => {
|
|
184
|
+
var f, o, r, c, $;
|
|
185
|
+
const { property: s } = t;
|
|
186
|
+
if (s === "move") {
|
|
187
|
+
const v = Number(((f = t.details) == null ? void 0 : f.fromX) ?? t.from ?? 0), B = Number(((o = t.details) == null ? void 0 : o.toX) ?? t.to ?? 0), T = Number(((r = t.details) == null ? void 0 : r.fromY) ?? 0), P = Number(((c = t.details) == null ? void 0 : c.toY) ?? 0), F = Number((($ = t.details) == null ? void 0 : $.scale) || 1) || 1;
|
|
188
|
+
let V = i;
|
|
189
|
+
if (V == null || Number.isNaN(V)) {
|
|
190
|
+
const p = t.details;
|
|
191
|
+
V = J((p == null ? void 0 : p.rotate) ?? (p == null ? void 0 : p.rotation) ?? (p == null ? void 0 : p.transform));
|
|
192
192
|
}
|
|
193
|
-
const
|
|
193
|
+
const e = t.delay || 0, x = t.durationInFrames || 30, C = l ? [n - x - e, n - e] : [e, e + x], O = G(d, C, [v, B], {
|
|
194
194
|
extrapolateLeft: "clamp",
|
|
195
195
|
extrapolateRight: "clamp",
|
|
196
196
|
easing: t.ease
|
|
197
|
-
}),
|
|
197
|
+
}), S = G(d, C, [T, P], {
|
|
198
198
|
extrapolateLeft: "clamp",
|
|
199
199
|
extrapolateRight: "clamp",
|
|
200
200
|
easing: t.ease
|
|
201
|
-
}),
|
|
201
|
+
}), w = (V || 0) * Math.PI / 180, Y = Math.cos(w), a = Math.sin(w), g = O * Y + S * a, m = -O * a + S * Y, j = g / F, R = m / F;
|
|
202
202
|
return {
|
|
203
|
-
transform: `translateX(${
|
|
203
|
+
transform: `translateX(${j}px) translateY(${R}px)`
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
|
-
const
|
|
207
|
-
return (
|
|
208
|
-
},
|
|
206
|
+
const b = Tt(d, t, n, l), h = Ht();
|
|
207
|
+
return (h[s] || h.default)(b);
|
|
208
|
+
}, M = (t, d, n, l = !1, i = !1, s) => q.useMemo(() => {
|
|
209
209
|
if (t.length === 0) return {};
|
|
210
|
-
const
|
|
211
|
-
(
|
|
210
|
+
const b = t.filter(
|
|
211
|
+
(h) => h.from !== void 0 && h.to !== void 0
|
|
212
212
|
);
|
|
213
|
-
if (
|
|
214
|
-
const
|
|
215
|
-
return
|
|
216
|
-
const r =
|
|
217
|
-
n,
|
|
213
|
+
if (b.length !== t.length && console.error("Some animations are invalid and will be ignored"), i) {
|
|
214
|
+
const h = [];
|
|
215
|
+
return b.reverse().forEach((o) => {
|
|
216
|
+
const r = It(
|
|
218
217
|
o,
|
|
219
|
-
|
|
218
|
+
n,
|
|
219
|
+
d,
|
|
220
220
|
!1,
|
|
221
|
-
|
|
221
|
+
s
|
|
222
222
|
);
|
|
223
|
-
|
|
224
|
-
}),
|
|
225
|
-
(
|
|
226
|
-
|
|
227
|
-
}),
|
|
223
|
+
h.push(r);
|
|
224
|
+
}), h.reduce(
|
|
225
|
+
(o, r) => (Object.keys(r).forEach((c) => {
|
|
226
|
+
c === "transform" || c === "filter" ? o[c] = o[c] ? `${o[c]} ${r[c]}` : r[c] : o[c] = r[c];
|
|
227
|
+
}), o),
|
|
228
228
|
{}
|
|
229
229
|
);
|
|
230
230
|
} else
|
|
231
|
-
return
|
|
232
|
-
(
|
|
233
|
-
r === "transform" || r === "filter" ?
|
|
234
|
-
}),
|
|
231
|
+
return b.map((f) => It(f, n, d, l, s)).reduce(
|
|
232
|
+
(f, o) => (Object.keys(o).forEach((r) => {
|
|
233
|
+
r === "transform" || r === "filter" ? f[r] = f[r] ? `${f[r]} ${o[r]}` : o[r] : f[r] = o[r];
|
|
234
|
+
}), f),
|
|
235
235
|
{}
|
|
236
236
|
);
|
|
237
|
-
}, [t,
|
|
238
|
-
const
|
|
239
|
-
return t.forEach((
|
|
240
|
-
Array.isArray(
|
|
241
|
-
}),
|
|
242
|
-
(
|
|
243
|
-
) ?
|
|
244
|
-
(
|
|
245
|
-
...
|
|
246
|
-
from: Math.min(
|
|
247
|
-
to: Math.max(
|
|
237
|
+
}, [t, n, d, l, s]), U = (t) => t ? Array.isArray(t) ? t : [t] : [], Dt = (...t) => {
|
|
238
|
+
const d = [];
|
|
239
|
+
return t.forEach((n) => {
|
|
240
|
+
Array.isArray(n) ? d.push(...n) : n && d.push(n);
|
|
241
|
+
}), d.filter((n) => n !== void 0).reduce((n, l) => n.find(
|
|
242
|
+
(s) => s.property === l.property
|
|
243
|
+
) ? n.map(
|
|
244
|
+
(s) => s.property === l.property ? {
|
|
245
|
+
...s,
|
|
246
|
+
from: Math.min(s.from, l.from),
|
|
247
|
+
to: Math.max(s.to, l.to),
|
|
248
248
|
durationInFrames: Math.max(
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
s.durationInFrames,
|
|
250
|
+
l.durationInFrames
|
|
251
251
|
),
|
|
252
|
-
delay: Math.min(
|
|
253
|
-
ease: (
|
|
252
|
+
delay: Math.min(s.delay || 0, l.delay || 0),
|
|
253
|
+
ease: (b) => (s.ease(b) + l.ease(b)) / 2
|
|
254
254
|
// Average the easing functions
|
|
255
|
-
} :
|
|
256
|
-
) : [...
|
|
257
|
-
},
|
|
255
|
+
} : s
|
|
256
|
+
) : [...n, l], []);
|
|
257
|
+
}, Gt = ({
|
|
258
258
|
animationIn: t,
|
|
259
|
-
animationOut:
|
|
260
|
-
durationInFrames:
|
|
261
|
-
children:
|
|
262
|
-
style:
|
|
263
|
-
frame:
|
|
264
|
-
isTransition:
|
|
265
|
-
basicCharAnimationsIn:
|
|
266
|
-
basicCharAnimationsOut:
|
|
259
|
+
animationOut: d,
|
|
260
|
+
durationInFrames: n,
|
|
261
|
+
children: l,
|
|
262
|
+
style: i = {},
|
|
263
|
+
frame: s,
|
|
264
|
+
isTransition: b = !1,
|
|
265
|
+
basicCharAnimationsIn: h = [],
|
|
266
|
+
basicCharAnimationsOut: f = []
|
|
267
267
|
}) => {
|
|
268
|
-
const
|
|
269
|
-
(
|
|
270
|
-
), r =
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
268
|
+
const o = J(
|
|
269
|
+
(i == null ? void 0 : i.transform) || (i == null ? void 0 : i.rotate) || (i == null ? void 0 : i.rotation)
|
|
270
|
+
), r = M(
|
|
271
|
+
U(t),
|
|
272
|
+
n,
|
|
273
|
+
s,
|
|
274
274
|
!1,
|
|
275
275
|
!1,
|
|
276
|
-
|
|
277
|
-
),
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
276
|
+
o
|
|
277
|
+
), c = M(
|
|
278
|
+
U(d),
|
|
279
|
+
n,
|
|
280
|
+
s,
|
|
281
281
|
!0,
|
|
282
282
|
!1,
|
|
283
|
-
|
|
284
|
-
),
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
283
|
+
o
|
|
284
|
+
), $ = M(
|
|
285
|
+
U(h),
|
|
286
|
+
n,
|
|
287
|
+
s,
|
|
288
288
|
!0,
|
|
289
289
|
!1,
|
|
290
|
-
|
|
291
|
-
),
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
290
|
+
o
|
|
291
|
+
), v = M(
|
|
292
|
+
U(f),
|
|
293
|
+
n,
|
|
294
|
+
s,
|
|
295
295
|
!0,
|
|
296
296
|
!1,
|
|
297
|
-
|
|
298
|
-
),
|
|
299
|
-
const
|
|
300
|
-
(
|
|
297
|
+
o
|
|
298
|
+
), B = q.useMemo(() => {
|
|
299
|
+
const S = Object.keys(r).length > 0, w = t == null ? void 0 : t.reduce(
|
|
300
|
+
(a, g) => Math.min(a, g.delay || 0),
|
|
301
301
|
1 / 0
|
|
302
|
-
),
|
|
303
|
-
return
|
|
304
|
-
}, [r,
|
|
305
|
-
if (
|
|
306
|
-
return { visibility:
|
|
307
|
-
const
|
|
308
|
-
if (!
|
|
309
|
-
let
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
302
|
+
), Y = s - (w || 0);
|
|
303
|
+
return S && Y < 0 ? { visibility: b ? "visible" : "hidden" } : r;
|
|
304
|
+
}, [r, s, t, b]), T = q.useMemo(() => {
|
|
305
|
+
if (s > n)
|
|
306
|
+
return { visibility: b ? "visible" : "hidden" };
|
|
307
|
+
const S = U(d);
|
|
308
|
+
if (!S || S.length === 0) return {};
|
|
309
|
+
let w = 0;
|
|
310
|
+
S.forEach((a) => {
|
|
311
|
+
const g = (a.durationInFrames || 0) + (a.delay || 0);
|
|
312
|
+
g > w && (w = g);
|
|
313
313
|
});
|
|
314
|
-
const
|
|
315
|
-
return
|
|
316
|
-
}, [
|
|
317
|
-
const
|
|
318
|
-
...
|
|
314
|
+
const Y = Math.max(0, n - w);
|
|
315
|
+
return s < Y ? {} : c;
|
|
316
|
+
}, [c, s, d, n, b]), P = q.useMemo(() => {
|
|
317
|
+
const S = {
|
|
318
|
+
...B
|
|
319
319
|
};
|
|
320
|
-
return Object.entries(
|
|
321
|
-
|
|
322
|
-
}),
|
|
323
|
-
}, [
|
|
324
|
-
const
|
|
325
|
-
translateX:
|
|
326
|
-
translateY:
|
|
327
|
-
scale:
|
|
328
|
-
rotation:
|
|
329
|
-
rotateX:
|
|
330
|
-
rotateY:
|
|
331
|
-
rotateZ:
|
|
332
|
-
} =
|
|
333
|
-
return `${
|
|
334
|
-
}, [
|
|
335
|
-
top:
|
|
336
|
-
left:
|
|
337
|
-
position:
|
|
338
|
-
transform:
|
|
339
|
-
...
|
|
340
|
-
} =
|
|
341
|
-
return /* @__PURE__ */
|
|
320
|
+
return Object.entries(T).forEach(([w, Y]) => {
|
|
321
|
+
w === "transform" ? S[w] = `${S[w] || ""} ${Y || ""}`.trim() : w in S && typeof S[w] == "number" && typeof Y == "number" ? S[w] = S[w] * Y : S[w] = Y;
|
|
322
|
+
}), S;
|
|
323
|
+
}, [B, T]), F = jt(() => {
|
|
324
|
+
const S = P.transform || "", {
|
|
325
|
+
translateX: w,
|
|
326
|
+
translateY: Y,
|
|
327
|
+
scale: a,
|
|
328
|
+
rotation: g,
|
|
329
|
+
rotateX: m,
|
|
330
|
+
rotateY: j,
|
|
331
|
+
rotateZ: R
|
|
332
|
+
} = Wt(S);
|
|
333
|
+
return `${g} ${w} ${Y} ${a} ${m} ${j} ${R}`.trim();
|
|
334
|
+
}, [P]), {
|
|
335
|
+
top: V,
|
|
336
|
+
left: e,
|
|
337
|
+
position: x,
|
|
338
|
+
transform: C,
|
|
339
|
+
...O
|
|
340
|
+
} = i || {};
|
|
341
|
+
return /* @__PURE__ */ H(
|
|
342
342
|
"div",
|
|
343
343
|
{
|
|
344
344
|
style: {
|
|
345
345
|
width: "100%",
|
|
346
346
|
height: "100%",
|
|
347
|
-
overflow:
|
|
347
|
+
overflow: P.overflow || $.overflow || v.overflow || "visible",
|
|
348
348
|
pointerEvents: "none"
|
|
349
349
|
},
|
|
350
|
-
children: /* @__PURE__ */
|
|
350
|
+
children: /* @__PURE__ */ H(
|
|
351
351
|
"div",
|
|
352
352
|
{
|
|
353
353
|
style: {
|
|
354
354
|
width: "100%",
|
|
355
355
|
height: "100%",
|
|
356
|
-
...
|
|
357
|
-
...
|
|
356
|
+
...O,
|
|
357
|
+
...P,
|
|
358
358
|
overflow: "visible",
|
|
359
|
-
transform:
|
|
359
|
+
transform: F,
|
|
360
360
|
pointerEvents: "none",
|
|
361
|
-
background: Object.keys(
|
|
361
|
+
background: Object.keys(P).length === 0 ? "transparent" : P.backgroundColor
|
|
362
362
|
},
|
|
363
|
-
children:
|
|
363
|
+
children: l
|
|
364
364
|
}
|
|
365
365
|
)
|
|
366
366
|
}
|
|
367
367
|
);
|
|
368
|
-
},
|
|
369
|
-
let
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
const
|
|
373
|
-
|
|
368
|
+
}, Wt = (t) => {
|
|
369
|
+
let d = "", n = "", l = "scale(1)", i = "", s = "", b = "", h = "";
|
|
370
|
+
const f = t.match(/translateX\([^)]+\)/g);
|
|
371
|
+
f && (d = f[f.length - 1]);
|
|
372
|
+
const o = t.match(/translateY\([^)]+\)/g);
|
|
373
|
+
o && (n = o[o.length - 1]);
|
|
374
374
|
const r = t.match(/scale\([^)]+\)/g);
|
|
375
|
-
r && (
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
const
|
|
383
|
-
return
|
|
384
|
-
},
|
|
375
|
+
r && (l = r[r.length - 1]);
|
|
376
|
+
const c = t.match(/rotate\([^)]+\)/g);
|
|
377
|
+
c && (i = c[c.length - 1]);
|
|
378
|
+
const $ = t.match(/rotateX\([^)]+\)/g);
|
|
379
|
+
$ && (s = $[$.length - 1]);
|
|
380
|
+
const v = t.match(/rotateY\([^)]+\)/g);
|
|
381
|
+
v && (b = v[v.length - 1]);
|
|
382
|
+
const B = t.match(/rotateZ\([^)]+\)/g);
|
|
383
|
+
return B && (h = B[B.length - 1]), { translateX: d, translateY: n, scale: l, rotation: i, rotateX: s, rotateY: b, rotateZ: h };
|
|
384
|
+
}, Jt = ({
|
|
385
385
|
animationTimed: t,
|
|
386
|
-
durationInFrames:
|
|
387
|
-
children:
|
|
388
|
-
style:
|
|
389
|
-
frame:
|
|
386
|
+
durationInFrames: d,
|
|
387
|
+
children: n,
|
|
388
|
+
style: l = {},
|
|
389
|
+
frame: i
|
|
390
390
|
}) => {
|
|
391
|
-
const
|
|
392
|
-
(
|
|
393
|
-
),
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
391
|
+
const s = J(
|
|
392
|
+
(l == null ? void 0 : l.transform) || (l == null ? void 0 : l.rotate) || (l == null ? void 0 : l.rotation)
|
|
393
|
+
), b = M(
|
|
394
|
+
U(t),
|
|
395
|
+
d,
|
|
396
|
+
i,
|
|
397
397
|
!1,
|
|
398
398
|
!0,
|
|
399
|
-
|
|
400
|
-
),
|
|
401
|
-
...
|
|
402
|
-
}), [
|
|
403
|
-
return /* @__PURE__ */
|
|
399
|
+
s
|
|
400
|
+
), h = q.useMemo(() => ({
|
|
401
|
+
...b
|
|
402
|
+
}), [b]), f = !!h.borderRadius;
|
|
403
|
+
return /* @__PURE__ */ H(
|
|
404
404
|
"div",
|
|
405
405
|
{
|
|
406
406
|
style: {
|
|
407
|
-
overflow:
|
|
408
|
-
borderRadius:
|
|
407
|
+
overflow: f ? "hidden" : h.overflow || "visible",
|
|
408
|
+
borderRadius: h.borderRadius,
|
|
409
409
|
pointerEvents: "none",
|
|
410
|
-
height:
|
|
411
|
-
width:
|
|
412
|
-
...
|
|
413
|
-
...
|
|
410
|
+
height: l.height || "100%",
|
|
411
|
+
width: l.width || "100%",
|
|
412
|
+
...h,
|
|
413
|
+
...f ? { overflow: "hidden" } : {}
|
|
414
414
|
},
|
|
415
|
-
children: /* @__PURE__ */
|
|
415
|
+
children: /* @__PURE__ */ H(
|
|
416
416
|
"div",
|
|
417
417
|
{
|
|
418
418
|
style: {
|
|
419
|
-
overflow:
|
|
420
|
-
borderRadius:
|
|
419
|
+
overflow: f ? "hidden" : "visible",
|
|
420
|
+
borderRadius: h.borderRadius,
|
|
421
421
|
pointerEvents: "none",
|
|
422
422
|
height: "100%",
|
|
423
423
|
width: "100%",
|
|
@@ -425,181 +425,234 @@ const nt = () => ({
|
|
|
425
425
|
alignItems: "center",
|
|
426
426
|
justifyContent: "center"
|
|
427
427
|
},
|
|
428
|
-
children:
|
|
428
|
+
children: n
|
|
429
429
|
}
|
|
430
430
|
)
|
|
431
431
|
}
|
|
432
432
|
);
|
|
433
|
-
},
|
|
433
|
+
}, Lt = (t) => {
|
|
434
434
|
if (typeof (t == null ? void 0 : t.ease) == "function")
|
|
435
435
|
return t.ease;
|
|
436
436
|
switch (t == null ? void 0 : t.easing) {
|
|
437
437
|
case "ease-in":
|
|
438
438
|
case "accelerate":
|
|
439
|
-
return
|
|
439
|
+
return E.in(E.cubic);
|
|
440
440
|
case "ease-out":
|
|
441
441
|
case "smooth":
|
|
442
442
|
case "slowDown":
|
|
443
|
-
return
|
|
443
|
+
return E.out(E.cubic);
|
|
444
444
|
case "ease-in-out":
|
|
445
445
|
case "natural":
|
|
446
446
|
case "swing":
|
|
447
|
-
return
|
|
447
|
+
return E.inOut(E.cubic);
|
|
448
448
|
case "bounce":
|
|
449
|
-
return
|
|
449
|
+
return E.bounce;
|
|
450
450
|
case "elastic":
|
|
451
|
-
return
|
|
451
|
+
return E.elastic(1);
|
|
452
452
|
case "overshoot":
|
|
453
453
|
case "impulse":
|
|
454
|
-
return
|
|
454
|
+
return E.out(E.back(1.7));
|
|
455
455
|
case "none":
|
|
456
456
|
case "linear":
|
|
457
457
|
default:
|
|
458
|
-
return
|
|
458
|
+
return E.linear;
|
|
459
459
|
}
|
|
460
|
-
},
|
|
461
|
-
const
|
|
460
|
+
}, Zt = (t, d) => {
|
|
461
|
+
const n = d * Math.PI / 180, l = Math.cos(n), i = Math.sin(n), s = t / 100 * 50, b = 50, h = 50, f = 200, o = l, r = i, c = -i, $ = l;
|
|
462
462
|
return `polygon(${[
|
|
463
463
|
[
|
|
464
|
-
|
|
465
|
-
|
|
464
|
+
b - o * f - c * s,
|
|
465
|
+
h - r * f - $ * s
|
|
466
466
|
],
|
|
467
467
|
[
|
|
468
|
-
|
|
469
|
-
|
|
468
|
+
b + o * f - c * s,
|
|
469
|
+
h + r * f - $ * s
|
|
470
470
|
],
|
|
471
471
|
[
|
|
472
|
-
|
|
473
|
-
|
|
472
|
+
b + o * f + c * s,
|
|
473
|
+
h + r * f + $ * s
|
|
474
474
|
],
|
|
475
475
|
[
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
b - o * f + c * s,
|
|
477
|
+
h - r * f + $ * s
|
|
478
478
|
]
|
|
479
|
-
].map(([
|
|
480
|
-
},
|
|
479
|
+
].map(([B, T]) => `${B}% ${T}%`).join(", ")})`;
|
|
480
|
+
}, zt = ({
|
|
481
481
|
children: t,
|
|
482
|
-
currentWidth:
|
|
483
|
-
currentHeight:
|
|
484
|
-
frame:
|
|
485
|
-
item:
|
|
486
|
-
keyframeAnimations:
|
|
487
|
-
durationInFrames:
|
|
482
|
+
currentWidth: d,
|
|
483
|
+
currentHeight: n,
|
|
484
|
+
frame: l,
|
|
485
|
+
item: i,
|
|
486
|
+
keyframeAnimations: s,
|
|
487
|
+
durationInFrames: b
|
|
488
488
|
}) => {
|
|
489
|
-
var
|
|
490
|
-
if (!
|
|
491
|
-
return /* @__PURE__ */
|
|
492
|
-
const
|
|
493
|
-
var
|
|
494
|
-
return !!((
|
|
495
|
-
},
|
|
496
|
-
var
|
|
497
|
-
return !!((
|
|
498
|
-
},
|
|
499
|
-
(
|
|
500
|
-
), r =
|
|
501
|
-
(
|
|
489
|
+
var et, rt, ot, st, nt, lt, at, it, ct, dt, ft, ut, pt, ht, gt, bt, $t, xt, St, wt, mt, yt, Nt, Yt;
|
|
490
|
+
if (!s || !Array.isArray(s) || s.length === 0)
|
|
491
|
+
return /* @__PURE__ */ H(vt, { children: t });
|
|
492
|
+
const h = (u) => {
|
|
493
|
+
var y, I;
|
|
494
|
+
return !!((y = u == null ? void 0 : u.property) != null && y.includes("maskReveal") || (I = u == null ? void 0 : u.id) != null && I.includes("maskReveal"));
|
|
495
|
+
}, f = (u) => {
|
|
496
|
+
var y, I;
|
|
497
|
+
return !!((u == null ? void 0 : u.type) === "exit" || (y = u == null ? void 0 : u.property) != null && y.includes("Out") || (I = u == null ? void 0 : u.id) != null && I.includes("Out"));
|
|
498
|
+
}, o = s.find(
|
|
499
|
+
(u) => h(u) && !f(u)
|
|
500
|
+
), r = s.find(
|
|
501
|
+
(u) => h(u) && f(u)
|
|
502
502
|
);
|
|
503
|
-
if (!
|
|
504
|
-
return /* @__PURE__ */
|
|
505
|
-
const
|
|
506
|
-
let
|
|
507
|
-
|
|
508
|
-
|
|
503
|
+
if (!o && !r)
|
|
504
|
+
return /* @__PURE__ */ H(vt, { children: t });
|
|
505
|
+
const c = Math.max(1, b || 300), $ = o ? Math.max(1, Number(o.durationInFrames || 30)) : 30, v = o ? Math.max(0, Number(o.delay || 0)) : 0, B = r ? Math.max(1, Number(r.durationInFrames || 30)) : 30, T = r ? Math.max(0, Number(r.delay || 0)) : 0, P = r ? Math.max(0, c - B - T) : Number.POSITIVE_INFINITY;
|
|
506
|
+
let F = !1, V = !1, e = null, x = !1, C = 30, O = 0;
|
|
507
|
+
if (r && (l >= P || !o)) {
|
|
508
|
+
e = r, x = !0, C = B;
|
|
509
|
+
const u = o || P < c ? P : 0;
|
|
510
|
+
O = l - u;
|
|
511
|
+
const y = String(r.property || r.id || ""), I = y.includes("Blur") || y.includes("Soft") || !!((et = r == null ? void 0 : r.details) != null && et.blurBottom) || !!((rt = r == null ? void 0 : r.details) != null && rt.softEdge);
|
|
512
|
+
O >= C - 1 && !I && (F = !0);
|
|
513
|
+
} else if (o)
|
|
514
|
+
if (l < v)
|
|
515
|
+
F = !0, e = o, x = !1, C = $, O = 0;
|
|
516
|
+
else if (l < v + $)
|
|
517
|
+
e = o, x = !1, C = $, O = l - v;
|
|
518
|
+
else {
|
|
519
|
+
const u = String(o.property || o.id || "");
|
|
520
|
+
u.includes("Blur") || u.includes("Soft") || !!((ot = o == null ? void 0 : o.details) != null && ot.blurBottom) || !!((st = o == null ? void 0 : o.details) != null && st.softEdge) ? (e = o, x = !1, C = $, O = $) : (V = !0, e = null);
|
|
521
|
+
}
|
|
522
|
+
else
|
|
523
|
+
V = !0, e = null;
|
|
524
|
+
const S = Math.max(0, O), w = C > 0 ? Math.min(Math.max(0, S / C), 1) : 1, Y = e ? Lt(e) : E.linear, a = Math.max(
|
|
509
525
|
0,
|
|
510
|
-
Math.min(1,
|
|
526
|
+
Math.min(1, Y(w))
|
|
511
527
|
);
|
|
512
|
-
let
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
528
|
+
let g, m = "", j = 1;
|
|
529
|
+
const R = String(
|
|
530
|
+
(e == null ? void 0 : e.property) || (e == null ? void 0 : e.id) || ""
|
|
531
|
+
), p = ((nt = e == null ? void 0 : e.details) == null ? void 0 : nt.direction) || "up";
|
|
532
|
+
if (F)
|
|
533
|
+
g = "inset(100%)";
|
|
534
|
+
else if (V || !e)
|
|
535
|
+
g = void 0;
|
|
517
536
|
else {
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
W,
|
|
527
|
-
M
|
|
537
|
+
const u = R.includes("ShrinkScale"), y = R.includes("CenterScale"), I = R.includes("Slide") || R.includes("slide");
|
|
538
|
+
if (y) {
|
|
539
|
+
const N = Number(
|
|
540
|
+
((lt = e == null ? void 0 : e.details) == null ? void 0 : lt.angle) ?? (e == null ? void 0 : e.angle) ?? 0
|
|
541
|
+
), Z = x ? 100 * (1 - a) : 100 * a;
|
|
542
|
+
g = Zt(
|
|
543
|
+
Z,
|
|
544
|
+
N
|
|
528
545
|
);
|
|
529
|
-
} else if (
|
|
530
|
-
const
|
|
531
|
-
((
|
|
532
|
-
),
|
|
546
|
+
} else if (u) {
|
|
547
|
+
const N = Number(
|
|
548
|
+
((at = e == null ? void 0 : e.details) == null ? void 0 : at.initialVisiblePercent) ?? (e == null ? void 0 : e.initialVisiblePercent) ?? 50
|
|
549
|
+
), Z = Math.max(
|
|
533
550
|
0,
|
|
534
|
-
Math.min(50, (100 -
|
|
535
|
-
),
|
|
536
|
-
|
|
537
|
-
${
|
|
538
|
-
${
|
|
539
|
-
${
|
|
540
|
-
${
|
|
551
|
+
Math.min(50, (100 - N) / 2)
|
|
552
|
+
), z = x ? Z * a : Z * (1 - a);
|
|
553
|
+
g = `inset(
|
|
554
|
+
${z}%
|
|
555
|
+
${z}%
|
|
556
|
+
${z}%
|
|
557
|
+
${z}%
|
|
541
558
|
)`;
|
|
542
|
-
} else if (
|
|
543
|
-
|
|
544
|
-
else if (
|
|
545
|
-
|
|
546
|
-
else if (
|
|
547
|
-
const
|
|
548
|
-
|
|
559
|
+
} else if (I)
|
|
560
|
+
g = "inset(0% 0% 0% 0%)", x ? p === "down" ? m = `translateY(${100 * a}%)` : p === "left" ? m = `translateX(${-100 * a}%)` : p === "right" ? m = `translateX(${100 * a}%)` : m = `translateY(${-100 * a}%)` : p === "down" ? m = `translateY(${-100 * (1 - a)}%)` : p === "left" ? m = `translateX(${100 * (1 - a)}%)` : p === "right" ? m = `translateX(${-100 * (1 - a)}%)` : m = `translateY(${100 * (1 - a)}%)`;
|
|
561
|
+
else if (R.includes("Center"))
|
|
562
|
+
g = `circle(${x ? 150 * (1 - a) : 150 * a}% at 50% 50%)`;
|
|
563
|
+
else if (R.includes("Corner")) {
|
|
564
|
+
const N = x ? a : 1 - a;
|
|
565
|
+
p === "down" ? g = `inset(0 ${100 * N}% ${100 * N}% 0)` : p === "up" ? g = `inset(${100 * N}% ${100 * N}% 0 0)` : p === "left" ? g = `inset(0 0 ${100 * N}% ${100 * N}%)` : p === "right" ? g = `inset(${100 * N}% 0 0 ${100 * N}%)` : g = `inset(0 ${100 * N}% ${100 * N}% 0)`;
|
|
549
566
|
} else
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
|
|
567
|
+
x ? p === "down" ? g = `inset(${100 * a}% 0 0 0)` : p === "left" ? g = `inset(0 0 0 ${100 * a}%)` : p === "right" ? g = `inset(0 ${100 * a}% 0 0)` : g = `inset(0 0 ${100 * a}% 0)` : p === "down" ? g = `inset(0 0 ${100 * (1 - a)}% 0)` : p === "left" ? g = `inset(0 0 0 ${100 * (1 - a)}%)` : p === "right" ? g = `inset(0 ${100 * (1 - a)}% 0 0)` : g = `inset(${100 * (1 - a)}% 0 0 0)`;
|
|
568
|
+
const Q = !!((it = e == null ? void 0 : e.details) != null && it.scale || e != null && e.scale);
|
|
569
|
+
y || u ? ((ct = e == null ? void 0 : e.details) == null ? void 0 : ct.scale) === !1 ? j = 1 : j = x ? 1 + 0.5 * a : 1.5 - 0.5 * a : Q && (j = x ? 1 - 0.2 * a : 0.8 + 0.2 * a);
|
|
570
|
+
}
|
|
571
|
+
const K = R.includes("Blur") || R.includes("Soft") || !!((dt = e == null ? void 0 : e.details) != null && dt.blurBottom) || !!((ft = e == null ? void 0 : e.details) != null && ft.softEdge);
|
|
572
|
+
let L;
|
|
573
|
+
if (K && !F && e) {
|
|
574
|
+
g = void 0;
|
|
575
|
+
const u = 30, y = ((ut = e == null ? void 0 : e.details) == null ? void 0 : ut.blurPosition) || "bottom";
|
|
576
|
+
x ? p === "up" ? m = `translateY(${u * a}%)` : p === "down" ? m = `translateY(${-u * a}%)` : p === "left" ? m = `translateX(${u * a}%)` : p === "right" && (m = `translateX(${-u * a}%)`) : p === "up" ? m = `translateY(${u * (1 - a)}%)` : p === "down" ? m = `translateY(${-u * (1 - a)}%)` : p === "left" ? m = `translateX(${u * (1 - a)}%)` : p === "right" && (m = `translateX(${-u * (1 - a)}%)`);
|
|
577
|
+
const I = typeof ((pt = e == null ? void 0 : e.details) == null ? void 0 : pt.blurHeight) == "number" ? e.details.blurHeight : parseInt(String(((ht = e == null ? void 0 : e.details) == null ? void 0 : ht.blurHeight) || "35"), 10) || 35, Q = x ? 100 : 0, N = x ? 0 : 100, Z = Number(((gt = e == null ? void 0 : e.details) == null ? void 0 : gt.initialOpacity) ?? Q) / 100, z = Number(((bt = e == null ? void 0 : e.details) == null ? void 0 : bt.finalOpacity) ?? N) / 100, Ot = Math.max(
|
|
578
|
+
0,
|
|
579
|
+
Math.min(1, Z + (z - Z) * a)
|
|
580
|
+
), D = Math.max(0, 1 - Ot);
|
|
581
|
+
y === "bottom" ? L = `linear-gradient(to bottom, black 0%, black ${100 - I}%, rgba(0,0,0,${D}) 100%)` : y === "top" ? L = `linear-gradient(to top, black 0%, black ${100 - I}%, rgba(0,0,0,${D}) 100%)` : y === "right" ? L = `linear-gradient(to right, black 0%, black ${100 - I}%, rgba(0,0,0,${D}) 100%)` : y === "left" && (L = `linear-gradient(to left, black 0%, black ${100 - I}%, rgba(0,0,0,${D}) 100%)`);
|
|
553
582
|
}
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
].filter(Boolean).join(" ") || void 0,
|
|
558
|
-
return /* @__PURE__ */
|
|
583
|
+
const Bt = [
|
|
584
|
+
m,
|
|
585
|
+
j !== 1 ? `scale(${j})` : ""
|
|
586
|
+
].filter(Boolean).join(" ") || void 0, W = ($t = i == null ? void 0 : i.details) == null ? void 0 : $t.boxShadow, _ = W && (W.x || W.y || W.blur) ? `drop-shadow(${W.x || 0}px ${W.y || 0}px ${W.blur || 0}px ${W.color || "#000000"})` : void 0, A = Number(((xt = e == null ? void 0 : e.details) == null ? void 0 : xt.blurAmount) ?? 16), Pt = !!(K && (((St = e == null ? void 0 : e.details) == null ? void 0 : St.blurBottom) ?? !0)), X = ((wt = e == null ? void 0 : e.details) == null ? void 0 : wt.blurPosition) || "bottom", k = typeof ((mt = e == null ? void 0 : e.details) == null ? void 0 : mt.blurHeight) == "number" ? `${e.details.blurHeight}%` : ((yt = e == null ? void 0 : e.details) == null ? void 0 : yt.blurHeight) || "35%", Rt = x ? 100 : 0, Et = x ? 0 : 100, tt = Number(((Nt = e == null ? void 0 : e.details) == null ? void 0 : Nt.initialOpacity) ?? Rt) / 100, Ft = Number(((Yt = e == null ? void 0 : e.details) == null ? void 0 : Yt.finalOpacity) ?? Et) / 100, Ct = K && e ? Math.max(0, Math.min(1, tt + (Ft - tt) * a)) : 1;
|
|
587
|
+
return /* @__PURE__ */ H(
|
|
559
588
|
"div",
|
|
560
589
|
{
|
|
561
590
|
style: {
|
|
562
|
-
width:
|
|
563
|
-
height:
|
|
591
|
+
width: d !== void 0 ? d : "100%",
|
|
592
|
+
height: n !== void 0 ? n : "100%",
|
|
564
593
|
position: "relative",
|
|
565
|
-
visibility:
|
|
566
|
-
filter: O,
|
|
567
|
-
WebkitFilter: O
|
|
594
|
+
visibility: F ? "hidden" : "visible"
|
|
568
595
|
},
|
|
569
|
-
children: /* @__PURE__ */
|
|
596
|
+
children: /* @__PURE__ */ Vt(
|
|
570
597
|
"div",
|
|
571
598
|
{
|
|
572
599
|
style: {
|
|
573
600
|
width: "100%",
|
|
574
601
|
height: "100%",
|
|
575
602
|
position: "relative",
|
|
576
|
-
clipPath:
|
|
577
|
-
WebkitClipPath:
|
|
578
|
-
|
|
603
|
+
clipPath: g || void 0,
|
|
604
|
+
WebkitClipPath: g || void 0,
|
|
605
|
+
maskImage: L || void 0,
|
|
606
|
+
WebkitMaskImage: L || void 0,
|
|
607
|
+
overflow: g || L ? "hidden" : "visible"
|
|
579
608
|
},
|
|
580
|
-
children:
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ H(
|
|
611
|
+
"div",
|
|
612
|
+
{
|
|
613
|
+
style: {
|
|
614
|
+
width: "100%",
|
|
615
|
+
height: "100%",
|
|
616
|
+
transform: Bt,
|
|
617
|
+
transformOrigin: "center",
|
|
618
|
+
filter: _,
|
|
619
|
+
WebkitFilter: _
|
|
620
|
+
},
|
|
621
|
+
children: t
|
|
622
|
+
}
|
|
623
|
+
),
|
|
624
|
+
Pt && !F && /* @__PURE__ */ H(
|
|
625
|
+
"div",
|
|
626
|
+
{
|
|
627
|
+
style: {
|
|
628
|
+
position: "absolute",
|
|
629
|
+
top: X === "top" ? 0 : void 0,
|
|
630
|
+
bottom: X === "bottom" ? 0 : void 0,
|
|
631
|
+
left: 0,
|
|
632
|
+
right: 0,
|
|
633
|
+
width: X === "left" || X === "right" ? k : "100%",
|
|
634
|
+
height: X === "top" || X === "bottom" ? k : "100%",
|
|
635
|
+
pointerEvents: "none",
|
|
636
|
+
opacity: Ct,
|
|
637
|
+
backdropFilter: `blur(${A}px)`,
|
|
638
|
+
WebkitBackdropFilter: `blur(${A}px)`,
|
|
639
|
+
maskImage: X === "top" ? "linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)" : X === "left" ? "linear-gradient(to right, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)" : X === "right" ? "linear-gradient(to left, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)" : "linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)",
|
|
640
|
+
WebkitMaskImage: X === "top" ? "linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)" : X === "left" ? "linear-gradient(to right, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)" : X === "right" ? "linear-gradient(to left, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)" : "linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)"
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
)
|
|
644
|
+
]
|
|
592
645
|
}
|
|
593
646
|
)
|
|
594
647
|
}
|
|
595
648
|
);
|
|
596
|
-
},
|
|
649
|
+
}, Kt = zt;
|
|
597
650
|
export {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
651
|
+
Gt as BoxAnim,
|
|
652
|
+
Jt as ContentAnim,
|
|
653
|
+
Kt as MaskAnim,
|
|
654
|
+
Dt as combine,
|
|
655
|
+
U as combineAnimations,
|
|
656
|
+
Wt as extractTransformations,
|
|
657
|
+
M as useAnimation
|
|
605
658
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(M,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react/jsx-runtime"),require("react"),require("remotion")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","remotion"],m):(M=typeof globalThis<"u"?globalThis:M||self,m(M.animations={},M.jsxRuntime,M.React,M.remotion))})(this,function(M,m,L,S){"use strict";const re=()=>({scale:e=>({transform:`scale(${e})`}),growIn:e=>({transform:`scale(${e})`}),shrinkIn:e=>({transform:`scale(${e})`}),shrinkOut:e=>({transform:`scale(${e})`}),opacity:e=>({opacity:e}),translateX:e=>({transform:`translateX(${e}%)`}),translateY:e=>({transform:`translateY(${e}%)`}),rotate:e=>({transform:`rotate(${e}deg)`}),spin:e=>({transform:`rotate(${e}deg)`}),spinIn:e=>({transform:`rotate(${e}deg)`}),twistIn:e=>({transform:`rotate(${e}deg)`}),twistOut:e=>({transform:`rotate(${e}deg)`}),moveScaleIn:e=>({transform:`scale(${e})`}),spinOut:e=>({transform:`rotate(${e}deg)`}),default:()=>({}),rotateY:e=>({transform:`rotateY(${e}deg)`}),rotateX:e=>({transform:`rotateX(${e}deg)`}),blur:e=>({filter:`blur(${e}px)`}),blurIn:e=>({filter:`blur(${e}px)`}),blurOut:e=>({filter:`blur(${e}px)`}),blurV2In:e=>({filter:`blur(${e}px)`}),blurSlide:e=>({filter:`blur(${e}px)`,transform:`translateY(${e*5}%)`}),blurSlideV2In:e=>({filter:`blur(${e}px)`}),brightness:e=>({filter:`brightness(${e}%)`}),contrast:e=>({filter:`contrast(${e}%)`}),grayscale:e=>({filter:`grayscale(${e}%)`}),hue:e=>({filter:`hue-rotate(${e}deg)`}),saturation:e=>({filter:`saturate(${e}%)`}),vignette:e=>({filter:`contrast(${100+e*20}%) brightness(${100-e*20}%)`}),noise:e=>({filter:`contrast(${100+e*40}%) brightness(${100+e*20}%)`}),pixelate:e=>({filter:`contrast(${100+e*2}%)`}),chromaticAberration:e=>({filter:`hue-rotate(${e*10}deg) contrast(110%)`}),lightLeak:e=>({filter:`brightness(${100+e*50}%) saturate(${100+e*30}%)`}),duotone:e=>({filter:`sepia(${e*100}%) hue-rotate(${e*180}deg)`}),shakeHorizontalIn:e=>({transform:`translateX(${e}px)`}),shakeVerticalIn:e=>({transform:`translateY(${e}px)`}),shakeHorizontalOut:e=>({transform:`translateX(${e}px)`}),shakeVerticalOut:e=>({transform:`translateY(${e}px)`}),maskUpIn:e=>({transform:`translateY(${e}px)`,overflow:"hidden"}),maskUpOut:e=>({transform:`translateY(${e}px)`,overflow:"hidden"}),maskDownIn:e=>({transform:`translateY(${e}px)`,overflow:"hidden"}),maskDownOut:e=>({transform:`translateY(${e}px)`,overflow:"hidden"}),moveTranslateY:e=>({transform:`translateY(${e}%)`}),"hide-show":e=>({opacity:e}),hide:e=>({opacity:e}),show:e=>({opacity:e}),borderRadius:e=>({borderRadius:`${e}px`,overflow:"hidden"}),"corner-radius":e=>({borderRadius:`${e}px`,overflow:"hidden"})}),z=(e,l=0)=>{const s=[],o=e/5;for(let a=0;a<6;a+=1)s.push(a*o+l);return s},se=(e,l,s,o=!1)=>{const{from:a,to:t,ease:h}=l,u=l.durationInFrames||30,c=Number(a),n=Number(t),r=Math.max(1,Number(u));if(isNaN(c)||isNaN(n))return console.error("Invalid animation values:",{from:a,to:t,animationDurationInFrames:u,property:l.property}),c;u===void 0&&console.warn(`durationInFrames is undefined for animation: ${l.property}. Using 1 frame as default.`);const i=l.delay||0;if(l.property==="hide-show"||l.property==="hide"||l.property==="show")return e<i?c:n;let $;if(l.property==="moveScaleIn"?$=o?[s-r-i,s-r*.5-i]:[i+r*.5,i+r]:l.property==="moveTranslateY"?$=o?[s-r*.5-i,s-i]:[i,i+r*.5]:$=o?[s-r-i,s-i]:[i,i+r],l.property.includes("shake")){const E=o?z(r,s-r-i):z(r,i);return S.interpolate(e,E,[0,c,n,c,n,0],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:h})}return S.interpolate(e,$,[c,n],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:h})},Z=e=>{if(e==null)return 0;if(typeof e=="number")return Number.isNaN(e)?0:e;if(typeof e=="object"){if(e.rotate!==void 0&&e.rotate!==null){const a=parseFloat(String(e.rotate));if(!Number.isNaN(a))return a}if(e.rotation!==void 0&&e.rotation!==null){const a=parseFloat(String(e.rotation));if(!Number.isNaN(a))return a}return e.transform?Z(e.transform):0}const l=String(e),s=/rotate\((-?[\d.]+)deg\)/.exec(l);if(s)return parseFloat(s[1])||0;const o=/matrix\(([^)]+)\)/.exec(l);if(o){const a=o[1].split(",").map(t=>parseFloat(t.trim()));if(a.length>=4){const[t,h]=a;return Math.atan2(h,t)*(180/Math.PI)}}return 0},O=(e,l,s,o,a)=>{var c,n,r,i,$;const{property:t}=e;if(t==="move"){const E=Number(((c=e.details)==null?void 0:c.fromX)??e.from??0),X=Number(((n=e.details)==null?void 0:n.toX)??e.to??0),F=Number(((r=e.details)==null?void 0:r.fromY)??0),P=Number(((i=e.details)==null?void 0:i.toY)??0),T=Number((($=e.details)==null?void 0:$.scale)||1)||1;let A=a;if(A==null||Number.isNaN(A)){const w=e.details;A=Z((w==null?void 0:w.rotate)??(w==null?void 0:w.rotation)??(w==null?void 0:w.transform))}const d=e.delay||0,N=e.durationInFrames||30,j=o?[s-N-d,s-d]:[d,d+N],C=S.interpolate(l,j,[E,X],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:e.ease}),x=S.interpolate(l,j,[F,P],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:e.ease}),v=(A||0)*Math.PI/180,y=Math.cos(v),f=Math.sin(v),p=C*y+x*f,I=-C*f+x*y,V=p/T,W=I/T;return{transform:`translateX(${V}px) translateY(${W}px)`}}const h=se(l,e,s,o),u=re();return(u[t]||u.default)(h)},H=(e,l,s,o=!1,a=!1,t)=>L.useMemo(()=>{if(e.length===0)return{};const h=e.filter(u=>u.from!==void 0&&u.to!==void 0);if(h.length!==e.length&&console.error("Some animations are invalid and will be ignored"),a){const u=[];return h.reverse().forEach(n=>{const r=O(n,s,l,!1,t);u.push(r)}),u.reduce((n,r)=>(Object.keys(r).forEach(i=>{i==="transform"||i==="filter"?n[i]=n[i]?`${n[i]} ${r[i]}`:r[i]:n[i]=r[i]}),n),{})}else return h.map(c=>O(c,s,l,o,t)).reduce((c,n)=>(Object.keys(n).forEach(r=>{r==="transform"||r==="filter"?c[r]=c[r]?`${c[r]} ${n[r]}`:n[r]:c[r]=n[r]}),c),{})},[e,s,l,o,t]),R=e=>e?Array.isArray(e)?e:[e]:[],oe=(...e)=>{const l=[];return e.forEach(s=>{Array.isArray(s)?l.push(...s):s&&l.push(s)}),l.filter(s=>s!==void 0).reduce((s,o)=>s.find(t=>t.property===o.property)?s.map(t=>t.property===o.property?{...t,from:Math.min(t.from,o.from),to:Math.max(t.to,o.to),durationInFrames:Math.max(t.durationInFrames,o.durationInFrames),delay:Math.min(t.delay||0,o.delay||0),ease:h=>(t.ease(h)+o.ease(h))/2}:t):[...s,o],[])},ne=({animationIn:e,animationOut:l,durationInFrames:s,children:o,style:a={},frame:t,isTransition:h=!1,basicCharAnimationsIn:u=[],basicCharAnimationsOut:c=[]})=>{const n=Z((a==null?void 0:a.transform)||(a==null?void 0:a.rotate)||(a==null?void 0:a.rotation)),r=H(R(e),s,t,!1,!1,n),i=H(R(l),s,t,!0,!1,n),$=H(R(u),s,t,!0,!1,n),E=H(R(c),s,t,!0,!1,n),X=L.useMemo(()=>{const x=Object.keys(r).length>0,v=e==null?void 0:e.reduce((f,p)=>Math.min(f,p.delay||0),1/0),y=t-(v||0);return x&&y<0?{visibility:h?"visible":"hidden"}:r},[r,t,e,h]),F=L.useMemo(()=>{if(t>s)return{visibility:h?"visible":"hidden"};const x=R(l);if(!x||x.length===0)return{};let v=0;x.forEach(f=>{const p=(f.durationInFrames||0)+(f.delay||0);p>v&&(v=p)});const y=Math.max(0,s-v);return t<y?{}:i},[i,t,l,s,h]),P=L.useMemo(()=>{const x={...X};return Object.entries(F).forEach(([v,y])=>{v==="transform"?x[v]=`${x[v]||""} ${y||""}`.trim():v in x&&typeof x[v]=="number"&&typeof y=="number"?x[v]=x[v]*y:x[v]=y}),x},[X,F]),T=L.useMemo(()=>{const x=P.transform||"",{translateX:v,translateY:y,scale:f,rotation:p,rotateX:I,rotateY:V,rotateZ:W}=G(x);return`${p} ${v} ${y} ${f} ${I} ${V} ${W}`.trim()},[P]),{top:A,left:d,position:N,transform:j,...C}=a||{};return m.jsx("div",{style:{width:"100%",height:"100%",overflow:P.overflow||$.overflow||E.overflow||"visible",pointerEvents:"none"},children:m.jsx("div",{style:{width:"100%",height:"100%",...C,...P,overflow:"visible",transform:T,pointerEvents:"none",background:Object.keys(P).length===0?"transparent":P.backgroundColor},children:o})})},G=e=>{let l="",s="",o="scale(1)",a="",t="",h="",u="";const c=e.match(/translateX\([^)]+\)/g);c&&(l=c[c.length-1]);const n=e.match(/translateY\([^)]+\)/g);n&&(s=n[n.length-1]);const r=e.match(/scale\([^)]+\)/g);r&&(o=r[r.length-1]);const i=e.match(/rotate\([^)]+\)/g);i&&(a=i[i.length-1]);const $=e.match(/rotateX\([^)]+\)/g);$&&(t=$[$.length-1]);const E=e.match(/rotateY\([^)]+\)/g);E&&(h=E[E.length-1]);const X=e.match(/rotateZ\([^)]+\)/g);return X&&(u=X[X.length-1]),{translateX:l,translateY:s,scale:o,rotation:a,rotateX:t,rotateY:h,rotateZ:u}},ae=({animationTimed:e,durationInFrames:l,children:s,style:o={},frame:a})=>{const t=Z((o==null?void 0:o.transform)||(o==null?void 0:o.rotate)||(o==null?void 0:o.rotation)),h=H(R(e),l,a,!1,!0,t),u=L.useMemo(()=>({...h}),[h]),c=!!u.borderRadius;return m.jsx("div",{style:{overflow:c?"hidden":u.overflow||"visible",borderRadius:u.borderRadius,pointerEvents:"none",height:o.height||"100%",width:o.width||"100%",...u,...c?{overflow:"hidden"}:{}},children:m.jsx("div",{style:{overflow:c?"hidden":"visible",borderRadius:u.borderRadius,pointerEvents:"none",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:s})})},le=e=>{if(typeof(e==null?void 0:e.ease)=="function")return e.ease;switch(e==null?void 0:e.easing){case"ease-in":case"accelerate":return S.Easing.in(S.Easing.cubic);case"ease-out":case"smooth":case"slowDown":return S.Easing.out(S.Easing.cubic);case"ease-in-out":case"natural":case"swing":return S.Easing.inOut(S.Easing.cubic);case"bounce":return S.Easing.bounce;case"elastic":return S.Easing.elastic(1);case"overshoot":case"impulse":return S.Easing.out(S.Easing.back(1.7));case"none":case"linear":default:return S.Easing.linear}},ie=(e,l)=>{const s=l*Math.PI/180,o=Math.cos(s),a=Math.sin(s),t=e/100*50,h=50,u=50,c=200,n=o,r=a,i=-a,$=o;return`polygon(${[[h-n*c-i*t,u-r*c-$*t],[h+n*c-i*t,u+r*c-$*t],[h+n*c+i*t,u+r*c+$*t],[h-n*c+i*t,u-r*c+$*t]].map(([X,F])=>`${X}% ${F}%`).join(", ")})`},ce=({children:e,currentWidth:l,currentHeight:s,frame:o,item:a,keyframeAnimations:t,durationInFrames:h})=>{var K,Q,D,_,k,ee;if(!t||!Array.isArray(t)||t.length===0)return m.jsx(m.Fragment,{children:e});const u=g=>{var b,B;return!!((b=g==null?void 0:g.property)!=null&&b.includes("maskReveal")||(B=g==null?void 0:g.id)!=null&&B.includes("maskReveal"))},c=g=>{var b,B;return!!((g==null?void 0:g.type)==="exit"||(b=g==null?void 0:g.property)!=null&&b.includes("Out")||(B=g==null?void 0:g.id)!=null&&B.includes("Out"))},n=t.find(g=>u(g)&&!c(g)),r=t.find(g=>u(g)&&c(g));if(!n&&!r)return m.jsx(m.Fragment,{children:e});const i=Math.max(1,h||300),$=n?Math.max(1,Number(n.durationInFrames||30)):30,E=n?Math.max(0,Number(n.delay||0)):0,X=r?Math.max(1,Number(r.durationInFrames||30)):30,F=r?Math.max(0,Number(r.delay||0)):0,P=r?Math.max(0,i-X-F):Number.POSITIVE_INFINITY;let T=!1,A=!1,d=null,N=!1,j=30,C=0;r&&o>=P?(d=r,N=!0,j=X,C=o-P,C>=j-1&&(T=!0)):n?o<E?(T=!0,d=n,N=!1,j=$,C=0):o<E+$?(d=n,N=!1,j=$,C=o-E):(A=!0,d=null):(A=!0,d=null);const x=Math.max(0,C),v=j>0?Math.min(Math.max(0,x/j),1):1,y=d?le(d):S.Easing.linear,f=Math.max(0,Math.min(1,y(v)));let p,I="",V=1;if(T)p="inset(100%)";else if(A||!d)p=void 0;else{const g=String(d.property||d.id||""),b=((K=d.details)==null?void 0:K.direction)||"up",B=g.includes("ShrinkScale"),te=g.includes("CenterScale"),de=g.includes("Slide")||g.includes("slide");if(te){const Y=Number(((Q=d==null?void 0:d.details)==null?void 0:Q.angle)??(d==null?void 0:d.angle)??0),q=N?100*(1-f):100*f;p=ie(q,Y)}else if(B){const Y=Number(((D=d==null?void 0:d.details)==null?void 0:D.initialVisiblePercent)??(d==null?void 0:d.initialVisiblePercent)??50),q=Math.max(0,Math.min(50,(100-Y)/2)),U=N?q*f:q*(1-f);p=`inset(
|
|
2
|
-
${
|
|
3
|
-
${
|
|
4
|
-
${
|
|
5
|
-
${
|
|
6
|
-
)`}else if(
|
|
1
|
+
(function(E,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react/jsx-runtime"),require("react"),require("remotion")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","remotion"],v):(E=typeof globalThis<"u"?globalThis:E||self,v(E.animations={},E.jsxRuntime,E.React,E.remotion))})(this,function(E,v,z,m){"use strict";const Bt=()=>({scale:t=>({transform:`scale(${t})`}),growIn:t=>({transform:`scale(${t})`}),shrinkIn:t=>({transform:`scale(${t})`}),shrinkOut:t=>({transform:`scale(${t})`}),opacity:t=>({opacity:t}),translateX:t=>({transform:`translateX(${t}%)`}),translateY:t=>({transform:`translateY(${t}%)`}),rotate:t=>({transform:`rotate(${t}deg)`}),spin:t=>({transform:`rotate(${t}deg)`}),spinIn:t=>({transform:`rotate(${t}deg)`}),twistIn:t=>({transform:`rotate(${t}deg)`}),twistOut:t=>({transform:`rotate(${t}deg)`}),moveScaleIn:t=>({transform:`scale(${t})`}),spinOut:t=>({transform:`rotate(${t}deg)`}),default:()=>({}),rotateY:t=>({transform:`rotateY(${t}deg)`}),rotateX:t=>({transform:`rotateX(${t}deg)`}),blur:t=>({filter:`blur(${t}px)`}),blurIn:t=>({filter:`blur(${t}px)`}),blurOut:t=>({filter:`blur(${t}px)`}),blurV2In:t=>({filter:`blur(${t}px)`}),blurSlide:t=>({filter:`blur(${t}px)`,transform:`translateY(${t*5}%)`}),blurSlideV2In:t=>({filter:`blur(${t}px)`}),brightness:t=>({filter:`brightness(${t}%)`}),contrast:t=>({filter:`contrast(${t}%)`}),grayscale:t=>({filter:`grayscale(${t}%)`}),hue:t=>({filter:`hue-rotate(${t}deg)`}),saturation:t=>({filter:`saturate(${t}%)`}),vignette:t=>({filter:`contrast(${100+t*20}%) brightness(${100-t*20}%)`}),noise:t=>({filter:`contrast(${100+t*40}%) brightness(${100+t*20}%)`}),pixelate:t=>({filter:`contrast(${100+t*2}%)`}),chromaticAberration:t=>({filter:`hue-rotate(${t*10}deg) contrast(110%)`}),lightLeak:t=>({filter:`brightness(${100+t*50}%) saturate(${100+t*30}%)`}),duotone:t=>({filter:`sepia(${t*100}%) hue-rotate(${t*180}deg)`}),shakeHorizontalIn:t=>({transform:`translateX(${t}px)`}),shakeVerticalIn:t=>({transform:`translateY(${t}px)`}),shakeHorizontalOut:t=>({transform:`translateX(${t}px)`}),shakeVerticalOut:t=>({transform:`translateY(${t}px)`}),maskUpIn:t=>({transform:`translateY(${t}px)`,overflow:"hidden"}),maskUpOut:t=>({transform:`translateY(${t}px)`,overflow:"hidden"}),maskDownIn:t=>({transform:`translateY(${t}px)`,overflow:"hidden"}),maskDownOut:t=>({transform:`translateY(${t}px)`,overflow:"hidden"}),moveTranslateY:t=>({transform:`translateY(${t}%)`}),"hide-show":t=>({opacity:t}),hide:t=>({opacity:t}),show:t=>({opacity:t}),borderRadius:t=>({borderRadius:`${t}px`,overflow:"hidden"}),"corner-radius":t=>({borderRadius:`${t}px`,overflow:"hidden"})}),_=(t,d=0)=>{const s=[],l=t/5;for(let i=0;i<6;i+=1)s.push(i*l+d);return s},It=(t,d,s,l=!1)=>{const{from:i,to:n,ease:b}=d,h=d.durationInFrames||30,f=Number(i),o=Number(n),r=Math.max(1,Number(h));if(isNaN(f)||isNaN(o))return console.error("Invalid animation values:",{from:i,to:n,animationDurationInFrames:h,property:d.property}),f;h===void 0&&console.warn(`durationInFrames is undefined for animation: ${d.property}. Using 1 frame as default.`);const c=d.delay||0;if(d.property==="hide-show"||d.property==="hide"||d.property==="show")return t<c?f:o;let $;if(d.property==="moveScaleIn"?$=l?[s-r-c,s-r*.5-c]:[c+r*.5,c+r]:d.property==="moveTranslateY"?$=l?[s-r*.5-c,s-c]:[c,c+r*.5]:$=l?[s-r-c,s-c]:[c,c+r],d.property.includes("shake")){const B=l?_(r,s-r-c):_(r,c);return m.interpolate(t,B,[0,f,o,f,o,0],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:b})}return m.interpolate(t,$,[f,o],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:b})},G=t=>{if(t==null)return 0;if(typeof t=="number")return Number.isNaN(t)?0:t;if(typeof t=="object"){if(t.rotate!==void 0&&t.rotate!==null){const i=parseFloat(String(t.rotate));if(!Number.isNaN(i))return i}if(t.rotation!==void 0&&t.rotation!==null){const i=parseFloat(String(t.rotation));if(!Number.isNaN(i))return i}return t.transform?G(t.transform):0}const d=String(t),s=/rotate\((-?[\d.]+)deg\)/.exec(d);if(s)return parseFloat(s[1])||0;const l=/matrix\(([^)]+)\)/.exec(d);if(l){const i=l[1].split(",").map(n=>parseFloat(n.trim()));if(i.length>=4){const[n,b]=i;return Math.atan2(b,n)*(180/Math.PI)}}return 0},A=(t,d,s,l,i)=>{var f,o,r,c,$;const{property:n}=t;if(n==="move"){const B=Number(((f=t.details)==null?void 0:f.fromX)??t.from??0),F=Number(((o=t.details)==null?void 0:o.toX)??t.to??0),L=Number(((r=t.details)==null?void 0:r.fromY)??0),j=Number(((c=t.details)==null?void 0:c.toY)??0),O=Number((($=t.details)==null?void 0:$.scale)||1)||1;let H=i;if(H==null||Number.isNaN(H)){const p=t.details;H=G((p==null?void 0:p.rotate)??(p==null?void 0:p.rotation)??(p==null?void 0:p.transform))}const e=t.delay||0,x=t.durationInFrames||30,T=l?[s-x-e,s-e]:[e,e+x],V=m.interpolate(d,T,[B,F],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:t.ease}),S=m.interpolate(d,T,[L,j],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:t.ease}),w=(H||0)*Math.PI/180,X=Math.cos(w),a=Math.sin(w),g=V*X+S*a,y=-V*a+S*X,W=g/O,C=y/O;return{transform:`translateX(${W}px) translateY(${C}px)`}}const b=It(d,t,s,l),h=Bt();return(h[n]||h.default)(b)},U=(t,d,s,l=!1,i=!1,n)=>z.useMemo(()=>{if(t.length===0)return{};const b=t.filter(h=>h.from!==void 0&&h.to!==void 0);if(b.length!==t.length&&console.error("Some animations are invalid and will be ignored"),i){const h=[];return b.reverse().forEach(o=>{const r=A(o,s,d,!1,n);h.push(r)}),h.reduce((o,r)=>(Object.keys(r).forEach(c=>{c==="transform"||c==="filter"?o[c]=o[c]?`${o[c]} ${r[c]}`:r[c]:o[c]=r[c]}),o),{})}else return b.map(f=>A(f,s,d,l,n)).reduce((f,o)=>(Object.keys(o).forEach(r=>{r==="transform"||r==="filter"?f[r]=f[r]?`${f[r]} ${o[r]}`:o[r]:f[r]=o[r]}),f),{})},[t,s,d,l,n]),M=t=>t?Array.isArray(t)?t:[t]:[],Pt=(...t)=>{const d=[];return t.forEach(s=>{Array.isArray(s)?d.push(...s):s&&d.push(s)}),d.filter(s=>s!==void 0).reduce((s,l)=>s.find(n=>n.property===l.property)?s.map(n=>n.property===l.property?{...n,from:Math.min(n.from,l.from),to:Math.max(n.to,l.to),durationInFrames:Math.max(n.durationInFrames,l.durationInFrames),delay:Math.min(n.delay||0,l.delay||0),ease:b=>(n.ease(b)+l.ease(b))/2}:n):[...s,l],[])},Ft=({animationIn:t,animationOut:d,durationInFrames:s,children:l,style:i={},frame:n,isTransition:b=!1,basicCharAnimationsIn:h=[],basicCharAnimationsOut:f=[]})=>{const o=G((i==null?void 0:i.transform)||(i==null?void 0:i.rotate)||(i==null?void 0:i.rotation)),r=U(M(t),s,n,!1,!1,o),c=U(M(d),s,n,!0,!1,o),$=U(M(h),s,n,!0,!1,o),B=U(M(f),s,n,!0,!1,o),F=z.useMemo(()=>{const S=Object.keys(r).length>0,w=t==null?void 0:t.reduce((a,g)=>Math.min(a,g.delay||0),1/0),X=n-(w||0);return S&&X<0?{visibility:b?"visible":"hidden"}:r},[r,n,t,b]),L=z.useMemo(()=>{if(n>s)return{visibility:b?"visible":"hidden"};const S=M(d);if(!S||S.length===0)return{};let w=0;S.forEach(a=>{const g=(a.durationInFrames||0)+(a.delay||0);g>w&&(w=g)});const X=Math.max(0,s-w);return n<X?{}:c},[c,n,d,s,b]),j=z.useMemo(()=>{const S={...F};return Object.entries(L).forEach(([w,X])=>{w==="transform"?S[w]=`${S[w]||""} ${X||""}`.trim():w in S&&typeof S[w]=="number"&&typeof X=="number"?S[w]=S[w]*X:S[w]=X}),S},[F,L]),O=z.useMemo(()=>{const S=j.transform||"",{translateX:w,translateY:X,scale:a,rotation:g,rotateX:y,rotateY:W,rotateZ:C}=k(S);return`${g} ${w} ${X} ${a} ${y} ${W} ${C}`.trim()},[j]),{top:H,left:e,position:x,transform:T,...V}=i||{};return v.jsx("div",{style:{width:"100%",height:"100%",overflow:j.overflow||$.overflow||B.overflow||"visible",pointerEvents:"none"},children:v.jsx("div",{style:{width:"100%",height:"100%",...V,...j,overflow:"visible",transform:O,pointerEvents:"none",background:Object.keys(j).length===0?"transparent":j.backgroundColor},children:l})})},k=t=>{let d="",s="",l="scale(1)",i="",n="",b="",h="";const f=t.match(/translateX\([^)]+\)/g);f&&(d=f[f.length-1]);const o=t.match(/translateY\([^)]+\)/g);o&&(s=o[o.length-1]);const r=t.match(/scale\([^)]+\)/g);r&&(l=r[r.length-1]);const c=t.match(/rotate\([^)]+\)/g);c&&(i=c[c.length-1]);const $=t.match(/rotateX\([^)]+\)/g);$&&(n=$[$.length-1]);const B=t.match(/rotateY\([^)]+\)/g);B&&(b=B[B.length-1]);const F=t.match(/rotateZ\([^)]+\)/g);return F&&(h=F[F.length-1]),{translateX:d,translateY:s,scale:l,rotation:i,rotateX:n,rotateY:b,rotateZ:h}},jt=({animationTimed:t,durationInFrames:d,children:s,style:l={},frame:i})=>{const n=G((l==null?void 0:l.transform)||(l==null?void 0:l.rotate)||(l==null?void 0:l.rotation)),b=U(M(t),d,i,!1,!0,n),h=z.useMemo(()=>({...b}),[b]),f=!!h.borderRadius;return v.jsx("div",{style:{overflow:f?"hidden":h.overflow||"visible",borderRadius:h.borderRadius,pointerEvents:"none",height:l.height||"100%",width:l.width||"100%",...h,...f?{overflow:"hidden"}:{}},children:v.jsx("div",{style:{overflow:f?"hidden":"visible",borderRadius:h.borderRadius,pointerEvents:"none",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:s})})},Ct=t=>{if(typeof(t==null?void 0:t.ease)=="function")return t.ease;switch(t==null?void 0:t.easing){case"ease-in":case"accelerate":return m.Easing.in(m.Easing.cubic);case"ease-out":case"smooth":case"slowDown":return m.Easing.out(m.Easing.cubic);case"ease-in-out":case"natural":case"swing":return m.Easing.inOut(m.Easing.cubic);case"bounce":return m.Easing.bounce;case"elastic":return m.Easing.elastic(1);case"overshoot":case"impulse":return m.Easing.out(m.Easing.back(1.7));case"none":case"linear":default:return m.Easing.linear}},Ot=(t,d)=>{const s=d*Math.PI/180,l=Math.cos(s),i=Math.sin(s),n=t/100*50,b=50,h=50,f=200,o=l,r=i,c=-i,$=l;return`polygon(${[[b-o*f-c*n,h-r*f-$*n],[b+o*f-c*n,h+r*f-$*n],[b+o*f+c*n,h+r*f+$*n],[b-o*f+c*n,h-r*f+$*n]].map(([F,L])=>`${F}% ${L}%`).join(", ")})`},Tt=({children:t,currentWidth:d,currentHeight:s,frame:l,item:i,keyframeAnimations:n,durationInFrames:b})=>{var nt,st,lt,at,it,ct,dt,ft,ut,pt,ht,gt,bt,$t,xt,St,wt,yt,Nt,Yt,vt,mt,Et,Xt;if(!n||!Array.isArray(n)||n.length===0)return v.jsx(v.Fragment,{children:t});const h=u=>{var N,P;return!!((N=u==null?void 0:u.property)!=null&&N.includes("maskReveal")||(P=u==null?void 0:u.id)!=null&&P.includes("maskReveal"))},f=u=>{var N,P;return!!((u==null?void 0:u.type)==="exit"||(N=u==null?void 0:u.property)!=null&&N.includes("Out")||(P=u==null?void 0:u.id)!=null&&P.includes("Out"))},o=n.find(u=>h(u)&&!f(u)),r=n.find(u=>h(u)&&f(u));if(!o&&!r)return v.jsx(v.Fragment,{children:t});const c=Math.max(1,b||300),$=o?Math.max(1,Number(o.durationInFrames||30)):30,B=o?Math.max(0,Number(o.delay||0)):0,F=r?Math.max(1,Number(r.durationInFrames||30)):30,L=r?Math.max(0,Number(r.delay||0)):0,j=r?Math.max(0,c-F-L):Number.POSITIVE_INFINITY;let O=!1,H=!1,e=null,x=!1,T=30,V=0;if(r&&(l>=j||!o)){e=r,x=!0,T=F;const u=o||j<c?j:0;V=l-u;const N=String(r.property||r.id||""),P=N.includes("Blur")||N.includes("Soft")||!!((nt=r==null?void 0:r.details)!=null&&nt.blurBottom)||!!((st=r==null?void 0:r.details)!=null&&st.softEdge);V>=T-1&&!P&&(O=!0)}else if(o)if(l<B)O=!0,e=o,x=!1,T=$,V=0;else if(l<B+$)e=o,x=!1,T=$,V=l-B;else{const u=String(o.property||o.id||"");u.includes("Blur")||u.includes("Soft")||!!((lt=o==null?void 0:o.details)!=null&<.blurBottom)||!!((at=o==null?void 0:o.details)!=null&&at.softEdge)?(e=o,x=!1,T=$,V=$):(H=!0,e=null)}else H=!0,e=null;const S=Math.max(0,V),w=T>0?Math.min(Math.max(0,S/T),1):1,X=e?Ct(e):m.Easing.linear,a=Math.max(0,Math.min(1,X(w)));let g,y="",W=1;const C=String((e==null?void 0:e.property)||(e==null?void 0:e.id)||""),p=((it=e==null?void 0:e.details)==null?void 0:it.direction)||"up";if(O)g="inset(100%)";else if(H||!e)g=void 0;else{const u=C.includes("ShrinkScale"),N=C.includes("CenterScale"),P=C.includes("Slide")||C.includes("slide");if(N){const Y=Number(((ct=e==null?void 0:e.details)==null?void 0:ct.angle)??(e==null?void 0:e.angle)??0),q=x?100*(1-a):100*a;g=Ot(q,Y)}else if(u){const Y=Number(((dt=e==null?void 0:e.details)==null?void 0:dt.initialVisiblePercent)??(e==null?void 0:e.initialVisiblePercent)??50),q=Math.max(0,Math.min(50,(100-Y)/2)),D=x?q*a:q*(1-a);g=`inset(
|
|
2
|
+
${D}%
|
|
3
|
+
${D}%
|
|
4
|
+
${D}%
|
|
5
|
+
${D}%
|
|
6
|
+
)`}else if(P)g="inset(0% 0% 0% 0%)",x?p==="down"?y=`translateY(${100*a}%)`:p==="left"?y=`translateX(${-100*a}%)`:p==="right"?y=`translateX(${100*a}%)`:y=`translateY(${-100*a}%)`:p==="down"?y=`translateY(${-100*(1-a)}%)`:p==="left"?y=`translateX(${100*(1-a)}%)`:p==="right"?y=`translateX(${-100*(1-a)}%)`:y=`translateY(${100*(1-a)}%)`;else if(C.includes("Center"))g=`circle(${x?150*(1-a):150*a}% at 50% 50%)`;else if(C.includes("Corner")){const Y=x?a:1-a;p==="down"?g=`inset(0 ${100*Y}% ${100*Y}% 0)`:p==="up"?g=`inset(${100*Y}% ${100*Y}% 0 0)`:p==="left"?g=`inset(0 0 ${100*Y}% ${100*Y}%)`:p==="right"?g=`inset(${100*Y}% 0 0 ${100*Y}%)`:g=`inset(0 ${100*Y}% ${100*Y}% 0)`}else x?p==="down"?g=`inset(${100*a}% 0 0 0)`:p==="left"?g=`inset(0 0 0 ${100*a}%)`:p==="right"?g=`inset(0 ${100*a}% 0 0)`:g=`inset(0 0 ${100*a}% 0)`:p==="down"?g=`inset(0 0 ${100*(1-a)}% 0)`:p==="left"?g=`inset(0 0 0 ${100*(1-a)}%)`:p==="right"?g=`inset(0 ${100*(1-a)}% 0 0)`:g=`inset(${100*(1-a)}% 0 0 0)`;const Q=!!((ft=e==null?void 0:e.details)!=null&&ft.scale||e!=null&&e.scale);N||u?((ut=e==null?void 0:e.details)==null?void 0:ut.scale)===!1?W=1:W=x?1+.5*a:1.5-.5*a:Q&&(W=x?1-.2*a:.8+.2*a)}const K=C.includes("Blur")||C.includes("Soft")||!!((pt=e==null?void 0:e.details)!=null&&pt.blurBottom)||!!((ht=e==null?void 0:e.details)!=null&&ht.softEdge);let Z;if(K&&!O&&e){g=void 0;const u=30,N=((gt=e==null?void 0:e.details)==null?void 0:gt.blurPosition)||"bottom";x?p==="up"?y=`translateY(${u*a}%)`:p==="down"?y=`translateY(${-u*a}%)`:p==="left"?y=`translateX(${u*a}%)`:p==="right"&&(y=`translateX(${-u*a}%)`):p==="up"?y=`translateY(${u*(1-a)}%)`:p==="down"?y=`translateY(${-u*(1-a)}%)`:p==="left"?y=`translateX(${u*(1-a)}%)`:p==="right"&&(y=`translateX(${-u*(1-a)}%)`);const P=typeof((bt=e==null?void 0:e.details)==null?void 0:bt.blurHeight)=="number"?e.details.blurHeight:parseInt(String((($t=e==null?void 0:e.details)==null?void 0:$t.blurHeight)||"35"),10)||35,Q=x?100:0,Y=x?0:100,q=Number(((xt=e==null?void 0:e.details)==null?void 0:xt.initialOpacity)??Q)/100,D=Number(((St=e==null?void 0:e.details)==null?void 0:St.finalOpacity)??Y)/100,Zt=Math.max(0,Math.min(1,q+(D-q)*a)),J=Math.max(0,1-Zt);N==="bottom"?Z=`linear-gradient(to bottom, black 0%, black ${100-P}%, rgba(0,0,0,${J}) 100%)`:N==="top"?Z=`linear-gradient(to top, black 0%, black ${100-P}%, rgba(0,0,0,${J}) 100%)`:N==="right"?Z=`linear-gradient(to right, black 0%, black ${100-P}%, rgba(0,0,0,${J}) 100%)`:N==="left"&&(Z=`linear-gradient(to left, black 0%, black ${100-P}%, rgba(0,0,0,${J}) 100%)`)}const Vt=[y,W!==1?`scale(${W})`:""].filter(Boolean).join(" ")||void 0,R=(wt=i==null?void 0:i.details)==null?void 0:wt.boxShadow,tt=R&&(R.x||R.y||R.blur)?`drop-shadow(${R.x||0}px ${R.y||0}px ${R.blur||0}px ${R.color||"#000000"})`:void 0,et=Number(((yt=e==null?void 0:e.details)==null?void 0:yt.blurAmount)??16),Ht=!!(K&&(((Nt=e==null?void 0:e.details)==null?void 0:Nt.blurBottom)??!0)),I=((Yt=e==null?void 0:e.details)==null?void 0:Yt.blurPosition)||"bottom",rt=typeof((vt=e==null?void 0:e.details)==null?void 0:vt.blurHeight)=="number"?`${e.details.blurHeight}%`:((mt=e==null?void 0:e.details)==null?void 0:mt.blurHeight)||"35%",Wt=x?100:0,Lt=x?0:100,ot=Number(((Et=e==null?void 0:e.details)==null?void 0:Et.initialOpacity)??Wt)/100,Rt=Number(((Xt=e==null?void 0:e.details)==null?void 0:Xt.finalOpacity)??Lt)/100,Mt=K&&e?Math.max(0,Math.min(1,ot+(Rt-ot)*a)):1;return v.jsx("div",{style:{width:d!==void 0?d:"100%",height:s!==void 0?s:"100%",position:"relative",visibility:O?"hidden":"visible"},children:v.jsxs("div",{style:{width:"100%",height:"100%",position:"relative",clipPath:g||void 0,WebkitClipPath:g||void 0,maskImage:Z||void 0,WebkitMaskImage:Z||void 0,overflow:g||Z?"hidden":"visible"},children:[v.jsx("div",{style:{width:"100%",height:"100%",transform:Vt,transformOrigin:"center",filter:tt,WebkitFilter:tt},children:t}),Ht&&!O&&v.jsx("div",{style:{position:"absolute",top:I==="top"?0:void 0,bottom:I==="bottom"?0:void 0,left:0,right:0,width:I==="left"||I==="right"?rt:"100%",height:I==="top"||I==="bottom"?rt:"100%",pointerEvents:"none",opacity:Mt,backdropFilter:`blur(${et}px)`,WebkitBackdropFilter:`blur(${et}px)`,maskImage:I==="top"?"linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)":I==="left"?"linear-gradient(to right, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)":I==="right"?"linear-gradient(to left, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)":"linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)",WebkitMaskImage:I==="top"?"linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)":I==="left"?"linear-gradient(to right, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)":I==="right"?"linear-gradient(to left, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)":"linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 75%, transparent 100%)"}})]})})};E.BoxAnim=Ft,E.ContentAnim=jt,E.MaskAnim=Tt,E.combine=Pt,E.combineAnimations=M,E.extractTransformations=k,E.useAnimation=U,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cliquify.me/animations",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"typescript": "^5.3.3",
|
|
27
27
|
"vite": "^5.2.0",
|
|
28
28
|
"vite-plugin-dts": "^3.9.1",
|
|
29
|
-
"@cliquify.me/types": "9.0.
|
|
29
|
+
"@cliquify.me/types": "9.0.3",
|
|
30
30
|
"@cliquify.me/typescript-config": "1.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@designcombo/events": "^1.0.2",
|
|
39
39
|
"react": "^18.2.0 || ^19.0.0",
|
|
40
40
|
"remotion": "4.0.506",
|
|
41
|
-
"@cliquify.me/types": "9.0.
|
|
41
|
+
"@cliquify.me/types": "9.0.3"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"dev": "vite",
|