Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Marketing: template covers fill their tiles, clear of the tile's labels

Adarsha865a329cb74
diff --git a/public/previews/templates/marketing/m2-line-reveal.jpg b/public/previews/templates/marketing/m2-line-reveal.jpg
index 2d8e484a..29b4cb11 100644
Binary files a/public/previews/templates/marketing/m2-line-reveal.jpg and b/public/previews/templates/marketing/m2-line-reveal.jpg differ
diff --git a/public/previews/templates/marketing/m2-line-reveal.mp4 b/public/previews/templates/marketing/m2-line-reveal.mp4
index 89e29e0e..0ff2accd 100644
Binary files a/public/previews/templates/marketing/m2-line-reveal.mp4 and b/public/previews/templates/marketing/m2-line-reveal.mp4 differ
diff --git a/public/previews/templates/marketing/m2-offer-badge.jpg b/public/previews/templates/marketing/m2-offer-badge.jpg
index a6b52937..684f1d33 100644
Binary files a/public/previews/templates/marketing/m2-offer-badge.jpg and b/public/previews/templates/marketing/m2-offer-badge.jpg differ
diff --git a/public/previews/templates/marketing/m2-offer-badge.mp4 b/public/previews/templates/marketing/m2-offer-badge.mp4
index 1dbca4c9..5cbdaaa6 100644
Binary files a/public/previews/templates/marketing/m2-offer-badge.mp4 and b/public/previews/templates/marketing/m2-offer-badge.mp4 differ
diff --git a/public/previews/templates/marketing/m2-retro-starburst.jpg b/public/previews/templates/marketing/m2-retro-starburst.jpg
index 90bbd0ef..e31ecf68 100644
Binary files a/public/previews/templates/marketing/m2-retro-starburst.jpg and b/public/previews/templates/marketing/m2-retro-starburst.jpg differ
diff --git a/public/previews/templates/marketing/m2-retro-starburst.mp4 b/public/previews/templates/marketing/m2-retro-starburst.mp4
index 94368e3c..03fb28e9 100644
Binary files a/public/previews/templates/marketing/m2-retro-starburst.mp4 and b/public/previews/templates/marketing/m2-retro-starburst.mp4 differ
diff --git a/public/previews/templates/marketing/ms-big-number.jpg b/public/previews/templates/marketing/ms-big-number.jpg
index de44ef09..ee1dcaf8 100644
Binary files a/public/previews/templates/marketing/ms-big-number.jpg and b/public/previews/templates/marketing/ms-big-number.jpg differ
diff --git a/public/previews/templates/marketing/ms-big-number.mp4 b/public/previews/templates/marketing/ms-big-number.mp4
index 67d1eca4..fa38d96b 100644
Binary files a/public/previews/templates/marketing/ms-big-number.mp4 and b/public/previews/templates/marketing/ms-big-number.mp4 differ
diff --git a/public/previews/templates/marketing/ms-dashboard-zoom.jpg b/public/previews/templates/marketing/ms-dashboard-zoom.jpg
index c1b0ab50..2f1a25dd 100644
Binary files a/public/previews/templates/marketing/ms-dashboard-zoom.jpg and b/public/previews/templates/marketing/ms-dashboard-zoom.jpg differ
diff --git a/public/previews/templates/marketing/ms-dashboard-zoom.mp4 b/public/previews/templates/marketing/ms-dashboard-zoom.mp4
index 681044c2..ed9f67dd 100644
Binary files a/public/previews/templates/marketing/ms-dashboard-zoom.mp4 and b/public/previews/templates/marketing/ms-dashboard-zoom.mp4 differ
diff --git a/public/previews/templates/marketing/ms-end-card.jpg b/public/previews/templates/marketing/ms-end-card.jpg
index 3b7b39ce..4911ecd1 100644
Binary files a/public/previews/templates/marketing/ms-end-card.jpg and b/public/previews/templates/marketing/ms-end-card.jpg differ
diff --git a/public/previews/templates/marketing/ms-end-card.mp4 b/public/previews/templates/marketing/ms-end-card.mp4
index db4e3097..4de79053 100644
Binary files a/public/previews/templates/marketing/ms-end-card.mp4 and b/public/previews/templates/marketing/ms-end-card.mp4 differ
diff --git a/public/previews/templates/marketing/ms-feature-cards.jpg b/public/previews/templates/marketing/ms-feature-cards.jpg
index 26453350..5f9d3b0c 100644
Binary files a/public/previews/templates/marketing/ms-feature-cards.jpg and b/public/previews/templates/marketing/ms-feature-cards.jpg differ
diff --git a/public/previews/templates/marketing/ms-feature-cards.mp4 b/public/previews/templates/marketing/ms-feature-cards.mp4
index 743f8b8d..5658a970 100644
Binary files a/public/previews/templates/marketing/ms-feature-cards.mp4 and b/public/previews/templates/marketing/ms-feature-cards.mp4 differ
diff --git a/public/previews/templates/marketing/ms-five-star-quote.jpg b/public/previews/templates/marketing/ms-five-star-quote.jpg
index 32be3027..b3b164a4 100644
Binary files a/public/previews/templates/marketing/ms-five-star-quote.jpg and b/public/previews/templates/marketing/ms-five-star-quote.jpg differ
diff --git a/public/previews/templates/marketing/ms-five-star-quote.mp4 b/public/previews/templates/marketing/ms-five-star-quote.mp4
index 67fb92db..c93bacb9 100644
Binary files a/public/previews/templates/marketing/ms-five-star-quote.mp4 and b/public/previews/templates/marketing/ms-five-star-quote.mp4 differ
diff --git a/public/previews/templates/marketing/ms-kinetic-headline.jpg b/public/previews/templates/marketing/ms-kinetic-headline.jpg
index bf13ba64..effc042f 100644
Binary files a/public/previews/templates/marketing/ms-kinetic-headline.jpg and b/public/previews/templates/marketing/ms-kinetic-headline.jpg differ
diff --git a/public/previews/templates/marketing/ms-kinetic-headline.mp4 b/public/previews/templates/marketing/ms-kinetic-headline.mp4
index 78df08e0..bbca2933 100644
Binary files a/public/previews/templates/marketing/ms-kinetic-headline.mp4 and b/public/previews/templates/marketing/ms-kinetic-headline.mp4 differ
diff --git a/public/previews/templates/marketing/ms-logo-sting.jpg b/public/previews/templates/marketing/ms-logo-sting.jpg
index 61115ddb..12593f0e 100644
Binary files a/public/previews/templates/marketing/ms-logo-sting.jpg and b/public/previews/templates/marketing/ms-logo-sting.jpg differ
diff --git a/public/previews/templates/marketing/ms-logo-sting.mp4 b/public/previews/templates/marketing/ms-logo-sting.mp4
index 8711397e..f3324fd9 100644
Binary files a/public/previews/templates/marketing/ms-logo-sting.mp4 and b/public/previews/templates/marketing/ms-logo-sting.mp4 differ
diff --git a/public/previews/templates/marketing/thumbs/m2-line-reveal.jpg b/public/previews/templates/marketing/thumbs/m2-line-reveal.jpg
index 9f5c6acf..b14a97a3 100644
Binary files a/public/previews/templates/marketing/thumbs/m2-line-reveal.jpg and b/public/previews/templates/marketing/thumbs/m2-line-reveal.jpg differ
diff --git a/public/previews/templates/marketing/thumbs/m2-offer-badge.jpg b/public/previews/templates/marketing/thumbs/m2-offer-badge.jpg
index d842c7ae..a066ec12 100644
Binary files a/public/previews/templates/marketing/thumbs/m2-offer-badge.jpg and b/public/previews/templates/marketing/thumbs/m2-offer-badge.jpg differ
diff --git a/public/previews/templates/marketing/thumbs/m2-retro-starburst.jpg b/public/previews/templates/marketing/thumbs/m2-retro-starburst.jpg
index 835f6bef..ff06d5f9 100644
Binary files a/public/previews/templates/marketing/thumbs/m2-retro-starburst.jpg and b/public/previews/templates/marketing/thumbs/m2-retro-starburst.jpg differ
diff --git a/public/previews/templates/marketing/thumbs/ms-big-number.jpg b/public/previews/templates/marketing/thumbs/ms-big-number.jpg
index 04a5c1ea..0f2641e7 100644
Binary files a/public/previews/templates/marketing/thumbs/ms-big-number.jpg and b/public/previews/templates/marketing/thumbs/ms-big-number.jpg differ
diff --git a/public/previews/templates/marketing/thumbs/ms-dashboard-zoom.jpg b/public/previews/templates/marketing/thumbs/ms-dashboard-zoom.jpg
index da5bc2dd..ade89139 100644
Binary files a/public/previews/templates/marketing/thumbs/ms-dashboard-zoom.jpg and b/public/previews/templates/marketing/thumbs/ms-dashboard-zoom.jpg differ
diff --git a/public/previews/templates/marketing/thumbs/ms-end-card.jpg b/public/previews/templates/marketing/thumbs/ms-end-card.jpg
index 2467a16c..8d5f579d 100644
Binary files a/public/previews/templates/marketing/thumbs/ms-end-card.jpg and b/public/previews/templates/marketing/thumbs/ms-end-card.jpg differ
diff --git a/public/previews/templates/marketing/thumbs/ms-feature-cards.jpg b/public/previews/templates/marketing/thumbs/ms-feature-cards.jpg
index df4cbf86..c4913a66 100644
Binary files a/public/previews/templates/marketing/thumbs/ms-feature-cards.jpg and b/public/previews/templates/marketing/thumbs/ms-feature-cards.jpg differ
diff --git a/public/previews/templates/marketing/thumbs/ms-five-star-quote.jpg b/public/previews/templates/marketing/thumbs/ms-five-star-quote.jpg
index 59f8baf8..95675144 100644
Binary files a/public/previews/templates/marketing/thumbs/ms-five-star-quote.jpg and b/public/previews/templates/marketing/thumbs/ms-five-star-quote.jpg differ
diff --git a/public/previews/templates/marketing/thumbs/ms-kinetic-headline.jpg b/public/previews/templates/marketing/thumbs/ms-kinetic-headline.jpg
index cfa25828..89ababfb 100644
Binary files a/public/previews/templates/marketing/thumbs/ms-kinetic-headline.jpg and b/public/previews/templates/marketing/thumbs/ms-kinetic-headline.jpg differ
diff --git a/public/previews/templates/marketing/thumbs/ms-logo-sting.jpg b/public/previews/templates/marketing/thumbs/ms-logo-sting.jpg
index 1d1a5867..038f0828 100644
Binary files a/public/previews/templates/marketing/thumbs/ms-logo-sting.jpg and b/public/previews/templates/marketing/thumbs/ms-logo-sting.jpg differ
diff --git a/src/lib/motion/scenes/end-card/shared.ts b/src/lib/motion/scenes/end-card/shared.ts
index f49ae3d3..368f352b 100644
--- a/src/lib/motion/scenes/end-card/shared.ts
+++ b/src/lib/motion/scenes/end-card/shared.ts
@@ -13,7 +13,7 @@ import { curve } from "../../ease";
import { layoutText, type Measure, type TextLayout } from "../../layout";
import type { Recipe } from "../../recipe";
import type { LogoInfo, Scene, SceneInput, ScenePlan } from "../../scene";
-import { designSize } from "../../sizes";
+import { designSize, TILE_CHIPS, tileCover } from "../../sizes";
import { frameCount } from "../../time";
import { timeline, scaleCues, type Cue, type Timeline } from "../../tween";
@@ -84,7 +84,7 @@ export function cardColours(theme: AdTheme, colors: readonly string[]): { ink: s
* sets the same sizes as a tall one; a tall card keeps its foot clear (where phone apps put their buttons and
* captions). Text is set as typed (layoutText); a stack too tall for the frame is reported, never squeezed.
*/
-export function endCardRest(p: { theme: AdTheme; content: EndCardContent; logo: { w: number; h: number } | null; measure: Measure; size: { w: number; h: number }; letters?: boolean; colors?: readonly string[] }): EndCardRest {
+export function endCardRest(p: { theme: AdTheme; content: EndCardContent; logo: { w: number; h: number } | null; measure: Measure; size: { w: number; h: number }; letters?: boolean; colors?: readonly string[]; clear?: { top: number; bottom: number } }): EndCardRest {
const { w: W, h: H } = p.size;
const t = p.theme;
const S = Math.min(W, H);
@@ -114,8 +114,12 @@ export function endCardRest(p: { theme: AdTheme; content: EndCardContent; logo:
let y = (H - total) / 2 - V * 0.03;
// A tall card keeps its bottom fifth clear.
if (H / W > 1.5) y = Math.min(y, H * 0.8 - total);
- const fits = y >= m - 0.5 && y + total <= H - m + 0.5;
- y = Math.max(m, y);
+ // Where the stack may go: inside the margins, and clear of what lies over the card (a gallery tile's chips).
+ const lo = Math.max(m, p.clear?.top ?? 0);
+ const hi = H - Math.max(m, p.clear?.bottom ?? 0);
+ if (p.clear) y = Math.max(lo, Math.min(y, hi - total));
+ const fits = y >= lo - 0.5 && y + total <= hi + 0.5;
+ y = Math.max(lo, y);
let logo: EndCardRest["logo"];
let brand: TextBlock | undefined;
@@ -348,7 +352,9 @@ export function endCardScene(variant: EndCardVariant, build: (c: StyleContext) =
plan(input: SceneInput): ScenePlan {
const design = designSize(input.recipe.size);
const { theme, content } = endCardFrom(input.recipe);
- const rest = endCardRest({ theme, content, logo: input.logo ? { w: input.logo.w, h: input.logo.h } : null, measure: input.measure, size: design, colors: input.recipe.brand.colors });
+ // A gallery tile's cover keeps the card clear of the tile's chips.
+ const clear = tileCover(input.recipe) ? { top: design.h * TILE_CHIPS.top, bottom: design.h * TILE_CHIPS.bottom } : undefined;
+ const rest = endCardRest({ theme, content, logo: input.logo ? { w: input.logo.w, h: input.logo.h } : null, measure: input.measure, size: design, colors: input.recipe.brand.colors, clear });
const style = build({ rest, input, second: secondColour(input.recipe.brand.colors, theme.accent) });
const k = timeScale(input.recipe.duration);
const lead = (style.lead ?? 0) * k;
diff --git a/src/lib/motion/scenes/marketing/kit.ts b/src/lib/motion/scenes/marketing/kit.ts
index 6091243d..46ecc143 100644
--- a/src/lib/motion/scenes/marketing/kit.ts
+++ b/src/lib/motion/scenes/marketing/kit.ts
@@ -12,7 +12,7 @@ import { curve, type CurveName } from "../../ease";
import { layoutText, type Measure, type TextLayout } from "../../layout";
import type { Recipe } from "../../recipe";
import type { Outline, Scene, SceneInput, ScenePlan } from "../../scene";
-import { designSize, type SizeSpec } from "../../sizes";
+import { designSize, TILE_CHIPS, tileCover, type SizeSpec } from "../../sizes";
import { frameCount, local } from "../../time";
import { DURATION_LIMITS, timeline, type EventKind, type MotionEvent, type StaggerUnit, type Timeline } from "../../tween";
import { cardColours, lineLeft, lineRun, lineRuns, secondColour, type TextBlock } from "../end-card/shared";
@@ -134,9 +134,10 @@ export function paletteFor(look: LookId, theme: AdTheme, colors: readonly string
* Where words may go: 6 % of the short side in from every edge; a tall 9:16 frame keeps its top 12 % and bottom 18 %
* clear for the platform's own buttons and captions.
*/
-export function safeArea(d: { w: number; h: number }): { x: number; y: number; w: number; h: number } {
+export function safeArea(d: { w: number; h: number }, tile = false): { x: number; y: number; w: number; h: number } {
const S = Math.min(d.w, d.h);
const side = Math.round(S * 0.06);
+ if (tile) return { x: side, y: Math.round(d.h * TILE_CHIPS.top), w: d.w - 2 * side, h: Math.round(d.h * (1 - TILE_CHIPS.top - TILE_CHIPS.bottom)) };
if (d.h / d.w > 1.7) return { x: side, y: Math.round(d.h * 0.12), w: d.w - 2 * side, h: Math.round(d.h * 0.7) };
return { x: side, y: side, w: d.w - 2 * side, h: d.h - 2 * side };
}
@@ -396,7 +397,7 @@ export function marketingScene(def: MarketingSceneDef): Scene {
measure: input.measure,
design,
S,
- safe: safeArea(design),
+ safe: safeArea(design, tileCover(recipe)),
theme,
palette: paletteFor(lookId, theme, recipe.brand.colors),
pace: paceOf(recipe.controls),
diff --git a/src/lib/motion/showcase.ts b/src/lib/motion/showcase.ts
index 112740cf..59573f8a 100644
--- a/src/lib/motion/showcase.ts
+++ b/src/lib/motion/showcase.ts
@@ -6,7 +6,7 @@
*/
import { DEFAULT_EXPORT, type Recipe } from "./recipe";
-import type { SizePreset } from "./sizes";
+import { TILE_COVER, type SizePreset } from "./sizes";
export interface ShowcaseBrand {
name: string;
@@ -46,28 +46,26 @@ export interface Showcase {
* fully set, before it gives way to the logo). By default the cover rests on the last frame.
*/
poster?: string;
- /**
- * The size its cover is made at, when not its own: a tall piece's cover is made at 4:5, so the gallery's 3:4 tile
- * shows all of it (a 9:16 frame cropped to 3:4 loses its top and its foot).
- */
- cover?: SizePreset;
}
/** Each code-drawn template's showcase, by template id. */
export const SHOWCASES: Record<string, Showcase> = {
- "ms-kinetic-headline": { brand: "lumen", size: "9:16", fields: { headline: "Invoices that *chase* themselves.", cta: "Start free", website: "lumenlabs.io" }, controls: { pace: "punchy", look: "dark", align: "centre" }, poster: "words.exit", cover: "4:5" },
- "m2-line-reveal": { brand: "ardent", size: "9:16", product: "perfume", fields: { headline: "Quietly exceptional.", cta: "Discover the scent" }, controls: { pace: "calm", look: "light", line: "fine" }, cover: "4:5" },
+ "ms-kinetic-headline": { brand: "lumen", size: "9:16", fields: { headline: "Invoices that *chase* themselves.", cta: "Start free", website: "lumenlabs.io" }, controls: { pace: "punchy", look: "dark", align: "centre" }, poster: "words.exit" },
+ "m2-line-reveal": { brand: "ardent", size: "9:16", product: "perfume", fields: { headline: "Quietly exceptional.", cta: "Discover the scent" }, controls: { pace: "calm", look: "light", line: "fine" } },
"ms-logo-sting": { brand: "lumen", size: "4:5", fields: { tagline: "Software that ships itself" }, controls: { pace: "punchy", look: "dark" } },
"ms-feature-cards": { brand: "ledgerly", size: "4:5", fields: { headline: "Month-end, minus the panic", point1: "Invoices that chase themselves", point2: "Payroll in two taps", point3: "Books that close on Friday" }, controls: { pace: "calm", look: "light" } },
"ms-dashboard-zoom": { brand: "ledgerly", size: "4:5", fields: { stat: "$1,284,000", label: "Revenue this quarter, up 38%" }, controls: { pace: "calm", look: "dark" } },
- "m2-retro-starburst": { brand: "vesper", size: "9:16", product: "heel", fields: { headline: "Made to be noticed.", badge: "New!" }, controls: { pace: "punchy", look: "brand" }, cover: "4:5" },
- "m2-offer-badge": { brand: "sora", size: "9:16", product: "perfume", fields: { offer: "20% off", headline: "The gifting edit", cta: "Shop the edit" }, controls: { pace: "punchy", look: "light" }, cover: "4:5" },
+ "m2-retro-starburst": { brand: "vesper", size: "9:16", product: "heel", fields: { headline: "Made to be noticed.", badge: "New!" }, controls: { pace: "punchy", look: "brand" } },
+ "m2-offer-badge": { brand: "sora", size: "9:16", product: "perfume", fields: { offer: "20% off", headline: "The gifting edit", cta: "Shop the edit" }, controls: { pace: "punchy", look: "light" } },
"ms-big-number": { brand: "ledgerly", size: "4:5", fields: { stat: "3×", caption: "faster month-end close" }, controls: { pace: "punchy", look: "brand" } },
"ms-five-star-quote": { brand: "sora", size: "4:5", fields: { quote: "“The only serum I’ve ever bought three times.”", name: "Amara K., verified buyer" }, controls: { pace: "calm", look: "light" } },
- "ms-end-card": { brand: "aurele", size: "9:16", scene: "end-card/draw-on", fields: { product: "Le Sérum Nuit", cta: "Discover the ritual", website: "aurele-paris.com" }, controls: { style: "draw-on", mark: "logo" }, cover: "4:5" },
+ "ms-end-card": { brand: "aurele", size: "9:16", scene: "end-card/draw-on", fields: { product: "Le Sérum Nuit", cta: "Discover the ritual", website: "aurele-paris.com" }, controls: { style: "draw-on", mark: "logo" } },
};
-/** A template's showcase as a full recipe (its scene, 30 fps, its own length; `cover`: at its cover's size). */
+/**
+ * A template's showcase as a full recipe (its scene, 30 fps, its own length). With `cover`: its gallery tile's cover,
+ * made at the tile's own shape (TILE_COVER) so nothing is cropped, with its words and product clear of the tile's chips.
+ */
export function showcaseRecipe(id: string, scene: string, duration = 5, o: { cover?: boolean } = {}): Recipe | null {
const s = SHOWCASES[id];
if (!s) return null;
@@ -78,13 +76,13 @@ export function showcaseRecipe(id: string, scene: string, duration = 5, o: { cov
v: 1,
scene: s.scene ?? scene,
seed: 7,
- size: (o.cover && s.cover) || s.size,
+ size: o.cover ? { ...TILE_COVER } : s.size,
fps: 30,
duration,
fields: s.brand === "aurele" ? { brand: b.name, ...s.fields } : { ...s.fields },
brand: { name: b.name, colors: [...b.colors], fonts: { ...b.fonts }, ...(logo && { logo }) },
...(s.product && { media: { product: SHOWCASE_PRODUCTS[s.product] } }),
- controls: { template: id, ...s.controls },
+ controls: { template: id, ...s.controls, ...(o.cover && { cover: "tile" }) },
export: DEFAULT_EXPORT,
};
}
diff --git a/src/lib/motion/sizes.ts b/src/lib/motion/sizes.ts
index ad4e4edd..b8f9d42f 100644
--- a/src/lib/motion/sizes.ts
+++ b/src/lib/motion/sizes.ts
@@ -14,6 +14,19 @@ export const SIZE_PRESETS: Record<SizePreset, { w: number; h: number; preview: {
"4:5": { w: 1080, h: 1350, preview: { w: 576, h: 720 } },
};
+/** The shape of Marketing's gallery tiles (3:4): a template's cover is made at it, so the tile shows all of it. */
+export const TILE_COVER = { w: 1080, h: 1440 } as const;
+
+/**
+ * A gallery tile's chips (its format top left, play top right, "Instant" bottom left) cover these shares of its height
+ * at the smallest tile (a 360 px phone), with a little room: a cover made for the tile (`tileCover`) keeps its words and
+ * its product between them.
+ */
+export const TILE_CHIPS = { top: 0.165, bottom: 0.15 } as const;
+
+/** Whether a recipe makes a gallery tile's cover (showcaseRecipe with `cover`). */
+export const tileCover = (r: { controls?: Record<string, unknown> }): boolean => r.controls?.cover === "tile";
+
/** The fps a clip may be made at (60 comes with the editor). */
export const FPS_CHOICES = [24, 25, 30] as const;
export const DEFAULT_FPS = 30;
diff --git a/src/lib/template-covers.generated.ts b/src/lib/template-covers.generated.ts
index 6e4b59b7..ac1926a2 100644
--- a/src/lib/template-covers.generated.ts
+++ b/src/lib/template-covers.generated.ts
@@ -25,19 +25,19 @@ export const TEMPLATE_COVERS: Record<string, TemplateCoverEntry> = {
"marketing/ad-five-stars": "93cc91cb",
"marketing/ad-hero-headline": "8ba3422e",
"marketing/m2-comic-panels": "5b751ae1",
- "marketing/m2-line-reveal": {"poster":"/previews/templates/marketing/m2-line-reveal.jpg?v=491dce17","video":"/previews/templates/marketing/m2-line-reveal.mp4?v=20ad54f8","at":4.958},
- "marketing/m2-offer-badge": {"poster":"/previews/templates/marketing/m2-offer-badge.jpg?v=9fc5d192","video":"/previews/templates/marketing/m2-offer-badge.mp4?v=eaf7a5ea","at":4.958},
+ "marketing/m2-line-reveal": {"poster":"/previews/templates/marketing/m2-line-reveal.jpg?v=69ce44a9","video":"/previews/templates/marketing/m2-line-reveal.mp4?v=d00a6a8b","at":4.958},
+ "marketing/m2-offer-badge": {"poster":"/previews/templates/marketing/m2-offer-badge.jpg?v=9a96109c","video":"/previews/templates/marketing/m2-offer-badge.mp4?v=4f99cf6a","at":4.958},
"marketing/m2-paper-parade": "a21bc137",
- "marketing/m2-retro-starburst": {"poster":"/previews/templates/marketing/m2-retro-starburst.jpg?v=acaa97da","video":"/previews/templates/marketing/m2-retro-starburst.mp4?v=62109bf0","at":4.958},
+ "marketing/m2-retro-starburst": {"poster":"/previews/templates/marketing/m2-retro-starburst.jpg?v=4927388c","video":"/previews/templates/marketing/m2-retro-starburst.mp4?v=7c2383bd","at":4.958},
"marketing/m2-sticker-pop": "eb15d9a1",
"marketing/mk-clean-listing": "875102cc",
- "marketing/ms-big-number": {"poster":"/previews/templates/marketing/ms-big-number.jpg?v=3e1010ed","video":"/previews/templates/marketing/ms-big-number.mp4?v=3c367720","at":4.958},
- "marketing/ms-dashboard-zoom": {"poster":"/previews/templates/marketing/ms-dashboard-zoom.jpg?v=f0ad33cd","video":"/previews/templates/marketing/ms-dashboard-zoom.mp4?v=167a025e","at":4.958},
- "marketing/ms-end-card": {"poster":"/previews/templates/marketing/ms-end-card.jpg?v=58ec3d0b","video":"/previews/templates/marketing/ms-end-card.mp4?v=f94937c8","at":2.458},
- "marketing/ms-feature-cards": {"poster":"/previews/templates/marketing/ms-feature-cards.jpg?v=6fbd49de","video":"/previews/templates/marketing/ms-feature-cards.mp4?v=d712e5b3","at":4.958},
- "marketing/ms-five-star-quote": {"poster":"/previews/templates/marketing/ms-five-star-quote.jpg?v=98ffea8f","video":"/previews/templates/marketing/ms-five-star-quote.mp4?v=5683f816","at":4.958},
- "marketing/ms-kinetic-headline": {"poster":"/previews/templates/marketing/ms-kinetic-headline.jpg?v=05317779","video":"/previews/templates/marketing/ms-kinetic-headline.mp4?v=39b0f451","at":2.167},
- "marketing/ms-logo-sting": {"poster":"/previews/templates/marketing/ms-logo-sting.jpg?v=5ae33292","video":"/previews/templates/marketing/ms-logo-sting.mp4?v=013ae409","at":4.958},
+ "marketing/ms-big-number": {"poster":"/previews/templates/marketing/ms-big-number.jpg?v=2253282e","video":"/previews/templates/marketing/ms-big-number.mp4?v=a68c4477","at":4.958},
+ "marketing/ms-dashboard-zoom": {"poster":"/previews/templates/marketing/ms-dashboard-zoom.jpg?v=9f6863e1","video":"/previews/templates/marketing/ms-dashboard-zoom.mp4?v=90300e75","at":4.958},
+ "marketing/ms-end-card": {"poster":"/previews/templates/marketing/ms-end-card.jpg?v=a445714e","video":"/previews/templates/marketing/ms-end-card.mp4?v=b706f02c","at":2.458},
+ "marketing/ms-feature-cards": {"poster":"/previews/templates/marketing/ms-feature-cards.jpg?v=0adfaea1","video":"/previews/templates/marketing/ms-feature-cards.mp4?v=db6c688f","at":4.958},
+ "marketing/ms-five-star-quote": {"poster":"/previews/templates/marketing/ms-five-star-quote.jpg?v=5a4d1301","video":"/previews/templates/marketing/ms-five-star-quote.mp4?v=af449d3c","at":4.958},
+ "marketing/ms-kinetic-headline": {"poster":"/previews/templates/marketing/ms-kinetic-headline.jpg?v=d9ff2197","video":"/previews/templates/marketing/ms-kinetic-headline.mp4?v=aea37133","at":2.167},
+ "marketing/ms-logo-sting": {"poster":"/previews/templates/marketing/ms-logo-sting.jpg?v=46c7b096","video":"/previews/templates/marketing/ms-logo-sting.mp4?v=bf3836cc","at":4.958},
"marketing/po-retro-sunburst": "4c19058c",
"marketing/po-riso-bloom": "69f64638",
"marketing/po-swiss-grid": "3c9c9370",
diff --git a/tests/kinetic-covers.test.ts b/tests/kinetic-covers.test.ts
new file mode 100644
index 00000000..175dfbea
--- /dev/null
+++ b/tests/kinetic-covers.test.ts
@@ -0,0 +1,115 @@
+import { describe, expect, it } from "vitest";
+import { isCodeTemplate, TEMPLATES } from "@/lib/catalog/marketing";
+import { IDENTITY, multiply, type DisplayNode, type Matrix } from "@/lib/motion/display";
+import { loadScene } from "@/lib/motion/registry";
+import type { ScenePlan } from "@/lib/motion/scene";
+import { SHOWCASES, showcaseRecipe } from "@/lib/motion/showcase";
+import { designSize, TILE_CHIPS, TILE_COVER } from "@/lib/motion/sizes";
+import { measure, RASTER_LOGO } from "./helpers/motion";
+
+// The covers of Marketing's code-drawn templates (scripts/kinetic/render-covers.mjs): each is made at the gallery
+// tile's own shape, keeps its words and its picture clear of the tile's chips, and rests on a settled frame (nothing
+// moving, nothing half in).
+
+const CODE = TEMPLATES.filter(isCodeTemplate);
+
+interface Item {
+ kind: "text" | "image";
+ what: string;
+ alpha: number;
+ box: { x0: number; y0: number; x1: number; y1: number };
+}
+
+const apply = (m: Matrix, x: number, y: number): [number, number] => [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]];
+
+function boxOf(m: Matrix, x: number, y: number, w: number, h: number) {
+ const pts = [apply(m, x, y), apply(m, x + w, y), apply(m, x, y + h), apply(m, x + w, y + h)];
+ return { x0: Math.min(...pts.map((p) => p[0])), y0: Math.min(...pts.map((p) => p[1])), x1: Math.max(...pts.map((p) => p[0])), y1: Math.max(...pts.map((p) => p[1])) };
+}
+
+/** Every text run and picture, placed in design units, with the opacity it is drawn at. */
+function items(nodes: readonly DisplayNode[], m: Matrix = IDENTITY, alpha = 1, out: Item[] = []): Item[] {
+ for (const n of nodes) {
+ const a = alpha * (n.opacity ?? 1);
+ if (n.type === "group") items(n.children, n.transform ? multiply(m, n.transform) : m, a, out);
+ else if (n.type === "text") {
+ for (const r of n.runs) {
+ if (!r.text.trim()) continue;
+ const size = Number(/(\d+(\.\d+)?)px/.exec(r.font)![1]);
+ const rm = r.transform ? multiply(m, r.transform) : m;
+ out.push({ kind: "text", what: `${n.field} "${r.text}"`, alpha: a * (r.opacity ?? 1), box: boxOf(rm, r.x, r.y, measure(r.text, r.font), size) });
+ }
+ } else if (n.type === "image") out.push({ kind: "image", what: n.src, alpha: a, box: boxOf(m, n.x, n.y, n.w, n.h) });
+ }
+ return out;
+}
+
+/** Where a cover rests, as render-covers.mjs sets it: a little before its `poster` event, else its last frame. */
+function coverRest(id: string, plan: ScenePlan): number {
+ const event = SHOWCASES[id].poster;
+ if (!event) return plan.rest;
+ const e = plan.timeline.events.find((x) => x.id === event);
+ return e ? Math.max(0, Math.round((e.start - 0.08) * 100) / 100) : plan.rest;
+}
+
+const covers = await Promise.all(
+ CODE.map(async (t) => {
+ const recipe = showcaseRecipe(t.id, t.scene!, t.lengths?.default ?? t.duration ?? 5, { cover: true })!;
+ const scene = await loadScene(recipe.scene);
+ const plan = scene.plan({ recipe, measure, logo: RASTER_LOGO, images: recipe.media?.product ? { product: { w: 800, h: 1000 } } : undefined, outlines: {} });
+ return { id: t.id, recipe, plan, rest: coverRest(t.id, plan) };
+ }),
+);
+
+describe("a code-drawn template's cover", () => {
+ it("is made at the gallery tile's shape, and its words fit", () => {
+ for (const c of covers) {
+ expect(c.recipe.size, c.id).toEqual(TILE_COVER);
+ expect(c.plan.design, c.id).toEqual(designSize(TILE_COVER));
+ expect(c.plan.overflow, c.id).toEqual([]);
+ }
+ });
+
+ it("keeps its words and its picture clear of the tile's chips and inside the frame", () => {
+ for (const c of covers) {
+ const { w, h } = c.plan.design;
+ const found = items(c.plan.evaluate(c.rest).nodes);
+ expect(found.some((i) => i.kind === "text") || found.some((i) => i.what === "logo"), c.id).toBe(true);
+ for (const i of found) {
+ const tag = `${c.id} ${i.what}`;
+ expect(i.box.y0, tag).toBeGreaterThanOrEqual(h * TILE_CHIPS.top - 1);
+ expect(i.box.y1, tag).toBeLessThanOrEqual(h * (1 - TILE_CHIPS.bottom) + 1);
+ expect(i.box.x0, tag).toBeGreaterThanOrEqual(-1);
+ expect(i.box.x1, tag).toBeLessThanOrEqual(w + 1);
+ }
+ }
+ });
+
+ it("rests on a settled frame: no move under way, everything fully in, and still from the frame before", () => {
+ for (const c of covers) {
+ for (const e of c.plan.timeline.events) {
+ if (e.kind === "camera") continue;
+ const running = e.start < c.rest - 1e-6 && e.start + e.dur > c.rest + 1e-6;
+ expect(running, `${c.id} ${e.id} runs ${e.start}-${e.start + e.dur} at ${c.rest}`).toBe(false);
+ }
+ const now = items(c.plan.evaluate(c.rest).nodes);
+ // The cover's clip runs at 24 fps: the frame before it on the tile.
+ const before = items(c.plan.evaluate(c.rest - 1 / 24).nodes);
+ expect(before.map((i) => i.what), c.id).toEqual(now.map((i) => i.what));
+ now.forEach((i, k) => {
+ expect(i.alpha, `${c.id} ${i.what}`).toBe(1);
+ const b = before[k].box;
+ const moved = Math.max(Math.abs(b.x0 - i.box.x0), Math.abs(b.y0 - i.box.y0), Math.abs(b.x1 - i.box.x1), Math.abs(b.y1 - i.box.y1));
+ expect(moved, `${c.id} ${i.what} moves ${moved.toFixed(2)} design px in the frame before its rest`).toBeLessThan(0.75);
+ });
+ }
+ });
+
+ it("keeps the template's own frame free of the tile's room (only its cover makes it)", async () => {
+ for (const t of CODE) {
+ const recipe = showcaseRecipe(t.id, t.scene!, 5)!;
+ expect(recipe.controls?.cover, t.id).toBeUndefined();
+ expect(typeof recipe.size, t.id).toBe("string");
+ }
+ });
+});