agentcut 0.2.26 → 0.2.27
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/README.md +177 -177
- package/dist/studio/agents/claude.js +3 -2
- package/dist/studio/agents/claude.js.map +1 -1
- package/dist/studio/chat.js +1 -1
- package/dist/studio/chat.js.map +1 -1
- package/dist/studio/cli.js +24 -24
- package/dist/studio/download.d.ts +24 -0
- package/dist/studio/download.js +234 -0
- package/dist/studio/download.js.map +1 -0
- package/dist/studio/host.js +8 -0
- package/dist/studio/host.js.map +1 -1
- package/dist/studio/housekeeping.d.ts +2 -2
- package/dist/studio/housekeeping.js +18 -17
- package/dist/studio/housekeeping.js.map +1 -1
- package/dist/studio/release-cursor.js +21 -21
- package/dist/studio/release-video.js +10 -10
- package/dist/studio/tools.js +7 -0
- package/dist/studio/tools.js.map +1 -1
- package/package.json +56 -56
- package/template/AGENTS.md +14 -14
- package/template/components/README.md +70 -70
- package/template/components/before-after/BeforeAfter.tsx +89 -89
- package/template/components/catalog.ts +107 -107
- package/template/components/cinematic/Device3D.tsx +324 -324
- package/template/components/cinematic/devices3d/display-model.ts +184 -184
- package/template/components/cinematic/devices3d/iphone-model.ts +643 -643
- package/template/components/cinematic/devices3d/macbook-model.ts +608 -608
- package/template/components/cinematic/devices3d/models.ts +657 -657
- package/template/components/cinematic/devices3d/runtime.ts +267 -267
- package/template/components/cinematic/math.ts +100 -100
- package/template/components/color/grade-effect.ts +650 -650
- package/template/components/color/grade.ts +512 -512
- package/template/components/color/looks.ts +154 -154
- package/template/components/countdown/Countdown.tsx +166 -166
- package/template/components/dot-trace-title/DotTraceTitle.tsx +181 -181
- package/template/components/dot-trace-title/meta.json +51 -51
- package/template/components/generate/GenerateReveal.tsx +381 -381
- package/template/components/hook-card/HookCard.tsx +554 -554
- package/template/components/index.ts +199 -199
- package/template/components/lib.ts +191 -191
- package/template/components/line-diagram/LineDiagram.tsx +205 -205
- package/template/components/line-diagram/meta.json +215 -215
- package/template/components/list-card/ListCard.tsx +104 -104
- package/template/components/live-clip.ts +75 -75
- package/template/components/looks.tsx +1447 -1447
- package/template/components/loops/LoopCanvas.tsx +132 -132
- package/template/components/loops/engine.ts +184 -184
- package/template/components/loops/library.ts +667 -667
- package/template/components/loops/library2.ts +777 -777
- package/template/components/motion-loop/MotionLoop.tsx +37 -37
- package/template/components/motion-loop/meta.json +311 -311
- package/template/components/props.ts +73 -73
- package/template/components/quote-card/QuoteCard.tsx +71 -71
- package/template/components/style-layer.tsx +233 -233
- package/template/components/styles.ts +113 -113
- package/template/components/types.ts +66 -66
- package/template/components/word-pop/WordPop.tsx +59 -59
- package/template/components/word-stack/WordStack.tsx +122 -122
- package/template/presets/charcoal-sketch/PROMPT.md +48 -48
- package/template/presets/charcoal-sketch/scripts/duck_music.py +34 -34
- package/template/presets/punk-cut-paper/scenes/Motif.tsx +376 -376
- package/template/presets/punk-cut-paper/scenes/Photo.tsx +73 -73
- package/template/presets/punk-cut-paper/scenes/Ransom.tsx +119 -119
- package/template/runtime/composition.tsx +1189 -1189
- package/template/runtime/helpers.tsx +230 -230
- package/template/runtime/index.tsx +22 -22
- package/template/runtime/types.ts +315 -315
- package/template/skill/SKILL.md +186 -187
- package/template/skill/references/broll.md +44 -44
- package/template/skill/references/browser-export.md +61 -61
- package/template/skill/references/cinematic.md +206 -206
- package/template/skill/references/color.md +79 -79
- package/template/skill/references/craft.md +97 -97
- package/template/skill/references/editing-styles.md +57 -57
- package/template/skill/references/feature-launch.md +34 -34
- package/template/skill/references/footage.md +72 -72
- package/template/skill/references/format.md +142 -142
- package/template/skill/references/how-to.md +146 -146
- package/template/skill/references/launch-direction.md +89 -89
- package/template/skill/references/loops.md +151 -151
- package/template/skill/references/mcp-external.md +19 -19
- package/template/skill/references/performance.md +93 -93
- package/template/skill/references/person-cutout.md +19 -19
- package/template/skill/references/presets.md +60 -60
- package/template/skill/references/product-launch.md +134 -134
- package/template/skill/references/release-capture.md +53 -53
- package/template/skill/references/sound.md +167 -166
- package/template/skill/references/style-spy.md +160 -160
- package/template/skill/references/website-howto.md +45 -45
- package/template/starter/.studio/chat.json +1 -1
- package/template/starter/layers.json +46 -46
- package/template/starter/notes.md +4 -4
- package/template/starter/project.json +13 -13
- package/template/starter/scenes/Title.tsx +38 -38
|
@@ -1,230 +1,230 @@
|
|
|
1
|
-
// The `agentcut` module that scenes import.
|
|
2
|
-
// Same animation helpers as video-studio's shared/anim.ts, plus asset URLs and
|
|
3
|
-
// browser-export-safe building blocks (SVG radial glows instead of CSS radial-gradient).
|
|
4
|
-
import { createContext, useContext, useId, type CSSProperties, type ReactNode } from "react";
|
|
5
|
-
import { Easing, interpolate, spring, staticFile, useRemotionEnvironment, type SpringConfig } from "remotion";
|
|
6
|
-
import type { StudioProject } from "./types";
|
|
7
|
-
|
|
8
|
-
export interface StudioRuntimeContextValue {
|
|
9
|
-
project: StudioProject;
|
|
10
|
-
variant: string;
|
|
11
|
-
width: number;
|
|
12
|
-
height: number;
|
|
13
|
-
fps: number;
|
|
14
|
-
assetBase: string;
|
|
15
|
-
libraryBase: string;
|
|
16
|
-
/** Fast-seeking copies of footage, project path → URL (live preview only). */
|
|
17
|
-
previewProxies?: Record<string, string>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const runtimeState: { fps: number; assetBase: string; libraryBase: string } = {
|
|
21
|
-
fps: 30,
|
|
22
|
-
assetBase: "",
|
|
23
|
-
libraryBase: "",
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/** Called by StudioComposition on every render so helpers work outside hooks too. */
|
|
27
|
-
export function setRuntimeState(next: { fps: number; assetBase: string; libraryBase: string }) {
|
|
28
|
-
runtimeState.fps = next.fps;
|
|
29
|
-
runtimeState.assetBase = next.assetBase;
|
|
30
|
-
runtimeState.libraryBase = next.libraryBase;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const StudioRuntimeContext = createContext<StudioRuntimeContextValue | null>(null);
|
|
34
|
-
|
|
35
|
-
/** Project size, fps and variant for the frame being drawn. */
|
|
36
|
-
export function useStudio(): StudioRuntimeContextValue {
|
|
37
|
-
const value = useContext(StudioRuntimeContext);
|
|
38
|
-
if (!value) throw new Error("useStudio() must be used inside a Studio composition.");
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Live preview vs. final pixels. The Player has to draw 30 frames a second on the page's
|
|
44
|
-
* main thread; captures and the export can take as long as they need. Heavy scenes (three.js,
|
|
45
|
-
* big canvases) should draw cheaper in the preview: lower pixel ratio, smaller shadow maps,
|
|
46
|
-
* redraw canvas textures less often. Captures and the export always get full quality.
|
|
47
|
-
*/
|
|
48
|
-
export function usePreviewQuality() {
|
|
49
|
-
const env = useRemotionEnvironment();
|
|
50
|
-
const isPreview = env.isPlayer && !env.isRendering;
|
|
51
|
-
return {
|
|
52
|
-
isPreview,
|
|
53
|
-
/** For renderer.setPixelRatio() / canvas resolution. */
|
|
54
|
-
pixelRatio: isPreview ? 0.5 : 1,
|
|
55
|
-
/** For light.shadow.mapSize. */
|
|
56
|
-
shadowMapSize: isPreview ? 512 : 2048,
|
|
57
|
-
/** Redraw expensive canvas textures every Nth frame in the preview. */
|
|
58
|
-
textureEvery: isPreview ? 2 : 1,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** True when the composition is drawn in a tall (9:16-like) variant. */
|
|
63
|
-
export function useIsVertical() {
|
|
64
|
-
const { width, height } = useStudio();
|
|
65
|
-
return height > width;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function joinUrl(base: string, path: string) {
|
|
69
|
-
if (base.startsWith("static:")) {
|
|
70
|
-
// Local Remotion render: files come from the render's public dir.
|
|
71
|
-
const prefix = base.slice("static:".length).replace(/^\/+|\/+$/g, "");
|
|
72
|
-
return staticFile(prefix ? `${prefix}/${path.replace(/^\/+/, "")}` : path.replace(/^\/+/, ""));
|
|
73
|
-
}
|
|
74
|
-
const cleanBase = base.replace(/\/+$/, "");
|
|
75
|
-
const cleanPath = path
|
|
76
|
-
.replace(/^\/+/, "")
|
|
77
|
-
.split("/")
|
|
78
|
-
.map((part) => encodeURIComponent(part))
|
|
79
|
-
.join("/");
|
|
80
|
-
return `${cleanBase}/${cleanPath}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Resolve a project file to a URL.
|
|
85
|
-
* - `assets/voice.wav` → this project's folder
|
|
86
|
-
* - `library:sfx/whoosh.wav` → the workspace library
|
|
87
|
-
* - `https://…` → unchanged
|
|
88
|
-
*/
|
|
89
|
-
export function asset(src: string): string {
|
|
90
|
-
if (/^(https?:|data:|blob:)/i.test(src)) return src;
|
|
91
|
-
if (src.startsWith("library:")) {
|
|
92
|
-
return joinUrl(runtimeState.libraryBase, src.slice("library:".length));
|
|
93
|
-
}
|
|
94
|
-
return joinUrl(runtimeState.assetBase, src);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// ---------------------------------------------------------------------------
|
|
98
|
-
// Animation helpers (frame-based, same names as video-studio's shared/anim.ts)
|
|
99
|
-
|
|
100
|
-
export const clamp = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const;
|
|
101
|
-
|
|
102
|
-
export const mix = (a: number, b: number, t: number) => a + (b - a) * t;
|
|
103
|
-
|
|
104
|
-
/** 0→1 progress between two frames with an easing curve (clamped). */
|
|
105
|
-
export const ease = (
|
|
106
|
-
frame: number,
|
|
107
|
-
from: number,
|
|
108
|
-
to: number,
|
|
109
|
-
easing: (t: number) => number = Easing.inOut(Easing.cubic),
|
|
110
|
-
) => interpolate(frame, [from, Math.max(from + 0.0001, to)], [0, 1], { ...clamp, easing });
|
|
111
|
-
|
|
112
|
-
export const SPRING = {
|
|
113
|
-
smooth: { damping: 200 },
|
|
114
|
-
snappy: { damping: 20, stiffness: 200 },
|
|
115
|
-
bouncy: { damping: 11, stiffness: 140 },
|
|
116
|
-
pop: { damping: 9, stiffness: 180, mass: 0.7 },
|
|
117
|
-
land: { damping: 14, stiffness: 150, mass: 0.9 },
|
|
118
|
-
} satisfies Record<string, Partial<SpringConfig>>;
|
|
119
|
-
|
|
120
|
-
/** Spring that starts at `start` (same frame basis as `frame`), at the project's fps. */
|
|
121
|
-
export const sp = (
|
|
122
|
-
frame: number,
|
|
123
|
-
start: number,
|
|
124
|
-
config: Partial<SpringConfig> = SPRING.snappy,
|
|
125
|
-
durationInFrames?: number,
|
|
126
|
-
) => spring({ frame: frame - start, fps: runtimeState.fps, config, durationInFrames });
|
|
127
|
-
|
|
128
|
-
/** Seconds → frames at the project's fps. */
|
|
129
|
-
export const sec = (seconds: number) => Math.round(seconds * runtimeState.fps);
|
|
130
|
-
|
|
131
|
-
// ---------------------------------------------------------------------------
|
|
132
|
-
// Browser-export-safe building blocks
|
|
133
|
-
|
|
134
|
-
export interface RadialGlowProps {
|
|
135
|
-
/** Center, as fractions of the box (0..1). Default 0.5 / 0.5. */
|
|
136
|
-
x?: number;
|
|
137
|
-
y?: number;
|
|
138
|
-
/** Radius as a fraction of the box's larger side. Default 0.6. */
|
|
139
|
-
radius?: number;
|
|
140
|
-
color: string;
|
|
141
|
-
/** Opacity at the center. Default 1. */
|
|
142
|
-
opacity?: number;
|
|
143
|
-
/** Where the glow reaches 0 (0..1 of the radius). Default 1. */
|
|
144
|
-
falloff?: number;
|
|
145
|
-
style?: CSSProperties;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* A radial glow drawn with SVG. Use instead of CSS `radial-gradient`, which the
|
|
150
|
-
* browser export cannot draw.
|
|
151
|
-
*/
|
|
152
|
-
export function RadialGlow({
|
|
153
|
-
x = 0.5,
|
|
154
|
-
y = 0.5,
|
|
155
|
-
radius = 0.6,
|
|
156
|
-
color,
|
|
157
|
-
opacity = 1,
|
|
158
|
-
falloff = 1,
|
|
159
|
-
style,
|
|
160
|
-
}: RadialGlowProps) {
|
|
161
|
-
const id = useId().replace(/:/g, "");
|
|
162
|
-
return (
|
|
163
|
-
<svg
|
|
164
|
-
width="100%"
|
|
165
|
-
height="100%"
|
|
166
|
-
viewBox="0 0 100 100"
|
|
167
|
-
preserveAspectRatio="none"
|
|
168
|
-
style={{ position: "absolute", inset: 0, width: "100%", height: "100%", ...style }}
|
|
169
|
-
>
|
|
170
|
-
<defs>
|
|
171
|
-
<radialGradient
|
|
172
|
-
id={`glow-${id}`}
|
|
173
|
-
cx={x * 100}
|
|
174
|
-
cy={y * 100}
|
|
175
|
-
r={radius * 100}
|
|
176
|
-
gradientUnits="userSpaceOnUse"
|
|
177
|
-
>
|
|
178
|
-
<stop offset="0" stopColor={color} stopOpacity={opacity} />
|
|
179
|
-
<stop offset={Math.max(0.01, Math.min(1, falloff))} stopColor={color} stopOpacity={0} />
|
|
180
|
-
</radialGradient>
|
|
181
|
-
</defs>
|
|
182
|
-
<rect x="0" y="0" width="100" height="100" fill={`url(#glow-${id})`} />
|
|
183
|
-
</svg>
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/** Absolutely positioned box in frame fractions (0..1). */
|
|
188
|
-
export function FrameBox({
|
|
189
|
-
x = 0,
|
|
190
|
-
y = 0,
|
|
191
|
-
width = 1,
|
|
192
|
-
height = 1,
|
|
193
|
-
style,
|
|
194
|
-
children,
|
|
195
|
-
}: {
|
|
196
|
-
x?: number;
|
|
197
|
-
y?: number;
|
|
198
|
-
width?: number;
|
|
199
|
-
height?: number;
|
|
200
|
-
style?: CSSProperties;
|
|
201
|
-
children?: ReactNode;
|
|
202
|
-
}) {
|
|
203
|
-
return (
|
|
204
|
-
<div
|
|
205
|
-
style={{
|
|
206
|
-
position: "absolute",
|
|
207
|
-
left: `${x * 100}%`,
|
|
208
|
-
top: `${y * 100}%`,
|
|
209
|
-
width: `${width * 100}%`,
|
|
210
|
-
height: `${height * 100}%`,
|
|
211
|
-
...style,
|
|
212
|
-
}}
|
|
213
|
-
>
|
|
214
|
-
{children}
|
|
215
|
-
</div>
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export type {
|
|
220
|
-
AudioClip,
|
|
221
|
-
Box,
|
|
222
|
-
CaptionWord,
|
|
223
|
-
ClipAnim,
|
|
224
|
-
SceneProps,
|
|
225
|
-
StudioClip,
|
|
226
|
-
StudioLayers,
|
|
227
|
-
StudioProject,
|
|
228
|
-
StudioTrack,
|
|
229
|
-
TextStyle,
|
|
230
|
-
} from "./types";
|
|
1
|
+
// The `agentcut` module that scenes import.
|
|
2
|
+
// Same animation helpers as video-studio's shared/anim.ts, plus asset URLs and
|
|
3
|
+
// browser-export-safe building blocks (SVG radial glows instead of CSS radial-gradient).
|
|
4
|
+
import { createContext, useContext, useId, type CSSProperties, type ReactNode } from "react";
|
|
5
|
+
import { Easing, interpolate, spring, staticFile, useRemotionEnvironment, type SpringConfig } from "remotion";
|
|
6
|
+
import type { StudioProject } from "./types";
|
|
7
|
+
|
|
8
|
+
export interface StudioRuntimeContextValue {
|
|
9
|
+
project: StudioProject;
|
|
10
|
+
variant: string;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
fps: number;
|
|
14
|
+
assetBase: string;
|
|
15
|
+
libraryBase: string;
|
|
16
|
+
/** Fast-seeking copies of footage, project path → URL (live preview only). */
|
|
17
|
+
previewProxies?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const runtimeState: { fps: number; assetBase: string; libraryBase: string } = {
|
|
21
|
+
fps: 30,
|
|
22
|
+
assetBase: "",
|
|
23
|
+
libraryBase: "",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Called by StudioComposition on every render so helpers work outside hooks too. */
|
|
27
|
+
export function setRuntimeState(next: { fps: number; assetBase: string; libraryBase: string }) {
|
|
28
|
+
runtimeState.fps = next.fps;
|
|
29
|
+
runtimeState.assetBase = next.assetBase;
|
|
30
|
+
runtimeState.libraryBase = next.libraryBase;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const StudioRuntimeContext = createContext<StudioRuntimeContextValue | null>(null);
|
|
34
|
+
|
|
35
|
+
/** Project size, fps and variant for the frame being drawn. */
|
|
36
|
+
export function useStudio(): StudioRuntimeContextValue {
|
|
37
|
+
const value = useContext(StudioRuntimeContext);
|
|
38
|
+
if (!value) throw new Error("useStudio() must be used inside a Studio composition.");
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Live preview vs. final pixels. The Player has to draw 30 frames a second on the page's
|
|
44
|
+
* main thread; captures and the export can take as long as they need. Heavy scenes (three.js,
|
|
45
|
+
* big canvases) should draw cheaper in the preview: lower pixel ratio, smaller shadow maps,
|
|
46
|
+
* redraw canvas textures less often. Captures and the export always get full quality.
|
|
47
|
+
*/
|
|
48
|
+
export function usePreviewQuality() {
|
|
49
|
+
const env = useRemotionEnvironment();
|
|
50
|
+
const isPreview = env.isPlayer && !env.isRendering;
|
|
51
|
+
return {
|
|
52
|
+
isPreview,
|
|
53
|
+
/** For renderer.setPixelRatio() / canvas resolution. */
|
|
54
|
+
pixelRatio: isPreview ? 0.5 : 1,
|
|
55
|
+
/** For light.shadow.mapSize. */
|
|
56
|
+
shadowMapSize: isPreview ? 512 : 2048,
|
|
57
|
+
/** Redraw expensive canvas textures every Nth frame in the preview. */
|
|
58
|
+
textureEvery: isPreview ? 2 : 1,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** True when the composition is drawn in a tall (9:16-like) variant. */
|
|
63
|
+
export function useIsVertical() {
|
|
64
|
+
const { width, height } = useStudio();
|
|
65
|
+
return height > width;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function joinUrl(base: string, path: string) {
|
|
69
|
+
if (base.startsWith("static:")) {
|
|
70
|
+
// Local Remotion render: files come from the render's public dir.
|
|
71
|
+
const prefix = base.slice("static:".length).replace(/^\/+|\/+$/g, "");
|
|
72
|
+
return staticFile(prefix ? `${prefix}/${path.replace(/^\/+/, "")}` : path.replace(/^\/+/, ""));
|
|
73
|
+
}
|
|
74
|
+
const cleanBase = base.replace(/\/+$/, "");
|
|
75
|
+
const cleanPath = path
|
|
76
|
+
.replace(/^\/+/, "")
|
|
77
|
+
.split("/")
|
|
78
|
+
.map((part) => encodeURIComponent(part))
|
|
79
|
+
.join("/");
|
|
80
|
+
return `${cleanBase}/${cleanPath}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Resolve a project file to a URL.
|
|
85
|
+
* - `assets/voice.wav` → this project's folder
|
|
86
|
+
* - `library:sfx/whoosh.wav` → the workspace library
|
|
87
|
+
* - `https://…` → unchanged
|
|
88
|
+
*/
|
|
89
|
+
export function asset(src: string): string {
|
|
90
|
+
if (/^(https?:|data:|blob:)/i.test(src)) return src;
|
|
91
|
+
if (src.startsWith("library:")) {
|
|
92
|
+
return joinUrl(runtimeState.libraryBase, src.slice("library:".length));
|
|
93
|
+
}
|
|
94
|
+
return joinUrl(runtimeState.assetBase, src);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Animation helpers (frame-based, same names as video-studio's shared/anim.ts)
|
|
99
|
+
|
|
100
|
+
export const clamp = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const;
|
|
101
|
+
|
|
102
|
+
export const mix = (a: number, b: number, t: number) => a + (b - a) * t;
|
|
103
|
+
|
|
104
|
+
/** 0→1 progress between two frames with an easing curve (clamped). */
|
|
105
|
+
export const ease = (
|
|
106
|
+
frame: number,
|
|
107
|
+
from: number,
|
|
108
|
+
to: number,
|
|
109
|
+
easing: (t: number) => number = Easing.inOut(Easing.cubic),
|
|
110
|
+
) => interpolate(frame, [from, Math.max(from + 0.0001, to)], [0, 1], { ...clamp, easing });
|
|
111
|
+
|
|
112
|
+
export const SPRING = {
|
|
113
|
+
smooth: { damping: 200 },
|
|
114
|
+
snappy: { damping: 20, stiffness: 200 },
|
|
115
|
+
bouncy: { damping: 11, stiffness: 140 },
|
|
116
|
+
pop: { damping: 9, stiffness: 180, mass: 0.7 },
|
|
117
|
+
land: { damping: 14, stiffness: 150, mass: 0.9 },
|
|
118
|
+
} satisfies Record<string, Partial<SpringConfig>>;
|
|
119
|
+
|
|
120
|
+
/** Spring that starts at `start` (same frame basis as `frame`), at the project's fps. */
|
|
121
|
+
export const sp = (
|
|
122
|
+
frame: number,
|
|
123
|
+
start: number,
|
|
124
|
+
config: Partial<SpringConfig> = SPRING.snappy,
|
|
125
|
+
durationInFrames?: number,
|
|
126
|
+
) => spring({ frame: frame - start, fps: runtimeState.fps, config, durationInFrames });
|
|
127
|
+
|
|
128
|
+
/** Seconds → frames at the project's fps. */
|
|
129
|
+
export const sec = (seconds: number) => Math.round(seconds * runtimeState.fps);
|
|
130
|
+
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
// Browser-export-safe building blocks
|
|
133
|
+
|
|
134
|
+
export interface RadialGlowProps {
|
|
135
|
+
/** Center, as fractions of the box (0..1). Default 0.5 / 0.5. */
|
|
136
|
+
x?: number;
|
|
137
|
+
y?: number;
|
|
138
|
+
/** Radius as a fraction of the box's larger side. Default 0.6. */
|
|
139
|
+
radius?: number;
|
|
140
|
+
color: string;
|
|
141
|
+
/** Opacity at the center. Default 1. */
|
|
142
|
+
opacity?: number;
|
|
143
|
+
/** Where the glow reaches 0 (0..1 of the radius). Default 1. */
|
|
144
|
+
falloff?: number;
|
|
145
|
+
style?: CSSProperties;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* A radial glow drawn with SVG. Use instead of CSS `radial-gradient`, which the
|
|
150
|
+
* browser export cannot draw.
|
|
151
|
+
*/
|
|
152
|
+
export function RadialGlow({
|
|
153
|
+
x = 0.5,
|
|
154
|
+
y = 0.5,
|
|
155
|
+
radius = 0.6,
|
|
156
|
+
color,
|
|
157
|
+
opacity = 1,
|
|
158
|
+
falloff = 1,
|
|
159
|
+
style,
|
|
160
|
+
}: RadialGlowProps) {
|
|
161
|
+
const id = useId().replace(/:/g, "");
|
|
162
|
+
return (
|
|
163
|
+
<svg
|
|
164
|
+
width="100%"
|
|
165
|
+
height="100%"
|
|
166
|
+
viewBox="0 0 100 100"
|
|
167
|
+
preserveAspectRatio="none"
|
|
168
|
+
style={{ position: "absolute", inset: 0, width: "100%", height: "100%", ...style }}
|
|
169
|
+
>
|
|
170
|
+
<defs>
|
|
171
|
+
<radialGradient
|
|
172
|
+
id={`glow-${id}`}
|
|
173
|
+
cx={x * 100}
|
|
174
|
+
cy={y * 100}
|
|
175
|
+
r={radius * 100}
|
|
176
|
+
gradientUnits="userSpaceOnUse"
|
|
177
|
+
>
|
|
178
|
+
<stop offset="0" stopColor={color} stopOpacity={opacity} />
|
|
179
|
+
<stop offset={Math.max(0.01, Math.min(1, falloff))} stopColor={color} stopOpacity={0} />
|
|
180
|
+
</radialGradient>
|
|
181
|
+
</defs>
|
|
182
|
+
<rect x="0" y="0" width="100" height="100" fill={`url(#glow-${id})`} />
|
|
183
|
+
</svg>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Absolutely positioned box in frame fractions (0..1). */
|
|
188
|
+
export function FrameBox({
|
|
189
|
+
x = 0,
|
|
190
|
+
y = 0,
|
|
191
|
+
width = 1,
|
|
192
|
+
height = 1,
|
|
193
|
+
style,
|
|
194
|
+
children,
|
|
195
|
+
}: {
|
|
196
|
+
x?: number;
|
|
197
|
+
y?: number;
|
|
198
|
+
width?: number;
|
|
199
|
+
height?: number;
|
|
200
|
+
style?: CSSProperties;
|
|
201
|
+
children?: ReactNode;
|
|
202
|
+
}) {
|
|
203
|
+
return (
|
|
204
|
+
<div
|
|
205
|
+
style={{
|
|
206
|
+
position: "absolute",
|
|
207
|
+
left: `${x * 100}%`,
|
|
208
|
+
top: `${y * 100}%`,
|
|
209
|
+
width: `${width * 100}%`,
|
|
210
|
+
height: `${height * 100}%`,
|
|
211
|
+
...style,
|
|
212
|
+
}}
|
|
213
|
+
>
|
|
214
|
+
{children}
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export type {
|
|
220
|
+
AudioClip,
|
|
221
|
+
Box,
|
|
222
|
+
CaptionWord,
|
|
223
|
+
ClipAnim,
|
|
224
|
+
SceneProps,
|
|
225
|
+
StudioClip,
|
|
226
|
+
StudioLayers,
|
|
227
|
+
StudioProject,
|
|
228
|
+
StudioTrack,
|
|
229
|
+
TextStyle,
|
|
230
|
+
} from "./types";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
// Bundle entry helpers. The helper generates one entry per project that calls
|
|
2
|
-
// createStudioModule() with the project's scenes.
|
|
3
|
-
import { createStudioComposition, type SceneRegistry } from "./composition";
|
|
4
|
-
|
|
5
|
-
export const RUNTIME_VERSION = 1;
|
|
6
|
-
|
|
7
|
-
export interface StudioModule {
|
|
8
|
-
runtimeVersion: number;
|
|
9
|
-
StudioComposition: ReturnType<typeof createStudioComposition>;
|
|
10
|
-
scenes: string[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function createStudioModule(scenes: SceneRegistry): StudioModule {
|
|
14
|
-
return {
|
|
15
|
-
runtimeVersion: RUNTIME_VERSION,
|
|
16
|
-
StudioComposition: createStudioComposition(scenes),
|
|
17
|
-
scenes: Object.keys(scenes).sort(),
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type { SceneRegistry } from "./composition";
|
|
22
|
-
export * from "./types";
|
|
1
|
+
// Bundle entry helpers. The helper generates one entry per project that calls
|
|
2
|
+
// createStudioModule() with the project's scenes.
|
|
3
|
+
import { createStudioComposition, type SceneRegistry } from "./composition";
|
|
4
|
+
|
|
5
|
+
export const RUNTIME_VERSION = 1;
|
|
6
|
+
|
|
7
|
+
export interface StudioModule {
|
|
8
|
+
runtimeVersion: number;
|
|
9
|
+
StudioComposition: ReturnType<typeof createStudioComposition>;
|
|
10
|
+
scenes: string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function createStudioModule(scenes: SceneRegistry): StudioModule {
|
|
14
|
+
return {
|
|
15
|
+
runtimeVersion: RUNTIME_VERSION,
|
|
16
|
+
StudioComposition: createStudioComposition(scenes),
|
|
17
|
+
scenes: Object.keys(scenes).sort(),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type { SceneRegistry } from "./composition";
|
|
22
|
+
export * from "./types";
|