@softure-ai/marketing-kit 0.29.0 → 0.31.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 (40) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +15 -1
  3. package/dist/footage/draft-boxes.d.ts +3 -1
  4. package/dist/footage/draft-boxes.d.ts.map +1 -1
  5. package/dist/footage/draft-boxes.js +3 -2
  6. package/dist/footage/draft-boxes.js.map +1 -1
  7. package/dist/footage/draft-overlays.d.ts.map +1 -1
  8. package/dist/footage/draft-overlays.js +191 -41
  9. package/dist/footage/draft-overlays.js.map +1 -1
  10. package/dist/footage/edl.d.ts +27 -0
  11. package/dist/footage/edl.d.ts.map +1 -1
  12. package/dist/footage/overlay-html.d.ts +8 -0
  13. package/dist/footage/overlay-html.d.ts.map +1 -1
  14. package/dist/footage/overlay-html.js +127 -29
  15. package/dist/footage/overlay-html.js.map +1 -1
  16. package/dist/footage/overlay-motion.d.ts +107 -0
  17. package/dist/footage/overlay-motion.d.ts.map +1 -0
  18. package/dist/footage/overlay-motion.js +129 -0
  19. package/dist/footage/overlay-motion.js.map +1 -0
  20. package/dist/footage/overlay-schema.d.ts +63 -2
  21. package/dist/footage/overlay-schema.d.ts.map +1 -1
  22. package/dist/footage/overlay-schema.js +70 -5
  23. package/dist/footage/overlay-schema.js.map +1 -1
  24. package/dist/footage/overlays.d.ts +16 -1
  25. package/dist/footage/overlays.d.ts.map +1 -1
  26. package/dist/footage/overlays.js +43 -12
  27. package/dist/footage/overlays.js.map +1 -1
  28. package/dist/index.d.ts +3 -2
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +3 -2
  31. package/dist/index.js.map +1 -1
  32. package/package.json +1 -1
  33. package/schema/edl.schema.json +82 -1
  34. package/src/footage/draft-boxes.ts +7 -3
  35. package/src/footage/draft-overlays.ts +224 -42
  36. package/src/footage/overlay-html.ts +148 -27
  37. package/src/footage/overlay-motion.ts +157 -0
  38. package/src/footage/overlay-schema.ts +90 -5
  39. package/src/footage/overlays.ts +70 -16
  40. package/src/index.ts +22 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@ Newest first. Each version lists what changed for an app that uses `@softure-ai/
4
4
  production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
5
5
  "Definition of done"). Versions before the first one below are described in their GitHub Releases (`marketing-kit@x.y.z`).
6
6
 
7
+ ## 0.31.0
8
+
9
+ - **New entrances:** `style.entrance` takes `pop` (92 % to 100 %, `power2.out`, 0.3 s, no overshoot), `rise` (up from
10
+ 5 % of the frame's height with a fade, 0.3 s), `blur` (14 px of a 1080 px frame to sharp, 0.3 s) and `wipe` (the card
11
+ grows from the left under an accent panel, which then slides off to the right over the card and its text, 0.5 s) on
12
+ every kind with a card (`OVERLAY_ENTRANCES_BY_KIND`; an arrow and a highlight keep `fade` and `none`).
13
+ - **Exits and easing:** `style.exit` (`OVERLAY_EXITS`: `auto` mirrors the entrance, `fade`, `slide`, `none`) and
14
+ `style.easing` (`OVERLAY_EASINGS`: `smooth`, `snappy`). Without them, or with no entrance or `none`, an overlay
15
+ leaves as before. Refused on a `punch_in`.
16
+ - **Per kind:** a list's `style.stagger` and `item_words` (one word per point; a word the cut does not say is refused
17
+ as `item_words[i]`) or `item_at` (one film second per point), resolved to `itemStarts`; a place card's `style.pin` (`OVERLAY_PINS`) and
18
+ `style.subtitle_delay` (up to `MAX_OVERLAY_SUBTITLE_DELAY`, 0.6 s), resolved to `pin` and `subtitleDelay` (a pinned
19
+ card is taller by `getPlaceCardPinRow`; `getPlaceCardTimes` answers when the pin, the title and the subtitle come
20
+ in); a keyword's `style.underline`. Each is refused on another kind.
21
+ - **One motion model:** `overlay-motion.ts` (`getEntranceMotion`, `getExitMotion`, `getEntranceScaleAt`,
22
+ `getListItemStarts`, `OVERLAY_EASES`) feeds the render's tweens and the draft's ASS tags. The soft pill of a keyword,
23
+ a lower third and a list without an entrance now eases with `power3.out` (was `back.out(1.7)`, which passed 100 %),
24
+ and the lower third's dot with `power2.out`. The counter keeps its `power2.out` count, in the draft from the same
25
+ curve.
26
+ - **Draft:** a pop scales about the card's middle (the position moves with the scale), a rise moves, a blur animates
27
+ `\blur` (a shadow keeps its own), a wipe animates `\clip` with an accent panel, a staggered point, a delayed
28
+ subtitle and a pinned card's title fade in from their own seconds, a dropped pin falls into place, an underline is
29
+ drawn from the left. `DraftBoxEventsInput.blurTags` (new, optional) gives a box's drawings their blur motion.
30
+
7
31
  ## 0.29.0
8
32
 
9
33
  - **The caption pill's entrance:** `FootageFilm.captionEntrance` (`none | fade | pop`, new `CAPTION_ENTRANCES` and type
package/README.md CHANGED
@@ -693,7 +693,7 @@ softure-marketing footage <film> --step=render # the EDL as it is, maybe e
693
693
  knobs in `style`, each checked against its kind: `size`; `side` (keyword, lower third, list, date stamp);
694
694
  `position` (`top`, `middle`, `bottom` of the room above the captions: keyword, search bar, place card, counter;
695
695
  `top` or `bottom` for a lower third; `top` or `middle` for a list); `entrance` (`fade`, `slide`, `type` for text
696
- kinds, `none`; never a bounce or a pop; without it the kind's own); `typing_speed` (4-40 characters per second, 14
696
+ kinds, `none`, and since 0.31.0 `pop`, `rise`, `blur`, `wipe`; never a bounce; without it the kind's own); `typing_speed` (4-40 characters per second, 14
697
697
  by default) for a typed text; `colors: { card, text, accent }` (`#rrggbb`, each in place of the brand's). Missing
698
698
  knobs keep the kinds' defaults, so a stored EDL reads and renders as before. Titles, keywords and numbers are drawn
699
699
  in the brand's heading font, labels, lists, the search query and the stamp in its new optional interface font
@@ -717,6 +717,20 @@ softure-marketing footage <film> --step=render # the EDL as it is, maybe e
717
717
  only what is typed, centred in a card that keeps the whole title's width, in the draft and the render alike.
718
718
  `brand.style.padding` pads every overlay card (`resolveEdlOverlays({ style })`, `getOverlayPadding`), and
719
719
  `getTitleContentBox` answers where a title's text block sits in its card.
720
+ - **Entrances and exits** (0.31.0): `style.entrance` also takes `pop` (92 % to 100 % with an ease-out, never past its
721
+ size), `rise` (up from 5 % of the frame's height with a fade), `blur` (from a slight blur to sharp) and `wipe` (the
722
+ card revealed from the left under an accent panel, then its text), on every kind with a card. `style.exit` (`auto`,
723
+ the default, mirrors the entrance; `fade`, `slide` down and out, `none`) and `style.easing` (`smooth`, the default,
724
+ or `snappy`: 0.7 as long, `expo.out`) shape the way out and the curve. Per kind: a list's `style.stagger` (its
725
+ points one by one, spaced automatically) or `item_words` (one transcript word per point, each point on its word) or `item_at` (the film second of each point, for
726
+ a caller that reads the words itself);
727
+ a place card's `style.pin` (`none`, `static`, or `drop`: an accent pin above the title that falls a little and
728
+ stops) and `style.subtitle_delay` (0-0.6 s; pin first, then the title, then the subtitle); a keyword's
729
+ `style.underline` (an accent bar drawn under the word once it is in). The motion lives in one model
730
+ (`getEntranceMotion`, `getExitMotion`, `getEntranceScaleAt`) that the render's tweens and the draft's tags both read;
731
+ the soft pill of a keyword, a lower third and a list without an entrance now eases out without overshoot. The draft
732
+ draws a pop about the card's middle, a rise and a slide as moves, a blur, a wipe as clips, and the parts that come
733
+ later from their own seconds.
720
734
  - **Transitions and look:** `jump` (a cut inside one talking clip) and `clip` (between clips) are hard cuts by
721
735
  default; `zoom` punches in by `edit.zoomPercent` (105-112, default 108) and back out on the next, `fade` lasts
722
736
  `edit.fadeFrames` (default 10 at 30 fps), `whoosh` is a cut with the `sfx.whoosh` sound. B-roll stays still unless
@@ -24,8 +24,10 @@ export interface DraftBoxEventsInput {
24
24
  style: Pick<BrandStyle, "shadow" | "border">;
25
25
  /** The frame's width / 1080. */
26
26
  scale: number;
27
- /** Motion tags every drawing takes (a fade, a move); a `\move` replaces the `\pos`. */
27
+ /** Motion tags every drawing takes (a fade, a move, a scale, a clip); a `\move` replaces the `\pos`. */
28
28
  motion?: string;
29
+ /** A blur entrance or exit: the tags for a drawing whose own blur is `own` (the shadow's, else 0). */
30
+ blurTags?: (own: number) => string;
29
31
  }
30
32
  /** The shadow, box and border drawings of one box. */
31
33
  export declare function getDraftBoxEvents(input: DraftBoxEventsInput): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"draft-boxes.d.ts","sourceRoot":"","sources":["../../src/footage/draft-boxes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAIlF;;;;GAIG;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,QAAQ,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC;IAC7C,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAQD,sDAAsD;AACtD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAiBtE"}
1
+ {"version":3,"file":"draft-boxes.d.ts","sourceRoot":"","sources":["../../src/footage/draft-boxes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAIlF;;;;GAIG;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,QAAQ,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC;IAC7C,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,wGAAwG;IACxG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC;AAQD,sDAAsD;AACtD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAmBtE"}
@@ -12,12 +12,13 @@ export function getDraftBoxEvents(input) {
12
12
  const motion = input.motion ?? "";
13
13
  const pos = motion.includes("\\move") ? "" : "\\pos(0,0)";
14
14
  const drawing = getRoundedRectDrawing(box, radius);
15
- const event = (tags, shape) => `Dialogue: ${String(input.layer)},${input.at},${input.styleName},,0,0,0,,{\\an7${pos}${motion}${tags}\\p1}${shape}{\\p0}`;
15
+ const event = (tags, shape, blur = 0) => `Dialogue: ${String(input.layer)},${input.at},${input.styleName},,0,0,0,,{\\an7${pos}${motion}${tags}${input.blurTags?.(blur) ?? ""}\\p1}${shape}{\\p0}`;
16
16
  const events = [];
17
17
  if (input.style.shadow === "soft") {
18
18
  const lowered = getRoundedRectDrawing({ ...box, top: box.top + STYLE_SHADOW.offsetY * scale }, radius);
19
19
  const alpha = Math.round((1 - STYLE_SHADOW.opacity) * 255).toString(16).padStart(2, "0").toUpperCase();
20
- events.push(event(`\\1c&H000000&\\1a&H${alpha}&\\bord0\\shad0\\blur${String(Math.round((STYLE_SHADOW.blur / 3) * scale))}`, lowered));
20
+ const blur = Math.round((STYLE_SHADOW.blur / 3) * scale);
21
+ events.push(event(`\\1c&H000000&\\1a&H${alpha}&\\bord0\\shad0\\blur${String(blur)}`, lowered, blur));
21
22
  }
22
23
  events.push(event(`${toColorTags(input.color, 1)}\\bord0\\shad0`, drawing));
23
24
  if (input.style.border === "thin") {
@@ -1 +1 @@
1
- {"version":3,"file":"draft-boxes.js","sourceRoot":"","sources":["../../src/footage/draft-boxes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAiC5D,oFAAoF;AACpF,SAAS,WAAW,CAAC,GAAW,EAAE,IAAW;IAC3C,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5B,OAAO,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC;AACvF,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,iBAAiB,CAAC,KAA0B;IAC1D,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC;IAClC,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC;IAC1D,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE,CAAC,aAAa,MAA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E,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACxC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,CAAA;CAAO,GACtG,MAAM,EAAE,CAQV"}
@@ -1,8 +1,9 @@
1
1
  import { getCornerRadiusPx } from "./brand-style.js";
2
2
  import { getDraftBoxEvents } from "./draft-boxes.js";
3
3
  import { toAssColor } from "./draft-color.js";
4
- import { getCounterSeconds, getOverlayColors, getTypingTimes } from "./overlay-html.js";
5
- import { OVERLAY_FONT_ROLES, OVERLAY_LINE_HEIGHT, OVERLAY_LIST_LINE_HEIGHT, OVERLAY_TITLE_LINE_HEIGHT, SEARCH_BAR_ICON_EM, SEARCH_BAR_PADDING_EM, estimateTextWidth, formatOverlayNumber, getDrawnOverlayCard, getOverlayPadding, getSideTextLines, getTitleContentBox, } from "./overlays.js";
4
+ import { getCounterSeconds, getOverlayColors, getPlaceCardTimes, getTypingTimes } from "./overlay-html.js";
5
+ import { OVERLAY_EASES, PIN_DROP_SECONDS, PIN_DROP_SHARE, UNDERLINE_EM, UNDERLINE_SECONDS, getEntranceMotion, getExitMotion, getWipeHalves, } from "./overlay-motion.js";
6
+ import { OVERLAY_FONT_ROLES, OVERLAY_LINE_HEIGHT, OVERLAY_LIST_LINE_HEIGHT, OVERLAY_TITLE_LINE_HEIGHT, SEARCH_BAR_ICON_EM, SEARCH_BAR_PADDING_EM, estimateTextWidth, formatOverlayNumber, getDrawnOverlayCard, getOverlayPadding, getPlaceCardPinRow, getPlaceCardPinSize, getSideTextLines, getTitleContentBox, } from "./overlays.js";
6
7
  /**
7
8
  * The draft's overlays as ASS (issue #1200): the same places and times as the render, simplified. Text overlays are
8
9
  * drawn rounded cards of the brand's background, fitted to their text, with the text in its foreground; an
@@ -107,20 +108,103 @@ export function getDraftCardRadius(overlay, box, context, own) {
107
108
  const token = overlay.cornerRadius ?? (context.style === undefined ? null : overlay.kind === "search_bar" ? "pill" : context.style.cornerRadius);
108
109
  return token === null ? own : getCornerRadiusPx(token, box.height, context.scale);
109
110
  }
110
- /** The entrance and exit tags of a run of events: the first fades or slides in, the last fades out. */
111
- function getMotionTags(entrance, isFirst, isLast, slide) {
112
- const fadeIn = isFirst && entrance !== "none" ? FADE_IN_MS : 0;
113
- const fadeOut = isLast ? FADE_OUT_MS : 0;
111
+ /** An overlay's draft motion with its entrance `name` (already the kind's own when it names none). */
112
+ function getDraftMotion(overlay, name, card, context) {
113
+ const easing = overlay.easing ?? "smooth";
114
+ const frame = { width: 1080 * context.scale, height: 1920 * context.scale };
115
+ return {
116
+ name,
117
+ entrance: getEntranceMotion(name, easing, frame),
118
+ exit: getExitMotion({ exit: overlay.exit ?? "auto", entrance: overlay.entrance, easing, frame }),
119
+ card,
120
+ scale: context.scale,
121
+ isSnappy: easing === "snappy",
122
+ isCardMoved: name === "slide" || name === "rise" || name === "pop",
123
+ };
124
+ }
125
+ /** The same motion entering by a plain fade: a part that comes in after its card (a delayed subtitle, a staggered point). */
126
+ function withFadeEntrance(motion) {
127
+ return { ...motion, name: "fade", entrance: getEntranceMotion("fade", "smooth", { width: 1080, height: 1920 }) };
128
+ }
129
+ /** The rectangle a wipe clips to, round the card with room for its shadow and border. */
130
+ function getWipeClip(motion) {
131
+ const room = 24 * motion.scale;
132
+ const { card } = motion;
133
+ return { x0: r0(card.left - room / 4), y0: r0(card.top - room), x1: r0(card.left + card.width + room / 4), y1: r0(card.top + card.height + room) };
134
+ }
135
+ const toClip = (box) => `\\clip(${box.x0},${box.y0},${box.x1},${box.y1})`;
136
+ const toMs = (seconds) => Math.max(0, Math.round(seconds * 1000));
137
+ /**
138
+ * The position and motion tags of one event of a run: the first takes the entrance (a fade, a slide or a rise moving up
139
+ * into place, a pop growing about the card's middle, a wipe's clip), the last the exit (a fade, a move down, a wipe
140
+ * off to the right). libass scales about an event's position, so a pop moves the position with the scale (both linear)
141
+ * to keep the card's middle still. `pos` is the event's position, (0, 0) for a drawing.
142
+ */
143
+ function getMotionTags(motion, input) {
144
+ const { entrance, exit } = motion;
145
+ const { pos, ms } = input;
146
+ let move = null;
147
+ const tags = [];
148
+ let fadeIn = 0;
149
+ if (input.isFirst && entrance.kind === "tween") {
150
+ const enterMs = toMs(entrance.seconds);
151
+ fadeIn = motion.name === "fade" || motion.name === "slide" || motion.name === "type" ? FADE_IN_MS : r0(enterMs * 0.7);
152
+ if (motion.name === "slide")
153
+ move = `\\move(${r0(pos.x)},${r0(pos.y + SLIDE_PX * motion.scale)},${r0(pos.x)},${r0(pos.y)},0,${SLIDE_MS})`;
154
+ if (entrance.from.y > 0 && motion.name !== "slide")
155
+ move = `\\move(${r0(pos.x)},${r0(pos.y + entrance.from.y)},${r0(pos.x)},${r0(pos.y)},0,${enterMs})`;
156
+ if (entrance.from.scale < 1) {
157
+ const s = entrance.from.scale;
158
+ const centre = { x: motion.card.left + motion.card.width / 2, y: motion.card.top + motion.card.height / 2 };
159
+ move = `\\move(${r0(centre.x + s * (pos.x - centre.x))},${r0(centre.y + s * (pos.y - centre.y))},${r0(pos.x)},${r0(pos.y)},0,${enterMs})`;
160
+ const percent = Math.round(s * 100);
161
+ tags.push(`\\fscx${percent}\\fscy${percent}\\t(0,${enterMs},\\fscx100\\fscy100)`);
162
+ }
163
+ }
164
+ const clip = getWipeClip(motion);
165
+ if (input.isFirst && entrance.kind === "wipe") {
166
+ const halves = getWipeHalves(entrance.seconds);
167
+ const [grow, reveal] = [toMs(halves.grow), toMs(halves.reveal)];
168
+ const closed = toClip({ ...clip, x1: clip.x0 });
169
+ tags.push(input.part === "card" ? `${closed}\\t(0,${grow},${toClip(clip)})` : `${closed}\\t(${grow},${grow + reveal},${toClip(clip)})`);
170
+ }
171
+ let fadeOut = 0;
172
+ if (input.isLast && exit.kind !== "none") {
173
+ if (exit.kind === "wipe") {
174
+ const exitMs = toMs(exit.seconds);
175
+ if (!(input.isFirst && entrance.kind === "wipe"))
176
+ tags.push(toClip(clip));
177
+ tags.push(`\\t(${Math.max(0, ms - exitMs)},${ms},${toClip({ ...clip, x0: clip.x1 })})`);
178
+ }
179
+ else {
180
+ fadeOut = motion.isSnappy ? r0(FADE_OUT_MS * 0.7) : FADE_OUT_MS;
181
+ if (exit.kind === "tween" && exit.from.y > 0 && !motion.isCardMoved) {
182
+ const exitMs = toMs(exit.seconds);
183
+ move = `\\move(${r0(pos.x)},${r0(pos.y)},${r0(pos.x)},${r0(pos.y + exit.from.y)},${Math.max(0, ms - exitMs)},${ms})`;
184
+ }
185
+ }
186
+ }
114
187
  const fade = fadeIn === 0 && fadeOut === 0 ? "" : `\\fad(${fadeIn},${fadeOut})`;
115
- const move = isFirst && entrance === "slide" && slide !== null ? `\\move(${r0(slide.x)},${r0(slide.y + slide.dy)},${r0(slide.x)},${r0(slide.y)},0,${SLIDE_MS})` : "";
116
- return `${move}${fade}`;
188
+ return { position: move ?? `\\pos(${r0(pos.x)},${r0(pos.y)})`, rest: `${fade}${tags.join("")}` };
117
189
  }
118
- /** Text events for a run of steps, positioned at `pos` with `tags`, the entrance on the first and the fade out on the last. */
190
+ /** A blur entrance's and exit's tags for an event whose own blur is `own`: from blurred to its own, from its own to blurred. */
191
+ function getBlurTags(motion, input, own) {
192
+ const tags = [];
193
+ if (input.isFirst && motion.entrance.kind === "tween" && motion.entrance.from.blur > 0) {
194
+ tags.push(`\\blur${Math.max(own, r0(motion.entrance.from.blur / 2))}\\t(0,${toMs(motion.entrance.seconds)},\\blur${own})`);
195
+ }
196
+ if (input.isLast && motion.exit.kind === "tween" && motion.exit.from.blur > 0) {
197
+ const exitMs = toMs(motion.exit.seconds);
198
+ tags.push(`\\t(${Math.max(0, input.ms - exitMs)},${input.ms},\\blur${Math.max(own, r0(motion.exit.from.blur / 2))})`);
199
+ }
200
+ return tags.join("");
201
+ }
202
+ /** Text events for a run of steps, positioned at `pos` with `tags`, the entrance on the first and the exit on the last. */
119
203
  function getTextEvents(input) {
120
204
  return input.steps.map((step, index) => {
121
- const motion = getMotionTags(input.entrance, index === 0, index === input.steps.length - 1, { x: input.pos.x, y: input.pos.y, dy: input.slidePx });
122
- const pos = motion.includes("\\move") ? "" : `\\pos(${r0(input.pos.x)},${r0(input.pos.y)})`;
123
- return `Dialogue: ${input.layer},${toAssTime(step.from)},${toAssTime(step.to)},${input.style},,0,0,0,,{${input.tags}${pos}${motion}}${step.text}`;
205
+ const at = { isFirst: index === 0, isLast: index === input.steps.length - 1, ms: toMs(step.to - step.from) };
206
+ const { position, rest } = getMotionTags(input.motion, { ...at, pos: input.pos, part: "text" });
207
+ return `Dialogue: ${input.layer},${toAssTime(step.from)},${toAssTime(step.to)},${input.style},,0,0,0,,{${input.tags}${position}${rest}${getBlurTags(input.motion, at, 0)}}${step.text}`;
124
208
  });
125
209
  }
126
210
  /**
@@ -159,14 +243,19 @@ function getOwnCardRadius(overlay, box, fontSize) {
159
243
  return overlay.kind === "search_bar" ? box.height / 2 : fontSize * 0.42;
160
244
  }
161
245
  /**
162
- * A card's drawn box on layer 3 with the overlay's entrance: one fill without a brand style, else the style's shadow,
163
- * fill and border (`getDraftBoxEvents`), at the brand style's corner or the overlay's own (`getDraftCardRadius`).
246
+ * A card's drawn box on layer 3 with the overlay's motion: one fill without a brand style, else the style's shadow,
247
+ * fill and border (`getDraftBoxEvents`), at the brand style's corner or the overlay's own (`getDraftCardRadius`); a
248
+ * wipe's accent panel over it.
164
249
  */
165
- function getCardShapeEvents(overlay, box, fontSize, colors, entrance, context) {
250
+ function getCardShapeEvents(overlay, box, fontSize, colors, motion, context) {
166
251
  const radius = getDraftCardRadius(overlay, box, context, getOwnCardRadius(overlay, box, fontSize));
252
+ const drawing = getRoundedRectDrawing(box, radius);
253
+ const panel = getWipePanelEvent(overlay, drawing, colors.accent, motion);
167
254
  if (context.style === undefined)
168
- return [getShapeEvent(overlay, getRoundedRectDrawing(box, radius), colors.background, entrance, context.scale)];
169
- return getDraftBoxEvents({
255
+ return [getShapeEvent(overlay, drawing, colors.background, motion), ...panel];
256
+ const at = { isFirst: true, isLast: true, ms: toMs(overlay.end - overlay.start) };
257
+ const { position, rest } = getMotionTags(motion, { ...at, pos: { x: 0, y: 0 }, part: "card" });
258
+ const events = getDraftBoxEvents({
170
259
  layer: 3,
171
260
  at: `${toAssTime(overlay.start)},${toAssTime(overlay.end)}`,
172
261
  styleName: "OverlayShape",
@@ -176,12 +265,42 @@ function getCardShapeEvents(overlay, box, fontSize, colors, entrance, context) {
176
265
  accent: colors.accent,
177
266
  style: context.style,
178
267
  scale: context.scale,
179
- motion: getMotionTags(entrance, true, true, { x: 0, y: 0, dy: SLIDE_PX * context.scale }),
268
+ motion: `${position.startsWith("\\move") ? position : ""}${rest}`,
269
+ blurTags: (own) => getBlurTags(motion, at, own),
180
270
  });
271
+ return [...events, ...panel];
272
+ }
273
+ /** A wipe's accent panel: it grows over the card from the left, then slides off to the right, revealing the card and its text. */
274
+ function getWipePanelEvent(overlay, drawing, accent, motion) {
275
+ if (motion.entrance.kind !== "wipe")
276
+ return [];
277
+ const halves = getWipeHalves(motion.entrance.seconds);
278
+ const [grow, reveal] = [toMs(halves.grow), toMs(halves.reveal)];
279
+ const clip = getWipeClip(motion);
280
+ const tags = `${toClip({ ...clip, x1: clip.x0 })}\\t(0,${grow},${toClip(clip)})\\t(${grow},${grow + reveal},${toClip({ ...clip, x0: clip.x1 })})`;
281
+ return [`Dialogue: 3,${toAssTime(overlay.start)},${toAssTime(overlay.start + motion.entrance.seconds)},OverlayShape,,0,0,0,,{\\an7\\pos(0,0)${tags}\\1c${toTagColor(accent)}\\p1}${drawing}{\\p0}`];
282
+ }
283
+ /** A keyword's underline: an accent bar under its text, drawn from the left once the keyword is in. */
284
+ function getUnderlineEvent(overlay, card, colour, motion) {
285
+ if (overlay.underline !== true)
286
+ return [];
287
+ const pad = getOverlayPadding(overlay);
288
+ const height = Math.max(2, r0(overlay.fontSize * UNDERLINE_EM.height));
289
+ const bar = { left: card.left + pad.x, top: card.top + card.height - pad.y + r0(overlay.fontSize * UNDERLINE_EM.gap), width: card.width - 2 * pad.x, height };
290
+ const after = motion.entrance.kind === "none" ? 0 : motion.entrance.seconds;
291
+ const from = Math.min(overlay.end, overlay.start + after);
292
+ const drawMs = toMs(UNDERLINE_SECONDS);
293
+ const x0 = r0(bar.left);
294
+ const clip = `\\clip(${x0},${r0(bar.top - 4)},${x0},${r0(bar.top + bar.height + 4)})\\t(0,${drawMs},\\clip(${x0},${r0(bar.top - 4)},${r0(bar.left + bar.width)},${r0(bar.top + bar.height + 4)}))`;
295
+ const fade = motion.exit.kind === "none" ? "" : `\\fad(0,${motion.isSnappy ? r0(FADE_OUT_MS * 0.7) : FADE_OUT_MS})`;
296
+ // Under a wipe off, the bar leaves as the wipe starts: it is not clipped with the card.
297
+ const until = motion.exit.kind === "wipe" ? Math.max(from, overlay.end - motion.exit.seconds) : overlay.end;
298
+ return [`Dialogue: 4,${toAssTime(from)},${toAssTime(until)},OverlayShape,,0,0,0,,{\\an7\\pos(0,0)${fade}${clip}\\1c${toTagColor(colour)}\\p1}${getRoundedRectDrawing(bar, height / 2)}{\\p0}`];
181
299
  }
182
300
  /**
183
301
  * A keyword, a lower third or a list: a drawn rounded card fitted to its text (`getDrawnOverlayCard`) on layer 3 and
184
- * its text on layer 4, inset by the card's padding on its side (a lower third from its foot).
302
+ * its text on layer 4, inset by the card's padding on its side (a lower third from its foot). A staggered list's points
303
+ * come in one by one; a keyword's underline is drawn once it is in.
185
304
  */
186
305
  function getSideTextEvents(overlay, context) {
187
306
  const colors = getOverlayColors(overlay, context.brand);
@@ -195,40 +314,63 @@ function getSideTextEvents(overlay, context) {
195
314
  const y = isFoot ? card.top + card.height - padY : card.top + padY;
196
315
  // \an: 7 top left, 9 top right, 1 bottom left, 3 bottom right.
197
316
  const align = isFoot ? (isRight ? 3 : 1) : isRight ? 9 : 7;
198
- const entrance = overlay.entrance === null || overlay.entrance === "type" ? "fade" : overlay.entrance;
317
+ const motion = getDraftMotion(overlay, overlay.entrance === null || overlay.entrance === "type" ? "fade" : overlay.entrance, card, context);
199
318
  const span = { start: overlay.start, end: overlay.end };
200
319
  const tags = `\\an${align}\\fs${fontSize}${getTextTags(overlay, colors, context, OVERLAY_FONT_ROLES[overlay.kind])}`;
201
- const text = (pos, steps) => getTextEvents({ layer: 4, style: "OverlayPlain", pos, tags, steps, entrance, slidePx: SLIDE_PX * context.scale });
202
- const shape = getCardShapeEvents(overlay, card, fontSize, colors, entrance, context);
320
+ const text = (pos, steps, own = motion) => getTextEvents({ layer: 4, style: "OverlayPlain", pos, tags, steps, motion: own });
321
+ const shape = getCardShapeEvents(overlay, card, fontSize, colors, motion, context);
203
322
  if (overlay.kind === "list") {
204
- // One event per point, on the render's line height (libass's own line spacing is tighter), all shown at once.
323
+ // One event per point, on the render's line height (libass's own line spacing is tighter); a staggered point from its second.
205
324
  const step = fontSize * OVERLAY_LIST_LINE_HEIGHT;
206
325
  const lead = (step - fontSize * OVERLAY_LINE_HEIGHT) / 2;
207
- return [...shape, ...getSideTextLines(overlay).flatMap((line, index) => text({ x, y: y + lead + index * step }, [{ from: span.start, to: span.end, text: toAssText(line) }]))];
326
+ return [
327
+ ...shape,
328
+ ...getSideTextLines(overlay).flatMap((line, index) => {
329
+ const from = overlay.itemStarts?.[index];
330
+ const pos = { x, y: y + lead + index * step };
331
+ 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));
332
+ }),
333
+ ];
208
334
  }
209
335
  // A keyword or a lower third types in only when its entrance says so.
210
- return [...shape, ...text({ x, y }, overlay.entrance === null ? [{ from: span.start, to: span.end, text: toAssText(overlay.text) }] : getTypedSteps(overlay.text, span, overlay.typing))];
336
+ const steps = overlay.entrance === null ? [{ from: span.start, to: span.end, text: toAssText(overlay.text) }] : getTypedSteps(overlay.text, span, overlay.typing);
337
+ return [...shape, ...text({ x, y }, steps), ...(overlay.kind === "keyword" ? getUnderlineEvent(overlay, card, colors.accent, motion) : [])];
211
338
  }
212
339
  /** Each card's own entrance when the overlay names none (a typed card fades its card in). */
213
340
  const DEFAULT_ENTRANCES = { hook_title: "slide", search_bar: "fade", place_card: "slide", counter: "fade", date_stamp: "fade" };
214
- /** A drawing event in the overlay's card colour (or accent), with the overlay's entrance. */
215
- function getShapeEvent(overlay, drawing, colour, entrance, scale) {
216
- const motion = getMotionTags(entrance, true, true, { x: 0, y: 0, dy: SLIDE_PX * scale });
217
- const pos = motion.includes("\\move") ? "" : "\\pos(0,0)";
218
- return `Dialogue: 3,${toAssTime(overlay.start)},${toAssTime(overlay.end)},OverlayShape,,0,0,0,,{\\an7${pos}${motion}\\1c${toTagColor(colour)}\\p1}${drawing}{\\p0}`;
341
+ /** A drawing event in the overlay's card colour (or accent), with the overlay's motion. */
342
+ function getShapeEvent(overlay, drawing, colour, motion, layer = 3) {
343
+ const at = { isFirst: true, isLast: true, ms: toMs(overlay.end - overlay.start) };
344
+ const { position, rest } = getMotionTags(motion, { ...at, pos: { x: 0, y: 0 }, part: "card" });
345
+ 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}`;
346
+ }
347
+ /** A place card's pin above its title: there with the card, or dropping a little onto its place. */
348
+ function getPinEvents(overlay, at, colour, motion) {
349
+ if (overlay.pin === undefined)
350
+ return [];
351
+ const size = getPlaceCardPinSize(overlay.fontSize);
352
+ const drawing = getPinDrawing(at, size);
353
+ if (overlay.pin === "static")
354
+ return [getShapeEvent(overlay, drawing, colour, motion, 4)];
355
+ const drop = r0(size * PIN_DROP_SHARE);
356
+ const fade = motion.exit.kind === "none" ? 0 : motion.isSnappy ? r0(FADE_OUT_MS * 0.7) : FADE_OUT_MS;
357
+ return [
358
+ `Dialogue: 4,${toAssTime(overlay.start)},${toAssTime(overlay.end)},OverlayShape,,0,0,0,,{\\an7\\move(0,${-drop},0,0,0,${toMs(PIN_DROP_SECONDS)})\\fad(${r0(toMs(PIN_DROP_SECONDS) * 0.6)},${fade})\\1c${toTagColor(colour)}\\p1}${drawing}{\\p0}`,
359
+ ];
219
360
  }
220
361
  /** A hook title, a search bar, a place card, a counter or a date stamp: a drawn rounded card and its text on layer 4. */
221
362
  function getCardEvents(overlay, context) {
222
363
  const colors = getOverlayColors(overlay, context.brand);
223
364
  const { box, fontSize } = overlay;
224
- const entrance = overlay.entrance === null || overlay.entrance === "type" ? (overlay.typing !== null ? "fade" : DEFAULT_ENTRANCES[overlay.kind]) : overlay.entrance;
225
- const slidePx = SLIDE_PX * context.scale;
365
+ const name = overlay.entrance === null || overlay.entrance === "type" ? (overlay.typing !== null ? "fade" : DEFAULT_ENTRANCES[overlay.kind]) : overlay.entrance;
366
+ const motion = getDraftMotion(overlay, name, box, context);
226
367
  const span = { start: overlay.start, end: overlay.end };
227
- const events = getCardShapeEvents(overlay, box, fontSize, colors, entrance, context);
368
+ const events = getCardShapeEvents(overlay, box, fontSize, colors, motion, context);
228
369
  const { x: padX, y: padY } = getOverlayPadding(overlay);
229
370
  const centerX = box.left + box.width / 2;
230
371
  const tagsFor = (role) => getTextTags(overlay, colors, context, role);
231
- const text = (pos, align, size, role, steps, own = entrance) => getTextEvents({ layer: 4, style: "OverlayPlain", pos, tags: `\\an${align}\\fs${r0(size)}${tagsFor(role)}`, steps, entrance: own, slidePx });
372
+ const text = (pos, align, size, role, steps, own = motion) => getTextEvents({ layer: 4, style: "OverlayPlain", pos, tags: `\\an${align}\\fs${r0(size)}${tagsFor(role)}`, steps, motion: own });
373
+ const plain = { ...motion, name: "none", entrance: { kind: "none" } };
232
374
  if (overlay.kind === "hook_title" || overlay.kind === "place_card") {
233
375
  // The text block sits in the card's middle; centred lines on its axis, left ones from its left edge (RV-131).
234
376
  const content = getTitleContentBox(overlay);
@@ -241,32 +383,40 @@ function getCardEvents(overlay, context) {
241
383
  const pin = Math.round(size * 1.05);
242
384
  const rowWidth = pin + Math.round(size * 0.25) + estimateTextWidth(overlay.place, size);
243
385
  const rowLeft = isLeft ? content.left : centerX - rowWidth / 2;
244
- events.push(getShapeEvent(overlay, getPinDrawing({ x: rowLeft, y: y + (size * OVERLAY_LINE_HEIGHT - pin) / 2 }, pin), colors.accent, entrance, context.scale).replace("Dialogue: 3,", "Dialogue: 4,"));
386
+ events.push(getShapeEvent(overlay, getPinDrawing({ x: rowLeft, y: y + (size * OVERLAY_LINE_HEIGHT - pin) / 2 }, pin), colors.accent, motion, 4));
245
387
  events.push(...text({ x: rowLeft + pin + Math.round(size * 0.25), y }, 7, size, OVERLAY_FONT_ROLES.date_stamp, [{ from: span.start, to: span.end, text: toAssText(overlay.place) }]));
246
388
  y += size * 1.3 + fontSize * 0.12;
247
389
  }
390
+ const times = overlay.kind === "place_card" ? getPlaceCardTimes(overlay) : { pin: null, title: span.start, subtitle: null };
391
+ if (overlay.kind === "place_card" && overlay.pin !== undefined) {
392
+ const size = getPlaceCardPinSize(fontSize);
393
+ events.push(...getPinEvents(overlay, { x: isLeft ? content.left : centerX - size / 2, y }, colors.accent, motion));
394
+ y += getPlaceCardPinRow(fontSize);
395
+ }
248
396
  const lineHeight = overlay.kind === "hook_title" ? OVERLAY_LINE_HEIGHT : OVERLAY_TITLE_LINE_HEIGHT;
397
+ const titleMotion = times.title > span.start ? withFadeEntrance(motion) : motion;
249
398
  let typedBefore = 0;
250
399
  overlay.lines.forEach((line) => {
251
400
  // The lines type one after the other, as the render's characters do; a left line holds its place transparent
252
401
  // from the start, a centred one shows its typed part only (`getTypedSteps`).
253
- const lineStart = overlay.typing === null ? span.start : span.start + typedBefore / overlay.typing;
402
+ const lineStart = overlay.typing === null ? times.title : span.start + typedBefore / overlay.typing;
254
403
  const steps = getTypedSteps(line, { start: lineStart, end: span.end }, overlay.typing, !isLeft);
255
404
  // A centred typed line has no hidden first step to carry the entrance: its letters appear as typed, as the render's.
256
405
  const isTypedCentre = !isLeft && overlay.typing !== null;
257
- events.push(...text({ x: lineX, y }, lineAlign, fontSize, "heading", isLeft ? steps.map((step, index) => (index === 0 ? { ...step, from: span.start } : step)) : steps, isTypedCentre ? "none" : entrance));
406
+ events.push(...text({ x: lineX, y }, lineAlign, fontSize, "heading", isLeft ? steps.map((step, index) => (index === 0 ? { ...step, from: span.start } : step)) : steps, isTypedCentre ? plain : titleMotion));
258
407
  typedBefore += [...line].length;
259
408
  y += fontSize * lineHeight;
260
409
  });
261
410
  if (overlay.kind === "place_card" && overlay.subtitle !== null) {
262
- events.push(...text({ x: lineX, y: y + fontSize * 0.12 }, lineAlign, overlay.subtitleFontSize, "interface", [{ from: span.start, to: span.end, text: toAssText(overlay.subtitle) }]));
411
+ const from = times.subtitle ?? span.start;
412
+ events.push(...text({ x: lineX, y: y + fontSize * 0.12 }, lineAlign, overlay.subtitleFontSize, "interface", [{ from, to: span.end, text: toAssText(overlay.subtitle) }], from > span.start ? withFadeEntrance(motion) : motion));
263
413
  }
264
414
  return events;
265
415
  }
266
416
  if (overlay.kind === "search_bar") {
267
417
  const searchPadX = r0(fontSize * SEARCH_BAR_PADDING_EM.x);
268
418
  const middle = box.top + box.height / 2;
269
- events.push(getShapeEvent(overlay, getGlassDrawing({ x: box.left + searchPadX, y: middle - fontSize / 2 }, fontSize), colors.accent, entrance, context.scale).replace("Dialogue: 3,", "Dialogue: 4,"));
419
+ events.push(getShapeEvent(overlay, getGlassDrawing({ x: box.left + searchPadX, y: middle - fontSize / 2 }, fontSize), colors.accent, motion, 4));
270
420
  events.push(...text({ x: box.left + searchPadX + Math.round(fontSize * SEARCH_BAR_ICON_EM), y: middle }, 4, fontSize, "interface", getTypedSteps(overlay.text, span, overlay.typing)));
271
421
  return events;
272
422
  }
@@ -279,8 +429,8 @@ function getCardEvents(overlay, context) {
279
429
  steps.push({ from: span.start, to: count.start, text: show(overlay.from) });
280
430
  for (let tick = 1; tick <= ticks; tick++) {
281
431
  const progress = tick / ticks;
282
- // power2.out, as the render's tween eases.
283
- const eased = 1 - (1 - progress) ** 2;
432
+ // power2.out, as the render's tween eases: the count slows down to its value.
433
+ const eased = OVERLAY_EASES["power2.out"](progress);
284
434
  const value = overlay.from + (overlay.value - overlay.from) * eased;
285
435
  steps.push({ from: count.start + (tick - 1) * COUNT_STEP, to: tick === ticks ? span.end : count.start + tick * COUNT_STEP, text: show(value) });
286
436
  }