MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / runOnionShot

Function runOnionShot

packages/cli/src/commands/keyframes.ts:709–733  ·  view source on GitHub ↗

Render the 3D onion-skin screenshot for every animated element. Returns true * when the command should early-return (a guard failed).

(
  comps: SurfacedComposition[],
  allComps: SurfacedComposition[],
  projectDir: string | undefined,
  args: ShotArgs & { selector?: string },
)

Source from the content-addressed store, hash-verified

707/** Render the 3D onion-skin screenshot for every animated element. Returns true
708 * when the command should early-return (a guard failed). */
709async function runOnionShot(
710 comps: SurfacedComposition[],
711 allComps: SurfacedComposition[],
712 projectDir: string | undefined,
713 args: ShotArgs & { selector?: string },
714): Promise<boolean> {
715 const { captureMotionPathShot } = await import("./motionShot.js");
716 // With --selector, sample from the FULL animated set and let the browser scope
717 // to the selector (or its animated descendants when the selector is a static
718 // wrapper like `.clip`). Without it, only the (already-filtered) comps qualify.
719 const requests = collectShotSelectors(args.selector ? allComps : comps);
720 const guardError = onionShotGuardError(projectDir, requests, args.ghost ?? false);
721 if (guardError) {
722 console.log(c.dim(guardError));
723 return true;
724 }
725 const saved = await captureMotionPathShot(
726 projectDir!,
727 requests,
728 resolve(args.shot!),
729 onionShotOptions(args),
730 );
731 printOnionShotSaved(saved, requests.length);
732 return false;
733}
734
735// Resolve the command target (a project dir or a single .html) into surfaced
736// compositions, applying the optional --selector filter.

Callers 1

runFunction · 0.85

Calls 6

collectShotSelectorsFunction · 0.85
onionShotGuardErrorFunction · 0.85
captureMotionPathShotFunction · 0.85
resolveFunction · 0.85
onionShotOptionsFunction · 0.85
printOnionShotSavedFunction · 0.85

Tested by

no test coverage detected