trace-avatar-render 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.2.
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
- A director card that shows the product's address (`card(title, { url: true })`) now records its caption with
|
|
6
|
+
the address ("For more info visit acme.com"), so a video's words (`saysOf`, a catalogue entry's `says`) no longer
|
|
7
|
+
end on "visit". Its spoken line, and the captions file (cards have no cue), are unchanged. `cardCaption()` is
|
|
8
|
+
exported.
|
|
9
|
+
- Director videos captured at any size but 1280×800 (phone cuts, and 16:9 when the brand fills it) drew the cursor
|
|
10
|
+
at twice its place: Chrome's screencast sent the frames at 1× though the page was at scale 2. The frame scale is
|
|
11
|
+
now measured from the frames (`frameScale()`, exported), so the cursor and click ring land on what is clicked.
|
|
12
|
+
|
|
13
|
+
## 0.2.1
|
|
4
14
|
|
|
5
15
|
- **`fill`**: a brand's `"fill": ["16:9"]` or `--fill <shape>` makes outputs of that shape fill the picture: no window, no
|
|
6
16
|
safe margins. A capture of the same shape (e.g. `--viewport 1280x720`) fills it exactly; another is fitted inside it.
|
|
@@ -2243,6 +2243,11 @@ function cursorAt(moves, t) {
|
|
|
2243
2243
|
}
|
|
2244
2244
|
return moves[moves.length - 1];
|
|
2245
2245
|
}
|
|
2246
|
+
function frameScale(shots, viewportWidth, fallback = 1) {
|
|
2247
|
+
if (!shots.length || !viewportWidth) return fallback;
|
|
2248
|
+
const p = PNG3.sync.read(shots[0].png);
|
|
2249
|
+
return p.width / viewportWidth;
|
|
2250
|
+
}
|
|
2246
2251
|
function withCursor(shots, moves, clicks, o = {}) {
|
|
2247
2252
|
if (!shots.length) return [];
|
|
2248
2253
|
const sprite = o.sprite ?? arrowSprite((o.scale ?? 1) * CURSOR_SIZE);
|
|
@@ -2332,6 +2337,9 @@ function lookOptions(video, brand, appName = "") {
|
|
|
2332
2337
|
if (title || end) o.cards = { ...title ? { title } : {}, ...end ? { end } : {} };
|
|
2333
2338
|
return o;
|
|
2334
2339
|
}
|
|
2340
|
+
function cardCaption(title, url) {
|
|
2341
|
+
return url ? `${title.trim().replace(/[\s:,]+$/, "")} ${url}` : title;
|
|
2342
|
+
}
|
|
2335
2343
|
function cardsOf(cards, finishCards = {}, appName = "") {
|
|
2336
2344
|
const { title: _t, url, ...look } = finishCards?.end ?? finishCards?.title ?? { sub: appName };
|
|
2337
2345
|
return cards.map((c) => ({ t: c.t, ms: c.ms, step: c.step, card: { ...look, title: c.title, ...c.url && url ? { url } : {} } }));
|
|
@@ -2559,10 +2567,16 @@ async function direct(o) {
|
|
|
2559
2567
|
events.push({ t: stopAt, type: "end" });
|
|
2560
2568
|
shots.sort((a, b) => a.t - b.t);
|
|
2561
2569
|
log(`${id}: ${scenes.length} scenes, ${shots.length} screencast frames; drawing the cursor \u2026`);
|
|
2562
|
-
const
|
|
2563
|
-
const
|
|
2570
|
+
const kept = shots.filter((s) => s.t >= playAt - 400);
|
|
2571
|
+
const scale = frameScale(kept, VP.width, DSF);
|
|
2572
|
+
const frames = withCursor(kept, moves, clicks, { scale });
|
|
2573
|
+
const cap = { frames, viewport: { w: VP.width, h: VP.height, scale }, titles, events, playAt, stopAt, endAt: stopAt };
|
|
2564
2574
|
const f = { ...o.look ?? {}, cuts: { maxWaitMs: skipped ? SKIP_KEEP_MS : 0 } };
|
|
2565
|
-
if (cards.length)
|
|
2575
|
+
if (cards.length) {
|
|
2576
|
+
const resolved = cardsOf(cards, f.cards, o.appName);
|
|
2577
|
+
cap.cards = resolved;
|
|
2578
|
+
for (const c of resolved) if (c.card.url && scenes[c.step]) scenes[c.step].caption = cardCaption(c.card.title, c.card.url);
|
|
2579
|
+
}
|
|
2566
2580
|
let narrated = false;
|
|
2567
2581
|
if (o.voice) {
|
|
2568
2582
|
const lines = /* @__PURE__ */ new Map();
|
|
@@ -3558,11 +3572,13 @@ export {
|
|
|
3558
3572
|
arrowSprite,
|
|
3559
3573
|
drawCursor,
|
|
3560
3574
|
cursorAt,
|
|
3575
|
+
frameScale,
|
|
3561
3576
|
withCursor,
|
|
3562
3577
|
pathOf,
|
|
3563
3578
|
travelMs,
|
|
3564
3579
|
sayFrom,
|
|
3565
3580
|
lookOptions,
|
|
3581
|
+
cardCaption,
|
|
3566
3582
|
cardsOf,
|
|
3567
3583
|
aliasOf,
|
|
3568
3584
|
direct,
|
|
@@ -3586,4 +3602,4 @@ export {
|
|
|
3586
3602
|
makeCampaign,
|
|
3587
3603
|
saysOf
|
|
3588
3604
|
};
|
|
3589
|
-
//# sourceMappingURL=chunk-
|
|
3605
|
+
//# sourceMappingURL=chunk-NFJMQBQ4.js.map
|