@make-pictures/kits 0.0.0-stage → 2.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/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/chunk-3SUIELJV.mjs +601 -0
- package/dist/chunk-4Z3G6FPZ.mjs +485 -0
- package/dist/chunk-AHA23PHC.mjs +678 -0
- package/dist/chunk-CW623YVB.mjs +1124 -0
- package/dist/chunk-NNA7XXQB.mjs +1059 -0
- package/dist/chunk-S4CHTWOS.mjs +1237 -0
- package/dist/chunk-WAA7P5FT.mjs +912 -0
- package/dist/data-storytelling/AnimatedBarRace.d.ts +37 -0
- package/dist/data-storytelling/MetricComparisonCard.d.ts +29 -0
- package/dist/data-storytelling/TimelineTrack.d.ts +29 -0
- package/dist/data-storytelling/index.cjs +1224 -0
- package/dist/data-storytelling/index.d.ts +3 -0
- package/dist/data-storytelling/index.mjs +10 -0
- package/dist/index.cjs +6010 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +108 -0
- package/dist/isometric-3d/IsometricStudioEnvironment.d.ts +8 -0
- package/dist/isometric-3d/Stylized3DCharacter.d.ts +29 -0
- package/dist/isometric-3d/index.cjs +611 -0
- package/dist/isometric-3d/index.d.ts +2 -0
- package/dist/isometric-3d/index.mjs +8 -0
- package/dist/kinetic-typography/AnimatedMetricCounter.d.ts +36 -0
- package/dist/kinetic-typography/ImpactKeywordCard.d.ts +31 -0
- package/dist/kinetic-typography/WordByWordStage.d.ts +47 -0
- package/dist/kinetic-typography/index.cjs +665 -0
- package/dist/kinetic-typography/index.d.ts +3 -0
- package/dist/kinetic-typography/index.mjs +14 -0
- package/dist/motion-diagrams-2d/CameraRig.d.ts +34 -0
- package/dist/motion-diagrams-2d/CodePayloadToast.d.ts +14 -0
- package/dist/motion-diagrams-2d/DataFlowEdge.d.ts +24 -0
- package/dist/motion-diagrams-2d/NodeBox.d.ts +65 -0
- package/dist/motion-diagrams-2d/SystemNode.d.ts +21 -0
- package/dist/motion-diagrams-2d/index.cjs +1137 -0
- package/dist/motion-diagrams-2d/index.d.ts +5 -0
- package/dist/motion-diagrams-2d/index.mjs +28 -0
- package/dist/paper-diorama-3d/ImageCutout3D.d.ts +47 -0
- package/dist/paper-diorama-3d/PaperCutout3D.d.ts +62 -0
- package/dist/paper-diorama-3d/PaperPopUpBook3D.d.ts +51 -0
- package/dist/paper-diorama-3d/PaperStageLighting3D.d.ts +12 -0
- package/dist/paper-diorama-3d/index.cjs +1087 -0
- package/dist/paper-diorama-3d/index.d.ts +4 -0
- package/dist/paper-diorama-3d/index.mjs +34 -0
- package/dist/product-frames/BrowserFrame.d.ts +28 -0
- package/dist/product-frames/PhoneFrame.d.ts +23 -0
- package/dist/product-frames/ScreenSpotlightOverlay.d.ts +34 -0
- package/dist/product-frames/frameMedia.d.ts +24 -0
- package/dist/product-frames/index.cjs +507 -0
- package/dist/product-frames/index.d.ts +8 -0
- package/dist/product-frames/index.mjs +12 -0
- package/dist/vfx/CinematicLensOverlay.d.ts +29 -0
- package/dist/vfx/ParticleField.d.ts +18 -0
- package/dist/vfx/SceneTransition.d.ts +24 -0
- package/dist/vfx/StagePostProcessing3D.d.ts +44 -0
- package/dist/vfx/index.cjs +933 -0
- package/dist/vfx/index.d.ts +4 -0
- package/dist/vfx/index.mjs +14 -0
- package/package.json +95 -4
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
// packages/kits/src/product-frames/BrowserFrame.tsx
|
|
2
|
+
import { interpolate, spring, useCurrentFrame, useVideoConfig } from "remotion";
|
|
3
|
+
import { FONTS, SPRING_PRESETS, useStudioFontsReady } from "@make-pictures/core";
|
|
4
|
+
|
|
5
|
+
// packages/kits/src/product-frames/frameMedia.tsx
|
|
6
|
+
import { AbsoluteFill, Img, OffthreadVideo } from "remotion";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var FrameMedia = ({
|
|
9
|
+
videoSrc,
|
|
10
|
+
imageSrc,
|
|
11
|
+
startFrom,
|
|
12
|
+
endAt,
|
|
13
|
+
playbackRate = 1,
|
|
14
|
+
muted = true,
|
|
15
|
+
volume = 1,
|
|
16
|
+
objectFit = "cover",
|
|
17
|
+
children
|
|
18
|
+
}) => {
|
|
19
|
+
const mediaStyle = {
|
|
20
|
+
width: "100%",
|
|
21
|
+
height: "100%",
|
|
22
|
+
objectFit,
|
|
23
|
+
display: "block"
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsxs(AbsoluteFill, { style: { overflow: "hidden" }, children: [
|
|
26
|
+
videoSrc ? /* @__PURE__ */ jsx(
|
|
27
|
+
OffthreadVideo,
|
|
28
|
+
{
|
|
29
|
+
src: videoSrc,
|
|
30
|
+
startFrom,
|
|
31
|
+
endAt,
|
|
32
|
+
playbackRate,
|
|
33
|
+
muted,
|
|
34
|
+
volume: muted ? 0 : volume,
|
|
35
|
+
style: mediaStyle
|
|
36
|
+
}
|
|
37
|
+
) : imageSrc ? /* @__PURE__ */ jsx(Img, { src: imageSrc, style: mediaStyle }) : null,
|
|
38
|
+
children ? /* @__PURE__ */ jsx(AbsoluteFill, { style: { overflow: "hidden" }, children }) : null
|
|
39
|
+
] });
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// packages/kits/src/product-frames/BrowserFrame.tsx
|
|
43
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
44
|
+
var TOOLBAR_HEIGHT = {
|
|
45
|
+
macos: 52,
|
|
46
|
+
arc: 46,
|
|
47
|
+
minimal: 36
|
|
48
|
+
};
|
|
49
|
+
function parseAspectRatio(ar) {
|
|
50
|
+
if (typeof ar === "number") return ar > 0 ? ar : 1.6;
|
|
51
|
+
const parts = ar.split("/").map((p) => parseFloat(p.trim()));
|
|
52
|
+
if (parts.length === 2 && parts[0] > 0 && parts[1] > 0) {
|
|
53
|
+
return parts[0] / parts[1];
|
|
54
|
+
}
|
|
55
|
+
const single = parseFloat(ar);
|
|
56
|
+
return single > 0 ? single : 1.6;
|
|
57
|
+
}
|
|
58
|
+
var BrowserFrame = ({
|
|
59
|
+
url,
|
|
60
|
+
title,
|
|
61
|
+
variant = "macos",
|
|
62
|
+
theme = "dark",
|
|
63
|
+
width = 1360,
|
|
64
|
+
aspectRatio = "16 / 10",
|
|
65
|
+
height,
|
|
66
|
+
enterFrame = 2,
|
|
67
|
+
accentColor = "#38bdf8",
|
|
68
|
+
style,
|
|
69
|
+
...media
|
|
70
|
+
}) => {
|
|
71
|
+
const frame = useCurrentFrame();
|
|
72
|
+
const { fps } = useVideoConfig();
|
|
73
|
+
useStudioFontsReady();
|
|
74
|
+
const enter = spring({
|
|
75
|
+
frame: frame - Math.max(2, enterFrame),
|
|
76
|
+
fps,
|
|
77
|
+
config: SPRING_PRESETS.snappy
|
|
78
|
+
});
|
|
79
|
+
const isDark = theme === "dark";
|
|
80
|
+
const toolbarH = TOOLBAR_HEIGHT[variant];
|
|
81
|
+
const viewportH = typeof height === "number" ? Math.max(40, height - toolbarH) : Math.round(width / parseAspectRatio(aspectRatio));
|
|
82
|
+
const outerH = viewportH + toolbarH;
|
|
83
|
+
const chromeBg = isDark ? "#14161F" : "#F1F5F9";
|
|
84
|
+
const chromeBorder = isDark ? "rgba(255,255,255,0.08)" : "rgba(15,23,42,0.08)";
|
|
85
|
+
const pillBg = isDark ? "rgba(255,255,255,0.06)" : "#FFFFFF";
|
|
86
|
+
const textColor = isDark ? "#CBD5E1" : "#334155";
|
|
87
|
+
const mutedText = isDark ? "#64748B" : "#94A3B8";
|
|
88
|
+
const radius = variant === "arc" ? 22 : variant === "minimal" ? 14 : 18;
|
|
89
|
+
const translateY = interpolate(enter, [0, 1], [36, 0]);
|
|
90
|
+
const scale = interpolate(enter, [0, 1], [0.94, 1]);
|
|
91
|
+
return /* @__PURE__ */ jsxs2(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
style: {
|
|
95
|
+
position: "relative",
|
|
96
|
+
width,
|
|
97
|
+
height: outerH,
|
|
98
|
+
borderRadius: radius,
|
|
99
|
+
overflow: "hidden",
|
|
100
|
+
boxSizing: "border-box",
|
|
101
|
+
backgroundColor: isDark ? "#0B0D14" : "#FFFFFF",
|
|
102
|
+
border: `1px solid ${chromeBorder}`,
|
|
103
|
+
boxShadow: isDark ? "0 50px 120px -20px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.04) inset" : "0 40px 100px -20px rgba(15,23,42,0.28), 0 8px 24px -8px rgba(15,23,42,0.12)",
|
|
104
|
+
opacity: enter,
|
|
105
|
+
transform: `translate3d(0, ${translateY.toFixed(2)}px, 0) scale(${scale.toFixed(4)})`,
|
|
106
|
+
transformOrigin: "center center",
|
|
107
|
+
...style
|
|
108
|
+
},
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ jsxs2(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
style: {
|
|
114
|
+
position: "absolute",
|
|
115
|
+
left: 0,
|
|
116
|
+
right: 0,
|
|
117
|
+
top: 0,
|
|
118
|
+
height: toolbarH,
|
|
119
|
+
display: "flex",
|
|
120
|
+
alignItems: "center",
|
|
121
|
+
gap: 14,
|
|
122
|
+
padding: "0 18px",
|
|
123
|
+
boxSizing: "border-box",
|
|
124
|
+
backgroundColor: variant === "arc" ? "transparent" : chromeBg,
|
|
125
|
+
borderBottom: variant === "arc" ? "none" : `1px solid ${chromeBorder}`,
|
|
126
|
+
fontFamily: FONTS.sans
|
|
127
|
+
},
|
|
128
|
+
children: [
|
|
129
|
+
variant !== "minimal" && /* @__PURE__ */ jsx2("div", { style: { display: "flex", gap: 8, flexShrink: 0 }, children: ["#FF5F57", "#FEBC2E", "#28C840"].map((c) => /* @__PURE__ */ jsx2(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
style: {
|
|
133
|
+
width: 13,
|
|
134
|
+
height: 13,
|
|
135
|
+
borderRadius: 9999,
|
|
136
|
+
backgroundColor: c,
|
|
137
|
+
boxShadow: "inset 0 0 0 0.5px rgba(0,0,0,0.25)"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
c
|
|
141
|
+
)) }),
|
|
142
|
+
title && variant === "macos" && /* @__PURE__ */ jsx2(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
style: {
|
|
146
|
+
fontSize: 14,
|
|
147
|
+
fontWeight: 600,
|
|
148
|
+
color: mutedText,
|
|
149
|
+
whiteSpace: "nowrap",
|
|
150
|
+
maxWidth: 220,
|
|
151
|
+
overflow: "hidden",
|
|
152
|
+
textOverflow: "ellipsis"
|
|
153
|
+
},
|
|
154
|
+
children: title
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
/* @__PURE__ */ jsx2("div", { style: { flex: 1, display: "flex", justifyContent: "center" }, children: (url || variant !== "minimal") && /* @__PURE__ */ jsxs2(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
style: {
|
|
161
|
+
display: "flex",
|
|
162
|
+
alignItems: "center",
|
|
163
|
+
gap: 8,
|
|
164
|
+
height: variant === "minimal" ? 22 : 30,
|
|
165
|
+
minWidth: Math.min(520, width * 0.42),
|
|
166
|
+
maxWidth: width * 0.6,
|
|
167
|
+
padding: "0 16px",
|
|
168
|
+
borderRadius: 9999,
|
|
169
|
+
backgroundColor: pillBg,
|
|
170
|
+
border: `1px solid ${chromeBorder}`,
|
|
171
|
+
boxSizing: "border-box",
|
|
172
|
+
fontFamily: FONTS.mono,
|
|
173
|
+
fontSize: variant === "minimal" ? 12 : 14,
|
|
174
|
+
fontWeight: 500,
|
|
175
|
+
color: textColor,
|
|
176
|
+
justifyContent: "center",
|
|
177
|
+
whiteSpace: "nowrap",
|
|
178
|
+
overflow: "hidden"
|
|
179
|
+
},
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ jsx2(
|
|
182
|
+
"span",
|
|
183
|
+
{
|
|
184
|
+
style: {
|
|
185
|
+
width: 8,
|
|
186
|
+
height: 8,
|
|
187
|
+
borderRadius: 9999,
|
|
188
|
+
backgroundColor: accentColor,
|
|
189
|
+
flexShrink: 0
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
/* @__PURE__ */ jsx2("span", { style: { overflow: "hidden", textOverflow: "ellipsis" }, children: url ?? title ?? "" })
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
) }),
|
|
197
|
+
variant !== "minimal" && /* @__PURE__ */ jsx2("div", { style: { width: 55, flexShrink: 0 } })
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
/* @__PURE__ */ jsx2(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
style: {
|
|
205
|
+
position: "absolute",
|
|
206
|
+
left: variant === "arc" ? 8 : 0,
|
|
207
|
+
right: variant === "arc" ? 8 : 0,
|
|
208
|
+
bottom: variant === "arc" ? 8 : 0,
|
|
209
|
+
top: toolbarH,
|
|
210
|
+
borderRadius: variant === "arc" ? 14 : 0,
|
|
211
|
+
overflow: "hidden",
|
|
212
|
+
backgroundColor: isDark ? "#05060A" : "#F8FAFC"
|
|
213
|
+
},
|
|
214
|
+
children: /* @__PURE__ */ jsx2(FrameMedia, { ...media })
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// packages/kits/src/product-frames/PhoneFrame.tsx
|
|
223
|
+
import { interpolate as interpolate2, spring as spring2, useCurrentFrame as useCurrentFrame2, useVideoConfig as useVideoConfig2 } from "remotion";
|
|
224
|
+
import { SPRING_PRESETS as SPRING_PRESETS2 } from "@make-pictures/core";
|
|
225
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
226
|
+
function parseAspectRatio2(ar) {
|
|
227
|
+
if (typeof ar === "number") return ar > 0 ? ar : 9 / 19.5;
|
|
228
|
+
const parts = ar.split("/").map((p) => parseFloat(p.trim()));
|
|
229
|
+
if (parts.length === 2 && parts[0] > 0 && parts[1] > 0) {
|
|
230
|
+
return parts[0] / parts[1];
|
|
231
|
+
}
|
|
232
|
+
const single = parseFloat(ar);
|
|
233
|
+
return single > 0 ? single : 9 / 19.5;
|
|
234
|
+
}
|
|
235
|
+
var PhoneFrame = ({
|
|
236
|
+
variant = "dynamic-island",
|
|
237
|
+
theme = "dark",
|
|
238
|
+
width = 520,
|
|
239
|
+
aspectRatio = "9 / 19.5",
|
|
240
|
+
height,
|
|
241
|
+
enterFrame = 2,
|
|
242
|
+
style,
|
|
243
|
+
...media
|
|
244
|
+
}) => {
|
|
245
|
+
const frame = useCurrentFrame2();
|
|
246
|
+
const { fps } = useVideoConfig2();
|
|
247
|
+
const enter = spring2({
|
|
248
|
+
frame: frame - Math.max(2, enterFrame),
|
|
249
|
+
fps,
|
|
250
|
+
config: SPRING_PRESETS2.snappy
|
|
251
|
+
});
|
|
252
|
+
const isDark = theme === "dark";
|
|
253
|
+
const outerH = typeof height === "number" ? height : Math.round(width / parseAspectRatio2(aspectRatio));
|
|
254
|
+
const bezel = Math.max(10, Math.round(width * 0.03));
|
|
255
|
+
const outerRadius = Math.round(width * 0.135);
|
|
256
|
+
const innerRadius = Math.max(8, outerRadius - bezel);
|
|
257
|
+
const titanium = isDark ? "linear-gradient(145deg, #3A3D46 0%, #1C1E24 40%, #2A2C33 70%, #45484F 100%)" : "linear-gradient(145deg, #F1F2F4 0%, #C9CCD2 45%, #E4E6EA 75%, #FFFFFF 100%)";
|
|
258
|
+
const translateY = interpolate2(enter, [0, 1], [42, 0]);
|
|
259
|
+
const scale = interpolate2(enter, [0, 1], [0.93, 1]);
|
|
260
|
+
const islandW = Math.round(width * 0.3);
|
|
261
|
+
const islandH = Math.round(width * 0.068);
|
|
262
|
+
return /* @__PURE__ */ jsxs3(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
style: {
|
|
266
|
+
position: "relative",
|
|
267
|
+
width,
|
|
268
|
+
height: outerH,
|
|
269
|
+
borderRadius: outerRadius,
|
|
270
|
+
padding: bezel,
|
|
271
|
+
boxSizing: "border-box",
|
|
272
|
+
background: titanium,
|
|
273
|
+
boxShadow: isDark ? "0 60px 120px -24px rgba(0,0,0,0.75), inset 0 0 0 1.5px rgba(255,255,255,0.12)" : "0 50px 110px -24px rgba(15,23,42,0.32), inset 0 0 0 1.5px rgba(255,255,255,0.8)",
|
|
274
|
+
opacity: enter,
|
|
275
|
+
transform: `translate3d(0, ${translateY.toFixed(2)}px, 0) scale(${scale.toFixed(4)})`,
|
|
276
|
+
transformOrigin: "center center",
|
|
277
|
+
...style
|
|
278
|
+
},
|
|
279
|
+
children: [
|
|
280
|
+
/* @__PURE__ */ jsx3(
|
|
281
|
+
"div",
|
|
282
|
+
{
|
|
283
|
+
style: {
|
|
284
|
+
position: "absolute",
|
|
285
|
+
left: -3,
|
|
286
|
+
top: outerH * 0.2,
|
|
287
|
+
width: 4,
|
|
288
|
+
height: outerH * 0.06,
|
|
289
|
+
borderRadius: 4,
|
|
290
|
+
background: isDark ? "#2A2C33" : "#C9CCD2"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
/* @__PURE__ */ jsx3(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
style: {
|
|
298
|
+
position: "absolute",
|
|
299
|
+
right: -3,
|
|
300
|
+
top: outerH * 0.26,
|
|
301
|
+
width: 4,
|
|
302
|
+
height: outerH * 0.1,
|
|
303
|
+
borderRadius: 4,
|
|
304
|
+
background: isDark ? "#2A2C33" : "#C9CCD2"
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ jsxs3(
|
|
309
|
+
"div",
|
|
310
|
+
{
|
|
311
|
+
style: {
|
|
312
|
+
position: "relative",
|
|
313
|
+
width: "100%",
|
|
314
|
+
height: "100%",
|
|
315
|
+
borderRadius: innerRadius,
|
|
316
|
+
overflow: "hidden",
|
|
317
|
+
backgroundColor: "#000000"
|
|
318
|
+
},
|
|
319
|
+
children: [
|
|
320
|
+
/* @__PURE__ */ jsx3(FrameMedia, { ...media }),
|
|
321
|
+
variant === "dynamic-island" && /* @__PURE__ */ jsx3(
|
|
322
|
+
"div",
|
|
323
|
+
{
|
|
324
|
+
style: {
|
|
325
|
+
position: "absolute",
|
|
326
|
+
top: Math.round(width * 0.03),
|
|
327
|
+
left: "50%",
|
|
328
|
+
width: islandW,
|
|
329
|
+
height: islandH,
|
|
330
|
+
marginLeft: -islandW / 2,
|
|
331
|
+
borderRadius: 9999,
|
|
332
|
+
backgroundColor: "#000000",
|
|
333
|
+
boxShadow: "0 0 0 1px rgba(255,255,255,0.04)",
|
|
334
|
+
zIndex: 5
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
/* @__PURE__ */ jsx3(
|
|
339
|
+
"div",
|
|
340
|
+
{
|
|
341
|
+
style: {
|
|
342
|
+
position: "absolute",
|
|
343
|
+
bottom: Math.round(width * 0.022),
|
|
344
|
+
left: "50%",
|
|
345
|
+
width: Math.round(width * 0.34),
|
|
346
|
+
height: Math.max(4, Math.round(width * 0.011)),
|
|
347
|
+
marginLeft: -Math.round(width * 0.17),
|
|
348
|
+
borderRadius: 9999,
|
|
349
|
+
backgroundColor: "rgba(255,255,255,0.82)",
|
|
350
|
+
boxShadow: "0 0 0 0.5px rgba(0,0,0,0.3)",
|
|
351
|
+
zIndex: 5
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
)
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
// packages/kits/src/product-frames/ScreenSpotlightOverlay.tsx
|
|
364
|
+
import { interpolate as interpolate3, spring as spring3, useCurrentFrame as useCurrentFrame3, useVideoConfig as useVideoConfig3 } from "remotion";
|
|
365
|
+
import { FONTS as FONTS2, SPRING_PRESETS as SPRING_PRESETS3, useStudioFontsReady as useStudioFontsReady2 } from "@make-pictures/core";
|
|
366
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
367
|
+
var ScreenSpotlightOverlay = ({
|
|
368
|
+
x,
|
|
369
|
+
y,
|
|
370
|
+
width,
|
|
371
|
+
height,
|
|
372
|
+
unit = "percent",
|
|
373
|
+
startFrame,
|
|
374
|
+
endFrame,
|
|
375
|
+
label,
|
|
376
|
+
accentColor = "#38bdf8",
|
|
377
|
+
dimOpacity = 0.45,
|
|
378
|
+
borderRadius = 14,
|
|
379
|
+
labelPosition = "auto"
|
|
380
|
+
}) => {
|
|
381
|
+
const frame = useCurrentFrame3();
|
|
382
|
+
const { fps } = useVideoConfig3();
|
|
383
|
+
useStudioFontsReady2();
|
|
384
|
+
const effectiveStart = Math.max(2, startFrame);
|
|
385
|
+
const enter = spring3({
|
|
386
|
+
frame: frame - effectiveStart,
|
|
387
|
+
fps,
|
|
388
|
+
config: SPRING_PRESETS3.smooth
|
|
389
|
+
});
|
|
390
|
+
const exit = typeof endFrame === "number" ? spring3({ frame: frame - endFrame, fps, config: SPRING_PRESETS3.smooth }) : 0;
|
|
391
|
+
const visibility = Math.max(0, Math.min(1, enter * (1 - exit)));
|
|
392
|
+
if (visibility <= 5e-3) {
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
|
+
const u = unit === "percent" ? "%" : "px";
|
|
396
|
+
const grow = interpolate3(enter, [0, 1], [unit === "percent" ? 3 : 24, 0]);
|
|
397
|
+
const left = x - grow;
|
|
398
|
+
const top = y - grow;
|
|
399
|
+
const w = width + grow * 2;
|
|
400
|
+
const h = height + grow * 2;
|
|
401
|
+
const f60 = frame * (60 / Math.max(1, fps));
|
|
402
|
+
const breathe = 0.5 + 0.5 * Math.sin(f60 * 0.045);
|
|
403
|
+
const ringGlow = 14 + breathe * 10;
|
|
404
|
+
const labelPop = spring3({
|
|
405
|
+
frame: frame - effectiveStart - 8,
|
|
406
|
+
fps,
|
|
407
|
+
config: SPRING_PRESETS3.snappy
|
|
408
|
+
});
|
|
409
|
+
const placeTop = labelPosition === "top" || labelPosition === "auto" && (unit === "percent" ? y > 18 : y > 90);
|
|
410
|
+
return /* @__PURE__ */ jsxs4(
|
|
411
|
+
"div",
|
|
412
|
+
{
|
|
413
|
+
style: {
|
|
414
|
+
position: "absolute",
|
|
415
|
+
inset: 0,
|
|
416
|
+
overflow: "hidden",
|
|
417
|
+
pointerEvents: "none",
|
|
418
|
+
zIndex: 10
|
|
419
|
+
},
|
|
420
|
+
children: [
|
|
421
|
+
/* @__PURE__ */ jsx4(
|
|
422
|
+
"div",
|
|
423
|
+
{
|
|
424
|
+
style: {
|
|
425
|
+
position: "absolute",
|
|
426
|
+
left: `${left}${u}`,
|
|
427
|
+
top: `${top}${u}`,
|
|
428
|
+
width: `${w}${u}`,
|
|
429
|
+
height: `${h}${u}`,
|
|
430
|
+
borderRadius,
|
|
431
|
+
boxShadow: `0 0 0 9999px rgba(2, 6, 23, ${(dimOpacity * visibility).toFixed(3)})`
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
),
|
|
435
|
+
/* @__PURE__ */ jsx4(
|
|
436
|
+
"div",
|
|
437
|
+
{
|
|
438
|
+
style: {
|
|
439
|
+
position: "absolute",
|
|
440
|
+
left: `${left}${u}`,
|
|
441
|
+
top: `${top}${u}`,
|
|
442
|
+
width: `${w}${u}`,
|
|
443
|
+
height: `${h}${u}`,
|
|
444
|
+
borderRadius,
|
|
445
|
+
border: `3px solid ${accentColor}`,
|
|
446
|
+
boxSizing: "border-box",
|
|
447
|
+
boxShadow: `0 0 ${ringGlow.toFixed(1)}px ${accentColor}AA, inset 0 0 ${(ringGlow * 0.6).toFixed(1)}px ${accentColor}55`,
|
|
448
|
+
opacity: visibility
|
|
449
|
+
},
|
|
450
|
+
children: label && /* @__PURE__ */ jsx4(
|
|
451
|
+
"div",
|
|
452
|
+
{
|
|
453
|
+
style: {
|
|
454
|
+
position: "absolute",
|
|
455
|
+
left: "50%",
|
|
456
|
+
...placeTop ? { bottom: "100%", marginBottom: 12 } : { top: "100%", marginTop: 12 },
|
|
457
|
+
transform: `translateX(-50%) translateY(${interpolate3(labelPop, [0, 1], [placeTop ? 8 : -8, 0]).toFixed(2)}px) scale(${interpolate3(labelPop, [0, 1], [0.85, 1]).toFixed(3)})`,
|
|
458
|
+
opacity: labelPop * visibility,
|
|
459
|
+
padding: "7px 16px",
|
|
460
|
+
borderRadius: 9999,
|
|
461
|
+
backgroundColor: accentColor,
|
|
462
|
+
color: "#020617",
|
|
463
|
+
fontFamily: FONTS2.sans,
|
|
464
|
+
fontSize: 18,
|
|
465
|
+
fontWeight: 800,
|
|
466
|
+
letterSpacing: "-0.01em",
|
|
467
|
+
whiteSpace: "nowrap",
|
|
468
|
+
boxShadow: `0 10px 28px ${accentColor}66`
|
|
469
|
+
},
|
|
470
|
+
children: label
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
}
|
|
474
|
+
)
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
);
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
export {
|
|
481
|
+
FrameMedia,
|
|
482
|
+
BrowserFrame,
|
|
483
|
+
PhoneFrame,
|
|
484
|
+
ScreenSpotlightOverlay
|
|
485
|
+
};
|