@softure-ai/marketing-kit 0.32.0 → 0.34.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +21 -0
  3. package/dist/footage/camera.d.ts +67 -0
  4. package/dist/footage/camera.d.ts.map +1 -0
  5. package/dist/footage/camera.js +89 -0
  6. package/dist/footage/camera.js.map +1 -0
  7. package/dist/footage/compose.d.ts +6 -1
  8. package/dist/footage/compose.d.ts.map +1 -1
  9. package/dist/footage/compose.js +31 -9
  10. package/dist/footage/compose.js.map +1 -1
  11. package/dist/footage/draft-overlays.d.ts.map +1 -1
  12. package/dist/footage/draft-overlays.js +103 -27
  13. package/dist/footage/draft-overlays.js.map +1 -1
  14. package/dist/footage/draft.d.ts +10 -2
  15. package/dist/footage/draft.d.ts.map +1 -1
  16. package/dist/footage/draft.js +25 -28
  17. package/dist/footage/draft.js.map +1 -1
  18. package/dist/footage/edl.d.ts +28 -0
  19. package/dist/footage/edl.d.ts.map +1 -1
  20. package/dist/footage/edl.js +24 -0
  21. package/dist/footage/edl.js.map +1 -1
  22. package/dist/footage/overlay-html.d.ts.map +1 -1
  23. package/dist/footage/overlay-html.js +81 -22
  24. package/dist/footage/overlay-html.js.map +1 -1
  25. package/dist/footage/overlay-schema.d.ts +23 -2
  26. package/dist/footage/overlay-schema.d.ts.map +1 -1
  27. package/dist/footage/overlay-schema.js +28 -3
  28. package/dist/footage/overlay-schema.js.map +1 -1
  29. package/dist/footage/overlays.d.ts +26 -1
  30. package/dist/footage/overlays.d.ts.map +1 -1
  31. package/dist/footage/overlays.js +116 -14
  32. package/dist/footage/overlays.js.map +1 -1
  33. package/dist/footage/picture.d.ts +3 -0
  34. package/dist/footage/picture.d.ts.map +1 -1
  35. package/dist/footage/picture.js +15 -11
  36. package/dist/footage/picture.js.map +1 -1
  37. package/dist/index.d.ts +5 -4
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +5 -4
  40. package/dist/index.js.map +1 -1
  41. package/package.json +1 -1
  42. package/schema/edl.schema.json +79 -2
  43. package/src/footage/camera.ts +129 -0
  44. package/src/footage/compose.ts +30 -10
  45. package/src/footage/draft-overlays.ts +123 -26
  46. package/src/footage/draft.ts +29 -29
  47. package/src/footage/edl.ts +24 -0
  48. package/src/footage/overlay-html.ts +85 -22
  49. package/src/footage/overlay-schema.ts +40 -4
  50. package/src/footage/overlays.ts +149 -15
  51. package/src/footage/picture.ts +17 -11
  52. package/src/index.ts +29 -0
@@ -25,6 +25,8 @@ import {
25
25
  estimateTextWidth,
26
26
  formatOverlayNumber,
27
27
  getDrawnOverlayCard,
28
+ getListCardsByItem,
29
+ getListItemTimes,
28
30
  getOverlayPadding,
29
31
  getPlaceCardPinRow,
30
32
  getPlaceCardPinSize,
@@ -331,16 +333,24 @@ function getOwnCardRadius(overlay: Pick<ResolvedOverlay, "kind">, box: { height:
331
333
  * fill and border (`getDraftBoxEvents`), at the brand style's corner or the overlay's own (`getDraftCardRadius`); a
332
334
  * wipe's accent panel over it.
333
335
  */
334
- function getCardShapeEvents(overlay: Exclude<ResolvedOverlay, { kind: "punch_in" }>, box: OverlayBox, fontSize: number, colors: { background: string; accent: string }, motion: DraftMotion, context: DraftContext): string[] {
336
+ function getCardShapeEvents(
337
+ overlay: Exclude<ResolvedOverlay, { kind: "punch_in" }>,
338
+ box: OverlayBox,
339
+ fontSize: number,
340
+ colors: { background: string; accent: string },
341
+ motion: DraftMotion,
342
+ context: DraftContext,
343
+ span: ShapeSpan = { start: overlay.start, end: overlay.end, isFirst: true, isLast: true },
344
+ ): string[] {
335
345
  const radius = getDraftCardRadius(overlay, box, context, getOwnCardRadius(overlay, box, fontSize));
336
346
  const drawing = getRoundedRectDrawing(box, radius);
337
- const panel = getWipePanelEvent(overlay, drawing, colors.accent, motion);
338
- if (context.style === undefined) return [getShapeEvent(overlay, drawing, colors.background, motion), ...panel];
339
- const at = { isFirst: true, isLast: true, ms: toMs(overlay.end - overlay.start) };
347
+ const panel = span.isFirst ? getWipePanelEvent(span, drawing, colors.accent, motion) : [];
348
+ if (context.style === undefined) return [getShapeEvent(span, drawing, colors.background, motion, 3, span), ...panel];
349
+ const at = { isFirst: span.isFirst, isLast: span.isLast, ms: toMs(span.end - span.start) };
340
350
  const { position, rest } = getMotionTags(motion, { ...at, pos: { x: 0, y: 0 }, part: "card" });
341
351
  const events = getDraftBoxEvents({
342
352
  layer: 3,
343
- at: `${toAssTime(overlay.start)},${toAssTime(overlay.end)}`,
353
+ at: `${toAssTime(span.start)},${toAssTime(span.end)}`,
344
354
  styleName: "OverlayShape",
345
355
  box,
346
356
  radius,
@@ -387,48 +397,135 @@ function getUnderlineEvent(overlay: Extract<ResolvedOverlay, { kind: "keyword" }
387
397
  * come in one by one; a keyword's underline is drawn once it is in.
388
398
  */
389
399
  function getSideTextEvents(overlay: Extract<ResolvedOverlay, { kind: "keyword" | "lower_third" | "list" }>, context: DraftContext): string[] {
400
+ if (overlay.kind === "list") return getListEvents(overlay, context);
390
401
  const colors = getOverlayColors(overlay, context.brand);
391
402
  const { fontSize, side } = overlay;
392
403
  // A side text always has a card: only a punch_in has none.
393
404
  const card = getDrawnOverlayCard(overlay) as OverlayBox;
394
405
  const { x: padX, y: padY } = getOverlayPadding(overlay);
395
- const isRight = side === "right";
396
- const x = isRight ? card.left + card.width - padX : card.left + padX;
406
+ const isCentred = overlay.kind === "keyword" && overlay.isCentred === true;
407
+ const isRight = !isCentred && side === "right";
408
+ const x = isCentred ? card.left + card.width / 2 : isRight ? card.left + card.width - padX : card.left + padX;
397
409
  const isFoot = overlay.kind === "lower_third";
398
410
  const y = isFoot ? card.top + card.height - padY : card.top + padY;
399
- // \an: 7 top left, 9 top right, 1 bottom left, 3 bottom right.
400
- const align = isFoot ? (isRight ? 3 : 1) : isRight ? 9 : 7;
411
+ // \an: 7 top left, 8 top centre, 9 top right, 1 bottom left, 3 bottom right.
412
+ const align = isFoot ? (isRight ? 3 : 1) : isCentred ? 8 : isRight ? 9 : 7;
401
413
  const motion = getDraftMotion(overlay, overlay.entrance === null || overlay.entrance === "type" ? "fade" : overlay.entrance, card, context);
402
414
  const span = { start: overlay.start, end: overlay.end };
403
415
  const tags = `\\an${align}\\fs${fontSize}${getTextTags(overlay, colors, context, OVERLAY_FONT_ROLES[overlay.kind])}`;
404
416
  const text = (pos: OverlayPoint, steps: TextStep[], own = motion) => getTextEvents({ layer: 4, style: "OverlayPlain", pos, tags, steps, motion: own });
405
417
  const shape = getCardShapeEvents(overlay, card, fontSize, colors, motion, context);
406
- if (overlay.kind === "list") {
407
- // One event per point, on the render's line height (libass's own line spacing is tighter); a staggered point from its second.
408
- const step = fontSize * OVERLAY_LIST_LINE_HEIGHT;
409
- const lead = (step - fontSize * OVERLAY_LINE_HEIGHT) / 2;
410
- return [
411
- ...shape,
412
- ...getSideTextLines(overlay).flatMap((line, index) => {
413
- const from = overlay.itemStarts?.[index];
414
- const pos = { x, y: y + lead + index * step };
415
- return from === undefined ? text(pos, [{ from: span.start, to: span.end, text: toAssText(line) }]) : text(pos, [{ from, to: span.end, text: toAssText(line) }], withFadeEntrance(motion));
416
- }),
417
- ];
418
- }
419
418
  // A keyword or a lower third types in only when its entrance says so.
420
- const steps = overlay.entrance === null ? [{ from: span.start, to: span.end, text: toAssText(overlay.text) }] : getTypedSteps(overlay.text, span, overlay.typing);
419
+ const steps = overlay.entrance === null ? [{ from: span.start, to: span.end, text: toAssText(overlay.text) }] : getTypedSteps(overlay.text, span, overlay.typing, isCentred);
421
420
  return [...shape, ...text({ x, y }, steps), ...(overlay.kind === "keyword" ? getUnderlineEvent(overlay, card, colors.accent, motion) : [])];
422
421
  }
423
422
 
423
+ /** A list's card grows to its next point's size over these seconds, in this many steps along the render's ease. */
424
+ const LIST_GROW_SECONDS = 0.35;
425
+ const LIST_GROW_STEPS = 3;
426
+
427
+ /** A clip from a card to the next card it grows to, eased out over the growth (an ASS `\\t` with its acceleration under 1). */
428
+ function getGrowClip(from: OverlayBox, to: OverlayBox): string {
429
+ const rect = (box: OverlayBox) => toClip({ x0: r0(box.left), y0: r0(box.top), x1: r0(box.left + box.width), y1: r0(box.top + box.height) });
430
+ return `${rect(from)}\\t(0,${toMs(LIST_GROW_SECONDS)},0.4,${rect(to)})`;
431
+ }
432
+
433
+ /** A box part of the way (`share`, 0 to 1) from `from` to `to`, in whole px. */
434
+ function getBoxBetween(from: OverlayBox, to: OverlayBox, share: number): OverlayBox {
435
+ const at = (a: number, b: number) => r0(a + (b - a) * share);
436
+ return { left: at(from.left, to.left), top: at(from.top, to.top), width: at(from.width, to.width), height: at(from.height, to.height) };
437
+ }
438
+
439
+ /**
440
+ * A list's card shapes over time: one card per distinct second its points come in, each easing from the last one's size
441
+ * in `LIST_GROW_STEPS` steps along the render's `power3.out`; the first takes the entrance, the last the exit.
442
+ */
443
+ function getStackShapeEvents(overlay: Extract<ResolvedOverlay, { kind: "list" }>, times: readonly number[], colors: OverlayColors, context: DraftContext): string[] {
444
+ const cards = getListCardsByItem(overlay).map((boxes) => boxes[0] as OverlayBox);
445
+ // The card shown from each distinct second: the one fitted to every point in by then.
446
+ const stops = times.flatMap((at, index) => (times[index + 1] === at ? [] : [{ at, card: cards[index] as OverlayBox }]));
447
+ const name = overlay.entrance === null || overlay.entrance === "type" ? "fade" : overlay.entrance;
448
+ const parts = stops.flatMap((stop, index) => {
449
+ const previous = stops[index - 1];
450
+ if (previous === undefined) return [{ start: stop.at, card: stop.card }];
451
+ return Array.from({ length: LIST_GROW_STEPS }, (_step, step) => {
452
+ const share = (step + 1) / LIST_GROW_STEPS;
453
+ return { start: stop.at + (step * LIST_GROW_SECONDS) / LIST_GROW_STEPS, card: step === LIST_GROW_STEPS - 1 ? stop.card : getBoxBetween(previous.card, stop.card, OVERLAY_EASES["power3.out"](share)) };
454
+ });
455
+ });
456
+ const visible = parts.filter((part, index) => part.start < overlay.end && (parts[index + 1]?.start ?? overlay.end) > part.start);
457
+ return visible.flatMap((part, index) => {
458
+ const end = Math.min(overlay.end, visible[index + 1]?.start ?? overlay.end);
459
+ const motion = getDraftMotion(overlay, name, index === 0 ? part.card : (cards[cards.length - 1] as OverlayBox), context);
460
+ return getCardShapeEvents(overlay, part.card, overlay.fontSize, colors, motion, context, { start: part.start, end, isFirst: index === 0, isLast: index === visible.length - 1 });
461
+ });
462
+ }
463
+
464
+ /**
465
+ * A list (RV-144 of an adopting app): a stack, its card coming in with its first point and growing to each next one,
466
+ * its lines centred in the card (a centred stack) or from its side with their bullets; or chips, one card per point in
467
+ * its final place, each entering on its own second. A point after the first fades in from its second.
468
+ */
469
+ function getListEvents(overlay: Extract<ResolvedOverlay, { kind: "list" }>, context: DraftContext): string[] {
470
+ const colors = getOverlayColors(overlay, context.brand);
471
+ const { fontSize } = overlay;
472
+ const pad = getOverlayPadding(overlay);
473
+ const times = getListItemTimes(overlay);
474
+ const name = overlay.entrance === null || overlay.entrance === "type" ? "fade" : overlay.entrance;
475
+ const textTags = getTextTags(overlay, colors, context, OVERLAY_FONT_ROLES.list);
476
+ const lines = getSideTextLines(overlay);
477
+ const write = (pos: OverlayPoint, align: number, steps: TextStep[], motion: DraftMotion, clip = "") =>
478
+ getTextEvents({ layer: 4, style: "OverlayPlain", pos, tags: `\\an${align}\\fs${fontSize}${textTags}${clip}`, steps, motion });
479
+ if (overlay.chips !== undefined) {
480
+ return overlay.chips.flatMap((chip, index) => {
481
+ const from = times[index] as number;
482
+ const motion = getDraftMotion(overlay, name, chip, context);
483
+ const span = { start: from, end: overlay.end, isFirst: true, isLast: true };
484
+ const pos = { x: chip.left + chip.width / 2, y: chip.top + pad.y };
485
+ return [...getCardShapeEvents(overlay, chip, fontSize, colors, motion, context, span), ...write(pos, 8, [{ from, to: overlay.end, text: toAssText(lines[index] as string) }], motion)];
486
+ });
487
+ }
488
+ // The text sits on the whole list's card: centred on its axis, or from its side.
489
+ const card = getDrawnOverlayCard(overlay) as OverlayBox;
490
+ const isCentred = overlay.isCentred === true;
491
+ const isRight = !isCentred && overlay.side === "right";
492
+ const x = isCentred ? card.left + card.width / 2 : isRight ? card.left + card.width - pad.x : card.left + pad.x;
493
+ const align = isCentred ? 8 : isRight ? 9 : 7;
494
+ // One event per point, on the render's line height (libass's own line spacing is tighter).
495
+ const step = fontSize * OVERLAY_LIST_LINE_HEIGHT;
496
+ const lead = (step - fontSize * OVERLAY_LINE_HEIGHT) / 2;
497
+ const motion = getDraftMotion(overlay, name, card, context);
498
+ const cards = getListCardsByItem(overlay).map((boxes) => boxes[0] as OverlayBox);
499
+ return [
500
+ ...getStackShapeEvents(overlay, times, colors, context),
501
+ ...lines.flatMap((line, index) => {
502
+ const from = times[index] as number;
503
+ const pos = { x, y: card.top + pad.y + lead + index * step };
504
+ if (from <= overlay.start) return write(pos, align, [{ from, to: overlay.end, text: toAssText(line) }], motion);
505
+ // A later point shows only inside its card as the card grows to it, as the render's card clips it (a wipe's exit clips on its own).
506
+ const previous = cards[times.findIndex((at) => at === from) - 1] as OverlayBox;
507
+ const clip = motion.exit.kind === "wipe" ? "" : getGrowClip(previous, cards[index] as OverlayBox);
508
+ return write(pos, align, [{ from, to: overlay.end, text: toAssText(line) }], withFadeEntrance(motion), clip);
509
+ }),
510
+ ];
511
+ }
512
+
424
513
  type CardOverlay = Extract<ResolvedOverlay, { kind: "hook_title" | "search_bar" | "place_card" | "counter" | "date_stamp" }>;
425
514
 
426
515
  /** Each card's own entrance when the overlay names none (a typed card fades its card in). */
427
516
  const DEFAULT_ENTRANCES = { hook_title: "slide", search_bar: "fade", place_card: "slide", counter: "fade", date_stamp: "fade" } as const;
428
517
 
429
- /** A drawing event in the overlay's card colour (or accent), with the overlay's motion. */
430
- function getShapeEvent(overlay: Pick<ResolvedOverlay, "start" | "end">, drawing: string, colour: string, motion: DraftMotion, layer = 3): string {
431
- const at = { isFirst: true, isLast: true, ms: toMs(overlay.end - overlay.start) };
518
+ /** The stretch one drawn card shows for: its seconds, and whether it takes the entrance (first) and the exit (last). */
519
+ interface ShapeSpan {
520
+ start: number;
521
+ end: number;
522
+ isFirst: boolean;
523
+ isLast: boolean;
524
+ }
525
+
526
+ /** A drawing event in the overlay's card colour (or accent), with the overlay's motion (or a part of it, `span`). */
527
+ function getShapeEvent(overlay: Pick<ResolvedOverlay, "start" | "end">, drawing: string, colour: string, motion: DraftMotion, layer = 3, span?: ShapeSpan): string {
528
+ const at = { isFirst: span?.isFirst ?? true, isLast: span?.isLast ?? true, ms: toMs(overlay.end - overlay.start) };
432
529
  const { position, rest } = getMotionTags(motion, { ...at, pos: { x: 0, y: 0 }, part: "card" });
433
530
  return `Dialogue: ${layer},${toAssTime(overlay.start)},${toAssTime(overlay.end)},OverlayShape,,0,0,0,,{\\an7${position}${rest}${getBlurTags(motion, at, 0)}\\1c${toTagColor(colour)}\\p1}${drawing}{\\p0}`;
434
531
  }
@@ -8,7 +8,8 @@ import { err, ok } from "./failure.js";
8
8
  import type { TimedWord } from "../voice/voiceover.js";
9
9
  import { CAPTION_HIGHLIGHT_BOX_PADDING_EM, CAPTION_HIGHLIGHT_SECONDS, CAPTION_UNDERLINE_EM, getCaptionHighlight, type CaptionHighlightLook } from "./caption-highlight.js";
10
10
  import { getCaptionChunkLayouts, getCaptionSpans, getFootageCaptionChunks, getFootageCaptionLayout, isSameCaptionPlace, type CaptionWordsFilm } from "./captions.js";
11
- import { getSegmentScales, getSegmentZoomEases } from "./compose.js";
11
+ import { getCameraMoveFrames, getCameraOrigin, getCameraScaleExpression, type CameraAnchor, type EdlCamera } from "./camera.js";
12
+ import { getSegmentFadeFrames, getSegmentScales, getSegmentZoomEases } from "./compose.js";
12
13
  import { toAssColor } from "./draft-color.js";
13
14
  import { buildDraftOverlayEvents, getDraftOverlayStyles, getRoundedRectDrawing } from "./draft-overlays.js";
14
15
  import { getCaptionCornerRadius, getCornerRadiusPx, getStylePadding, type BrandStyle } from "./brand-style.js";
@@ -66,8 +67,6 @@ export const FOOTAGE_DRAFT_FONT = {
66
67
 
67
68
  /** How far a segment marked `kenburns` zooms when the film's `kenBurnsPercent` is 0, as in the render. */
68
69
  const HAND_KEN_BURNS_PERCENT = 4;
69
- /** The point a zoom keeps still, as the render's `transform-origin: 50% 42%`. */
70
- const ZOOM_ORIGIN = { x: 0.5, y: 0.42 } as const;
71
70
  const DRAFT_CRF = 28;
72
71
  const DRAFT_AUDIO_BITRATE = "128k";
73
72
 
@@ -481,6 +480,10 @@ export interface DraftSegmentPlan {
481
480
  startScale: number;
482
481
  /** The frames the zoom eases over (`getSegmentZoomEases`); 0: the segment starts at `scale`. */
483
482
  easeFrames: number;
483
+ /** The segment's camera (`EdlCamera`) and the frames its move takes; null: the film's own zoom (`scale`, `endScale`). */
484
+ camera: { camera: EdlCamera; frames: number } | null;
485
+ /** The point the segment's zooms keep still: its camera's anchor, else the render's `transform-origin: 50% 42%`. */
486
+ origin: CameraAnchor;
484
487
  /**
485
488
  * The EDL's `punch_in` overlays in this segment, in frames from its start: each multiplies the zoom by up to `scale`,
486
489
  * rising over `ease` frames from `from` and falling over the last `ease` of its `frames` (linear, the render eases).
@@ -489,17 +492,16 @@ export interface DraftSegmentPlan {
489
492
  }
490
493
 
491
494
  /**
492
- * How each segment plays in the draft. A `fade` cut lasts the film's `fadeFrames` (clamped to the incoming segment, so
493
- * the cross-fade never outlasts it) and the outgoing segment runs on under it, as in the render.
495
+ * How each segment plays in the draft. A `fade` cut lasts its own `fadeFrames` or the film's (clamped to the incoming
496
+ * segment, so the cross-fade never outlasts it) and the outgoing segment runs on under it, as in the render.
494
497
  */
495
498
  export function planFootageDraft(film: Pick<FootageFilm, "edit">, edl: Edl, overlays: readonly ResolvedOverlay[] = []): DraftSegmentPlan[] {
496
499
  const edit = getFootageEdit(film);
497
- const fadeSeconds = r3(edit.fadeFrames / FOOTAGE_FPS);
498
500
  const kenBurnsScale = 1 + (edit.kenBurnsPercent > 0 ? edit.kenBurnsPercent : HAND_KEN_BURNS_PERCENT) / 100;
499
501
  const scales = getSegmentScales(edl, edit.zoomPercent);
500
502
  const eases = getSegmentZoomEases(edl, edit);
501
503
  const starts = getSegmentStarts(edl);
502
- const fades = edl.segments.map((segment, index) => (segment.transition === "fade" && index > 0 ? r3(Math.min(fadeSeconds, segment.end - segment.start)) : 0));
504
+ const fades = edl.segments.map((segment, index) => r3(Math.min(getSegmentFadeFrames(edl, index, edit) / FOOTAGE_FPS, segment.end - segment.start)));
503
505
  return edl.segments.map((segment, index) => {
504
506
  const scale = scales[index] as number;
505
507
  return {
@@ -508,9 +510,11 @@ export function planFootageDraft(film: Pick<FootageFilm, "edit">, edl: Edl, over
508
510
  start: starts[index] as number,
509
511
  fade: fades[index] as number,
510
512
  scale,
511
- endScale: segment.motion === "kenburns" ? r4(scale * kenBurnsScale) : scale,
513
+ endScale: segment.camera !== undefined ? segment.camera.to : segment.motion === "kenburns" ? r4(scale * kenBurnsScale) : scale,
512
514
  startScale: (eases[index] as number) > 0 ? (scales[index - 1] as number) : scale,
513
515
  easeFrames: eases[index] as number,
516
+ camera: segment.camera === undefined ? null : { camera: segment.camera, frames: getCameraMoveFrames(segment.camera, segment.end - segment.start) },
517
+ origin: getCameraOrigin(segment.camera),
514
518
  punches: overlays.flatMap((overlay) =>
515
519
  overlay.kind === "punch_in" && overlay.segment === index
516
520
  ? [
@@ -528,36 +532,32 @@ export function planFootageDraft(film: Pick<FootageFilm, "edit">, edl: Edl, over
528
532
  }
529
533
 
530
534
  /**
531
- * The filters that zoom a segment's picture and scale it to the draft: a crop for a still zoom, `zoompan` for Ken Burns
532
- * and for an eased zoom cut (the render's `power1.out`: `1 - (1 - t)^2`).
535
+ * The filters that zoom a segment's picture and scale it to the draft: a crop for a still zoom, `zoompan` for Ken Burns,
536
+ * a camera's move and an eased zoom cut (the render's `power1.out`: `1 - (1 - t)^2`), each about the segment's origin.
533
537
  */
534
538
  function buildPictureFilters(plan: DraftSegmentPlan, draft: Frame): string[] {
535
539
  const size = `${draft.width}:${draft.height}`;
540
+ const { origin } = plan;
536
541
  const zoompan = (zoom: string): string =>
537
- `zoompan=z='${zoom}':x='(iw-iw/zoom)*${ZOOM_ORIGIN.x}':y='(ih-ih/zoom)*${ZOOM_ORIGIN.y}':d=1:s=${draft.width}x${draft.height}:fps=${FOOTAGE_FPS}`;
538
- if (plan.punches.length > 0) {
539
- // The segment's own zoom (an eased cut, Ken Burns or still) times each punch-in's rise, hold and fall.
540
- const frames = Math.max(1, Math.round(plan.length * FOOTAGE_FPS));
541
- const own =
542
- plan.easeFrames > 0
543
- ? `${plan.startScale}+(${r4(plan.scale - plan.startScale)})*(1-pow(1-min(on/${plan.easeFrames},1),2))`
542
+ `zoompan=z='${zoom}':x='(iw-iw/zoom)*${origin.x}':y='(ih-ih/zoom)*${origin.y}':d=1:s=${draft.width}x${draft.height}:fps=${FOOTAGE_FPS}`;
543
+ // The zoom runs over the segment's own length, as the render's tween does, and holds through a fade's tail.
544
+ const frames = Math.max(1, Math.round(plan.length * FOOTAGE_FPS));
545
+ const own =
546
+ plan.easeFrames > 0
547
+ ? `${plan.startScale}+(${r4(plan.scale - plan.startScale)})*(1-pow(1-min(on/${plan.easeFrames},1),2))`
548
+ : plan.camera !== null && plan.endScale !== plan.scale
549
+ ? getCameraScaleExpression(plan.camera.camera, plan.camera.frames)
544
550
  : plan.endScale !== plan.scale
545
551
  ? `${plan.scale}+${r4(plan.endScale - plan.scale)}*min(on/${frames},1)`
546
- : `${plan.scale}`;
552
+ : null;
553
+ if (plan.punches.length > 0) {
554
+ // The segment's own zoom (an eased cut, a camera, Ken Burns or still) times each punch-in's rise, hold and fall.
547
555
  const lifts = plan.punches.map((punch) => `${r4(punch.scale - 1)}*max(0,min(min(1,(on-${punch.from})/${punch.ease}),(${punch.from + punch.frames}-on)/${punch.ease}))`);
548
- return [zoompan(`(${own})*(1+${lifts.join("+")})`)];
549
- }
550
- if (plan.easeFrames > 0) {
551
- return [zoompan(`${plan.startScale}+(${r4(plan.scale - plan.startScale)})*(1-pow(1-min(on/${plan.easeFrames},1),2))`)];
552
- }
553
- if (plan.endScale !== plan.scale) {
554
- // The zoom runs over the segment's own length, as the render's tween does, and holds through a fade's tail.
555
- const frames = Math.max(1, Math.round(plan.length * FOOTAGE_FPS));
556
- const zoom = `${plan.scale}+${r4(plan.endScale - plan.scale)}*min(on/${frames},1)`;
557
- return [zoompan(zoom)];
556
+ return [zoompan(`(${own ?? String(plan.scale)})*(1+${lifts.join("+")})`)];
558
557
  }
558
+ if (own !== null) return [zoompan(own)];
559
559
  if (plan.scale !== 1) {
560
- return [`crop=iw/${plan.scale}:ih/${plan.scale}:(iw-iw/${plan.scale})*${ZOOM_ORIGIN.x}:(ih-ih/${plan.scale})*${ZOOM_ORIGIN.y}`, `scale=${size}`];
560
+ return [`crop=iw/${plan.scale}:ih/${plan.scale}:(iw-iw/${plan.scale})*${origin.x}:(ih-ih/${plan.scale})*${origin.y}`, `scale=${size}`];
561
561
  }
562
562
  return [`scale=${size}`];
563
563
  }
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  import type { TimedWord } from "../voice/voiceover.js";
4
+ import { cameraSchema, describeCamera, isSameCamera, type EdlCamera } from "./camera.js";
4
5
  import { overlaySchema, type EdlOverlay } from "./overlay-schema.js";
5
6
  import { CUT_TRANSITIONS, type ClipRole, type CutOptions, type CutTransition, type FootageTransitions } from "./film.js";
6
7
  import { splitFilmSentences, type Sentence } from "./sentences.js";
@@ -59,6 +60,10 @@ export interface EdlSegment {
59
60
  transition: CutTransition;
60
61
  /** `kenburns`: a slow zoom over a segment without speech. */
61
62
  motion: SegmentMotion;
63
+ /** The segment's framing and a slow move over it (`camera.ts`); absent: the film's own zoom (cuts, Ken Burns). */
64
+ camera?: EdlCamera;
65
+ /** A `fade` cut's own length in frames at 30 fps (1-30); absent: the film's `fadeFrames`. */
66
+ fadeFrames?: number;
62
67
  audio?: EdlAudio;
63
68
  /** Moves the caption box for the captions that start in this segment; absent: the film's box. */
64
69
  caption?: EdlCaption;
@@ -77,6 +82,10 @@ export interface Edl {
77
82
  captionRanges?: EdlCaptionRange[];
78
83
  }
79
84
 
85
+ /** The shortest and the longest a segment's own `fadeFrames` may be. */
86
+ export const MIN_FADE_FRAMES = 1;
87
+ export const MAX_FADE_FRAMES = 30;
88
+
80
89
  const SEGMENT_ID_PATTERN = /^[A-Za-z0-9._-]+$/;
81
90
 
82
91
  const segmentFields = {
@@ -96,6 +105,8 @@ export const edlSchema = z
96
105
  z.strictObject({
97
106
  id: z.string().regex(SEGMENT_ID_PATTERN, "letters, digits, dot, dash or underscore").describe("The segment's id, unique in the cut: s<n> for a sentence, r<n> for b-roll."),
98
107
  ...segmentFields,
108
+ camera: cameraSchema.optional(),
109
+ fadeFrames: z.number().int().min(MIN_FADE_FRAMES).max(MAX_FADE_FRAMES).optional().describe("A fade cut's own length in frames at 30 fps (1-30); absent: the film's fadeFrames. Only on a fade."),
99
110
  audio: z
100
111
  .strictObject({
101
112
  clip: z.string().min(1).describe("The clip the sound comes from."),
@@ -305,6 +316,7 @@ export function validateEdl(edl: Edl, clips: Pick<EdlClip, "id" | "duration">[],
305
316
  checkSpan(at, segment);
306
317
  if (segment.end - segment.start < MIN_SEGMENT_SECONDS) problems.push(`${at}: shorter than ${MIN_SEGMENT_SECONDS} s (start ${segment.start}, end ${segment.end})`);
307
318
  if (captionBounds !== undefined) problems.push(...findCaptionProblems(`${at}.caption`, segment.caption, captionBounds));
319
+ problems.push(...findCameraProblems(at, segment));
308
320
  const { audio } = segment;
309
321
  if (audio === undefined) return;
310
322
  checkSpan(`${at}.audio`, audio);
@@ -316,6 +328,16 @@ export function validateEdl(edl: Edl, clips: Pick<EdlClip, "id" | "duration">[],
316
328
  return problems;
317
329
  }
318
330
 
331
+ /** A camera beside the film's own zoom (a Ken Burns zoom, a zoom cut), which owns the scale too, and a fade length on another cut. */
332
+ function findCameraProblems(at: string, segment: EdlSegment): string[] {
333
+ const problems: string[] = [];
334
+ if (segment.fadeFrames !== undefined && segment.transition !== "fade") problems.push(`${at}.fadeFrames: only a fade cut has a length; this segment starts on a ${segment.transition}`);
335
+ if (segment.camera === undefined) return problems;
336
+ if (segment.motion === "kenburns") problems.push(`${at}.camera: the segment has a Ken Burns zoom, which owns the picture's scale; set motion to none or drop the camera`);
337
+ if (segment.transition === "zoom") problems.push(`${at}.camera: the segment starts on a zoom cut, which owns the picture's scale; start it on a cut or a fade`);
338
+ return problems;
339
+ }
340
+
319
341
  /** Caption ranges that are empty, run past the cut, overlap one another or (with `captionBounds`) leave the frame. */
320
342
  function findCaptionRangeProblems(edl: Edl, captionBounds: EdlCaptionBounds | undefined): string[] {
321
343
  const problems: string[] = [];
@@ -419,6 +441,8 @@ export function diffEdl(before: Edl, after: Edl): string[] {
419
441
  if (a.clip !== b.clip || a.start !== b.start || a.end !== b.end) lines.push(`${id}: ${a.clip} ${formatSpan(a)} → ${b.clip} ${formatSpan(b)}`);
420
442
  if (a.transition !== b.transition) lines.push(`${id}: ${a.transition} → ${b.transition}`);
421
443
  if (a.motion !== b.motion) lines.push(`${id}: motion ${a.motion} → ${b.motion}`);
444
+ if (!isSameCamera(a.camera, b.camera)) lines.push(`${id}: camera ${describeCamera(a.camera)} → ${describeCamera(b.camera)}`);
445
+ if (a.fadeFrames !== b.fadeFrames) lines.push(`${id}: fade ${a.fadeFrames === undefined ? "default" : `${String(a.fadeFrames)} frames`} → ${b.fadeFrames === undefined ? "default" : `${String(b.fadeFrames)} frames`}`);
422
446
  }
423
447
  for (const segment of after.segments) {
424
448
  const previous = old.get(segment.id);
@@ -24,7 +24,10 @@ import {
24
24
  getOverlayPadding,
25
25
  getPlaceCardPinRow,
26
26
  getPlaceCardPinSize,
27
+ getListCardsByItem,
28
+ getListItemTimes,
27
29
  getTitleContentBox,
30
+ type OverlayBox,
28
31
  type ResolvedOverlay,
29
32
  } from "./overlays.js";
30
33
 
@@ -90,6 +93,15 @@ function getOverlayCss(colors: OverlayColors, fonts: { heading: string; interfac
90
93
  `.ov-dot{flex:none;width:.36em;height:.36em;border-radius:50%;background:${colors.accent}}`,
91
94
  `.ov-list .ov-card{flex-direction:column;align-items:flex-start;gap:0;line-height:${OVERLAY_LIST_LINE_HEIGHT};font-weight:650}`,
92
95
  `.ov-list li{display:flex;align-items:center;gap:.45em;list-style:none}`,
96
+ // A list's card grows with its points (RV-144 of an adopting app): sized per point, the later points clipped until
97
+ // they come in; a centred stack centres its lines, and chips are cards of their own, one per point.
98
+ `.ov-list .ov-card.grow{box-sizing:border-box;overflow:hidden;flex:none}`,
99
+ `.ov-list .ov-card.cen{align-items:center;text-align:center}`,
100
+ `.ov-list li{white-space:nowrap}`,
101
+ `.ov.center .ov-card{transform-origin:50% 100%}`,
102
+ // A centred keyword (style.align center) centres a line that wraps too.
103
+ `.ov-keyword.center .ov-card{justify-content:center;text-align:center}`,
104
+ `.ov-list .ov-chip{position:absolute;box-sizing:border-box;flex-direction:row;align-items:center;justify-content:center;white-space:nowrap;line-height:${OVERLAY_LINE_HEIGHT};transform-origin:50% 100%}`,
93
105
  `.ov-svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}`,
94
106
  `.ov-search,.ov-counter .ov-card,.ov-date .ov-card,.ov-place,.ov-sub,.ov-line{white-space:nowrap}`,
95
107
  // A title card fills its fitted box, so a typed title keeps its width; a centred typed line hides its untyped
@@ -118,7 +130,7 @@ function getOverlayCss(colors: OverlayColors, fonts: { heading: string; interfac
118
130
  `.ov-ul{position:absolute;height:${UNDERLINE_EM.height}em;border-radius:${UNDERLINE_EM.height / 2}em;background:${colors.accent};transform:scaleX(0);transform-origin:0% 50%}`,
119
131
  `.ov-pinrow{display:flex;justify-content:center}`,
120
132
  `.ov-stack.left .ov-pinrow{justify-content:flex-start}`,
121
- `.st li,.pd .ov-pinrow svg,.pl .ov-line,.sd .ov-sub{opacity:0}`,
133
+ `.pd .ov-pinrow svg,.pl .ov-line,.sd .ov-sub{opacity:0}`,
122
134
  // An underlined keyword keeps only its drawn bar: the card's own accent edge would be a second line under it.
123
135
  `.ov-keyword.ul .ov-card{border-bottom-color:transparent}`,
124
136
  // The brand's style (after the kinds' own rules, so it wins over them; the search bar stays a pill).
@@ -252,26 +264,23 @@ interface MarkupContext {
252
264
  frame: { width: number; height: number };
253
265
  }
254
266
 
255
- /** A keyword, a lower third or a list, entering as the soft pill (or by its own entrance). */
256
- function addSideText(overlay: Extract<ResolvedOverlay, { kind: "keyword" | "lower_third" | "list" }>, id: string, context: MarkupContext, out: OverlayMarkup): void {
267
+ /** A keyword or a lower third, entering as the soft pill (or by its own entrance). */
268
+ function addSideText(overlay: Extract<ResolvedOverlay, { kind: "keyword" | "lower_third" }>, id: string, context: MarkupContext, out: OverlayMarkup): void {
257
269
  const { box, fontSize, side } = overlay;
270
+ const isCentred = overlay.kind === "keyword" && overlay.isCentred === true;
258
271
  const colors = getOverlayColors(overlay, context.colors);
259
272
  const cardStyle = getCardStyle(overlay, colors, context.scale);
260
273
  const dotStyle = overlay.colors.accent === undefined ? "" : ` style="background:${colors.accent}"`;
261
- const isTyped = overlay.typing !== null && overlay.kind !== "list";
274
+ const isTyped = overlay.typing !== null;
262
275
  const style = `left:${box.left}px;top:${box.top}px;width:${box.width}px;height:${box.height}px;font-size:${fontSize}px;align-items:${overlay.kind === "lower_third" ? "flex-end" : "flex-start"}`;
263
- const text = overlay.kind === "list" ? "" : isTyped ? toTypedHtml(overlay.text) : escapeHtml(overlay.text);
276
+ const text = isTyped ? toTypedHtml(overlay.text) : escapeHtml(overlay.text);
264
277
  const wipe = overlay.entrance === "wipe" ? `<i class="ov-wipe" id="${id}w"></i>` : "";
265
278
  const underline = overlay.kind === "keyword" && overlay.underline === true ? `<i class="ov-ul" id="${id}u" style="${getUnderlineStyle(overlay)}"></i>` : "";
266
- const staggered = overlay.kind === "list" ? overlay.itemStarts : undefined;
267
- const body =
268
- overlay.kind === "list"
269
- ? `<ul class="ov-card"${cardStyle}>${wipe}${overlay.items.map((item, i) => `<li id="${id}i${i}"><i class="ov-dot"${dotStyle}></i>${escapeHtml(item)}</li>`).join("")}</ul>`
270
- : `<div class="ov-card"${cardStyle}>${wipe}${overlay.kind === "lower_third" ? `<i class="ov-dot" id="${id}d"${dotStyle}></i>` : ""}<span id="${id}t">${text}</span>${underline}</div>`;
271
- out.html.push(clipDiv(overlay, id, `ov ov-${overlay.kind.replace("_", "-")}${side === "right" ? " right" : ""}${isTyped ? " ty" : ""}${staggered === undefined ? "" : " st"}${underline === "" ? "" : " ul"}`, style, body));
279
+ const body = `<div class="ov-card"${cardStyle}>${wipe}${overlay.kind === "lower_third" ? `<i class="ov-dot" id="${id}d"${dotStyle}></i>` : ""}<span id="${id}t">${text}</span>${underline}</div>`;
280
+ out.html.push(clipDiv(overlay, id, `ov ov-${overlay.kind.replace("_", "-")}${isCentred ? " center" : side === "right" ? " right" : ""}${isTyped ? " ty" : ""}${underline === "" ? "" : " ul"}`, style, body));
272
281
  if (overlay.entrance !== null) {
273
282
  out.tweens.push(...getMotionTweens(`#${id} .ov-card`, getEntranceMotion(overlay.entrance, overlay.easing ?? "smooth", context.frame), overlay.start));
274
- if (overlay.kind !== "list") out.tweens.push(...getTypingTweens(id, overlay, [...overlay.text].length));
283
+ out.tweens.push(...getTypingTweens(id, overlay, [...overlay.text].length));
275
284
  } else {
276
285
  // The soft pill's entrance: the card rises from its foot, then its dot and its text settle in, eased out without
277
286
  // overshoot (RV-133 of an adopting app: nothing grows past its size).
@@ -280,16 +289,7 @@ function addSideText(overlay: Extract<ResolvedOverlay, { kind: "keyword" | "lowe
280
289
  out.tweens.push(`tl.fromTo("#${id}d", { scale: 0 }, { scale: 1, duration: 0.35, ease: "power2.out", immediateRender: false }, ${r3(overlay.start + 0.25)});`);
281
290
  out.tweens.push(`tl.fromTo("#${id}t", { opacity: 0, x: -10 }, { opacity: 1, x: 0, duration: 0.4, ease: "power3.out", immediateRender: false }, ${r3(overlay.start + 0.3)});`);
282
291
  }
283
- if (overlay.kind === "list" && staggered === undefined) {
284
- overlay.items.forEach((_item, i) => {
285
- out.tweens.push(`tl.fromTo("#${id}i${i}", { opacity: 0, y: 14 }, { opacity: 1, y: 0, duration: 0.35, ease: "power3.out", immediateRender: false }, ${r3(overlay.start + 0.2 + 0.12 * i)});`);
286
- });
287
- }
288
292
  }
289
- // A staggered list's points come in one by one, each on its own second (`itemStarts`).
290
- staggered?.forEach((at, i) => {
291
- out.tweens.push(`tl.fromTo("#${id}i${i}", { opacity: 0, y: ${r3(14 * context.scale)} }, { opacity: 1, y: 0, duration: 0.35, ease: "power3.out", immediateRender: false }, ${at});`);
292
- });
293
293
  if (underline !== "") {
294
294
  out.tweens.push(`tl.fromTo("#${id}u", { scaleX: 0 }, { scaleX: 1, duration: ${UNDERLINE_SECONDS}, ease: "power2.out", immediateRender: false }, ${r3(overlay.start + getEntranceSeconds(overlay.entrance, overlay, context.frame))});`);
295
295
  }
@@ -298,6 +298,68 @@ function addSideText(overlay: Extract<ResolvedOverlay, { kind: "keyword" | "lowe
298
298
  );
299
299
  }
300
300
 
301
+ /** The seconds a list's card takes to grow to its next point, and a point to come in. */
302
+ const LIST_GROW_SECONDS = 0.35;
303
+
304
+ /** A card's entrance at `start`: its named entrance, else the soft pill rising from its foot (eased out, no overshoot). */
305
+ function getListCardEntrance(overlay: Extract<ResolvedOverlay, { kind: "list" }>, target: string, start: number, context: MarkupContext): string[] {
306
+ if (overlay.entrance !== null) return getMotionTweens(target, getEntranceMotion(overlay.entrance, overlay.easing ?? "smooth", context.frame), start);
307
+ return [`tl.fromTo("${target}", { scale: 0.88, y: ${r3(18 * context.scale)}, opacity: 0 }, { scale: 1, y: 0, opacity: 1, duration: 0.45, ease: "power3.out", immediateRender: false }, ${start});`];
308
+ }
309
+
310
+ /** A card's size and padding as inline CSS, in px. */
311
+ function getListCardSize(card: OverlayBox, pad: { x: number; y: number }): string {
312
+ return `width:${card.width}px;height:${card.height}px;padding:${pad.y}px ${pad.x}px`;
313
+ }
314
+
315
+ /**
316
+ * A list (RV-144 of an adopting app): a stack, one card whose first point comes in with it and which grows to each next
317
+ * point as it comes in (eased out, no overshoot; centred lines in the frame's middle without a side), or chips, one card
318
+ * per point in its final place of a centred row, each entering on its own second from the left. Every card leaves
319
+ * together.
320
+ */
321
+ function addList(overlay: Extract<ResolvedOverlay, { kind: "list" }>, id: string, context: MarkupContext, out: OverlayMarkup): void {
322
+ const { box, fontSize } = overlay;
323
+ const colors = getOverlayColors(overlay, context.colors);
324
+ const own = getCardStyle(overlay, colors, context.scale).replace(/^ style="|"$/g, "");
325
+ const pad = getOverlayPadding(overlay);
326
+ const times = getListItemTimes(overlay);
327
+ const cards = getListCardsByItem(overlay);
328
+ const wipe = (suffix: string) => (overlay.entrance === "wipe" ? `<i class="ov-wipe" id="${id}w${suffix}"></i>` : "");
329
+ const style = `left:${box.left}px;top:${box.top}px;width:${box.width}px;height:${box.height}px;font-size:${fontSize}px;align-items:flex-start`;
330
+ if (overlay.chips !== undefined) {
331
+ const chips = overlay.chips.map((chip, i) => {
332
+ const place = `left:${chip.left - box.left}px;top:${chip.top - box.top}px;${getListCardSize(chip, pad)}${i === 0 ? "" : ";visibility:hidden"}${own === "" ? "" : `;${own}`}`;
333
+ return `<div class="ov-card ov-chip" id="${id}c${i}" style="${place}">${wipe(String(i))}<span>${escapeHtml(overlay.items[i] as string)}</span></div>`;
334
+ });
335
+ out.html.push(clipDiv(overlay, id, "ov ov-list chips", style, chips.join("")));
336
+ times.forEach((at, i) => {
337
+ if (i > 0) out.tweens.push(`tl.set("#${id}c${i}", { visibility: "visible" }, ${at});`);
338
+ out.tweens.push(...getListCardEntrance(overlay, `#${id}c${i}`, at, context));
339
+ });
340
+ } else {
341
+ const isCentred = overlay.isCentred === true;
342
+ const dotStyle = overlay.colors.accent === undefined ? "" : ` style="background:${colors.accent}"`;
343
+ const first = times.filter((at) => at <= overlay.start).length - 1;
344
+ const card = (cards[first] as OverlayBox[])[0] as OverlayBox;
345
+ const items = overlay.items.map((item, i) => `<li id="${id}i${i}"${i > first ? ` style="opacity:0"` : ""}>${isCentred ? "" : `<i class="ov-dot"${dotStyle}></i>`}${escapeHtml(item)}</li>`);
346
+ const cardStyle = `${getListCardSize(card, pad)}${own === "" ? "" : `;${own}`}`;
347
+ const side = isCentred ? " center" : overlay.side === "right" ? " right" : "";
348
+ out.html.push(clipDiv(overlay, id, `ov ov-list${side}`, style, `<ul class="ov-card grow${isCentred ? " cen" : ""}" style="${cardStyle}">${wipe("")}${items.join("")}</ul>`));
349
+ out.tweens.push(...getListCardEntrance(overlay, `#${id} .ov-card`, overlay.start, context));
350
+ // Each later point: the card eases to its new size as the point fades up into it.
351
+ times.forEach((at, i) => {
352
+ if (i <= first) return;
353
+ const next = (cards[i] as OverlayBox[])[0] as OverlayBox;
354
+ out.tweens.push(`tl.to("#${id} .ov-card", { width: ${next.width}, height: ${next.height}, duration: ${LIST_GROW_SECONDS}, ease: "power3.out" }, ${at});`);
355
+ out.tweens.push(`tl.fromTo("#${id}i${i}", { opacity: 0, y: ${r3(14 * context.scale)} }, { opacity: 1, y: 0, duration: ${LIST_GROW_SECONDS}, ease: "power3.out", immediateRender: false }, ${at});`);
356
+ });
357
+ }
358
+ out.tweens.push(
359
+ ...getExitTweens(`#${id} .ov-card`, overlay, context.frame, `tl.to("#${id} .ov-card", { scale: 0.94, y: 14, opacity: 0, duration: ${EXIT_SECONDS}, ease: "power2.in" }, ${r3(overlay.end - EXIT_SECONDS)});`),
360
+ );
361
+ }
362
+
301
363
  /** Where a keyword's underline sits in its card: under the text, inside the card's padding. */
302
364
  function getUnderlineStyle(overlay: Extract<ResolvedOverlay, { kind: "keyword" }>): string {
303
365
  const pad = overlay.padScale ?? 1;
@@ -454,7 +516,8 @@ export function getOverlayMarkup(
454
516
  const out: OverlayMarkup = { html: [], css: getOverlayCss(input.colors, { heading: input.headingFont, interface: input.interfaceFont ?? "inherit" }, input.style, context.scale), tweens: [] };
455
517
  for (const overlay of drawn) {
456
518
  const id = `ov${overlay.index}`;
457
- if (overlay.kind === "keyword" || overlay.kind === "lower_third" || overlay.kind === "list") addSideText(overlay, id, context, out);
519
+ if (overlay.kind === "list") addList(overlay, id, context, out);
520
+ else if (overlay.kind === "keyword" || overlay.kind === "lower_third") addSideText(overlay, id, context, out);
458
521
  else if (overlay.kind === "arrow" || overlay.kind === "highlight") addMark(overlay, id, context, out);
459
522
  else addCard(overlay, id, context, out);
460
523
  }