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

Function buildLayoutSampleTimes

packages/cli/src/utils/layoutAudit.ts:60–73  ·  view source on GitHub ↗
({ duration, samples, at }: LayoutSampleOptions)

Source from the content-addressed store, hash-verified

58}
59
60export function buildLayoutSampleTimes({ duration, samples, at }: LayoutSampleOptions): number[] {
61 if (at?.length) {
62 return uniqueSortedTimes(
63 at.filter(
64 (time) => Number.isFinite(time) && time >= 0 && (duration <= 0 || time <= duration),
65 ),
66 );
67 }
68
69 if (!Number.isFinite(duration) || duration <= 0 || samples <= 0) return [];
70
71 const count = Math.max(1, Math.floor(samples));
72 return Array.from({ length: count }, (_, index) => roundTime(((index + 0.5) / count) * duration));
73}
74
75export function computeOverflow(
76 subject: LayoutRect,

Callers 2

runLayoutAuditFunction · 0.85

Calls 3

uniqueSortedTimesFunction · 0.85
roundTimeFunction · 0.85
fromMethod · 0.80

Tested by

no test coverage detected