@cliquify.me/animations 8.0.2 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +218 -204
- package/dist/index.umd.js +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import X, { useMemo as
|
|
3
|
-
import { interpolate as R, Easing as
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import X, { useMemo as C } from "react";
|
|
3
|
+
import { interpolate as R, Easing as w } from "remotion";
|
|
4
4
|
const I = () => ({
|
|
5
5
|
scale: (t) => ({ transform: `scale(${t})` }),
|
|
6
6
|
opacity: (t) => ({ opacity: t }),
|
|
@@ -11,7 +11,27 @@ const I = () => ({
|
|
|
11
11
|
rotateY: (t) => ({ transform: `rotateY(${t}deg)` }),
|
|
12
12
|
rotateX: (t) => ({ transform: `rotateX(${t}deg)` }),
|
|
13
13
|
blur: (t) => ({ filter: `blur(${t}px)` }),
|
|
14
|
-
brightness: (t) => ({ filter: `brightness(${t})` }),
|
|
14
|
+
brightness: (t) => ({ filter: `brightness(${t}%)` }),
|
|
15
|
+
contrast: (t) => ({ filter: `contrast(${t}%)` }),
|
|
16
|
+
grayscale: (t) => ({ filter: `grayscale(${t}%)` }),
|
|
17
|
+
hue: (t) => ({ filter: `hue-rotate(${t}deg)` }),
|
|
18
|
+
saturation: (t) => ({ filter: `saturate(${t}%)` }),
|
|
19
|
+
vignette: (t) => ({
|
|
20
|
+
filter: `contrast(${100 + t * 20}%) brightness(${100 - t * 20}%)`
|
|
21
|
+
}),
|
|
22
|
+
noise: (t) => ({
|
|
23
|
+
filter: `contrast(${100 + t * 40}%) brightness(${100 + t * 20}%)`
|
|
24
|
+
}),
|
|
25
|
+
pixelate: (t) => ({ filter: `contrast(${100 + t * 2}%)` }),
|
|
26
|
+
chromaticAberration: (t) => ({
|
|
27
|
+
filter: `hue-rotate(${t * 10}deg) contrast(110%)`
|
|
28
|
+
}),
|
|
29
|
+
lightLeak: (t) => ({
|
|
30
|
+
filter: `brightness(${100 + t * 50}%) saturate(${100 + t * 30}%)`
|
|
31
|
+
}),
|
|
32
|
+
duotone: (t) => ({
|
|
33
|
+
filter: `sepia(${t * 100}%) hue-rotate(${t * 180}deg)`
|
|
34
|
+
}),
|
|
15
35
|
shakeHorizontalIn: (t) => ({
|
|
16
36
|
transform: `translateX(${t}%)`,
|
|
17
37
|
overflow: "hidden"
|
|
@@ -28,33 +48,33 @@ const I = () => ({
|
|
|
28
48
|
transform: `translateY(${t}%)`,
|
|
29
49
|
overflow: "hidden"
|
|
30
50
|
})
|
|
31
|
-
}), j = (t,
|
|
32
|
-
const
|
|
33
|
-
for (let
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
},
|
|
37
|
-
const { from:
|
|
38
|
-
if (isNaN(
|
|
51
|
+
}), j = (t, l = 0) => {
|
|
52
|
+
const r = [], c = t / 5;
|
|
53
|
+
for (let a = 0; a < 6; a += 1)
|
|
54
|
+
r.push(a * c + l);
|
|
55
|
+
return r;
|
|
56
|
+
}, T = (t, l, r, c = !1) => {
|
|
57
|
+
const { from: a, to: o, ease: d } = l, n = l.durationInFrames || 30, f = Number(a), i = Number(o), e = Math.max(1, Number(n));
|
|
58
|
+
if (isNaN(f) || isNaN(i))
|
|
39
59
|
return console.error("Invalid animation values:", {
|
|
40
|
-
from:
|
|
60
|
+
from: a,
|
|
41
61
|
to: o,
|
|
42
|
-
animationDurationInFrames:
|
|
43
|
-
property:
|
|
44
|
-
}),
|
|
45
|
-
|
|
46
|
-
`durationInFrames is undefined for animation: ${
|
|
62
|
+
animationDurationInFrames: n,
|
|
63
|
+
property: l.property
|
|
64
|
+
}), f;
|
|
65
|
+
n === void 0 && console.warn(
|
|
66
|
+
`durationInFrames is undefined for animation: ${l.property}. Using 1 frame as default.`
|
|
47
67
|
);
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
e -
|
|
53
|
-
) : j(
|
|
68
|
+
const s = l.delay || 0, u = c ? [r - e - s, r - s] : [s, s + e];
|
|
69
|
+
if (l.property.includes("shake")) {
|
|
70
|
+
const p = c ? j(
|
|
71
|
+
e,
|
|
72
|
+
r - e - s
|
|
73
|
+
) : j(e, s);
|
|
54
74
|
return R(
|
|
55
75
|
t,
|
|
56
|
-
|
|
57
|
-
[0, i,
|
|
76
|
+
p,
|
|
77
|
+
[0, f, i, f, i, 0],
|
|
58
78
|
{
|
|
59
79
|
extrapolateLeft: "clamp",
|
|
60
80
|
extrapolateRight: "clamp",
|
|
@@ -62,238 +82,232 @@ const I = () => ({
|
|
|
62
82
|
}
|
|
63
83
|
);
|
|
64
84
|
}
|
|
65
|
-
return R(t,
|
|
85
|
+
return R(t, u, [f, i], {
|
|
66
86
|
extrapolateLeft: "clamp",
|
|
67
87
|
extrapolateRight: "clamp",
|
|
68
88
|
easing: d
|
|
69
89
|
});
|
|
70
|
-
}, V = (t,
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
s,
|
|
75
|
-
t,
|
|
76
|
-
e,
|
|
77
|
-
l
|
|
78
|
-
), i = I();
|
|
79
|
-
return (i[o] || i.default)(r);
|
|
80
|
-
}, A = (t, n, e, l = !1, s = !1) => X.useMemo(() => {
|
|
90
|
+
}, V = (t, l, r, c) => {
|
|
91
|
+
const { property: a } = t, o = T(l, t, r, c), d = I();
|
|
92
|
+
return (d[a] || d.default)(o);
|
|
93
|
+
}, E = (t, l, r, c = !1, a = !1) => X.useMemo(() => {
|
|
81
94
|
if (t.length === 0) return {};
|
|
82
95
|
const o = t.filter(
|
|
83
96
|
(d) => d.from !== void 0 && d.to !== void 0
|
|
84
97
|
);
|
|
85
|
-
if (o.length !== t.length && console.error("Some animations are invalid and will be ignored"),
|
|
86
|
-
const d = [],
|
|
87
|
-
o.reverse().forEach((
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
91
|
-
Object.keys(h).forEach((
|
|
92
|
-
|
|
93
|
-
[
|
|
94
|
-
} : h :
|
|
98
|
+
if (o.length !== t.length && console.error("Some animations are invalid and will be ignored"), a) {
|
|
99
|
+
const d = [], n = {};
|
|
100
|
+
o.reverse().forEach((e) => {
|
|
101
|
+
const s = V(e, r, l, !1);
|
|
102
|
+
if (e.persist === !0 && r - (e.delay || 0) >= e.durationInFrames) {
|
|
103
|
+
const p = e.to, v = I(), h = (v[e.property] || v.default)(p);
|
|
104
|
+
Object.keys(h).forEach(($) => {
|
|
105
|
+
$ === "transform" ? n[$] = n[$] ? {
|
|
106
|
+
[$]: `${n[$][$]} ${h[$]}`
|
|
107
|
+
} : h : n[$] = h;
|
|
95
108
|
});
|
|
96
109
|
}
|
|
97
|
-
d.push(
|
|
110
|
+
d.push(s);
|
|
98
111
|
});
|
|
99
|
-
const
|
|
100
|
-
(
|
|
101
|
-
u === "transform" ?
|
|
102
|
-
}),
|
|
112
|
+
const i = { ...d.reduce(
|
|
113
|
+
(e, s) => (Object.keys(s).forEach((u) => {
|
|
114
|
+
u === "transform" || u === "filter" ? e[u] = e[u] ? `${e[u]} ${s[u]}` : s[u] : e[u] = s[u];
|
|
115
|
+
}), e),
|
|
103
116
|
{}
|
|
104
117
|
) };
|
|
105
|
-
return Object.keys(
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
}),
|
|
118
|
+
return Object.keys(n).forEach((e) => {
|
|
119
|
+
const s = n[e];
|
|
120
|
+
(e === "transform" || e === "filter") && s[e] ? i[e] = i[e] ? `${i[e]} ${s[e]}` : String(s[e]) : s[e] !== void 0 && (i[e] = s[e]);
|
|
121
|
+
}), i;
|
|
109
122
|
} else
|
|
110
|
-
return o.map((
|
|
111
|
-
(
|
|
112
|
-
|
|
113
|
-
}),
|
|
123
|
+
return o.map((n) => V(n, r, l, c)).reduce(
|
|
124
|
+
(n, f) => (Object.keys(f).forEach((i) => {
|
|
125
|
+
i === "transform" || i === "filter" ? n[i] = n[i] ? `${n[i]} ${f[i]}` : f[i] : n[i] = f[i];
|
|
126
|
+
}), n),
|
|
114
127
|
{}
|
|
115
128
|
);
|
|
116
|
-
}, [t,
|
|
117
|
-
const
|
|
118
|
-
return t.forEach((
|
|
119
|
-
Array.isArray(
|
|
120
|
-
}),
|
|
121
|
-
(o) => o.property ===
|
|
122
|
-
) ?
|
|
123
|
-
(o) => o.property ===
|
|
129
|
+
}, [t, r, l, c]), A = (t) => t ? Array.isArray(t) ? t : [t] : [], P = (...t) => {
|
|
130
|
+
const l = [];
|
|
131
|
+
return t.forEach((r) => {
|
|
132
|
+
Array.isArray(r) ? l.push(...r) : r && l.push(r);
|
|
133
|
+
}), l.filter((r) => r !== void 0).reduce((r, c) => r.find(
|
|
134
|
+
(o) => o.property === c.property
|
|
135
|
+
) ? r.map(
|
|
136
|
+
(o) => o.property === c.property ? {
|
|
124
137
|
...o,
|
|
125
|
-
from: Math.min(o.from,
|
|
126
|
-
to: Math.max(o.to,
|
|
138
|
+
from: Math.min(o.from, c.from),
|
|
139
|
+
to: Math.max(o.to, c.to),
|
|
127
140
|
durationInFrames: Math.max(
|
|
128
141
|
o.durationInFrames,
|
|
129
|
-
|
|
142
|
+
c.durationInFrames
|
|
130
143
|
),
|
|
131
|
-
delay: Math.min(o.delay || 0,
|
|
132
|
-
ease: (d) => (o.ease(d) +
|
|
144
|
+
delay: Math.min(o.delay || 0, c.delay || 0),
|
|
145
|
+
ease: (d) => (o.ease(d) + c.ease(d)) / 2
|
|
133
146
|
// Average the easing functions
|
|
134
147
|
} : o
|
|
135
|
-
) : [...
|
|
136
|
-
},
|
|
148
|
+
) : [...r, c], []);
|
|
149
|
+
}, z = ({
|
|
137
150
|
animationIn: t,
|
|
138
|
-
animationOut:
|
|
139
|
-
durationInFrames:
|
|
140
|
-
children:
|
|
141
|
-
style:
|
|
151
|
+
animationOut: l,
|
|
152
|
+
durationInFrames: r,
|
|
153
|
+
children: c,
|
|
154
|
+
style: a = {},
|
|
142
155
|
frame: o,
|
|
143
156
|
isTransition: d = !1
|
|
144
157
|
}) => {
|
|
145
|
-
var
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
158
|
+
var F;
|
|
159
|
+
const n = E(
|
|
160
|
+
A(t),
|
|
161
|
+
r,
|
|
149
162
|
o,
|
|
150
163
|
!1
|
|
151
|
-
),
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
), f = E(
|
|
165
|
+
A(l),
|
|
166
|
+
r,
|
|
154
167
|
o,
|
|
155
168
|
!0
|
|
156
|
-
),
|
|
157
|
-
const
|
|
158
|
-
(
|
|
169
|
+
), i = X.useMemo(() => {
|
|
170
|
+
const m = Object.keys(n).length > 0, g = t == null ? void 0 : t.reduce(
|
|
171
|
+
(M, S) => Math.min(M, S.delay || 0),
|
|
159
172
|
1 / 0
|
|
160
|
-
),
|
|
161
|
-
return
|
|
162
|
-
}, [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
173
|
+
), b = o - (g || 0);
|
|
174
|
+
return m && b < 0 ? { visibility: d ? "visible" : "hidden" } : n;
|
|
175
|
+
}, [n, o, t]), e = X.useMemo(() => {
|
|
176
|
+
if (o >= r)
|
|
177
|
+
return { visibility: d ? "visible" : "hidden" };
|
|
178
|
+
const m = A(l);
|
|
179
|
+
if (!m || m.length === 0) return {};
|
|
180
|
+
let g = 0;
|
|
181
|
+
m.forEach((M) => {
|
|
182
|
+
const S = (M.durationInFrames || 0) + (M.delay || 0);
|
|
183
|
+
S > g && (g = S);
|
|
184
|
+
});
|
|
185
|
+
const b = Math.max(0, r - g);
|
|
186
|
+
return o < b ? {} : f;
|
|
187
|
+
}, [f, o, l, r, d]), u = ((a == null ? void 0 : a.transform) || "").match(/rotate\((-?[\d.]+)deg\)/), p = u ? parseFloat(u[1]) : 0, v = -p, h = X.useMemo(() => {
|
|
188
|
+
const m = {
|
|
189
|
+
...i
|
|
174
190
|
// , ...timedStyle
|
|
175
191
|
};
|
|
176
|
-
return Object.entries(
|
|
177
|
-
|
|
178
|
-
}),
|
|
179
|
-
}, [
|
|
180
|
-
if ((
|
|
181
|
-
const
|
|
182
|
-
h.transform =
|
|
192
|
+
return Object.entries(e).forEach(([g, b]) => {
|
|
193
|
+
g === "transform" ? m[g] = `${m[g] || ""} ${b || ""}`.trim() : g in m && typeof m[g] == "number" && typeof b == "number" ? m[g] = m[g] * b : m[g] = b;
|
|
194
|
+
}), m;
|
|
195
|
+
}, [i, e]);
|
|
196
|
+
if ((F = h.transform) != null && F.includes("rotate")) {
|
|
197
|
+
const m = h.transform;
|
|
198
|
+
h.transform = m.replace(
|
|
183
199
|
/rotate\(([^)]+)deg\)/,
|
|
184
|
-
(
|
|
200
|
+
(g, b) => `rotate(${parseFloat(b) - v}deg)`
|
|
185
201
|
);
|
|
186
202
|
}
|
|
187
|
-
const
|
|
188
|
-
const
|
|
189
|
-
translateX:
|
|
190
|
-
translateY:
|
|
191
|
-
scale:
|
|
192
|
-
rotation:
|
|
193
|
-
rotateX:
|
|
203
|
+
const $ = C(() => {
|
|
204
|
+
const m = h.transform || "", {
|
|
205
|
+
translateX: g,
|
|
206
|
+
translateY: b,
|
|
207
|
+
scale: M,
|
|
208
|
+
rotation: S,
|
|
209
|
+
rotateX: O,
|
|
194
210
|
rotateY: H,
|
|
195
211
|
rotateZ: N
|
|
196
|
-
} =
|
|
197
|
-
return `${
|
|
198
|
-
}, [h,
|
|
199
|
-
let y =
|
|
200
|
-
return
|
|
212
|
+
} = D(m);
|
|
213
|
+
return `${g} ${b} ${M} ${S || `rotate(${p}deg)`} ${O} ${H} ${N}`.trim();
|
|
214
|
+
}, [h, p]);
|
|
215
|
+
let y = n;
|
|
216
|
+
return p > 0 && y.transform && y.transform.includes("translateX") && (y = {
|
|
201
217
|
...y,
|
|
202
218
|
transform: y.transform.replace(
|
|
203
219
|
/translateX\(([^)]+)\)/g,
|
|
204
|
-
(
|
|
220
|
+
(m, g) => `translateX(${parseFloat(g)}%)`
|
|
205
221
|
)
|
|
206
|
-
}), /* @__PURE__ */
|
|
222
|
+
}), /* @__PURE__ */ x(
|
|
207
223
|
"div",
|
|
208
224
|
{
|
|
209
225
|
style: {
|
|
226
|
+
transform: "scale(1)",
|
|
210
227
|
overflow: h.overflow || "visible",
|
|
211
228
|
pointerEvents: "none",
|
|
212
|
-
...y,
|
|
213
|
-
transform: (y.transform || "") + ` -rotate(${g}deg) scale(1)`,
|
|
214
|
-
background: Object.keys(h).length === 0 ? "transparent" : h.backgroundColor,
|
|
215
229
|
display: "flex",
|
|
216
230
|
justifyContent: "center"
|
|
217
231
|
},
|
|
218
|
-
children: /* @__PURE__ */
|
|
232
|
+
children: /* @__PURE__ */ x(
|
|
219
233
|
"div",
|
|
220
234
|
{
|
|
221
235
|
style: {
|
|
222
|
-
...
|
|
236
|
+
...a,
|
|
223
237
|
...h,
|
|
224
|
-
rotate: `${
|
|
238
|
+
rotate: `${v}deg`,
|
|
225
239
|
overflow: "visible",
|
|
226
|
-
transform:
|
|
240
|
+
transform: $,
|
|
227
241
|
pointerEvents: "none",
|
|
228
242
|
background: Object.keys(h).length === 0 ? "transparent" : h.backgroundColor
|
|
229
243
|
},
|
|
230
|
-
children:
|
|
244
|
+
children: c
|
|
231
245
|
}
|
|
232
246
|
)
|
|
233
247
|
}
|
|
234
248
|
);
|
|
235
|
-
},
|
|
236
|
-
let
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
const u = t.match(/rotateX\([^)]+\)/);
|
|
246
|
-
u && (o = u[
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
const
|
|
250
|
-
return
|
|
251
|
-
},
|
|
249
|
+
}, D = (t) => {
|
|
250
|
+
let l = "", r = "", c = "scale(1)", a = "", o = "", d = "", n = "";
|
|
251
|
+
const f = t.match(/translateX\([^)]+\)/g);
|
|
252
|
+
f && (l = f[f.length - 1]);
|
|
253
|
+
const i = t.match(/translateY\([^)]+\)/g);
|
|
254
|
+
i && (r = i[i.length - 1]);
|
|
255
|
+
const e = t.match(/scale\([^)]+\)/g);
|
|
256
|
+
e && (c = e[e.length - 1]);
|
|
257
|
+
const s = t.match(/rotate\([^)]+\)/g);
|
|
258
|
+
s && (a = s[s.length - 1]);
|
|
259
|
+
const u = t.match(/rotateX\([^)]+\)/g);
|
|
260
|
+
u && (o = u[u.length - 1]);
|
|
261
|
+
const p = t.match(/rotateY\([^)]+\)/g);
|
|
262
|
+
p && (d = p[p.length - 1]);
|
|
263
|
+
const v = t.match(/rotateZ\([^)]+\)/g);
|
|
264
|
+
return v && (n = v[v.length - 1]), { translateX: l, translateY: r, scale: c, rotation: a, rotateX: o, rotateY: d, rotateZ: n };
|
|
265
|
+
}, W = ({
|
|
252
266
|
animationTimed: t,
|
|
253
|
-
durationInFrames:
|
|
254
|
-
children:
|
|
255
|
-
style:
|
|
256
|
-
frame:
|
|
267
|
+
durationInFrames: l,
|
|
268
|
+
children: r,
|
|
269
|
+
style: c = {},
|
|
270
|
+
frame: a
|
|
257
271
|
}) => {
|
|
258
272
|
var u;
|
|
259
|
-
const o =
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
273
|
+
const o = E(
|
|
274
|
+
A(t),
|
|
275
|
+
l,
|
|
276
|
+
a,
|
|
263
277
|
!1,
|
|
264
278
|
!0
|
|
265
|
-
),
|
|
279
|
+
), n = ((c == null ? void 0 : c.transform) || "").match(/rotate\((-?[\d.]+)deg\)/), f = n ? parseFloat(n[1]) : 0, i = -f, e = X.useMemo(() => ({
|
|
266
280
|
...o
|
|
267
281
|
}), [o]);
|
|
268
|
-
if ((u =
|
|
269
|
-
const
|
|
270
|
-
|
|
282
|
+
if ((u = e.transform) != null && u.includes("rotate")) {
|
|
283
|
+
const p = e.transform;
|
|
284
|
+
e.transform = p.replace(
|
|
271
285
|
/rotate\(([^)]+)deg\)/,
|
|
272
|
-
(
|
|
286
|
+
(v, h) => `rotate(${parseFloat(h) - i}deg)`
|
|
273
287
|
);
|
|
274
288
|
}
|
|
275
|
-
let
|
|
276
|
-
return
|
|
277
|
-
...
|
|
278
|
-
transform:
|
|
289
|
+
let s = e;
|
|
290
|
+
return f > 0 && s.transform && s.transform.includes("translateX") && (s = {
|
|
291
|
+
...s,
|
|
292
|
+
transform: s.transform.replace(
|
|
279
293
|
/translateX\(([^)]+)\)/g,
|
|
280
|
-
(
|
|
294
|
+
(p, v) => `translateX(${parseFloat(v)}px)`
|
|
281
295
|
)
|
|
282
|
-
}), /* @__PURE__ */
|
|
296
|
+
}), /* @__PURE__ */ x(
|
|
283
297
|
"div",
|
|
284
298
|
{
|
|
285
299
|
style: {
|
|
286
|
-
overflow:
|
|
300
|
+
overflow: e.overflow || "visible",
|
|
287
301
|
pointerEvents: "none",
|
|
288
|
-
height:
|
|
289
|
-
width:
|
|
290
|
-
...
|
|
302
|
+
height: c.height,
|
|
303
|
+
width: c.width,
|
|
304
|
+
...s
|
|
291
305
|
},
|
|
292
|
-
children: /* @__PURE__ */
|
|
306
|
+
children: /* @__PURE__ */ x(
|
|
293
307
|
"div",
|
|
294
308
|
{
|
|
295
309
|
style: {
|
|
296
|
-
...
|
|
310
|
+
...e,
|
|
297
311
|
overflow: "visible",
|
|
298
312
|
pointerEvents: "none",
|
|
299
313
|
height: "100%",
|
|
@@ -302,53 +316,53 @@ const I = () => ({
|
|
|
302
316
|
alignItems: "center",
|
|
303
317
|
justifyContent: "center"
|
|
304
318
|
},
|
|
305
|
-
children:
|
|
319
|
+
children: r
|
|
306
320
|
}
|
|
307
321
|
)
|
|
308
322
|
}
|
|
309
323
|
);
|
|
310
|
-
},
|
|
324
|
+
}, Y = (t) => {
|
|
311
325
|
if (typeof (t == null ? void 0 : t.ease) == "function") return t.ease;
|
|
312
326
|
switch (t == null ? void 0 : t.easing) {
|
|
313
327
|
case "ease-in":
|
|
314
|
-
return
|
|
328
|
+
return w.in(w.cubic);
|
|
315
329
|
case "ease-out":
|
|
316
|
-
return
|
|
330
|
+
return w.out(w.cubic);
|
|
317
331
|
case "ease-in-out":
|
|
318
|
-
return
|
|
332
|
+
return w.inOut(w.cubic);
|
|
319
333
|
case "linear":
|
|
320
334
|
default:
|
|
321
|
-
return
|
|
335
|
+
return w.linear;
|
|
322
336
|
}
|
|
323
|
-
},
|
|
337
|
+
}, B = ({
|
|
324
338
|
children: t,
|
|
325
|
-
frame:
|
|
326
|
-
item:
|
|
327
|
-
keyframeAnimations:
|
|
339
|
+
frame: l,
|
|
340
|
+
item: r,
|
|
341
|
+
keyframeAnimations: c
|
|
328
342
|
}) => {
|
|
329
|
-
var
|
|
330
|
-
const
|
|
331
|
-
let
|
|
332
|
-
return (
|
|
343
|
+
var v, h;
|
|
344
|
+
const a = c ? [...c].reverse().find(($) => $.property.includes("maskReveal")) : void 0, o = ((v = r.details.crop) == null ? void 0 : v.width) || r.details.width, d = ((h = r.details.crop) == null ? void 0 : h.height) || r.details.height;
|
|
345
|
+
let n = 1, f = n, i = d, e = 0, s = 0, u = o, p;
|
|
346
|
+
return (l || 0) >= 0 && (a == null ? void 0 : a.property) === "maskRevealIn" ? (n = Math.min((l || 0) / a.durationInFrames, 1), f = Math.max(0, Math.min(1, Y(a)(n))), i = d * f) : (l || 0) >= 0 && (a == null ? void 0 : a.property) === "maskRevealCenterIn" ? (n = Math.min((l || 0) / a.durationInFrames, 1), f = Math.max(0, Math.min(1, Y(a)(n))), u = o, i = d, e = 0, s = 0, p = `circle(${Math.max(o, d) * f}px at 50% 50%)`) : (l || 0) >= 0 && (a == null ? void 0 : a.property) === "maskRevealCornerIn" && (n = Math.min((l || 0) / a.durationInFrames, 1), f = Math.max(0, Math.min(1, Y(a)(n))), u = o * f, i = d * f, e = o - u, s = 0), /* @__PURE__ */ x(
|
|
333
347
|
"div",
|
|
334
348
|
{
|
|
335
349
|
style: {
|
|
336
350
|
width: o,
|
|
337
351
|
height: d,
|
|
338
352
|
position: "relative",
|
|
339
|
-
overflow:
|
|
353
|
+
overflow: f < 1 ? "hidden" : "visible"
|
|
340
354
|
},
|
|
341
|
-
children: /* @__PURE__ */
|
|
355
|
+
children: /* @__PURE__ */ x(
|
|
342
356
|
"div",
|
|
343
357
|
{
|
|
344
358
|
style: {
|
|
345
359
|
position: "absolute",
|
|
346
|
-
left:
|
|
347
|
-
top:
|
|
360
|
+
left: e,
|
|
361
|
+
top: s,
|
|
348
362
|
width: u,
|
|
349
|
-
height:
|
|
350
|
-
overflow:
|
|
351
|
-
clipPath:
|
|
363
|
+
height: i,
|
|
364
|
+
overflow: f < 1 ? "hidden" : "visible",
|
|
365
|
+
clipPath: p
|
|
352
366
|
},
|
|
353
367
|
children: t
|
|
354
368
|
}
|
|
@@ -357,11 +371,11 @@ const I = () => ({
|
|
|
357
371
|
);
|
|
358
372
|
};
|
|
359
373
|
export {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
374
|
+
z as BoxAnim,
|
|
375
|
+
W as ContentAnim,
|
|
376
|
+
B as MaskAnim,
|
|
377
|
+
P as combine,
|
|
378
|
+
A as combineAnimations,
|
|
379
|
+
D as extractTransformations,
|
|
380
|
+
E as useAnimation
|
|
367
381
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(v,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react/jsx-runtime"),require("react"),require("remotion")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","remotion"],S):(v=typeof globalThis<"u"?globalThis:v||self,S(v.animations={},v.jsxRuntime,v.React,v.remotion))})(this,function(v,S,x,w){"use strict";const F=()=>({scale:t=>({transform:`scale(${t})`}),opacity:t=>({opacity:t}),translateX:t=>({transform:`translateX(${t}%)`}),translateY:t=>({transform:`translateY(${t}%)`}),rotate:t=>({transform:`rotate(${t}deg)`}),default:()=>({}),rotateY:t=>({transform:`rotateY(${t}deg)`}),rotateX:t=>({transform:`rotateX(${t}deg)`}),blur: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}%)`,overflow:"hidden"}),shakeVerticalIn:t=>({transform:`translateY(${t}%)`,overflow:"hidden"}),shakeHorizontalOut:t=>({transform:`translateX(${t}%)`,overflow:"hidden"}),shakeVerticalOut:t=>({transform:`translateY(${t}%)`,overflow:"hidden"})}),V=(t,i=0)=>{const r=[],c=t/5;for(let a=0;a<6;a+=1)r.push(a*c+i);return r},C=(t,i,r,c=!1)=>{const{from:a,to:n,ease:d}=i,o=i.durationInFrames||30,f=Number(a),l=Number(n),e=Math.max(1,Number(o));if(isNaN(f)||isNaN(l))return console.error("Invalid animation values:",{from:a,to:n,animationDurationInFrames:o,property:i.property}),f;o===void 0&&console.warn(`durationInFrames is undefined for animation: ${i.property}. Using 1 frame as default.`);const s=i.delay||0,u=c?[r-e-s,r-s]:[s,s+e];if(i.property.includes("shake")){const p=c?V(e,r-e-s):V(e,s);return w.interpolate(t,p,[0,f,l,f,l,0],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:d})}return w.interpolate(t,u,[f,l],{extrapolateLeft:"clamp",extrapolateRight:"clamp",easing:d})},T=(t,i,r,c)=>{const{property:a}=t,n=C(i,t,r,c),d=F();return(d[a]||d.default)(n)},j=(t,i,r,c=!1,a=!1)=>x.useMemo(()=>{if(t.length===0)return{};const n=t.filter(d=>d.from!==void 0&&d.to!==void 0);if(n.length!==t.length&&console.error("Some animations are invalid and will be ignored"),a){const d=[],o={};n.reverse().forEach(e=>{const s=T(e,r,i,!1);if(e.persist===!0&&r-(e.delay||0)>=e.durationInFrames){const p=e.to,$=F(),h=($[e.property]||$.default)(p);Object.keys(h).forEach(b=>{b==="transform"?o[b]=o[b]?{[b]:`${o[b][b]} ${h[b]}`}:h:o[b]=h})}d.push(s)});const l={...d.reduce((e,s)=>(Object.keys(s).forEach(u=>{u==="transform"||u==="filter"?e[u]=e[u]?`${e[u]} ${s[u]}`:s[u]:e[u]=s[u]}),e),{})};return Object.keys(o).forEach(e=>{const s=o[e];(e==="transform"||e==="filter")&&s[e]?l[e]=l[e]?`${l[e]} ${s[e]}`:String(s[e]):s[e]!==void 0&&(l[e]=s[e])}),l}else return n.map(o=>T(o,r,i,c)).reduce((o,f)=>(Object.keys(f).forEach(l=>{l==="transform"||l==="filter"?o[l]=o[l]?`${o[l]} ${f[l]}`:f[l]:o[l]=f[l]}),o),{})},[t,r,i,c]),A=t=>t?Array.isArray(t)?t:[t]:[],H=(...t)=>{const i=[];return t.forEach(r=>{Array.isArray(r)?i.push(...r):r&&i.push(r)}),i.filter(r=>r!==void 0).reduce((r,c)=>r.find(n=>n.property===c.property)?r.map(n=>n.property===c.property?{...n,from:Math.min(n.from,c.from),to:Math.max(n.to,c.to),durationInFrames:Math.max(n.durationInFrames,c.durationInFrames),delay:Math.min(n.delay||0,c.delay||0),ease:d=>(n.ease(d)+c.ease(d))/2}:n):[...r,c],[])},N=({animationIn:t,animationOut:i,durationInFrames:r,children:c,style:a={},frame:n,isTransition:d=!1})=>{var I;const o=j(A(t),r,n,!1),f=j(A(i),r,n,!0),l=x.useMemo(()=>{const m=Object.keys(o).length>0,g=t==null?void 0:t.reduce((y,X)=>Math.min(y,X.delay||0),1/0),M=n-(g||0);return m&&M<0?{visibility:d?"visible":"hidden"}:o},[o,n,t]),e=x.useMemo(()=>{if(n>=r)return{visibility:d?"visible":"hidden"};const m=A(i);if(!m||m.length===0)return{};let g=0;m.forEach(y=>{const X=(y.durationInFrames||0)+(y.delay||0);X>g&&(g=X)});const M=Math.max(0,r-g);return n<M?{}:f},[f,n,i,r,d]),u=((a==null?void 0:a.transform)||"").match(/rotate\((-?[\d.]+)deg\)/),p=u?parseFloat(u[1]):0,$=-p,h=x.useMemo(()=>{const m={...l};return Object.entries(e).forEach(([g,M])=>{g==="transform"?m[g]=`${m[g]||""} ${M||""}`.trim():g in m&&typeof m[g]=="number"&&typeof M=="number"?m[g]=m[g]*M:m[g]=M}),m},[l,e]);if((I=h.transform)!=null&&I.includes("rotate")){const m=h.transform;h.transform=m.replace(/rotate\(([^)]+)deg\)/,(g,M)=>`rotate(${parseFloat(M)-$}deg)`)}const b=x.useMemo(()=>{const m=h.transform||"",{translateX:g,translateY:M,scale:y,rotation:X,rotateX:P,rotateY:Z,rotateZ:_}=O(m);return`${g} ${M} ${y} ${X||`rotate(${p}deg)`} ${P} ${Z} ${_}`.trim()},[h,p]);let E=o;return p>0&&E.transform&&E.transform.includes("translateX")&&(E={...E,transform:E.transform.replace(/translateX\(([^)]+)\)/g,(m,g)=>`translateX(${parseFloat(g)}%)`)}),S.jsx("div",{style:{transform:"scale(1)",overflow:h.overflow||"visible",pointerEvents:"none",display:"flex",justifyContent:"center"},children:S.jsx("div",{style:{...a,...h,rotate:`${$}deg`,overflow:"visible",transform:b,pointerEvents:"none",background:Object.keys(h).length===0?"transparent":h.backgroundColor},children:c})})},O=t=>{let i="",r="",c="scale(1)",a="",n="",d="",o="";const f=t.match(/translateX\([^)]+\)/g);f&&(i=f[f.length-1]);const l=t.match(/translateY\([^)]+\)/g);l&&(r=l[l.length-1]);const e=t.match(/scale\([^)]+\)/g);e&&(c=e[e.length-1]);const s=t.match(/rotate\([^)]+\)/g);s&&(a=s[s.length-1]);const u=t.match(/rotateX\([^)]+\)/g);u&&(n=u[u.length-1]);const p=t.match(/rotateY\([^)]+\)/g);p&&(d=p[p.length-1]);const $=t.match(/rotateZ\([^)]+\)/g);return $&&(o=$[$.length-1]),{translateX:i,translateY:r,scale:c,rotation:a,rotateX:n,rotateY:d,rotateZ:o}},R=({animationTimed:t,durationInFrames:i,children:r,style:c={},frame:a})=>{var u;const n=j(A(t),i,a,!1,!0),o=((c==null?void 0:c.transform)||"").match(/rotate\((-?[\d.]+)deg\)/),f=o?parseFloat(o[1]):0,l=-f,e=x.useMemo(()=>({...n}),[n]);if((u=e.transform)!=null&&u.includes("rotate")){const p=e.transform;e.transform=p.replace(/rotate\(([^)]+)deg\)/,($,h)=>`rotate(${parseFloat(h)-l}deg)`)}let s=e;return f>0&&s.transform&&s.transform.includes("translateX")&&(s={...s,transform:s.transform.replace(/translateX\(([^)]+)\)/g,(p,$)=>`translateX(${parseFloat($)}px)`)}),S.jsx("div",{style:{overflow:e.overflow||"visible",pointerEvents:"none",height:c.height,width:c.width,...s},children:S.jsx("div",{style:{...e,overflow:"visible",pointerEvents:"none",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:r})})},Y=t=>{if(typeof(t==null?void 0:t.ease)=="function")return t.ease;switch(t==null?void 0:t.easing){case"ease-in":return w.Easing.in(w.Easing.cubic);case"ease-out":return w.Easing.out(w.Easing.cubic);case"ease-in-out":return w.Easing.inOut(w.Easing.cubic);case"linear":default:return w.Easing.linear}},D=({children:t,frame:i,item:r,keyframeAnimations:c})=>{var $,h;const a=c?[...c].reverse().find(b=>b.property.includes("maskReveal")):void 0,n=(($=r.details.crop)==null?void 0:$.width)||r.details.width,d=((h=r.details.crop)==null?void 0:h.height)||r.details.height;let o=1,f=o,l=d,e=0,s=0,u=n,p;return(i||0)>=0&&(a==null?void 0:a.property)==="maskRevealIn"?(o=Math.min((i||0)/a.durationInFrames,1),f=Math.max(0,Math.min(1,Y(a)(o))),l=d*f):(i||0)>=0&&(a==null?void 0:a.property)==="maskRevealCenterIn"?(o=Math.min((i||0)/a.durationInFrames,1),f=Math.max(0,Math.min(1,Y(a)(o))),u=n,l=d,e=0,s=0,p=`circle(${Math.max(n,d)*f}px at 50% 50%)`):(i||0)>=0&&(a==null?void 0:a.property)==="maskRevealCornerIn"&&(o=Math.min((i||0)/a.durationInFrames,1),f=Math.max(0,Math.min(1,Y(a)(o))),u=n*f,l=d*f,e=n-u,s=0),S.jsx("div",{style:{width:n,height:d,position:"relative",overflow:f<1?"hidden":"visible"},children:S.jsx("div",{style:{position:"absolute",left:e,top:s,width:u,height:l,overflow:f<1?"hidden":"visible",clipPath:p},children:t})})};v.BoxAnim=N,v.ContentAnim=R,v.MaskAnim=D,v.combine=H,v.combineAnimations=A,v.extractTransformations=O,v.useAnimation=j,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cliquify.me/animations",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
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": "
|
|
29
|
+
"@cliquify.me/types": "8.0.0",
|
|
30
30
|
"@cliquify.me/typescript-config": "0.0.2"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@designcombo/events": "^1.0.2",
|
|
40
40
|
"react": "^18.2.0",
|
|
41
41
|
"remotion": "4.0.221",
|
|
42
|
-
"@cliquify.me/types": "
|
|
42
|
+
"@cliquify.me/types": "8.0.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"dev": "vite",
|