fix(design-motion): app-only coverage skip, gif fps cap, early empty mask

- check: the >90% coverage skip applies only to an app frame's own surfaces
  (ungrown mask); in cards, or when --mask-grow pushes coverage over 90%,
  overflow fails with what to change (a cards capture with real overflow
  passed as 'clean (overflow not checked)' after a large grow)
- export: --gif-fps/--small-fps capped at 50 (GIF delays are 1/100 s)
- compare resolves its paths (a colon in a relative path read as a protocol)
- capture: MOTION_MASK_EMPTY is checked before the first frame
- tests: cards vs app full-frame mask, fps cap, no frames on an empty mask

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-26 02:28:16 +00:00
1 parent 1ec1a2d481
commit 3aa44719b6
4 files changed
+39 -22

No files matched your search

+19 -9
View File
@@ -13,8 +13,9 @@
// filter; it prints one "MOTION_CHECK: <id> pass|fail ..." line each, writes
// contact-sheet.png, prints "MOTION_SETTINGS: ..." naming any threshold or
// phase override, and ends with "MOTION_RESULT: clean" (exit 0; "clean
// (overflow not checked)" for a capture without a mask, or one whose grown
// mask covers more than 90% of the frame, as a full-bleed app frame does) or
// (overflow not checked)" for a capture without a mask, or an app frame whose
// surfaces cover more than 90% of the frame; in cards, or after --mask-grow,
// such coverage fails overflow) or
// "MOTION_RESULT: <n> failed" (exit 1). Defaults follow the 12 s cycle:
// dissolve at cycle - 1.0, empty beat from cycle - 0.4, intro landed at 2.4.
// export writes <name>-x.mp4, <name>-loop.gif and <name>-800x500.gif into the
@@ -86,7 +87,7 @@ function num(flag: string, fallback: number): number {
}
if (cmd === 'compare') {
const [a, b] = positional as [string, string];
const [a, b] = positional.map(p => path.resolve(p)) as [string, string];
const r = run(compareArgs(a, b, { blur: num('--blur', 0) || undefined, crop: flags.get('--crop') }));
const frame = parsePsnrStats(String(r.stdout))[0];
if (r.status !== 0 || !frame) die(1, `COMPARE_FAILED ${String(r.stderr).trim().split('\n').pop() || 'no PSNR line'} (same pixel size required)`);
@@ -122,15 +123,24 @@ if (cmd === 'check') {
let overflowChecked = manifest.mask !== undefined;
for (const job of jobs) {
if (job.id === 'overflow') {
const coverage = parseMaskCoverage(String(run(maskCoverageArgs(path.join(dir, manifest.mask!), maskGrow)).stdout));
if (coverage === null) {
const coverage = (grow: number) => parseMaskCoverage(String(run(maskCoverageArgs(path.join(dir, manifest.mask!), grow)).stdout));
const own = coverage(0);
const grown = coverage(maskGrow);
if (own === null || grown === null) {
failed++;
console.log('MOTION_CHECK: overflow fail the mask coverage could not be measured');
continue;
}
if (coverage > MAX_MASK_COVERAGE) {
if (own > MAX_MASK_COVERAGE && layout === 'app') {
overflowChecked = false;
console.log(`MOTION_CHECK: overflow skipped (the grown mask covers ${Math.round(coverage * 100)}% of the frame; nothing outside the containers to compare)`);
console.log(`MOTION_CHECK: overflow skipped (the app frame's surfaces cover ${Math.round(own * 100)}% of the frame; nothing outside them to compare)`);
continue;
}
if (grown > MAX_MASK_COVERAGE) {
failed++;
console.log(own > MAX_MASK_COVERAGE
? `MOTION_CHECK: overflow fail the mask covers ${Math.round(own * 100)}% of the frame; in a cards layout mark only the card containers with data-motion-clip`
: `MOTION_CHECK: overflow fail --mask-grow ${maskGrow} grows the mask over ${Math.round(grown * 100)}% of the frame, which hides overflow; lower it`);
continue;
}
}
@@ -169,8 +179,8 @@ if (missing) die(2, `gstack-motion-encode: ${missing} is missing; the capture is
function gifFps(flag: string): number {
const fps = num(flag, 20);
const perCycle = manifest.cycle * fps;
if (!Number.isInteger(fps) || fps < 1 || Math.abs(perCycle - Math.round(perCycle)) > 1e-6) {
die(2, `gstack-motion-encode: ${flag} ${flags.get(flag)} does not give a whole number of frames per ${manifest.cycle} s cycle, so the GIF would drift; 20 always does`);
if (!Number.isInteger(fps) || fps < 1 || fps > 50 || Math.abs(perCycle - Math.round(perCycle)) > 1e-6) {
die(2, `gstack-motion-encode: ${flag} ${flags.get(flag)} must be a whole fps from 1 to 50 (GIF delays are in 1/100 s) that gives a whole number of frames per ${manifest.cycle} s cycle; 20 always does`);
}
return fps;
}