@open-take/compositor 0.2.1 → 0.2.3

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/dist/index.d.ts CHANGED
@@ -123,6 +123,16 @@ type CaptureLog = {
123
123
  /** the ordered ground-truth actions (click / type / drag) */
124
124
  events: CaptureEvent[];
125
125
  tEndMs?: number;
126
+ /** Steps the capture DROPPED (target not found / endpoint unresolved) — the
127
+ * take still completes, but a missing beat must reach the end-of-run
128
+ * summary and (with --strict) the exit code, not just an early stderr line
129
+ * buried under render progress. `step` is the plan's 0-based step index. */
130
+ skipped?: {
131
+ step: number;
132
+ action: string;
133
+ target?: string;
134
+ reason: string;
135
+ }[];
126
136
  };
127
137
  type ZoomDecision = {
128
138
  /** selective: not every action zooms. Edit this to tune/remove. */
@@ -232,6 +242,28 @@ type CursorConfig = {
232
242
  * shapes the curve. Bounce > 0 overshoots the RECT (a touch past the target
233
243
  * frame, then settle) — keep it small. */
234
244
  zoomSpring?: number;
245
+ /** Fraction of a camera ramp still UNfinished at its keyframe end (the action
246
+ * instant), left to settle as an asymptotic overdamped tail that continues
247
+ * INTO the hold — so a move tapers out like a physical camera instead of
248
+ * stopping on a velocity cliff at the keyframe. Frame-tracked on the
249
+ * reference export: its moves keep sub-threshold motion ~0.5s past the
250
+ * visible end (tail τ ≈ 220ms in / ≈ 370ms out), while the cut spring's
251
+ * τ = duration/6.9 ends 2-3× harder. ~0.04 (the shipped default) reproduces
252
+ * the reference tails over the default zoomInMs/zoomOutMs. 0 = legacy
253
+ * cut+normalized spring (absent falls back to the default on NEW plans; an
254
+ * old composition without the field renders as it always did). Ignored when
255
+ * zoomSpring or zoomEase is set (those keep their exact legacy curves). */
256
+ zoomSettleFrac?: number;
257
+ /** Minimum stay (ms) after the previous action's visible end before a
258
+ * PULL-OUT ramp may begin. When the beat gap is too tight the pull-out now
259
+ * departs late and LANDS late (after its own action instant) instead of
260
+ * fleeing a frame the viewer is still reading — the reference recorder's
261
+ * reactive pattern (payoff plays while the camera is still arriving).
262
+ * ~800 (the shipped default) reads as a natural beat; pace presets scale it.
263
+ * 0/absent = legacy (a squeezed pull-out departs the instant the previous
264
+ * action ends and lands exactly on its action). Named pullOut- because
265
+ * holdMs already covers the ordinary post-action dwell. */
266
+ pullOutDwellMs?: number;
235
267
  /** ms to delay the synthetic cursor along a DRAG stroke, compensating for the
236
268
  * capture pipeline latency: the captured ink appears ~this long after the pen
237
269
  * actually moved, so without the delay the (exact-time) cursor leads the ink.
@@ -341,6 +373,14 @@ type TakeComposition = {
341
373
  start: Pt;
342
374
  events: CompEvent[];
343
375
  durationMs: number;
376
+ /** Head trim (ms of the composition timeline cut from the delivered mp4).
377
+ * Capture starts at navigation, so the first frames show the app before it
378
+ * painted (plus any cold-cache font swap) — trim them here instead of
379
+ * post-processing with ffmpeg, so the refine loop keeps applying to the file
380
+ * actually shipped. Event tMs values stay on the untrimmed timeline (the
381
+ * capture is the ground truth); only the delivered head moves. 0/absent =
382
+ * no trim. */
383
+ startMs?: number;
344
384
  /** render-time review decoration (badges/watermark/label); never persisted */
345
385
  review?: ReviewDecor;
346
386
  };
@@ -362,7 +402,7 @@ declare const ZOOM_LEVELS: {
362
402
  type ZoomLevelName = keyof typeof ZOOM_LEVELS;
363
403
  /** Name a scale if it sits within tolerance of a preset; else null (custom). */
364
404
  declare function zoomLevelName(scale: number, tol?: number): ZoomLevelName | null;
365
- type MotionPreset = Pick<CursorConfig, "travelWidthsPerSec" | "holdMs" | "zoomInMs" | "zoomOutMs"> & {
405
+ type MotionPreset = Pick<CursorConfig, "travelWidthsPerSec" | "holdMs" | "zoomInMs" | "zoomOutMs" | "pullOutDwellMs"> & {
366
406
  zoomEase?: undefined;
367
407
  };
368
408
  declare const MOTION: Record<"calm" | "natural" | "brisk", MotionPreset>;
@@ -519,7 +559,7 @@ declare function formatIssues(issues: CompositionIssue[]): string;
519
559
  //#region src/math.d.ts
520
560
  //# sourceMappingURL=validate.d.ts.map
521
561
  declare namespace math_d_exports {
522
- export { CamRect, StageKeyframes, bboxFitScale, buildLegs, buildStageKeyframes, clampCenter, cubicBezier, cursorPos, gradientEndpoints, isDragging, keyvalN, keyvalR, restStageScale, smoother, springEase, stageCamera, stageEasing };
562
+ export { CamRect, StageKeyframes, bboxFitScale, buildLegs, buildStageKeyframes, cameraRampSchedule, clampCenter, cubicBezier, cursorPos, gradientEndpoints, isDragging, keyvalN, keyvalR, restStageScale, smoother, springEase, stageCamera, stageEasing };
523
563
  }
524
564
  declare function smoother(t: number): number;
525
565
  declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): (x: number) => number;
@@ -572,6 +612,16 @@ type StageKeyframes = {
572
612
  * monotone toward frame centre — no wrong-way "bounce" for ANY scale pair,
573
613
  * which scale+centre lerp can't guarantee (it hooks when scale > 2×rest). */
574
614
  declare function keyvalR(t: number, kfs: KF<CamRect>[], ease: (u: number) => number): CamRect;
615
+ /** Per-EVENT camera ramp timing (ms), for the refine surfaces (A/B windows,
616
+ * review badges): when the camera actually departs toward a beat and when it
617
+ * lands. `null` for a beat the camera holds through (no anchor). Derived from
618
+ * the same schedule the render uses, so a dwell-delayed pull-out (which
619
+ * departs after the stored inAtMs and can land after its own tMs) is
620
+ * reflected instead of approximated from inAtMs. */
621
+ declare function cameraRampSchedule(comp: TakeComposition): ({
622
+ startMs: number;
623
+ landMs: number;
624
+ } | null)[];
575
625
  declare function buildStageKeyframes(comp: TakeComposition): StageKeyframes;
576
626
  /** The one camera evaluator — scene.tsx (render) and the editor preview both
577
627
  * consume THIS, so preview and export can never drift. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/presets.ts","../src/ffmpeg.ts","../src/plan.ts","../src/camera.ts","../src/render.ts","../src/validate.ts","../src/math.ts"],"sourcesContent":null,"mappings":";;;KAMY,EAAA;;;AAAZ,CAAA;AACY,KAAA,IAAA,GAAI;;EAKJ,CAAA,EAAA,MAAA;;;AAIZ,CAAA;;AAK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,iBO4EI,WAAA,CP5EW,MAAA,EO6EjB,EP7EiC,EAAA,KAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,CAAA,EOmFxC,EPnFwC;AAQ3C;;AACI,KOwFQ,OAAA,GPxFR;EAAY,EAAA,EACZ,MAAA;EAAW,EAAA,EACX,MAAA;EAAW,CAAA,EACX,MAAA;CAAa;AAEb,KOqFQ,cAAA,GPrFR;EAAY,CAAA,EOsFX,EPtFW,COsFR,OPtFQ,CAAA,EAAA;EAEJ,CAAA,EAAA,MAAA;AAWZ,CAAA;;;;AAeY;AAKZ;;;AAOS,iBOyDO,OAAA,CPzDP,CAAA,EAAA,MAAA,EAAA,GAAA,EOyD+B,EPzD/B,COyDkC,OPzDlC,CAAA,EAAA,EAAA,IAAA,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,GAAA,MAAA,CAAA,EOyD4E,OPzD5E;AAED,iBO+EQ,mBAAA,CP/ER,IAAA,EO+EkC,eP/ElC,CAAA,EO+EoD,cP/EpD;;;AAWG,iBO0LK,WAAA,CP1LL,IAAA,EO0LuB,eP1LvB,CAAA,EAAA;EAMC,CAAA,EAAA,MAAA;EAWA,IAAA,EAAA,MAAA;;;;YO6KkC;;;KA4BzC,GAAA;EPxIO,EAAA,EAAA,MAAA;;KO2IP;EPjIO,CAAA,EOkIP,EPlIO;;SOoIH;;;iBAIO,SAAA,OAAgB,kBAAkB;iBAoElC,SAAA,kBAA2B,aAAa,kBAAkB;;APnM9D,iBOgOI,UAAA,CP5NL,CAAA,EAAA,MAAW,EAAA,IAAA,EO4NsB,GP5NtB,EAAA,CAAA,EAAA,OAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/presets.ts","../src/ffmpeg.ts","../src/plan.ts","../src/camera.ts","../src/render.ts","../src/validate.ts","../src/math.ts"],"sourcesContent":null,"mappings":";;;KA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60
62
  travelEase: [
61
63
  .3,
@@ -92,6 +94,7 @@ const MOTION = {
92
94
  holdMs: 1500,
93
95
  zoomInMs: 900,
94
96
  zoomOutMs: 1650,
97
+ pullOutDwellMs: 1e3,
95
98
  zoomEase: void 0
96
99
  },
97
100
  natural: {
@@ -99,6 +102,7 @@ const MOTION = {
99
102
  holdMs: 1100,
100
103
  zoomInMs: 730,
101
104
  zoomOutMs: 1340,
105
+ pullOutDwellMs: 800,
102
106
  zoomEase: void 0
103
107
  },
104
108
  brisk: {
@@ -106,11 +110,12 @@ const MOTION = {
106
110
  holdMs: 750,
107
111
  zoomInMs: 550,
108
112
  zoomOutMs: 1e3,
113
+ pullOutDwellMs: 600,
109
114
  zoomEase: void 0
110
115
  }
111
116
  };
112
117
  function motionName(cursor) {
113
- for (const [name, m] of Object.entries(MOTION)) if (Math.abs(cursor.travelWidthsPerSec - m.travelWidthsPerSec) < .015 && Math.abs(cursor.holdMs - m.holdMs) < 60 && Math.abs(cursor.zoomInMs - m.zoomInMs) < 60 && Math.abs(cursor.zoomOutMs - m.zoomOutMs) < 60) return name;
118
+ for (const [name, m] of Object.entries(MOTION)) if (Math.abs(cursor.travelWidthsPerSec - m.travelWidthsPerSec) < .015 && Math.abs(cursor.holdMs - m.holdMs) < 60 && Math.abs(cursor.zoomInMs - m.zoomInMs) < 60 && Math.abs(cursor.zoomOutMs - m.zoomOutMs) < 60 && (cursor.pullOutDwellMs == null || Math.abs(cursor.pullOutDwellMs - (m.pullOutDwellMs ?? 0)) < 60)) return name;
114
119
  return null;
115
120
  }
116
121
  const DARK_SHADOW = {
@@ -287,6 +292,7 @@ __export(math_exports, {
287
292
  bboxFitScale: () => bboxFitScale,
288
293
  buildLegs: () => buildLegs,
289
294
  buildStageKeyframes: () => buildStageKeyframes,
295
+ cameraRampSchedule: () => cameraRampSchedule,
290
296
  clampCenter: () => clampCenter,
291
297
  cubicBezier: () => cubicBezier,
292
298
  cursorPos: () => cursorPos,
@@ -436,7 +442,7 @@ function keyvalR(t, kfs, ease) {
436
442
  }
437
443
  return kfs[kfs.length - 1][1];
438
444
  }
439
- function buildStageKeyframes(comp) {
445
+ function buildCameraSchedule(comp) {
440
446
  const { videoWidth: vW, videoHeight: vH } = comp.source;
441
447
  const { width: oW, height: oH } = comp.output;
442
448
  const rest = restStageScale(vW, vH, oW, oH, comp.framing.insetFrac);
@@ -444,7 +450,6 @@ function buildStageKeyframes(comp) {
444
450
  x: vW / 2,
445
451
  y: vH / 2
446
452
  };
447
- const HOLD = comp.cursor.holdMs / 1e3;
448
453
  const ZOUT_MS = comp.cursor.zoomOutMs;
449
454
  const rectFor = (center, scale) => {
450
455
  const c = clampCenter(center, scale, vW, vH, oW, oH);
@@ -456,13 +461,19 @@ function buildStageKeyframes(comp) {
456
461
  };
457
462
  const restR = rectFor(restC, rest);
458
463
  const anchors = [];
459
- for (const e of comp.events) {
464
+ const awayFromRest = () => {
465
+ const a = anchors[anchors.length - 1];
466
+ if (!a) return false;
467
+ return Math.abs(a.scale - rest) > 1e-6 || Math.abs(a.center.x - restC.x) > .5 || Math.abs(a.center.y - restC.y) > .5;
468
+ };
469
+ comp.events.forEach((e, evIdx) => {
460
470
  const base = {
471
+ evIdx,
461
472
  tMs: e.tMs,
462
473
  durationMs: e.durationMs ?? 0,
463
474
  inAtMs: e.zoom.inAtMs
464
475
  };
465
- if (e.kind === "scroll" || e.kind === "press" && !e.zoom.enabled) anchors.push({
476
+ if (e.kind === "scroll" || !e.zoom.enabled && (e.kind === "press" || awayFromRest())) anchors.push({
466
477
  ...base,
467
478
  scale: rest,
468
479
  center: restC
@@ -473,19 +484,89 @@ function buildStageKeyframes(comp) {
473
484
  center: e.zoom.center,
474
485
  glide: e.zoom.glide
475
486
  });
476
- }
487
+ });
477
488
  const targets = anchors.map((e) => rectFor(e.center, e.scale));
478
489
  const ZIN_MS = comp.cursor.zoomInMs;
479
- const rampStartS = anchors.map((e, i) => {
490
+ const DWELL_MS = comp.cursor.pullOutDwellMs ?? 0;
491
+ const ramps = anchors.map((e, i) => {
480
492
  const from = i > 0 ? targets[i - 1] : restR;
481
493
  const pullOut = targets[i].w > from.w + 1e-6;
482
494
  const isDefaultInAt = Math.abs(e.inAtMs - Math.max(0, e.tMs - ZIN_MS)) < 1;
483
- if (!pullOut || !isDefaultInAt) return e.inAtMs / 1e3;
495
+ if (!pullOut || !isDefaultInAt) return {
496
+ start: e.inAtMs / 1e3,
497
+ end: e.tMs / 1e3
498
+ };
484
499
  const desired = e.tMs - ZOUT_MS;
485
500
  const prevEndMs = i > 0 ? anchors[i - 1].tMs + anchors[i - 1].durationMs : 0;
486
- const start = desired >= prevEndMs ? desired : Math.min(prevEndMs, e.tMs - Math.min(ZOUT_MS, ZIN_MS));
487
- return Math.max(start, 0) / 1e3;
501
+ const floor = prevEndMs + DWELL_MS;
502
+ if (desired >= floor) return {
503
+ start: Math.max(desired, 0) / 1e3,
504
+ end: e.tMs / 1e3
505
+ };
506
+ if (DWELL_MS > 0) return {
507
+ start: floor / 1e3,
508
+ end: (floor + ZOUT_MS) / 1e3
509
+ };
510
+ const start = Math.min(prevEndMs, e.tMs - Math.min(ZOUT_MS, ZIN_MS));
511
+ return {
512
+ start: Math.max(start, 0) / 1e3,
513
+ end: e.tMs / 1e3
514
+ };
488
515
  });
516
+ if (DWELL_MS > 0) {
517
+ const minRamp = Math.min(ZOUT_MS, ZIN_MS);
518
+ for (let i = 0; i < ramps.length - 1; i++) {
519
+ const r = ramps[i];
520
+ const e = anchors[i];
521
+ if (r.end <= e.tMs / 1e3 + 1e-9) continue;
522
+ const latestStart = ramps[i + 1].start - .01 - minRamp / 1e3;
523
+ if (r.start <= latestStart) continue;
524
+ const prevEndMs = i > 0 ? anchors[i - 1].tMs + anchors[i - 1].durationMs : 0;
525
+ if (latestStart * 1e3 >= prevEndMs) {
526
+ r.start = latestStart;
527
+ r.end = Math.min(r.start + ZOUT_MS / 1e3, ramps[i + 1].start - .01);
528
+ } else {
529
+ const start = Math.min(prevEndMs, e.tMs - minRamp);
530
+ r.start = Math.max(start, 0) / 1e3;
531
+ r.end = e.tMs / 1e3;
532
+ }
533
+ }
534
+ }
535
+ const landTs = anchors.map((e, i) => {
536
+ const nextStart = anchors[i + 1] ? ramps[i + 1].start : Number.POSITIVE_INFINITY;
537
+ const rampEnd = ramps[i].end;
538
+ return rampEnd === e.tMs / 1e3 ? rampEnd : Math.max(ramps[i].start + Math.min(ZOUT_MS, ZIN_MS) / 1e3, Math.min(rampEnd, nextStart - .01));
539
+ });
540
+ return {
541
+ anchors,
542
+ targets,
543
+ restR,
544
+ ramps,
545
+ landTs,
546
+ rectFor
547
+ };
548
+ }
549
+ /** Per-EVENT camera ramp timing (ms), for the refine surfaces (A/B windows,
550
+ * review badges): when the camera actually departs toward a beat and when it
551
+ * lands. `null` for a beat the camera holds through (no anchor). Derived from
552
+ * the same schedule the render uses, so a dwell-delayed pull-out (which
553
+ * departs after the stored inAtMs and can land after its own tMs) is
554
+ * reflected instead of approximated from inAtMs. */
555
+ function cameraRampSchedule(comp) {
556
+ const { anchors, ramps, landTs } = buildCameraSchedule(comp);
557
+ const out = comp.events.map(() => null);
558
+ anchors.forEach((a, i) => {
559
+ out[a.evIdx] = {
560
+ startMs: ramps[i].start * 1e3,
561
+ landMs: landTs[i] * 1e3
562
+ };
563
+ });
564
+ return out;
565
+ }
566
+ function buildStageKeyframes(comp) {
567
+ const { anchors, targets, restR, ramps, landTs, rectFor } = buildCameraSchedule(comp);
568
+ const HOLD = comp.cursor.holdMs / 1e3;
569
+ const ZOUT_MS = comp.cursor.zoomOutMs;
489
570
  const rf = [{
490
571
  t: 0,
491
572
  r: restR
@@ -498,16 +579,17 @@ function buildStageKeyframes(comp) {
498
579
  };
499
580
  let cur = restR;
500
581
  anchors.forEach((e, i) => {
501
- const clickT = e.tMs / 1e3;
502
582
  const actionEnd = (e.tMs + e.durationMs) / 1e3;
503
583
  const next = anchors[i + 1];
504
- const holdEndT = next ? rampStartS[i + 1] : actionEnd + HOLD;
505
- push(rampStartS[i], cur);
506
- push(clickT, targets[i]);
584
+ const nextStart = next ? ramps[i + 1].start : Number.POSITIVE_INFINITY;
585
+ const landT = landTs[i];
586
+ const holdEndT = Math.max(next ? nextStart : actionEnd + HOLD, landT);
587
+ push(ramps[i].start, cur);
588
+ push(landT, targets[i]);
507
589
  cur = targets[i];
508
590
  let holdR = cur;
509
591
  if (e.glide && (e.glide.x !== 0 || e.glide.y !== 0)) {
510
- const holdDur = Math.max(0, holdEndT - clickT);
592
+ const holdDur = Math.max(0, holdEndT - landT);
511
593
  holdR = rectFor({
512
594
  x: e.center.x + e.glide.x * holdDur,
513
595
  y: e.center.y + e.glide.y * holdDur
@@ -528,6 +610,65 @@ function buildStageKeyframes(comp) {
528
610
  T
529
611
  };
530
612
  }
613
+ /** Residual (1 − progress) of an overdamped spring's unit step response, on
614
+ * NORMALISED segment time u = (t − t0)/(t1 − t0). ω0 is solved so the
615
+ * residual at u=1 (the action instant) equals `frac`; past u=1 the same
616
+ * curve keeps decaying — the tail that replaces the legacy cut. ζ=1.2 gives
617
+ * the reference-measured shape: a fast main ramp (peak velocity ~14% in)
618
+ * plus a slow settle pole; at frac 0.04 the tail τ ≈ duration/3.6 (730ms →
619
+ * ~205ms, 1340ms → ~375ms — the frame-tracked reference tails; a different
620
+ * frac shifts ω0 and with it τ). */
621
+ function settleDecay(frac) {
622
+ const zeta = 1.2;
623
+ const s = Math.sqrt(zeta * zeta - 1);
624
+ const l1 = zeta + s;
625
+ const l2 = zeta - s;
626
+ const resid = (x) => (l1 * Math.exp(-l2 * x) - l2 * Math.exp(-l1 * x)) / (l1 - l2);
627
+ let lo = .1;
628
+ let hi = 60;
629
+ for (let i = 0; i < 60; i++) {
630
+ const mid = (lo + hi) / 2;
631
+ if (resid(mid) > frac) lo = mid;
632
+ else hi = mid;
633
+ }
634
+ const w0T = (lo + hi) / 2;
635
+ return (u) => u <= 0 ? 1 : resid(w0T * u);
636
+ }
637
+ /** Evaluate the rect track with moves that settle ASYMPTOTICALLY: each ramp
638
+ * covers 1−frac of its distance by its keyframe end, then keeps creeping
639
+ * toward the target through the following hold (never a velocity cliff). A
640
+ * ramp launches from wherever the previous tail actually is (position-
641
+ * continuous chaining); every emitted rect is a convex combination of
642
+ * build-time-clamped rects, and the valid-rect set is convex (linear
643
+ * half-plane bounds in cx,cy,w), so in-between rects stay valid exactly as
644
+ * in the lerped path. */
645
+ function settleRectAt(kfs, decay, t) {
646
+ let from = kfs[0][1];
647
+ for (let i = 0; i < kfs.length - 1; i++) {
648
+ const [t0, r0] = kfs[i];
649
+ const [t1, r1] = kfs[i + 1];
650
+ if (r0.cx === r1.cx && r0.cy === r1.cy && r0.w === r1.w) continue;
651
+ if (t < t0) break;
652
+ let handoff = Number.POSITIVE_INFINITY;
653
+ for (let j = i + 1; j < kfs.length - 1; j++) {
654
+ const [ta, ra] = kfs[j];
655
+ const [, rb] = kfs[j + 1];
656
+ if (ra.cx !== rb.cx || ra.cy !== rb.cy || ra.w !== rb.w) {
657
+ handoff = ta;
658
+ break;
659
+ }
660
+ }
661
+ const evalT = Math.min(t, handoff);
662
+ const d = decay((evalT - t0) / Math.max(t1 - t0, 1e-6));
663
+ from = {
664
+ cx: r1.cx + (from.cx - r1.cx) * d,
665
+ cy: r1.cy + (from.cy - r1.cy) * d,
666
+ w: r1.w + (from.w - r1.w) * d
667
+ };
668
+ if (t < handoff) return from;
669
+ }
670
+ return from;
671
+ }
531
672
  /** The one camera evaluator — scene.tsx (render) and the editor preview both
532
673
  * consume THIS, so preview and export can never drift. */
533
674
  function stageCamera(comp) {
@@ -535,8 +676,11 @@ function stageCamera(comp) {
535
676
  const ease = stageEasing(comp.cursor);
536
677
  const oW = comp.output.width;
537
678
  const rest = restStageScale(comp.source.videoWidth, comp.source.videoHeight, oW, comp.output.height, comp.framing.insetFrac);
679
+ const frac = comp.cursor.zoomSettleFrac ?? 0;
680
+ const useSettle = frac > 0 && comp.cursor.zoomSpring == null && !comp.cursor.zoomEase;
681
+ const decay = useSettle ? settleDecay(frac) : void 0;
538
682
  const at = (t) => {
539
- const r = keyvalR(t, stage.r, ease);
683
+ const r = decay ? settleRectAt(stage.r, decay, t) : keyvalR(t, stage.r, ease);
540
684
  return {
541
685
  scale: oW / r.w,
542
686
  center: {
@@ -677,6 +821,7 @@ function growDown(box, video) {
677
821
  * field-anchored and height-capped (its reveal is open-ended); every other
678
822
  * kind trusts the captured effect region, else shapes one from the bbox. */
679
823
  function roiForBeat(b, video) {
824
+ if (b.kind === "press" && b.intent === "always" && b.box) return b.box;
680
825
  if (b.kind === "type" && b.box) {
681
826
  const capH = growDown(b.box, video).h;
682
827
  if (b.effectBox) {
@@ -725,14 +870,17 @@ function directCamera(beats, video, out, cam, rest, endMs) {
725
870
  boundary: true,
726
871
  reason: "plan: zoom=never → full view"
727
872
  };
728
- if (b.intent === "always") return {
729
- roi,
730
- scale,
731
- forceFull: false,
732
- forcePunch: true,
733
- boundary: true,
734
- reason: roi ? `plan: zoom=always → ${scale.toFixed(2)}× (framing from ROI)` : "plan: zoom=always but no bbox to frame → full view"
735
- };
873
+ if (b.intent === "always") {
874
+ const floored = roi ? Math.max(scale, cam.minZoomScale) : scale;
875
+ return {
876
+ roi,
877
+ scale: floored,
878
+ forceFull: false,
879
+ forcePunch: true,
880
+ boundary: true,
881
+ reason: roi ? floored > scale ? `plan: zoom=always → ROI fit ${scale.toFixed(2)}× is imperceptible — floored to ${floored.toFixed(2)}×` : `plan: zoom=always → ${floored.toFixed(2)}× (framing from ROI)` : "plan: zoom=always but no bbox to frame → full view"
882
+ };
883
+ }
736
884
  if (b.kind === "scroll") return {
737
885
  roi: void 0,
738
886
  scale: rest,
@@ -757,7 +905,7 @@ function directCamera(beats, video, out, cam, rest, endMs) {
757
905
  boundary: true,
758
906
  reason: `changeCoverage ${b.changeCoverage.toFixed(2)} ≥ ${cam.pullOutCoverage} (global repaint) → full view`
759
907
  };
760
- if (i === 0) return {
908
+ if (i === 0 && b.tMs < 2e3) return {
761
909
  roi,
762
910
  scale,
763
911
  forceFull: true,
@@ -1072,7 +1220,7 @@ function validateComposition(comp, opts = {}) {
1072
1220
  if (z.inAtMs > e.tMs) err(`${p}.zoom.inAtMs`, `inAtMs ${z.inAtMs} is AFTER the action at tMs ${e.tMs} — the zoom would arrive late`, `set inAtMs = tMs − cursor.zoomInMs (= ${Math.max(0, e.tMs - comp.cursor.zoomInMs)})`);
1073
1221
  if (z.enabled) {
1074
1222
  if (z.scale < rest - 1e-6) err(`${p}.zoom.scale`, `scale ${z.scale.toFixed(3)} is below rest ${rest.toFixed(3)} — that zooms OUT past the frame (dead space)`, `raise to ≥ ${rest.toFixed(2)}, or set zoom.enabled=false for a full-view beat`);
1075
- else if (z.scale <= rest + 1e-6) warn(`${p}.zoom.scale`, `scale ${z.scale.toFixed(3)} ≈ rest — zoom is enabled but does nothing visible`, "raise scale to actually zoom, or set enabled=false");
1223
+ else if (z.scale < rest * 1.2) warn(`${p}.zoom.scale`, `scale ${z.scale.toFixed(3)} is within 20% of rest ${rest.toFixed(3)} — an imperceptible zoom (enabled but invisible)`, "raise scale to ≥ ~1.25 to actually zoom, or set enabled=false");
1076
1224
  if (z.scale > maxScale) warn(`${p}.zoom.scale`, `scale ${z.scale.toFixed(2)} exceeds the soft cap ${maxScale} — pixels will soften`, `clamp toward ${maxScale.toFixed(1)} unless the detail truly needs it`);
1077
1225
  if (z.center.x < 0 || z.center.x > vW || z.center.y < 0 || z.center.y > vH) warn(`${p}.zoom.center`, `center (${z.center.x.toFixed(0)},${z.center.y.toFixed(0)}) is outside the video ${vW}x${vH}`, e.bbox ? "use the bbox center: { x: bbox.x+bbox.w/2, y: bbox.y+bbox.h/2 }" : "point at the on-screen target (video-px)");
1078
1226
  if (!e.bbox) warn(`${p}.zoom`, "zoom enabled on a beat with no bbox — center/scale are hand-set, not bbox-fit", "double-check the center frames the intended region");
@@ -1083,8 +1231,28 @@ function validateComposition(comp, opts = {}) {
1083
1231
  if (!(spring >= 0 && spring < .6)) err("cursor.zoomSpring", `zoomSpring ${spring} outside [0, 0.6)`, "0 = critically damped (the default feel); keep bounce ≤ 0.3");
1084
1232
  else if (spring > .3) warn("cursor.zoomSpring", `zoomSpring ${spring} is a lot of bounce — the rect overshoot can flash backdrop at edge-flush targets and over-zoom tight punches`, "keep ≤ 0.3 (the editor slider's max) unless the flash is wanted");
1085
1233
  }
1234
+ const settleFrac = comp.cursor.zoomSettleFrac;
1235
+ if (settleFrac != null && !(settleFrac >= 0 && settleFrac <= .15)) err("cursor.zoomSettleFrac", `zoomSettleFrac ${settleFrac} outside [0, 0.15]`, "~0.04 = the reference-measured tail; 0 = legacy cut spring");
1236
+ else if (settleFrac != null && settleFrac > 0 && (comp.cursor.zoomEase || spring != null)) warn("cursor.zoomSettleFrac", `zoomSettleFrac is IGNORED while cursor.${comp.cursor.zoomEase ? "zoomEase" : "zoomSpring"} is set — the render is byte-identical to not setting it`, "delete cursor.zoomEase / cursor.zoomSpring (a pace preset clears zoomEase) to activate the settle tail");
1237
+ const dwell = comp.cursor.pullOutDwellMs;
1238
+ if (dwell != null && !(dwell >= 0 && dwell <= 5e3)) err("cursor.pullOutDwellMs", `pullOutDwellMs ${dwell} outside [0, 5000]`, "600-1000 reads as a natural beat; 0 = legacy (depart as soon as the action ends)");
1086
1239
  if (comp.durationMs < lastEnd) err("durationMs", `durationMs ${comp.durationMs} ends before the last action (${lastEnd})`, `raise to ≥ ${Math.round(lastEnd + comp.cursor.holdMs + comp.cursor.zoomOutMs)}`);
1087
1240
  else if (comp.durationMs < lastEnd + comp.cursor.zoomOutMs) warn("durationMs", `only ${comp.durationMs - lastEnd}ms after the last action — the final zoom-out may be cut`, `allow ≥ ${comp.cursor.zoomOutMs}ms (cursor.zoomOutMs) of tail`);
1241
+ if ((comp.cursor.pullOutDwellMs ?? 0) > 0 && issues.every((i) => i.severity !== "error")) try {
1242
+ const kfs = buildStageKeyframes(comp).r;
1243
+ let motionEndS = 0;
1244
+ for (let i = 0; i < kfs.length - 1; i++) {
1245
+ const [, a] = kfs[i];
1246
+ const [t1, b] = kfs[i + 1];
1247
+ if (a.cx !== b.cx || a.cy !== b.cy || a.w !== b.w) motionEndS = t1;
1248
+ }
1249
+ if (motionEndS * 1e3 > comp.durationMs + 1) warn("durationMs", `the camera is still mid-motion at durationMs (dwell-delayed landing ends ~${Math.round(motionEndS * 1e3)}ms)`, `raise durationMs to ≥ ${Math.round(motionEndS * 1e3)}`);
1250
+ } catch {}
1251
+ const startMs = comp.startMs;
1252
+ if (startMs != null) {
1253
+ if (!(startMs >= 0) || startMs >= comp.durationMs) err("startMs", `startMs ${startMs} outside [0, durationMs ${comp.durationMs})`, "the head trim must leave a video");
1254
+ else if (comp.events[0] && startMs > comp.events[0].zoom.inAtMs) warn("startMs", `startMs ${startMs} cuts into the first beat (camera/cursor already moving at ${comp.events[0].zoom.inAtMs}ms)`, `keep the trim ≤ ${comp.events[0].zoom.inAtMs} so the delivered video opens at rest`);
1255
+ }
1088
1256
  if (opts.captureLog) {
1089
1257
  const log = opts.captureLog;
1090
1258
  if (log.events.length !== events.length) warn("events", `composition has ${events.length} beats but the capture log has ${log.events.length} — added/removed actions need a re-capture`, "re-capture to change the choreography; edit only renders the existing recording");
@@ -1259,6 +1427,7 @@ async function renderTakeExclusive(opts) {
1259
1427
  if (opts.logProgress && warns.length) process.stderr.write(`composition warnings:\n${formatIssues(warns)}\n`);
1260
1428
  if (errors.length) throw new Error(`composition has ${errors.length} error(s) — refusing to render:\n${formatIssues(errors)}`);
1261
1429
  }
1430
+ const rangeSec = opts.rangeSec ?? (composition.startMs && composition.startMs > 0 ? [composition.startMs / 1e3, composition.durationMs / 1e3 + 120] : void 0);
1262
1431
  await repairBundledMediaPermissions();
1263
1432
  const scratch = await prepareScratch(composition, opts.videoPath);
1264
1433
  const deps = depsRoot();
@@ -1274,7 +1443,7 @@ async function renderTakeExclusive(opts) {
1274
1443
  outFile: "take.mp4",
1275
1444
  outDir: RENDER_OUT,
1276
1445
  workers: 1,
1277
- ...opts.rangeSec ? { projectSettings: { range: opts.rangeSec } } : {},
1446
+ ...rangeSec ? { projectSettings: { range: rangeSec } } : {},
1278
1447
  logProgress: opts.logProgress ?? false,
1279
1448
  ...opts.onProgress ? { progressCallback: (_worker, progress) => opts.onProgress(progress) } : {},
1280
1449
  viteConfig: { server: { fs: { allow: [scratch, ...deps ? [deps] : []] } } },