@vanillaskyai/video 0.1.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/CHANGELOG.md +45 -0
- package/LICENSE +201 -0
- package/PUBLIC-API.md +276 -0
- package/README.md +152 -0
- package/SECURITY.md +22 -0
- package/SUPPORT.md +28 -0
- package/bin/vanillasky.js +3 -0
- package/dist/bg-confetti-WNQXS7ZS.js +89 -0
- package/dist/bg-emoji-ETI47GLS.js +150 -0
- package/dist/bg-media-SVUZAMGX.js +99 -0
- package/dist/brand-message-F3RD4P3P.js +253 -0
- package/dist/builtin-server-F7YXRVCH.js +8 -0
- package/dist/catalog-types-BIhSpOWK.d.ts +74 -0
- package/dist/chart-bar-CNSC7BNK.js +304 -0
- package/dist/chart-counter-MCRHKN77.js +299 -0
- package/dist/chart-progress-ring-RMI4A7ZK.js +296 -0
- package/dist/check-runtime.d.ts +15 -0
- package/dist/check-runtime.js +102 -0
- package/dist/chunk-2E6T633S.js +27 -0
- package/dist/chunk-352ZZCET.js +83 -0
- package/dist/chunk-73NTSFFI.js +81 -0
- package/dist/chunk-A2X45FET.js +46 -0
- package/dist/chunk-ABPKM4GK.js +187 -0
- package/dist/chunk-ABZACD4G.js +216 -0
- package/dist/chunk-BCRUUJ6A.js +756 -0
- package/dist/chunk-CHLGW22F.js +3551 -0
- package/dist/chunk-CJ7F2CE6.js +104 -0
- package/dist/chunk-CR7FE7BW.js +109 -0
- package/dist/chunk-E7CL7UPB.js +109 -0
- package/dist/chunk-EE6PK6XC.js +18 -0
- package/dist/chunk-ERY4S6QV.js +385 -0
- package/dist/chunk-EVG2ZYIY.js +125 -0
- package/dist/chunk-FNAEQ7QO.js +155 -0
- package/dist/chunk-FQ47WXAJ.js +38 -0
- package/dist/chunk-FSG2PYWG.js +336 -0
- package/dist/chunk-GHJEAP4O.js +504 -0
- package/dist/chunk-GRMUV7QY.js +262 -0
- package/dist/chunk-IFOW65Z6.js +205 -0
- package/dist/chunk-IXCUY3B3.js +786 -0
- package/dist/chunk-L5BTTCZV.js +97 -0
- package/dist/chunk-LMG3GHLL.js +107 -0
- package/dist/chunk-OOPIETLW.js +101 -0
- package/dist/chunk-P22HHFDK.js +43 -0
- package/dist/chunk-QAAO7OAY.js +19 -0
- package/dist/chunk-S7HFLYNN.js +35 -0
- package/dist/chunk-SPVTJH3F.js +24 -0
- package/dist/chunk-W2XJKG6C.js +3177 -0
- package/dist/chunk-XB7LH4J2.js +301 -0
- package/dist/chunk-XGRA2MUV.js +242 -0
- package/dist/chunk-XTOXFMLM.js +105 -0
- package/dist/chunk-YC5MFXA5.js +132 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1681 -0
- package/dist/compose-video-CN3VSWST.js +13 -0
- package/dist/cta-logo-SVA5GP2A.js +209 -0
- package/dist/cta-media-E7VLLK42.js +215 -0
- package/dist/events-_wfjbmEp.d.ts +81 -0
- package/dist/incoming-call-62MFZL3Z.js +320 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +14 -0
- package/dist/infographic-before-after-AXCDAWND.js +460 -0
- package/dist/infographic-feature-list-GW5GUE6O.js +266 -0
- package/dist/infographic-problem-solution-7NURJANA.js +340 -0
- package/dist/infographic-stat-row-J7IZR6ZN.js +241 -0
- package/dist/infographic-steps-VSZM6F5M.js +400 -0
- package/dist/kit-BMNcHqa9.d.ts +79 -0
- package/dist/prompt-input-LOUCRXCY.js +236 -0
- package/dist/react.d.ts +81 -0
- package/dist/react.js +835 -0
- package/dist/reaction-QG4CYZLQ.js +119 -0
- package/dist/server.d.ts +141 -0
- package/dist/server.js +498 -0
- package/dist/showcase-code-RUTFZR3H.js +351 -0
- package/dist/showcase-phone-6CP6XEU5.js +272 -0
- package/dist/showcase-terminal-MGAEQWPR.js +306 -0
- package/dist/showcase-web-Y4W2HVRJ.js +390 -0
- package/dist/social-conversation-75SD2637.js +695 -0
- package/dist/social-milestone-XI2QE5BO.js +292 -0
- package/dist/social-notification-2UOHQCUY.js +244 -0
- package/dist/social-review-stack-FDYZGZTJ.js +239 -0
- package/dist/social-testimonial-OQ7N52GJ.js +284 -0
- package/dist/social-tweet-5OLCNPPC.js +295 -0
- package/dist/state-DZcKuS32.d.ts +3 -0
- package/dist/system-prompt-A6UXNTPK.js +8 -0
- package/dist/template-catalog.d.ts +24 -0
- package/dist/template-catalog.js +6 -0
- package/dist/templates.d.ts +25 -0
- package/dist/templates.js +19 -0
- package/dist/test.d.ts +149 -0
- package/dist/test.js +272 -0
- package/dist/text-stream-6XHC7J47.js +10 -0
- package/dist/types-B-PZR6G_.d.ts +208 -0
- package/dist/validate-T7GBU2YF.js +8 -0
- package/docs/agent-integration.md +39 -0
- package/docs/architecture.md +84 -0
- package/docs/branding-and-personalization.md +87 -0
- package/docs/concepts.md +106 -0
- package/docs/custom-templates.md +329 -0
- package/docs/customization.md +141 -0
- package/docs/errors.md +70 -0
- package/docs/getting-started.md +111 -0
- package/docs/input-and-first-scene.md +41 -0
- package/docs/integrate-nextjs.md +79 -0
- package/docs/media-and-audio.md +69 -0
- package/docs/motion-and-effects.md +107 -0
- package/docs/persistence.md +95 -0
- package/docs/production.md +122 -0
- package/docs/prompt-and-input.md +185 -0
- package/docs/provider-integration.md +115 -0
- package/docs/reference/protocol.md +96 -0
- package/docs/reference/provider-adapters.md +158 -0
- package/docs/responsive-orientation.md +37 -0
- package/docs/security.md +38 -0
- package/docs/streaming-protocol.md +15 -0
- package/docs/testing.md +137 -0
- package/docs/use-cases.md +59 -0
- package/examples/custom-template/README.md +19 -0
- package/examples/custom-template/minimal-text.tsx +82 -0
- package/examples/custom-template/structured-data.tsx +104 -0
- package/examples/custom-template/supplied-media.tsx +92 -0
- package/examples/nextjs-quickstart/.env.example +2 -0
- package/examples/nextjs-quickstart/README.md +22 -0
- package/examples/nextjs-quickstart/next-env.d.ts +4 -0
- package/examples/nextjs-quickstart/package.json +24 -0
- package/examples/nextjs-quickstart/src/app/api/video/route.ts +22 -0
- package/examples/nextjs-quickstart/src/app/layout.tsx +5 -0
- package/examples/nextjs-quickstart/src/app/page.tsx +31 -0
- package/examples/nextjs-quickstart/tsconfig.json +26 -0
- package/package.json +167 -0
- package/registry/items/backgrounds.json +52 -0
- package/registry/items/barChart.json +237 -0
- package/registry/items/beforeAfter.json +180 -0
- package/registry/items/bigNumber.json +225 -0
- package/registry/items/brandMessage.json +158 -0
- package/registry/items/cardList.json +206 -0
- package/registry/items/chatMessenger.json +151 -0
- package/registry/items/chatWhatsapp.json +151 -0
- package/registry/items/codeEditor.json +184 -0
- package/registry/items/confetti.json +107 -0
- package/registry/items/ctaLogo.json +160 -0
- package/registry/items/ctaMedia.json +193 -0
- package/registry/items/emojiBurst.json +101 -0
- package/registry/items/incomingCall.json +170 -0
- package/registry/items/media.json +179 -0
- package/registry/items/milestone.json +205 -0
- package/registry/items/motion.json +45 -0
- package/registry/items/notification.json +182 -0
- package/registry/items/phoneMockup.json +254 -0
- package/registry/items/problemSolution.json +186 -0
- package/registry/items/progressRing.json +199 -0
- package/registry/items/promptInput.json +148 -0
- package/registry/items/reaction.json +170 -0
- package/registry/items/reviewStack.json +224 -0
- package/registry/items/steps.json +207 -0
- package/registry/items/template-context.json +31 -0
- package/registry/items/terminal.json +212 -0
- package/registry/items/testimonial.json +164 -0
- package/registry/items/theme.json +47 -0
- package/registry/items/tripleStats.json +228 -0
- package/registry/items/tweet.json +203 -0
- package/registry/items/typography.json +47 -0
- package/registry/items/webMockup.json +273 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseList
|
|
3
|
+
} from "./chunk-P22HHFDK.js";
|
|
4
|
+
import {
|
|
5
|
+
stripPipe
|
|
6
|
+
} from "./chunk-S7HFLYNN.js";
|
|
7
|
+
import {
|
|
8
|
+
smoothSize
|
|
9
|
+
} from "./chunk-BCRUUJ6A.js";
|
|
10
|
+
import {
|
|
11
|
+
Emoji,
|
|
12
|
+
renderWithEmoji
|
|
13
|
+
} from "./chunk-L5BTTCZV.js";
|
|
14
|
+
import {
|
|
15
|
+
gradientBackground
|
|
16
|
+
} from "./chunk-ABZACD4G.js";
|
|
17
|
+
import {
|
|
18
|
+
interpolate,
|
|
19
|
+
spring
|
|
20
|
+
} from "./chunk-XTOXFMLM.js";
|
|
21
|
+
import {
|
|
22
|
+
TOKEN_DEFAULTS,
|
|
23
|
+
resolveTokens
|
|
24
|
+
} from "./chunk-FNAEQ7QO.js";
|
|
25
|
+
|
|
26
|
+
// src/visual-system/primitives/infographic/BeforeAfterSplit.tsx
|
|
27
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
+
var SPRING_POP = { damping: 6, stiffness: 250 };
|
|
29
|
+
var SPRING_HAPPY = { damping: 9, stiffness: 220 };
|
|
30
|
+
var SPRING_TEXT = { damping: 10, stiffness: 150 };
|
|
31
|
+
var POSITIONS = [
|
|
32
|
+
{ x: 0.06, y: 0.06 },
|
|
33
|
+
{ x: 0.3, y: 0.1 },
|
|
34
|
+
{ x: 0.62, y: 0.07 },
|
|
35
|
+
{ x: 0.92, y: 0.09 },
|
|
36
|
+
{ x: 0.08, y: 0.26 },
|
|
37
|
+
{ x: 0.92, y: 0.24 },
|
|
38
|
+
{ x: 0.04, y: 0.4 },
|
|
39
|
+
{ x: 0.96, y: 0.42 },
|
|
40
|
+
{ x: 0.04, y: 0.62 },
|
|
41
|
+
{ x: 0.96, y: 0.6 },
|
|
42
|
+
{ x: 0.1, y: 0.78 },
|
|
43
|
+
{ x: 0.34, y: 0.82 },
|
|
44
|
+
{ x: 0.66, y: 0.8 },
|
|
45
|
+
{ x: 0.9, y: 0.78 },
|
|
46
|
+
{ x: 0.22, y: 0.92 },
|
|
47
|
+
{ x: 0.78, y: 0.94 }
|
|
48
|
+
];
|
|
49
|
+
var ROTATIONS = [-12, 8, -5, 15, -8, 10, -15, 6, -10, 12, -6, 14, -9, 7, -13, 11];
|
|
50
|
+
var POP_ORDER = [7, 12, 3, 9, 0, 14, 5, 11, 2, 8, 15, 4, 10, 1, 13, 6];
|
|
51
|
+
var FALL_SWAY = [0.7, -1, 0.4, -0.6, 0.9, -0.3, 0.5, -0.8, 0.6, -0.5, 0.3, -0.9, 0.8, -0.4, 0.2, -0.7];
|
|
52
|
+
var BeforeAfterSplit = ({
|
|
53
|
+
progress,
|
|
54
|
+
width,
|
|
55
|
+
height,
|
|
56
|
+
problemHeadline: rawProblemHeadline,
|
|
57
|
+
solutionHeadline: rawSolutionHeadline,
|
|
58
|
+
problemEmojis: rawProblemEmojis = [],
|
|
59
|
+
solutionEmojis: rawSolutionEmojis = [],
|
|
60
|
+
showEmojis = true,
|
|
61
|
+
beforeLabel = "BEFORE",
|
|
62
|
+
afterLabel = "AFTER",
|
|
63
|
+
beforeUrl,
|
|
64
|
+
afterUrl,
|
|
65
|
+
textColor = "#ffffff",
|
|
66
|
+
font = TOKEN_DEFAULTS.font,
|
|
67
|
+
beatIntensity = 0
|
|
68
|
+
}) => {
|
|
69
|
+
const s = Math.min(width, height) / 1080;
|
|
70
|
+
const problemLabel = String(beforeLabel || "BEFORE").toUpperCase();
|
|
71
|
+
const solutionLabel = String(afterLabel || "AFTER").toUpperCase();
|
|
72
|
+
const problemHeadline = stripPipe(String(rawProblemHeadline || ""));
|
|
73
|
+
const solutionHeadline = stripPipe(String(rawSolutionHeadline || ""));
|
|
74
|
+
const problemTypes = showEmojis ? rawProblemEmojis.filter((e) => (e || "").length > 0) : [];
|
|
75
|
+
const solutionTypes = showEmojis ? rawSolutionEmojis.filter((e) => (e || "").length > 0) : [];
|
|
76
|
+
if (showEmojis && problemTypes.length === 0) problemTypes.push("\u{1F4C5}", "\u{1F630}");
|
|
77
|
+
if (showEmojis && solutionTypes.length === 0) solutionTypes.push("\u2728", "\u2705");
|
|
78
|
+
const beforeColor = "#ef4444";
|
|
79
|
+
const afterColor = "#22c55e";
|
|
80
|
+
const SLOT_COUNT = POSITIONS.length;
|
|
81
|
+
const problemEmojis = showEmojis ? Array.from({ length: SLOT_COUNT }, (_, i) => problemTypes[POP_ORDER[i] % problemTypes.length]) : [];
|
|
82
|
+
const solutionEmojis = showEmojis ? Array.from({ length: SLOT_COUNT }, (_, i) => solutionTypes[POP_ORDER[i] % solutionTypes.length]) : [];
|
|
83
|
+
const PROBLEM_BASE = 0.05;
|
|
84
|
+
const PROBLEM_STAGGER = 0.01;
|
|
85
|
+
const FALL_START = 0.35;
|
|
86
|
+
const FALL_END = 0.5;
|
|
87
|
+
const HEADLINE_FADE = [0.4, 0.5];
|
|
88
|
+
const SOLUTION_BASE = 0.5;
|
|
89
|
+
const SOLUTION_STAGGER = 8e-3;
|
|
90
|
+
const problemHeadlineMask = 1 - interpolate(progress, [HEADLINE_FADE[0], HEADLINE_FADE[1]], [0, 1], {
|
|
91
|
+
extrapolateLeft: "clamp",
|
|
92
|
+
extrapolateRight: "clamp"
|
|
93
|
+
});
|
|
94
|
+
const solutionHeadlineMask = interpolate(progress, [HEADLINE_FADE[0] + 0.05, HEADLINE_FADE[1] + 0.05], [0, 1], {
|
|
95
|
+
extrapolateLeft: "clamp",
|
|
96
|
+
extrapolateRight: "clamp"
|
|
97
|
+
});
|
|
98
|
+
const emojiFontSize = Math.min(72 * s, width * 0.085);
|
|
99
|
+
const emojiHalf = emojiFontSize / 2;
|
|
100
|
+
const padX = emojiHalf + 8 * s;
|
|
101
|
+
const padY = emojiHalf + 8 * s;
|
|
102
|
+
const zoneTop = padY;
|
|
103
|
+
const zoneLeft = padX;
|
|
104
|
+
const zoneWidth = width - padX * 2;
|
|
105
|
+
const zoneHeight = height - padY * 2;
|
|
106
|
+
const labelFontSize = 32 * s;
|
|
107
|
+
const pillTop = height * 0.38;
|
|
108
|
+
const textTop = height * 0.46;
|
|
109
|
+
const longerChars = Math.max(problemHeadline.length, solutionHeadline.length, 1);
|
|
110
|
+
const mainSize = smoothSize(longerChars, 70, 88, 60) * s;
|
|
111
|
+
const problemTextP = spring(
|
|
112
|
+
interpolate(progress, [0.1, 0.25], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" }),
|
|
113
|
+
SPRING_TEXT
|
|
114
|
+
);
|
|
115
|
+
const problemTextScale = interpolate(problemTextP, [0, 1], [1.4, 1]);
|
|
116
|
+
const problemTextOpacity = interpolate(progress, [0.1, 0.2], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
|
|
117
|
+
const solutionTextP = spring(
|
|
118
|
+
interpolate(progress, [0.55, 0.7], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" }),
|
|
119
|
+
SPRING_TEXT
|
|
120
|
+
);
|
|
121
|
+
const solutionTextScale = interpolate(solutionTextP, [0, 1], [1.4, 1]);
|
|
122
|
+
const solutionTextOpacity = interpolate(progress, [0.55, 0.65], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
|
|
123
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
124
|
+
beforeUrl ? /* @__PURE__ */ jsx(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
style: {
|
|
128
|
+
position: "absolute",
|
|
129
|
+
inset: 0,
|
|
130
|
+
opacity: problemHeadlineMask * 0.6,
|
|
131
|
+
backgroundImage: `url(${beforeUrl})`,
|
|
132
|
+
backgroundSize: "cover",
|
|
133
|
+
backgroundPosition: "center",
|
|
134
|
+
pointerEvents: "none"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
) : null,
|
|
138
|
+
afterUrl ? /* @__PURE__ */ jsx(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
style: {
|
|
142
|
+
position: "absolute",
|
|
143
|
+
inset: 0,
|
|
144
|
+
opacity: solutionHeadlineMask * 0.6,
|
|
145
|
+
backgroundImage: `url(${afterUrl})`,
|
|
146
|
+
backgroundSize: "cover",
|
|
147
|
+
backgroundPosition: "center",
|
|
148
|
+
pointerEvents: "none"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
) : null,
|
|
152
|
+
problemEmojis.map((emoji, i) => {
|
|
153
|
+
const pos = POSITIONS[i];
|
|
154
|
+
const rotation = ROTATIONS[i];
|
|
155
|
+
const popRank = POP_ORDER[i];
|
|
156
|
+
const sway = FALL_SWAY[i];
|
|
157
|
+
const cx = zoneLeft + pos.x * zoneWidth;
|
|
158
|
+
const cy = zoneTop + pos.y * zoneHeight;
|
|
159
|
+
const popDelay = PROBLEM_BASE + popRank * PROBLEM_STAGGER;
|
|
160
|
+
const popP = spring(
|
|
161
|
+
interpolate(progress, [popDelay, popDelay + 0.1], [0, 1], {
|
|
162
|
+
extrapolateLeft: "clamp",
|
|
163
|
+
extrapolateRight: "clamp"
|
|
164
|
+
}),
|
|
165
|
+
SPRING_POP
|
|
166
|
+
);
|
|
167
|
+
const emojiScale = interpolate(popP, [0, 1], [0, 1]);
|
|
168
|
+
const settled = popP > 0.5;
|
|
169
|
+
const inFall = progress >= FALL_START;
|
|
170
|
+
const shakePhase = progress * 50;
|
|
171
|
+
const shakeX = settled && !inFall ? Math.sin(shakePhase + i * 1.7) * 7 * s : 0;
|
|
172
|
+
const shakeY = settled && !inFall ? Math.cos(shakePhase + i * 2.3) * 5 * s : 0;
|
|
173
|
+
const shakeRotate = settled && !inFall ? rotation + Math.sin(shakePhase * 0.7 + i * 3.1) * 9 : rotation;
|
|
174
|
+
const fallProgress = interpolate(progress, [FALL_START, FALL_END], [0, 1], {
|
|
175
|
+
extrapolateLeft: "clamp",
|
|
176
|
+
extrapolateRight: "clamp"
|
|
177
|
+
});
|
|
178
|
+
const fallY = fallProgress * fallProgress * height * 1.3;
|
|
179
|
+
const fallSwayX = Math.sin(fallProgress * Math.PI * 2 + i * 0.7) * 30 * s * sway;
|
|
180
|
+
const fallRotate = fallProgress * (180 + i % 5 * 60) * (i % 2 === 0 ? 1 : -1);
|
|
181
|
+
const fadeOut = interpolate(progress, [FALL_END - 0.02, FALL_END + 0.02], [1, 0], {
|
|
182
|
+
extrapolateLeft: "clamp",
|
|
183
|
+
extrapolateRight: "clamp"
|
|
184
|
+
});
|
|
185
|
+
const beatPulse = 1 + beatIntensity * 0.04 * (i % 2 === 0 ? 1 : -0.5);
|
|
186
|
+
return /* @__PURE__ */ jsx(
|
|
187
|
+
"div",
|
|
188
|
+
{
|
|
189
|
+
style: {
|
|
190
|
+
position: "absolute",
|
|
191
|
+
left: cx - emojiHalf,
|
|
192
|
+
top: cy - emojiHalf,
|
|
193
|
+
width: emojiFontSize,
|
|
194
|
+
height: emojiFontSize,
|
|
195
|
+
fontSize: emojiFontSize,
|
|
196
|
+
lineHeight: 1,
|
|
197
|
+
display: "flex",
|
|
198
|
+
alignItems: "center",
|
|
199
|
+
justifyContent: "center",
|
|
200
|
+
opacity: fadeOut,
|
|
201
|
+
transform: `translate(${shakeX + fallSwayX}px, ${shakeY + fallY}px) rotate(${shakeRotate + fallRotate}deg) scale(${emojiScale * beatPulse})`,
|
|
202
|
+
transformOrigin: "center center",
|
|
203
|
+
pointerEvents: "none"
|
|
204
|
+
},
|
|
205
|
+
children: /* @__PURE__ */ jsx(Emoji, { char: emoji, size: emojiFontSize, verticalAlign: "baseline" })
|
|
206
|
+
},
|
|
207
|
+
`problem-${i}`
|
|
208
|
+
);
|
|
209
|
+
}),
|
|
210
|
+
solutionEmojis.map((emoji, i) => {
|
|
211
|
+
const pos = POSITIONS[i];
|
|
212
|
+
const popRank = POP_ORDER[i];
|
|
213
|
+
const cx = zoneLeft + pos.x * zoneWidth;
|
|
214
|
+
const cy = zoneTop + pos.y * zoneHeight;
|
|
215
|
+
const popDelay = SOLUTION_BASE + popRank * SOLUTION_STAGGER;
|
|
216
|
+
const popP = spring(
|
|
217
|
+
interpolate(progress, [popDelay, popDelay + 0.14], [0, 1], {
|
|
218
|
+
extrapolateLeft: "clamp",
|
|
219
|
+
extrapolateRight: "clamp"
|
|
220
|
+
}),
|
|
221
|
+
SPRING_HAPPY
|
|
222
|
+
);
|
|
223
|
+
const emojiScale = interpolate(popP, [0, 1], [0, 1]);
|
|
224
|
+
const liftY = (1 - Math.min(1, popP)) * 14 * s;
|
|
225
|
+
const settled = popP > 0.95;
|
|
226
|
+
const breathe = settled ? 1 + Math.sin(progress * Math.PI * 4 + i * 0.9) * 0.015 : 1;
|
|
227
|
+
const exitP = interpolate(progress, [0.9, 1], [0, 1], {
|
|
228
|
+
extrapolateLeft: "clamp",
|
|
229
|
+
extrapolateRight: "clamp"
|
|
230
|
+
});
|
|
231
|
+
const exitFade = 1 - exitP;
|
|
232
|
+
const exitLift = exitP * -20 * s;
|
|
233
|
+
const exitShrink = 1 - exitP * 0.06;
|
|
234
|
+
const beatPulse = 1 + beatIntensity * 0.03;
|
|
235
|
+
const opacity = interpolate(popP, [0, 0.3], [0, 1], {
|
|
236
|
+
extrapolateLeft: "clamp",
|
|
237
|
+
extrapolateRight: "clamp"
|
|
238
|
+
}) * exitFade;
|
|
239
|
+
return /* @__PURE__ */ jsx(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
style: {
|
|
243
|
+
position: "absolute",
|
|
244
|
+
left: cx - emojiHalf,
|
|
245
|
+
top: cy - emojiHalf,
|
|
246
|
+
width: emojiFontSize,
|
|
247
|
+
height: emojiFontSize,
|
|
248
|
+
fontSize: emojiFontSize,
|
|
249
|
+
lineHeight: 1,
|
|
250
|
+
display: "flex",
|
|
251
|
+
alignItems: "center",
|
|
252
|
+
justifyContent: "center",
|
|
253
|
+
opacity,
|
|
254
|
+
transform: `translateY(${liftY + exitLift}px) scale(${emojiScale * breathe * beatPulse * exitShrink})`,
|
|
255
|
+
transformOrigin: "center center",
|
|
256
|
+
pointerEvents: "none"
|
|
257
|
+
},
|
|
258
|
+
children: /* @__PURE__ */ jsx(Emoji, { char: emoji, size: emojiFontSize, verticalAlign: "baseline" })
|
|
259
|
+
},
|
|
260
|
+
`solution-${i}`
|
|
261
|
+
);
|
|
262
|
+
}),
|
|
263
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "absolute", inset: 0, opacity: problemHeadlineMask, pointerEvents: "none" }, children: [
|
|
264
|
+
/* @__PURE__ */ jsx(
|
|
265
|
+
"div",
|
|
266
|
+
{
|
|
267
|
+
style: {
|
|
268
|
+
position: "absolute",
|
|
269
|
+
top: pillTop,
|
|
270
|
+
left: 0,
|
|
271
|
+
right: 0,
|
|
272
|
+
display: "flex",
|
|
273
|
+
justifyContent: "center"
|
|
274
|
+
},
|
|
275
|
+
children: /* @__PURE__ */ jsx(
|
|
276
|
+
"div",
|
|
277
|
+
{
|
|
278
|
+
style: {
|
|
279
|
+
fontSize: labelFontSize,
|
|
280
|
+
fontWeight: 700,
|
|
281
|
+
color: beforeColor,
|
|
282
|
+
letterSpacing: 3 * s,
|
|
283
|
+
textTransform: "uppercase",
|
|
284
|
+
whiteSpace: "nowrap",
|
|
285
|
+
transform: `scale(${interpolate(spring(interpolate(progress, [0.03, 0.18], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" }), { damping: 9, stiffness: 220 }), [0, 1], [0.55, 1])})`,
|
|
286
|
+
transformOrigin: "center center",
|
|
287
|
+
fontFamily: font,
|
|
288
|
+
backgroundColor: "rgba(0,0,0,0.3)",
|
|
289
|
+
border: "1px solid rgba(255,255,255,0.15)",
|
|
290
|
+
borderRadius: 100 * s,
|
|
291
|
+
padding: `${14 * s}px ${36 * s}px`,
|
|
292
|
+
textShadow: "0 1px 6px rgba(0,0,0,0.1)"
|
|
293
|
+
},
|
|
294
|
+
children: problemLabel
|
|
295
|
+
}
|
|
296
|
+
)
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/* @__PURE__ */ jsx(
|
|
300
|
+
"div",
|
|
301
|
+
{
|
|
302
|
+
style: {
|
|
303
|
+
position: "absolute",
|
|
304
|
+
top: textTop,
|
|
305
|
+
left: 0,
|
|
306
|
+
right: 0,
|
|
307
|
+
fontSize: mainSize,
|
|
308
|
+
fontWeight: 800,
|
|
309
|
+
color: textColor,
|
|
310
|
+
textAlign: "center",
|
|
311
|
+
padding: `0 ${60 * s}px`,
|
|
312
|
+
lineHeight: 1.2,
|
|
313
|
+
opacity: problemTextOpacity,
|
|
314
|
+
transform: `scale(${problemTextScale})`,
|
|
315
|
+
fontFamily: font
|
|
316
|
+
},
|
|
317
|
+
children: renderWithEmoji(problemHeadline, mainSize)
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
] }),
|
|
321
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "absolute", inset: 0, opacity: solutionHeadlineMask, pointerEvents: "none" }, children: [
|
|
322
|
+
/* @__PURE__ */ jsx(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
style: {
|
|
326
|
+
position: "absolute",
|
|
327
|
+
top: pillTop,
|
|
328
|
+
left: 0,
|
|
329
|
+
right: 0,
|
|
330
|
+
display: "flex",
|
|
331
|
+
justifyContent: "center"
|
|
332
|
+
},
|
|
333
|
+
children: /* @__PURE__ */ jsx(
|
|
334
|
+
"div",
|
|
335
|
+
{
|
|
336
|
+
style: {
|
|
337
|
+
fontSize: labelFontSize,
|
|
338
|
+
fontWeight: 700,
|
|
339
|
+
color: afterColor,
|
|
340
|
+
letterSpacing: 3 * s,
|
|
341
|
+
textTransform: "uppercase",
|
|
342
|
+
whiteSpace: "nowrap",
|
|
343
|
+
transform: `scale(${interpolate(spring(interpolate(progress, [0.5, 0.65], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" }), { damping: 9, stiffness: 220 }), [0, 1], [0.55, 1])})`,
|
|
344
|
+
transformOrigin: "center center",
|
|
345
|
+
fontFamily: font,
|
|
346
|
+
backgroundColor: "rgba(0,0,0,0.3)",
|
|
347
|
+
border: "1px solid rgba(255,255,255,0.15)",
|
|
348
|
+
borderRadius: 100 * s,
|
|
349
|
+
padding: `${14 * s}px ${36 * s}px`,
|
|
350
|
+
textShadow: "0 1px 6px rgba(0,0,0,0.1)"
|
|
351
|
+
},
|
|
352
|
+
children: solutionLabel
|
|
353
|
+
}
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
),
|
|
357
|
+
/* @__PURE__ */ jsx(
|
|
358
|
+
"div",
|
|
359
|
+
{
|
|
360
|
+
style: {
|
|
361
|
+
position: "absolute",
|
|
362
|
+
top: textTop,
|
|
363
|
+
left: 0,
|
|
364
|
+
right: 0,
|
|
365
|
+
fontSize: mainSize,
|
|
366
|
+
fontWeight: 800,
|
|
367
|
+
color: textColor,
|
|
368
|
+
textAlign: "center",
|
|
369
|
+
padding: `0 ${60 * s}px`,
|
|
370
|
+
lineHeight: 1.2,
|
|
371
|
+
opacity: solutionTextOpacity,
|
|
372
|
+
transform: `scale(${solutionTextScale})`,
|
|
373
|
+
fontFamily: font
|
|
374
|
+
},
|
|
375
|
+
children: renderWithEmoji(solutionHeadline, mainSize)
|
|
376
|
+
}
|
|
377
|
+
)
|
|
378
|
+
] })
|
|
379
|
+
] });
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
// src/visual-system/scene-templates/infographic-before-after.tsx
|
|
383
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
384
|
+
var InfographicBeforeAfterTemplate = ({
|
|
385
|
+
variables,
|
|
386
|
+
style,
|
|
387
|
+
progress,
|
|
388
|
+
beatIntensity,
|
|
389
|
+
width,
|
|
390
|
+
height,
|
|
391
|
+
textArchetype,
|
|
392
|
+
safeZone,
|
|
393
|
+
sceneDuration
|
|
394
|
+
}) => {
|
|
395
|
+
const { background, foreground, font } = resolveTokens(style);
|
|
396
|
+
const textColor = foreground;
|
|
397
|
+
const problemHeadline = String(variables.problemHeadline || "");
|
|
398
|
+
const solutionHeadline = String(variables.solutionHeadline || "");
|
|
399
|
+
const problemTypes = parseList(variables.problemEmojis);
|
|
400
|
+
const solutionTypes = parseList(variables.solutionEmojis);
|
|
401
|
+
const showEmojis = variables.showEmojis !== false && String(variables.showEmojis ?? "true").toLowerCase() !== "false";
|
|
402
|
+
const gradSeed = (problemHeadline + solutionHeadline).split("").reduce((acc, c) => acc + c.charCodeAt(0), 0);
|
|
403
|
+
void textArchetype;
|
|
404
|
+
void safeZone;
|
|
405
|
+
return /* @__PURE__ */ jsxs2(
|
|
406
|
+
"div",
|
|
407
|
+
{
|
|
408
|
+
style: {
|
|
409
|
+
width,
|
|
410
|
+
height,
|
|
411
|
+
backgroundColor: "#000",
|
|
412
|
+
position: "relative",
|
|
413
|
+
overflow: "hidden",
|
|
414
|
+
fontFamily: font
|
|
415
|
+
},
|
|
416
|
+
children: [
|
|
417
|
+
/* @__PURE__ */ jsx2(
|
|
418
|
+
"div",
|
|
419
|
+
{
|
|
420
|
+
style: {
|
|
421
|
+
position: "absolute",
|
|
422
|
+
inset: 0,
|
|
423
|
+
background: gradientBackground({
|
|
424
|
+
colorA: background.type === "solid" ? background.color : background.colors[0],
|
|
425
|
+
colorB: background.type === "solid" ? background.color : background.colors[1],
|
|
426
|
+
solidBg: background.type === "solid" ? background.color : void 0,
|
|
427
|
+
progress,
|
|
428
|
+
sceneDuration,
|
|
429
|
+
seed: gradSeed,
|
|
430
|
+
family: resolveTokens(style).preset.background
|
|
431
|
+
}),
|
|
432
|
+
pointerEvents: "none"
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
/* @__PURE__ */ jsx2(
|
|
437
|
+
BeforeAfterSplit,
|
|
438
|
+
{
|
|
439
|
+
progress,
|
|
440
|
+
width,
|
|
441
|
+
height,
|
|
442
|
+
problemHeadline,
|
|
443
|
+
solutionHeadline,
|
|
444
|
+
problemEmojis: problemTypes,
|
|
445
|
+
solutionEmojis: solutionTypes,
|
|
446
|
+
showEmojis,
|
|
447
|
+
beforeLabel: String(variables.problemLabel || ""),
|
|
448
|
+
afterLabel: String(variables.solutionLabel || ""),
|
|
449
|
+
textColor,
|
|
450
|
+
font,
|
|
451
|
+
beatIntensity
|
|
452
|
+
}
|
|
453
|
+
)
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
};
|
|
458
|
+
export {
|
|
459
|
+
InfographicBeforeAfterTemplate
|
|
460
|
+
};
|