motionrender 0.0.0-stage → 0.2.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 +61 -2
- package/blocks/badge.json +68 -0
- package/blocks/big-stat.json +240 -0
- package/blocks/cta-end.json +283 -0
- package/blocks/feature-list.json +286 -0
- package/blocks/footage.json +43 -0
- package/blocks/fx-background-swap.json +170 -0
- package/blocks/fx-before-after.json +212 -0
- package/blocks/fx-captions.json +34 -0
- package/blocks/fx-chat.json +368 -0
- package/blocks/fx-checklist.json +609 -0
- package/blocks/fx-clone-wall.json +181 -0
- package/blocks/fx-color-pop.json +92 -0
- package/blocks/fx-command-bridge.json +358 -0
- package/blocks/fx-counter-hero.json +206 -0
- package/blocks/fx-cta-card.json +337 -0
- package/blocks/fx-day-to-night.json +174 -0
- package/blocks/fx-duo-title.json +245 -0
- package/blocks/fx-duotone.json +95 -0
- package/blocks/fx-extruded-title.json +309 -0
- package/blocks/fx-gallery.json +239 -0
- package/blocks/fx-glass-cards.json +921 -0
- package/blocks/fx-glitch-title.json +373 -0
- package/blocks/fx-grade-look.json +91 -0
- package/blocks/fx-highlighter.json +53 -0
- package/blocks/fx-icon-orbit.json +2694 -0
- package/blocks/fx-lens-flare.json +325 -0
- package/blocks/fx-letterbox.json +105 -0
- package/blocks/fx-light-leak.json +140 -0
- package/blocks/fx-map-journey.json +443 -0
- package/blocks/fx-neon-outline.json +743 -0
- package/blocks/fx-notifications.json +456 -0
- package/blocks/fx-progress-ring.json +143 -0
- package/blocks/fx-pull-out.json +68 -0
- package/blocks/fx-punch-in.json +81 -0
- package/blocks/fx-rgb-flash.json +166 -0
- package/blocks/fx-shake-hit.json +120 -0
- package/blocks/fx-split-reveal.json +110 -0
- package/blocks/fx-spotlight.json +1383 -0
- package/blocks/fx-stats-split.json +500 -0
- package/blocks/fx-step-tracker.json +528 -0
- package/blocks/fx-sticker-freeze.json +584 -0
- package/blocks/fx-strike-rewrite.json +79 -0
- package/blocks/fx-ticker.json +179 -0
- package/blocks/fx-timeline.json +1287 -0
- package/blocks/fx-tracked-label.json +167 -0
- package/blocks/fx-typewriter-quote.json +164 -0
- package/blocks/handle.json +43 -0
- package/blocks/icon-row.json +404 -0
- package/blocks/image-caption.json +248 -0
- package/blocks/lower-third.json +106 -0
- package/blocks/phone-mockup.json +459 -0
- package/blocks/progress-bar.json +51 -0
- package/blocks/quote.json +347 -0
- package/blocks/section-title.json +240 -0
- package/blocks/split-screen.json +283 -0
- package/blocks/stat-grid.json +315 -0
- package/blocks/steps.json +266 -0
- package/blocks/title-hero.json +287 -0
- package/dist/builder.d.ts +1 -0
- package/dist/builder.js +169 -0
- package/dist/cli.js +9301 -0
- package/dist/fonts/LICENSE-Inter.txt +93 -0
- package/dist/fonts/inter-cyrillic-ext-opsz-italic.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-ext-opsz-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-opsz-italic.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-opsz-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-opsz-italic.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-opsz-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-opsz-italic.woff2 +0 -0
- package/dist/fonts/inter-greek-opsz-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-opsz-italic.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-opsz-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-opsz-italic.woff2 +0 -0
- package/dist/fonts/inter-latin-opsz-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-opsz-italic.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-opsz-normal.woff2 +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2330 -0
- package/dist/player.d.ts +1 -0
- package/dist/player.js +80 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +140 -0
- package/dist/runtime/canvas-runtime.js +261 -0
- package/dist/runtime/lottie_light_canvas.min.js +1 -0
- package/dist/runtime/text-layout.js +50 -0
- package/dist/sfx/click.wav +0 -0
- package/dist/sfx/ding.wav +0 -0
- package/dist/sfx/pop.wav +0 -0
- package/dist/sfx/riser.wav +0 -0
- package/dist/sfx/thump.wav +0 -0
- package/dist/sfx/tick.wav +0 -0
- package/dist/sfx/whoosh.wav +0 -0
- package/dist/types/packages/ai/src/assets.d.ts +26 -0
- package/dist/types/packages/ai/src/batch.d.ts +19 -0
- package/dist/types/packages/ai/src/compose.d.ts +34 -0
- package/dist/types/packages/ai/src/history.d.ts +37 -0
- package/dist/types/packages/ai/src/image.d.ts +19 -0
- package/dist/types/packages/ai/src/index.d.ts +13 -0
- package/dist/types/packages/ai/src/json.d.ts +2 -0
- package/dist/types/packages/ai/src/narrate.d.ts +63 -0
- package/dist/types/packages/ai/src/patch.d.ts +15 -0
- package/dist/types/packages/ai/src/project.d.ts +27 -0
- package/dist/types/packages/ai/src/prompt.d.ts +30 -0
- package/dist/types/packages/ai/src/providers.d.ts +109 -0
- package/dist/types/packages/ai/src/template.d.ts +80 -0
- package/dist/types/packages/ai/src/voiceover.d.ts +49 -0
- package/dist/types/packages/animation/src/index.d.ts +27 -0
- package/dist/types/packages/assets/src/cache.d.ts +26 -0
- package/dist/types/packages/assets/src/index.d.ts +8 -0
- package/dist/types/packages/builder/src/index.d.ts +270 -0
- package/dist/types/packages/cli/src/ai-studio-page.d.ts +1 -0
- package/dist/types/packages/cli/src/ai-studio.d.ts +35 -0
- package/dist/types/packages/cli/src/ai.d.ts +3 -0
- package/dist/types/packages/cli/src/args.d.ts +9 -0
- package/dist/types/packages/cli/src/blocks-cli.d.ts +3 -0
- package/dist/types/packages/cli/src/blocks.d.ts +50 -0
- package/dist/types/packages/cli/src/build.d.ts +1 -0
- package/dist/types/packages/cli/src/dev-page.d.ts +1 -0
- package/dist/types/packages/cli/src/dev.d.ts +13 -0
- package/dist/types/packages/cli/src/index.d.ts +2 -0
- package/dist/types/packages/cli/src/init.d.ts +10 -0
- package/dist/types/packages/cli/src/serve.d.ts +2 -0
- package/dist/types/packages/cli/src/studio.d.ts +36 -0
- package/dist/types/packages/cli/src/templates.d.ts +63 -0
- package/dist/types/packages/cli/src/thumbnail.d.ts +20 -0
- package/dist/types/packages/cli/src/track.d.ts +35 -0
- package/dist/types/packages/cli/src/worker.d.ts +13 -0
- package/dist/types/packages/contracts/src/index.d.ts +377 -0
- package/dist/types/packages/core/src/audio.d.ts +14 -0
- package/dist/types/packages/core/src/distributed.d.ts +50 -0
- package/dist/types/packages/core/src/index.d.ts +63 -0
- package/dist/types/packages/core/src/media.d.ts +11 -0
- package/dist/types/packages/core/src/review.d.ts +29 -0
- package/dist/types/packages/ffmpeg/src/index.d.ts +68 -0
- package/dist/types/packages/graphics/src/fonts.d.ts +3 -0
- package/dist/types/packages/graphics/src/index.d.ts +121 -0
- package/dist/types/packages/graphics/src/runtime.d.ts +10 -0
- package/dist/types/packages/jobs/src/env.d.ts +78 -0
- package/dist/types/packages/jobs/src/handlers.d.ts +17 -0
- package/dist/types/packages/jobs/src/index.d.ts +5 -0
- package/dist/types/packages/jobs/src/input.d.ts +18 -0
- package/dist/types/packages/jobs/src/queue.d.ts +70 -0
- package/dist/types/packages/jobs/src/redis.d.ts +42 -0
- package/dist/types/packages/player/src/bundle.d.ts +4 -0
- package/dist/types/packages/player/src/canvas-runtime.d.ts +11 -0
- package/dist/types/packages/player/src/index.d.ts +29 -0
- package/dist/types/packages/react/src/index.d.ts +76 -0
- package/dist/types/packages/renderer/src/index.d.ts +35 -0
- package/dist/types/packages/renderer/src/pool.d.ts +7 -0
- package/dist/types/packages/renderer/src/video.d.ts +9 -0
- package/dist/types/packages/schema/src/captions.d.ts +24 -0
- package/dist/types/packages/schema/src/expression.d.ts +1 -0
- package/dist/types/packages/schema/src/index.d.ts +1213 -0
- package/dist/types/packages/schema/src/variables.d.ts +115 -0
- package/dist/types/packages/storage/src/index.d.ts +78 -0
- package/dist/types/packages/timeline/src/index.d.ts +104 -0
- package/package.json +78 -4
- package/skills/ove/SKILL.md +356 -0
- package/skills/ove-ai-compose/SKILL.md +36 -0
- package/skills/ove-batch-videos/SKILL.md +23 -0
- package/skills/ove-code-video/SKILL.md +68 -0
- package/skills/ove-effects/SKILL.md +65 -0
- package/skills/ove-make-reel/SKILL.md +30 -0
- package/skills/ove-voiceover-captions/SKILL.md +31 -0
- package/studio/assets/index-CzOvWv9w.css +1 -0
- package/studio/assets/index-J_fvKgng.js +11 -0
- package/studio/index.html +16 -0
- package/templates/case-study/composition.json +358 -0
- package/templates/case-study/template.json +8 -0
- package/templates/event-invite/composition.json +245 -0
- package/templates/event-invite/template.json +8 -0
- package/templates/explainer-square/composition.json +1335 -0
- package/templates/explainer-square/template.json +13 -0
- package/templates/keynote-wide/composition.json +1458 -0
- package/templates/keynote-wide/template.json +13 -0
- package/templates/launch-wide/composition.json +1306 -0
- package/templates/launch-wide/template.json +13 -0
- package/templates/product-card/composition.json +196 -0
- package/templates/product-card/data.example.json +5 -0
- package/templates/product-card/template.json +8 -0
- package/templates/product-wide/composition.json +1609 -0
- package/templates/product-wide/template.json +14 -0
- package/templates/quote-card/composition.json +123 -0
- package/templates/quote-card/template.json +8 -0
- package/templates/sale-promo/composition.json +290 -0
- package/templates/sale-promo/template.json +8 -0
- package/templates/showcase-tall/composition.json +1646 -0
- package/templates/showcase-tall/template.json +14 -0
- package/templates/slideshow/composition.json +167 -0
- package/templates/slideshow/template.json +8 -0
- package/templates/social-reel/composition.json +252 -0
- package/templates/social-reel/template.json +8 -0
- package/templates/starter/assets/logo.svg +4 -0
- package/templates/starter/composition.json +84 -0
- package/templates/story-tall/composition.json +1379 -0
- package/templates/story-tall/template.json +13 -0
- package/themes/espresso.json +15 -0
- package/themes/midnight.json +15 -0
- package/themes/neon.json +15 -0
- package/themes/paper.json +15 -0
- package/themes/signal.json +15 -0
package/dist/builder.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// packages/builder/src/index.ts
|
|
2
|
+
var layer = (type, options) => ({ type, ...options });
|
|
3
|
+
var text = (content, options = {}) => layer("text", { content, ...options });
|
|
4
|
+
var rect = (options) => layer("rect", options);
|
|
5
|
+
var circle = (options) => layer("circle", options);
|
|
6
|
+
var path = (d, options = {}) => layer("path", { d, ...options });
|
|
7
|
+
var image = (src, options = {}) => layer("image", { src, ...options });
|
|
8
|
+
var clip = (src, options = {}) => layer("video", { src, ...options });
|
|
9
|
+
var audio = (src, options = {}) => layer("audio", { src, ...options });
|
|
10
|
+
var sfx = (name, options = {}) => layer("audio", { src: `sfx:${name}`, ...options });
|
|
11
|
+
var group = (children, options = {}) => layer("group", { ...options, children });
|
|
12
|
+
var html = (markup, options) => layer("html", { html: markup, ...options });
|
|
13
|
+
var lottie = (src, options) => layer("lottie", { src, ...options });
|
|
14
|
+
var shader = (fragment, options) => layer("shader", { fragment, ...options });
|
|
15
|
+
var captions = (src, options = {}) => layer("captions", { src, ...options });
|
|
16
|
+
var use = (component, values = {}, options = {}) => ({ use: component, ...options, with: values });
|
|
17
|
+
var code = (draw, options) => layer("code", { code: typeof draw === "string" ? draw : `const draw = ${draw.toString()};`, ...options });
|
|
18
|
+
var keyframes = (property, frames, options = {}) => ({ property, keyframes: frames.map(([frame, value, easing]) => easing === void 0 ? { frame, value } : { frame, value, easing }), ...options });
|
|
19
|
+
var tween = (property, from, to, options = {}) => {
|
|
20
|
+
const frames = options.frames ?? 15, delay = options.delay ?? 0;
|
|
21
|
+
return keyframes(property, [...delay ? [[0, from]] : [], [delay, from, options.easing], [delay + frames, to]]);
|
|
22
|
+
};
|
|
23
|
+
var fadeIn = (frames = 12, delay = 0) => tween("opacity", 0, 1, { frames, delay });
|
|
24
|
+
var fadeOut = (atFrame, frames = 12) => keyframes("opacity", [[atFrame, 1], [atFrame + frames, 0]]);
|
|
25
|
+
var riseIn = (y, distance = 36, frames = 18, delay = 0) => [tween("y", y + distance, y, { frames, delay, easing: "land" }), fadeIn(Math.round(frames * 0.75), delay)];
|
|
26
|
+
var sample = (property, from, to, fn, options = {}) => {
|
|
27
|
+
const step = Math.max(1, Math.round(options.step ?? 2)), frames = [];
|
|
28
|
+
for (let f = from; f < to; f += step) frames.push([f, Math.round(fn(f) * 1e3) / 1e3]);
|
|
29
|
+
frames.push([to, Math.round(fn(to) * 1e3) / 1e3]);
|
|
30
|
+
return keyframes(property, frames);
|
|
31
|
+
};
|
|
32
|
+
function spring(options) {
|
|
33
|
+
const { fps = 30, damping = 10, stiffness = 100, mass = 1, from = 0, to = 1 } = options, t = Math.max(0, options.frame) / fps, w0 = Math.sqrt(stiffness / mass), z = damping / (2 * Math.sqrt(stiffness * mass));
|
|
34
|
+
const wd = w0 * Math.sqrt(Math.max(0, 1 - z * z));
|
|
35
|
+
const v = z < 1 ? 1 - Math.exp(-z * w0 * t) * (Math.cos(wd * t) + z * w0 / wd * Math.sin(wd * t)) : 1 - Math.exp(-w0 * t) * (1 + w0 * t);
|
|
36
|
+
return from + (to - from) * v;
|
|
37
|
+
}
|
|
38
|
+
var eases = { linear: (t) => t, easeIn: (t) => t * t * t, easeOut: (t) => 1 - (1 - t) ** 3, easeInOut: (t) => t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2 };
|
|
39
|
+
function interpolate(x, input, output, options = {}) {
|
|
40
|
+
if (input.length !== output.length || input.length < 2) throw new Error("interpolate needs two lists of the same length, at least two long");
|
|
41
|
+
let i = 1;
|
|
42
|
+
while (i < input.length - 1 && x > input[i]) i++;
|
|
43
|
+
let t = (x - input[i - 1]) / (input[i] - input[i - 1] || 1);
|
|
44
|
+
if (options.clamp !== false) t = Math.min(1, Math.max(0, t));
|
|
45
|
+
const ease = typeof options.easing === "function" ? options.easing : eases[options.easing ?? "linear"];
|
|
46
|
+
if (!ease) throw new Error(`Unknown easing "${String(options.easing)}"`);
|
|
47
|
+
return output[i - 1] + (output[i] - output[i - 1]) * (t >= 0 && t <= 1 ? ease(t) : t);
|
|
48
|
+
}
|
|
49
|
+
function createVideo(options) {
|
|
50
|
+
const fps = options.fps ?? 30, scenes = [], variables = {}, components = {}, assets = [];
|
|
51
|
+
let exportSettings;
|
|
52
|
+
const idMaker = (taken2 = /* @__PURE__ */ new Set()) => {
|
|
53
|
+
const counts = {};
|
|
54
|
+
const idFor = (type, wanted) => {
|
|
55
|
+
if (wanted !== void 0) {
|
|
56
|
+
if (taken2.has(wanted)) throw new Error(`The id "${wanted}" is used twice; ids must be unique`);
|
|
57
|
+
taken2.add(wanted);
|
|
58
|
+
return wanted;
|
|
59
|
+
}
|
|
60
|
+
let id;
|
|
61
|
+
do {
|
|
62
|
+
id = `${type}-${counts[type] = (counts[type] ?? 0) + 1}`;
|
|
63
|
+
} while (taken2.has(id));
|
|
64
|
+
taken2.add(id);
|
|
65
|
+
return id;
|
|
66
|
+
};
|
|
67
|
+
const withIds2 = (input) => {
|
|
68
|
+
const copy = { ...input };
|
|
69
|
+
const type = String(copy.type ?? (copy.use ? "use" : "layer"));
|
|
70
|
+
copy.id = idFor(type, copy.id);
|
|
71
|
+
if (Array.isArray(copy.children)) copy.children = copy.children.map(withIds2);
|
|
72
|
+
return copy;
|
|
73
|
+
};
|
|
74
|
+
return { taken: taken2, withIds: withIds2 };
|
|
75
|
+
};
|
|
76
|
+
const { taken, withIds } = idMaker();
|
|
77
|
+
const builder = {
|
|
78
|
+
fps,
|
|
79
|
+
width: options.width,
|
|
80
|
+
height: options.height,
|
|
81
|
+
frames: (seconds) => Math.round(seconds * fps),
|
|
82
|
+
scene(id, sceneOptions, build) {
|
|
83
|
+
const { seconds, duration, ...rest } = sceneOptions, durationFrames = duration ?? (seconds !== void 0 ? Math.round(seconds * fps) : void 0);
|
|
84
|
+
if (!durationFrames || durationFrames < 1) throw new Error(`Scene "${id}" needs a duration in frames or seconds`);
|
|
85
|
+
taken.add(id);
|
|
86
|
+
const layers = [], api = { layers, add: (...added) => {
|
|
87
|
+
for (const item of added.flat()) layers.push(withIds(item));
|
|
88
|
+
return api;
|
|
89
|
+
} };
|
|
90
|
+
if (Array.isArray(build)) api.add(...build);
|
|
91
|
+
else build(api);
|
|
92
|
+
scenes.push({ id, name: rest.name ?? id, ...rest, durationFrames, layers });
|
|
93
|
+
return builder;
|
|
94
|
+
},
|
|
95
|
+
variable(name, declaration) {
|
|
96
|
+
variables[name] = declaration;
|
|
97
|
+
return builder;
|
|
98
|
+
},
|
|
99
|
+
component(name, definition) {
|
|
100
|
+
const own = idMaker();
|
|
101
|
+
components[name] = { params: {}, ...definition, layers: definition.layers.map(own.withIds) };
|
|
102
|
+
return builder;
|
|
103
|
+
},
|
|
104
|
+
asset(id, asset) {
|
|
105
|
+
assets.push({ id, ...asset });
|
|
106
|
+
return builder;
|
|
107
|
+
},
|
|
108
|
+
export(settings) {
|
|
109
|
+
exportSettings = { ...exportSettings ?? {}, ...settings };
|
|
110
|
+
return builder;
|
|
111
|
+
},
|
|
112
|
+
toJSON() {
|
|
113
|
+
if (!scenes.length) throw new Error("A video needs at least one scene");
|
|
114
|
+
const motionBlur = options.motionBlur === true ? { samples: 4, shutter: 180 } : options.motionBlur || void 0;
|
|
115
|
+
return {
|
|
116
|
+
$schema: "./composition.schema.json",
|
|
117
|
+
version: "1.0",
|
|
118
|
+
id: options.id,
|
|
119
|
+
name: options.name ?? options.id,
|
|
120
|
+
width: options.width,
|
|
121
|
+
height: options.height,
|
|
122
|
+
fps,
|
|
123
|
+
durationFrames: options.durationSeconds !== void 0 ? Math.round(options.durationSeconds * fps) : "auto",
|
|
124
|
+
...options.background !== void 0 ? { background: options.background } : {},
|
|
125
|
+
...motionBlur ? { motionBlur } : {},
|
|
126
|
+
...options.tempo ? { tempo: options.tempo } : {},
|
|
127
|
+
...Object.keys(variables).length ? { variables } : {},
|
|
128
|
+
...Object.keys(components).length ? { components } : {},
|
|
129
|
+
...assets.length ? { assets } : {},
|
|
130
|
+
...exportSettings ? { export: exportSettings } : {},
|
|
131
|
+
scenes: structuredClone(scenes)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
return builder;
|
|
136
|
+
}
|
|
137
|
+
async function resolveBuildable(value) {
|
|
138
|
+
const resolved = typeof value === "function" ? await value() : value;
|
|
139
|
+
if (resolved && typeof resolved.toJSON === "function") return resolved.toJSON();
|
|
140
|
+
if (resolved && typeof resolved === "object") return resolved;
|
|
141
|
+
throw new Error("The file must export a video from createVideo(...), a composition object, or a function returning one");
|
|
142
|
+
}
|
|
143
|
+
export {
|
|
144
|
+
audio,
|
|
145
|
+
captions,
|
|
146
|
+
circle,
|
|
147
|
+
clip,
|
|
148
|
+
code,
|
|
149
|
+
createVideo,
|
|
150
|
+
fadeIn,
|
|
151
|
+
fadeOut,
|
|
152
|
+
group,
|
|
153
|
+
html,
|
|
154
|
+
image,
|
|
155
|
+
interpolate,
|
|
156
|
+
keyframes,
|
|
157
|
+
lottie,
|
|
158
|
+
path,
|
|
159
|
+
rect,
|
|
160
|
+
resolveBuildable,
|
|
161
|
+
riseIn,
|
|
162
|
+
sample,
|
|
163
|
+
sfx,
|
|
164
|
+
shader,
|
|
165
|
+
spring,
|
|
166
|
+
text,
|
|
167
|
+
tween,
|
|
168
|
+
use
|
|
169
|
+
};
|