Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(zoom): pace transitions by zoom level and keep them at screen speed
EtienneLescot755b8fb78288
diff --git a/crates/compositor/src/frame_geometry.rs b/crates/compositor/src/frame_geometry.rsindex eca541c22..b28666dc3 100644--- a/crates/compositor/src/frame_geometry.rs+++ b/crates/compositor/src/frame_geometry.rs@@ -2323,7 +2323,18 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {scene.map(|s| &s.camera_fullscreen_regions).unwrap_or(&empty_cam);let webcam_reactive = scene.map(|s| s.layout.webcam_reactive_zoom).unwrap_or(false);let source_t = input.timeline_t_override.unwrap_or(frame / FPS);- let source_t_prev = source_t - 1.0 / FPS;+ // Les transitions se mesurent à l'écran (`ScreenClock`), la frame précédente aussi : sous+ // une speed region, une frame couvre `vitesse / FPS` de source, et c'est ce pas qui donne+ // au flou de mouvement du zoom la même traînée qu'à 1×.+ let clock = scene+ .map(|s| crate::regions::ScreenClock::new(&s.speed_regions, s.active_clip_index))+ .unwrap_or_default();+ let speed = scene+ .map(|s| {+ crate::regions::speed_at(&s.speed_regions, s.active_clip_index, source_t as f64)+ })+ .unwrap_or(1.0);+ let source_t_prev = source_t - speed as f32 / FPS;// le focus "auto" (suivi curseur) réutilise la même piste que le rendu du curseur.let cursor_for_zoom = cursor;// La rotation 3D (mode 8, pas de motion blur dans ce chemin — cf. le commentaire au@@ -2354,7 +2365,8 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {.map(|c| [c.source_start_sec as f32, c.source_end_sec as f32]).unwrap_or([f32::NEG_INFINITY, f32::INFINITY]),};- let zs = crate::regions::zoom_state_in(zoom_regions, source_t, cursor_for_zoom, &camera);+ let zs =+ crate::regions::zoom_state_in(zoom_regions, source_t, cursor_for_zoom, &camera, &clock);p.zoom = zs.scale;p.focus = zs.focus;zoom_rotation = zs.rotation;@@ -2363,15 +2375,22 @@ pub fn plan_frame(input: &FrameGeometryInput) -> FrameGeometry {zoom_camera = zs.camera;zoom_aim = zs.aim;zoom_orbit = zs.orbit;- let zs_p = crate::regions::zoom_state_at(zoom_regions, source_t_prev, cursor_for_zoom);+ let zs_p = crate::regions::zoom_state_in(+ zoom_regions,+ source_t_prev,+ cursor_for_zoom,+ &crate::regions::CameraFrame::NONE,+ &clock,+ );pp.zoom = zs_p.scale;pp.focus = zs_p.focus;}// Full Camera ignore le rétrécissement réactif de la webcam (design web : mélanger// "rétrécit pour le zoom" et "grandit en plein cadre" dans la même frame n'a pas de sens).- let cam_progress = crate::regions::camera_fullscreen_progress_at(cam_regions, source_t);+ let cam_progress =+ crate::regions::camera_fullscreen_progress_at(cam_regions, source_t, &clock);let cam_progress_prev =- crate::regions::camera_fullscreen_progress_at(cam_regions, source_t_prev);+ crate::regions::camera_fullscreen_progress_at(cam_regions, source_t_prev, &clock);// rétrécissement réactif : la webcam rétrécit pendant un zoom actif (1/zoom, plancher// 0.35 — parité `reactiveWebcamScale`, TS). Ignoré pendant Full Camera (voir ci-dessus).let reactive_scale = |zoom: f32, progress: f32| -> f32 {@@ -2842,7 +2861,10 @@ pub fn cursor_alpha(}let idle_alpha = track.opacity_at(t, live.cursor_auto_hide);let zoom_alpha = match scene {- Some(s) => crate::regions::zoom_cursor_alpha(&s.zoom_regions, t),+ Some(s) => {+ let clock = crate::regions::ScreenClock::new(&s.speed_regions, s.active_clip_index);+ crate::regions::zoom_cursor_alpha(&s.zoom_regions, t, &clock)+ }None => 1.0,};idle_alpha * zoom_alphadiff --git a/crates/compositor/src/regions.rs b/crates/compositor/src/regions.rsindex db136262f..9ef136788 100644--- a/crates/compositor/src/regions.rs+++ b/crates/compositor/src/regions.rs@@ -159,6 +159,60 @@ impl ProgrammeClock {}}+/// Le temps que le spectateur voit passer, en fonction du temps source du clip : ∫ dt / vitesse,+/// à une constante près. Les transitions de zoom et de Full Camera se mesurent sur cette horloge :+/// une speed region accélère le contenu, pas le mouvement de caméra, donc un zoom dure autant à+/// l'écran à 1× qu'à 4× (issue #683). Le palier d'une région reste en temps source : il couvre ce+/// qu'elle montre et défile avec.+///+/// Continue, contrairement à `ProgrammeClock` qui compte des frames entières : une enveloppe ne+/// doit pas marcher d'escalier. Seules les différences servent, d'où l'origine libre. Les+/// recouvrements sont tranchés comme dans `speed_segments_for_window` : la région qui commence+/// d'abord garde la portion commune.+#[derive(Debug, Clone, Default)]+pub struct ScreenClock {+ /// `(début, fin, vitesse)` en temps source, triés et disjoints.+ spans: Vec<(f64, f64, f64)>,+}++impl ScreenClock {+ /// L'horloge du clip `clip_index`, avec la même appartenance que `speed_at`.+ pub fn new(regions: &[SceneSpeedRegion], clip_index: usize) -> Self {+ let mut spans: Vec<(f64, f64, f64)> = regions+ .iter()+ .filter(|r| r.clip_index.map(|i| i == clip_index).unwrap_or(true))+ .map(|r| {+ let speed = if r.speed.is_finite() && r.speed > 0.0 { r.speed } else { 1.0 };+ (r.start_sec, r.end_sec, speed)+ })+ .collect();+ spans.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap_or(std::cmp::Ordering::Equal));+ let mut covered_to = f64::NEG_INFINITY;+ spans.retain_mut(|(start, end, _)| {+ *start = start.max(covered_to);+ let keep = *end > *start;+ if keep {+ covered_to = *end;+ }+ keep+ });+ Self { spans }+ }++ /// Temps écran au temps source `t`, en secondes.+ pub fn at(&self, t: f32) -> f32 {+ let t = t as f64;+ let mut screen = t;+ for &(start, end, speed) in &self.spans {+ if t <= start {+ break;+ }+ screen -= (t.min(end) - start) * (1.0 - 1.0 / speed);+ }+ screen as f32+ }+}+fn push_speed_segment(spans: &mut Vec<SpeedSegment>,start_sec: f64,@@ -178,9 +232,14 @@ fn push_speed_segment(// mêmes fenêtres de transition que le web (TRANSITION_WINDOW_MS etc., converties en secondes).const TRANSITION_WINDOW_S: f32 = 1.01505;-const ZOOM_IN_TRANSITION_WINDOW_S: f32 = TRANSITION_WINDOW_S * 1.5;-const ZOOM_IN_OVERLAP_S: f32 = 0.5;const FULLSCREEN_LEAD_OUT_WINDOW_S: f32 = TRANSITION_WINDOW_S * 1.5;+// Durée d'un zoom à l'écran selon l'échelle visée, cf. `zoom_transition_s` ; miroir de+// `ZOOM_TRANSITION_BASE_MS` / `ZOOM_TRANSITION_PER_LN_MS` (TS).+const ZOOM_TRANSITION_BASE_S: f32 = 0.6;+const ZOOM_TRANSITION_PER_LN_S: f32 = 0.55;+// ω·T du ressort de `ease_spring` : assez haut pour que la fin de fenêtre soit à l'arrêt (1,5 %+// du pic), assez bas pour ne pas figer la seconde moitié.+const SPRING_OMEGA_T: f32 = 7.0;// port de `CHAINED_ZOOM_PAN_GAP_MS` / `CONNECTED_ZOOM_PAN_DURATION_MS` (TS).const CHAINED_ZOOM_PAN_GAP_S: f32 = 1.5;const CONNECTED_ZOOM_PAN_DURATION_S: f32 = 1.0;@@ -237,64 +296,80 @@ fn lerp(a: f32, b: f32, t: f32) -> f32 {a + (b - a) * t}-/// Port de `computeRegionStrength` (TS, `zoomRegionUtils.ts`) : 0 hors fenêtre, ease-in avant-/// `startSec` (le zoom anticipe légèrement), plein régime pendant la région, ease-out après-/// `endSec`. Les temps reçus sont les temps source échantillonnés par le pipeline, donc ces-/// enveloppes restent alignées quand une speed region répète ou saute des frames.+/// L'échelle entre `a` et `b`, interpolée en log : un zoom se perçoit en rapport (passer de 1× à+/// 2× se lit comme de 2× à 4×), donc le rythme d'une transition ne dépend plus du niveau visé.+/// Linéaire, 1× → 5× faisait les trois quarts du chemin perçu dans le premier quart du trajet.+fn scale_lerp(a: f32, b: f32, t: f32) -> f32 {+ let a = a.max(1e-3);+ a * (b.max(1e-3) / a).powf(t)+}++/// Montée d'un ressort critique (sans rebond), ramenée pile sur [0, 1] à la fin de la fenêtre :+/// vitesse nulle au départ, donc pas d'à-coup, et arrivée amortie. L'ancienne courbe du zoom+/// (cubic-bezier(0.16, 1, 0.3, 1)) partait à pleine vitesse dès la première frame.+fn ease_spring(t: f32) -> f32 {+ let x = SPRING_OMEGA_T * clamp01(t);+ let end = 1.0 - (1.0 + SPRING_OMEGA_T) * (-SPRING_OMEGA_T).exp();+ (1.0 - (1.0 + x) * (-x).exp()) / end+}++/// Durée d'une transition de zoom à l'écran vers `scale` : ~0,7 s pour 1,25×, ~0,9 s pour 1,8×+/// (le défaut), ~1,5 s pour 5×. Elle croît avec le log de l'échelle, comme la distance perçue, en+/// gardant un plancher pour qu'un petit zoom ne passe pas en coup de vent. Pic de vitesse perçue :+/// 0,8 à 2,9 e-folds/s selon le niveau, contre 1 à 16 avec l'ancienne fenêtre fixe (issue #683).+fn zoom_transition_s(scale: f32) -> f32 {+ ZOOM_TRANSITION_BASE_S + ZOOM_TRANSITION_PER_LN_S * scale.max(1.0).ln()+}++/// Port de `computeRegionStrength` (TS, `zoomRegionUtils.ts`) : 0 hors fenêtre, ease-in qui+/// arrive pile à `startSec` (le zoom est en place quand la région commence), plein régime pendant+/// la région, ease-out qui part de `endSec`. Les deux transitions durent `zoom_transition_s`.+/// `t` est le temps source échantillonné par le pipeline, donc l'enveloppe reste alignée quand+/// une speed region répète ou saute des frames ; ses fenêtres, elles, se mesurent sur l'horloge+/// écran (`ScreenClock`).////// `under_trim` coupe les enveloppes : la région vit sous une coupe, donc pleine force sur son-/// span et rien en dehors. Sans ça son ease-in (1,5 s AVANT `start_sec`) et son ease-out+/// span et rien en dehors. Sans ça son ease-in (jusqu'à 1,5 s AVANT `start_sec`) et son ease-out/// déborderaient sur les frames GARDÉES de part et d'autre du trim — un zoom que l'export ne/// rendra jamais, visible dans la preview juste à côté de la coupe. Cf. `SceneZoomRegion`.-/// L'instant où la région commence à entrer (sa force quitte 0).-fn lead_in_start(region: &SceneZoomRegion) -> f32 {- let start = region.start_sec as f32;- if region.under_trim {- return start;- }- let zoom_in_end = start + ZOOM_IN_OVERLAP_S;- zoom_in_end - ZOOM_IN_TRANSITION_WINDOW_S-}--fn zoom_region_strength(region: &SceneZoomRegion, t: f32) -> f32 {+fn zoom_region_strength(region: &SceneZoomRegion, t: f32, clock: &ScreenClock) -> f32 {let start = region.start_sec as f32;let end = region.end_sec as f32;if region.under_trim {return if t >= start && t < end { 1.0 } else { 0.0 };}- let zoom_in_end = start + ZOOM_IN_OVERLAP_S;- let lead_in_start = lead_in_start(region);- let lead_out_end = end + TRANSITION_WINDOW_S;- if t < lead_in_start || t > lead_out_end {+ let (start, end, t) = (clock.at(start), clock.at(end), clock.at(t));+ let window = zoom_transition_s(region.scale);+ if t < start - window || t > end + window {return 0.0;}- if t < zoom_in_end {- let progress = (t - lead_in_start) / ZOOM_IN_TRANSITION_WINDOW_S;- return ease_out_screen_studio(progress);+ if t < start {+ return ease_spring((t - (start - window)) / window);}if t <= end {return 1.0;}- let progress = clamp01((t - end) / TRANSITION_WINDOW_S);- 1.0 - ease_out_screen_studio(progress)+ 1.0 - ease_spring((t - end) / window)}/// Facteur d'opacité du curseur (0.0..1.0) induit par les régions de zoom ayant `hide_cursor = true`./// Si aucune région masquant le curseur n'est active, retourne 1.0./// S'estompe avec l'ease-in du zoom (1.0 -> 0.0) et réapparaît avec l'ease-out (0.0 -> 1.0)./// En cas de transition chaînée (connected pan), suit le même enchaînement que `zoom_state_at`.-pub fn zoom_cursor_alpha(regions: &[SceneZoomRegion], t: f32) -> f32 {+pub fn zoom_cursor_alpha(regions: &[SceneZoomRegion], t: f32, clock: &ScreenClock) -> f32 {if regions.is_empty() || !regions.iter().any(|r| r.hide_cursor) {return 1.0;}- let pairs = connected_pairs(regions);+ let pairs = connected_pairs(regions, clock);+ let screen_t = clock.at(t);// 1) transition chaînée : pan lissé de la région courante vers la suivante.for &(ci, ni, t_start, t_end) in &pairs {- if t < t_start || t > t_end {+ if screen_t < t_start || screen_t > t_end {continue;}- let progress = ease_connected_pan(clamp01((t - t_start) / (t_end - t_start).max(1e-3)));+ let progress =+ ease_connected_pan(clamp01((screen_t - t_start) / (t_end - t_start).max(1e-3)));let cur_alpha = if regions[ci].hide_cursor { 0.0 } else { 1.0 };let next_alpha = if regions[ni].hide_cursor { 0.0 } else { 1.0 };return lerp(cur_alpha, next_alpha, progress).clamp(0.0, 1.0);@@ -304,7 +379,7 @@ pub fn zoom_cursor_alpha(regions: &[SceneZoomRegion], t: f32) -> f32 {// suivante, celle-ci est déjà pleinement active (anticipe son propre ease-in).for &(_, ni, _, t_end) in &pairs {let next = ®ions[ni];- if t > t_end && t < next.start_sec as f32 {+ if screen_t > t_end && t < next.start_sec as f32 {return if next.hide_cursor { 0.0 } else { 1.0 };}}@@ -316,11 +391,11 @@ pub fn zoom_cursor_alpha(regions: &[SceneZoomRegion], t: f32) -> f32 {let outgoing_past_end =pairs.iter().any(|&(ci, _, _, _)| ci == i && t > regions[i].end_sec as f32);let incoming_before_transition_end =- pairs.iter().any(|&(_, ni, _, t_end)| ni == i && t < t_end);+ pairs.iter().any(|&(_, ni, _, t_end)| ni == i && screen_t < t_end);if outgoing_past_end || incoming_before_transition_end {continue;}- let s = zoom_region_strength(r, t);+ let s = zoom_region_strength(r, t, clock);if s <= 0.0 {continue;}@@ -567,7 +642,8 @@ fn resolve_focus(region: &SceneZoomRegion, t: f32, cursor: Option<&CursorTrack>)/// Paires de régions adjacentes assez proches pour être chaînées (port de/// `getConnectedRegionPairs`, TS) : (index courant, index suivant, début transition, fin-/// transition), en secondes. Indices dans `regions` (pas d'id nécessaire — contrairement au+/// transition), en secondes ÉCRAN (`ScreenClock`) — l'écart et le pan se mesurent à l'écran.+/// Indices dans `regions` (pas d'id nécessaire — contrairement au/// web qui matche par `region.id` car il travaille sur des objets isolés, ici tout vient du/// même slice donc les positions suffisent).///@@ -575,50 +651,54 @@ fn resolve_focus(region: &SceneZoomRegion, t: f32, cursor: Option<&CursorTrack>)/// rendu, donc un pan lissé vers (ou depuis) l'une d'elles ferait bouger des frames gardées au/// nom d'une région que l'export ne joue pas. Elles restent des régions dominantes indépendantes,/// sèches sur leur propre span (cf. `zoom_region_strength`).-fn connected_pairs(regions: &[SceneZoomRegion]) -> Vec<(usize, usize, f32, f32)> {+fn connected_pairs(regions: &[SceneZoomRegion], clock: &ScreenClock) -> Vec<(usize, usize, f32, f32)> {let mut order: Vec<usize> = (0..regions.len()).filter(|&i| !regions[i].under_trim).collect();order.sort_by(|&a, &b| regions[a].start_sec.partial_cmp(®ions[b].start_sec).unwrap());let mut pairs = Vec::new();for w in order.windows(2) {let (ci, ni) = (w[0], w[1]);- let gap = regions[ni].start_sec as f32 - regions[ci].end_sec as f32;+ let transition_start = clock.at(regions[ci].end_sec as f32);+ let gap = clock.at(regions[ni].start_sec as f32) - transition_start;if gap <= CHAINED_ZOOM_PAN_GAP_S {- let transition_start = regions[ci].end_sec as f32;pairs.push((ci, ni, transition_start, transition_start + CONNECTED_ZOOM_PAN_DURATION_S));}}pairs}+/// `zoom_state_in` sans speed region ni caméra `follow-cursor` : ce que les tests comparent.+#[cfg(test)]+pub fn zoom_state_at(regions: &[SceneZoomRegion], t: f32, cursor: Option<&CursorTrack>) -> ZoomState {+ zoom_state_in(regions, t, cursor, &CameraFrame::NONE, &ScreenClock::default())+}+/// État de zoom au temps `t` (secondes source du clip actif). Port de/// `findDominantRegion` (TS) : régions chaînées d'abord (transition puis/// hold), sinon la région "dominante" indépendante la plus forte (ties → la plus récente)./// Hors de toute région → identité (échelle 1, focus centre, tilt nul).///-/// Sans piste, `follow-cursor` vise le centre. Le rendu passe par `zoom_state_in`, qui lui donne-/// la piste, le recadrage et la fenêtre du clip.-pub fn zoom_state_at(regions: &[SceneZoomRegion], t: f32, cursor: Option<&CursorTrack>) -> ZoomState {- zoom_state_in(regions, t, cursor, &CameraFrame::NONE)-}--/// `zoom_state_at`, avec ce que lit la caméra `follow-cursor` (`CameraFrame`).+/// `frame` est ce que lit la caméra `follow-cursor` (sans piste, elle vise le centre) ; `clock`+/// mesure les transitions à l'écran, cf. `ScreenClock`.pub fn zoom_state_in(regions: &[SceneZoomRegion],t: f32,cursor: Option<&CursorTrack>,frame: &CameraFrame,+ clock: &ScreenClock,) -> ZoomState {if regions.is_empty() {return IDENTITY_ZOOM;}- let pairs = connected_pairs(regions);+ let pairs = connected_pairs(regions, clock);+ let screen_t = clock.at(t);// 1) transition chaînée : pan lissé de la région courante vers la suivante.for &(ci, ni, t_start, t_end) in &pairs {- if t < t_start || t > t_end {+ if screen_t < t_start || screen_t > t_end {continue;}- let progress = ease_connected_pan(clamp01((t - t_start) / (t_end - t_start).max(1e-3)));+ let progress =+ ease_connected_pan(clamp01((screen_t - t_start) / (t_end - t_start).max(1e-3)));let (cur, next) = (®ions[ci], ®ions[ni]);let cur_focus = resolve_focus(cur, t, cursor);let next_focus = resolve_focus(next, t, cursor);@@ -651,7 +731,7 @@ pub fn zoom_state_in(let (a, b) = (follow_at(cur, t, frame), follow_at(next, t, frame));let mix = |p: [f32; 2], q: [f32; 2]| [lerp(p[0], q[0], progress), lerp(p[1], q[1], progress)];return ZoomState {- scale: lerp(cur.scale, next.scale, progress),+ scale: scale_lerp(cur.scale, next.scale, progress),focus: [lerp(cur_focus[0], next_focus[0], progress), lerp(cur_focus[1], next_focus[1], progress)],rotation,tilt: lerp(fixed_flag(cur), fixed_flag(next), progress) * crossing,@@ -666,7 +746,7 @@ pub fn zoom_state_in(// suivante, celle-ci est déjà pleinement active (anticipe son propre ease-in).for &(_, ni, _, t_end) in &pairs {let next = ®ions[ni];- if t > t_end && t < next.start_sec as f32 {+ if screen_t > t_end && t < next.start_sec as f32 {let camera = follow_flag(next);let seen = follow_at(next, t, frame);return ZoomState {@@ -688,11 +768,12 @@ pub fn zoom_state_in(for (i, r) in regions.iter().enumerate() {let outgoing_past_end =pairs.iter().any(|&(ci, _, _, _)| ci == i && t > regions[i].end_sec as f32);- let incoming_before_transition_end = pairs.iter().any(|&(_, ni, _, t_end)| ni == i && t < t_end);+ let incoming_before_transition_end =+ pairs.iter().any(|&(_, ni, _, t_end)| ni == i && screen_t < t_end);if outgoing_past_end || incoming_before_transition_end {continue;}- let s = zoom_region_strength(r, t);+ let s = zoom_region_strength(r, t, clock);if s <= 0.0 {continue;}@@ -708,7 +789,7 @@ pub fn zoom_state_in(Some((i, strength)) => {let r = ®ions[i];let focus = resolve_focus(r, t, cursor);- let scale = lerp(1.0, r.scale, strength);+ let scale = scale_lerp(1.0, r.scale, strength);// La référence (`zoomTransform.ts`) fait converger le point de focus vers le centre// de l'écran LINÉAIREMENT : screen(f) = 0.5 + (f - 0.5)(1 - strength). Passer// `lerp(0.5, f, strength)` comme centre de crop ne donne pas ça — le crop mappant@@ -739,13 +820,18 @@ pub fn zoom_state_in(/// [startSec, endSec] (contrairement au zoom, qui anticipe avant `startSec`) — ease-in depuis/// 0 pile à `startSec`, plein régime, ease-out jusqu'à 0 pile à `endSec`. Fenêtres bornées à la/// moitié de la durée de la région pour que les régions courtes s'animent pleinement sans-/// déborder.-fn camera_fullscreen_region_strength(region: &SceneCameraFullscreenRegion, t: f32) -> f32 {+/// déborder. Fenêtres mesurées à l'écran, comme celles du zoom (`ScreenClock`).+fn camera_fullscreen_region_strength(+ region: &SceneCameraFullscreenRegion,+ t: f32,+ clock: &ScreenClock,+) -> f32 {let start = region.start_sec as f32;let end = region.end_sec as f32;if t <= start || t >= end {return 0.0;}+ let (start, end, t) = (clock.at(start), clock.at(end), clock.at(t));let half = (end - start) * 0.5;let lead_in = TRANSITION_WINDOW_S.min(half);let lead_out = FULLSCREEN_LEAD_OUT_WINDOW_S.min(half);@@ -765,10 +851,14 @@ fn camera_fullscreen_region_strength(region: &SceneCameraFullscreenRegion, t: f3/// Progrès Full Camera (0..1) au temps `t` : 0 = webcam à sa taille normale, 1 = plein cadre./// Régions superposées (ne devrait pas arriver, gardé défensif comme le web) → la plus forte/// gagne.-pub fn camera_fullscreen_progress_at(regions: &[SceneCameraFullscreenRegion], t: f32) -> f32 {+pub fn camera_fullscreen_progress_at(+ regions: &[SceneCameraFullscreenRegion],+ t: f32,+ clock: &ScreenClock,+) -> f32 {let mut strongest = 0.0f32;for r in regions {- let s = camera_fullscreen_region_strength(r, t);+ let s = camera_fullscreen_region_strength(r, t, clock);if s > strongest {strongest = s;}@@ -1348,13 +1438,13 @@ mod zoom_focus_tests {let regions = vec![r];// Bien avant le zoom (t=0.0) -> pleine opacité- assert_eq!(zoom_cursor_alpha(®ions, 0.0), 1.0);+ assert_eq!(zoom_cursor_alpha(®ions, 0.0, &ScreenClock::default()), 1.0);// Plein milieu du zoom (t=4.5) -> complètement masqué- assert_eq!(zoom_cursor_alpha(®ions, 4.5), 0.0);+ assert_eq!(zoom_cursor_alpha(®ions, 4.5, &ScreenClock::default()), 0.0);// Bien après le zoom (t=10.0) -> pleine opacité- assert_eq!(zoom_cursor_alpha(®ions, 10.0), 1.0);+ assert_eq!(zoom_cursor_alpha(®ions, 10.0, &ScreenClock::default()), 1.0);}#[test]@@ -1372,13 +1462,13 @@ mod zoom_focus_tests {let regions = vec![r1, r2];// Pendant la région 1 (t=3.0) -> masqué- assert_eq!(zoom_cursor_alpha(®ions, 3.0), 0.0);+ assert_eq!(zoom_cursor_alpha(®ions, 3.0, &ScreenClock::default()), 0.0);// Pendant la transition chaînée (connected pan entre t=4.0 et t=4.3) -> reste masqué- assert_eq!(zoom_cursor_alpha(®ions, 4.15), 0.0);+ assert_eq!(zoom_cursor_alpha(®ions, 4.15, &ScreenClock::default()), 0.0);// Pendant le palier chaîné (t=4.4) -> reste masqué- assert_eq!(zoom_cursor_alpha(®ions, 4.4), 0.0);+ assert_eq!(zoom_cursor_alpha(®ions, 4.4, &ScreenClock::default()), 0.0);// Pendant la région 2 (t=5.5) -> masqué- assert_eq!(zoom_cursor_alpha(®ions, 5.5), 0.0);+ assert_eq!(zoom_cursor_alpha(®ions, 5.5, &ScreenClock::default()), 0.0);}#[test]@@ -1396,9 +1486,9 @@ mod zoom_focus_tests {let regions = vec![r1, r2];// Avant la transition (r1 actif) -> 0.0- assert_eq!(zoom_cursor_alpha(®ions, 3.0), 0.0);+ assert_eq!(zoom_cursor_alpha(®ions, 3.0, &ScreenClock::default()), 0.0);// Après la transition (r2 actif avec hide_cursor=false) -> 1.0- assert_eq!(zoom_cursor_alpha(®ions, 5.5), 1.0);+ assert_eq!(zoom_cursor_alpha(®ions, 5.5, &ScreenClock::default()), 1.0);}/// Où le point source `f` atterrit à l'écran (0..1) : le crop est centré sur `focus` et@@ -1420,8 +1510,9 @@ mod zoom_focus_tests {for step in 0..=20 {let t = 1.0 + step as f32 * 0.15;let state = zoom_state_at(®ions, t, None);- // `progress` déduit du scale rendu, pour ne pas ré-implémenter l'easing dans le test.- let progress = (state.scale - 1.0) / (target_scale - 1.0);+ // `progress` déduit du scale rendu (interpolé en log), pour ne pas ré-implémenter+ // l'easing dans le test.+ let progress = state.scale.ln() / target_scale.ln();let expected = 0.5 + (f - 0.5) * (1.0 - progress);assert!((screen_x(&state, f) - expected).abs() < 1e-4,@@ -1431,6 +1522,28 @@ mod zoom_focus_tests {}}+ /// Le rythme ne dépend plus du niveau (issue #683). À chaque échelle du sélecteur, le zoom part+ /// et repart à l'arrêt, ne dépasse pas 3 e-folds/s de vitesse perçue (|d ln échelle / dt|) et+ /// est en place pile au début de la région. L'ancienne fenêtre fixe montait à 16 à 5×, et dès+ /// la première frame.+ #[test]+ fn a_zoom_moves_at_a_comfortable_pace_at_every_level() {+ let dt = 1.0f32 / 240.0;+ for scale in [1.25f32, 1.5, 1.8, 2.2, 3.5, 5.0] {+ let r = [region(scale, 0.5)];+ let ln_scale = |t: f32| zoom_state_at(&r, t, None).scale.ln();+ let speed = |t: f32| (ln_scale(t + dt) - ln_scale(t)).abs() / dt;+ let lead_in = 2.0 - zoom_transition_s(scale);+ let peak = (0..=(zoom_transition_s(scale) / dt) as usize)+ .map(|i| speed(lead_in + i as f32 * dt))+ .fold(0.0f32, f32::max);+ assert!(peak < 3.0, "{scale}× : pic à {peak}/s");+ assert!(speed(lead_in) < 0.1 * peak, "{scale}× : départ à {}/s", speed(lead_in));+ assert!(speed(8.0) < 0.1 * peak, "{scale}× : retour à {}/s", speed(8.0));+ assert_eq!(zoom_state_at(&r, 2.0, None).scale, scale, "{scale}× en place au début");+ }+ }+#[test]fn manual_focus_is_dead_centre_at_full_strength() {let f = 0.8;@@ -1473,7 +1586,82 @@ mod zoom_focus_tests {cut.start_sec = 9.0;cut.end_sec = 10.0;// Sans le filtre, l'écart de 1 s < CHAINED_ZOOM_PAN_GAP_S apparierait [2,8] et [9,10].- assert!(connected_pairs(&[region(2.0, 0.5), cut]).is_empty());+ assert!(connected_pairs(&[region(2.0, 0.5), cut], &ScreenClock::default()).is_empty());+ }++ fn speed(clip_index: Option<usize>, start_sec: f64, end_sec: f64, speed: f64) -> SceneSpeedRegion {+ SceneSpeedRegion { clip_index, start_sec, end_sec, speed }+ }++ #[test]+ fn the_screen_clock_runs_slower_than_the_source_inside_a_speed_region() {+ let clock = ScreenClock::new(&[speed(None, 2.0, 6.0, 4.0)], 0);+ assert_eq!(clock.at(1.0), 1.0);+ assert_eq!(clock.at(4.0), 2.5);+ assert_eq!(clock.at(8.0), 5.0);+ // Autre clip ignoré ; recouvrement : la première région garde [4, 6), la seconde ne+ // compte que sur [6, 8). 2 + 1 + 1 à t = 8.+ let clock = ScreenClock::new(+ &[speed(Some(1), 0.0, 10.0, 2.0), speed(Some(0), 2.0, 6.0, 4.0), speed(Some(0), 4.0, 8.0, 2.0)],+ 0,+ );+ assert_eq!(clock.at(8.0), 4.0);+ }++ /// Un 4× uniforme est un pur changement d'échelle du temps POUR LE CONTENU : vu à l'écran, tout+ /// doit bouger exactement comme des régions quatre fois plus courtes à 1× — zooms chaînés+ /// (1 s d'écart à l'écran, foyers différents) et Full Camera compris.+ #[test]+ fn a_speed_region_scales_the_footage_not_the_camera_move() {+ let clock = ScreenClock::new(&[speed(None, 0.0, 1000.0, 4.0)], 0);+ let zooms = |k: f64| {+ let (mut a, mut b) = (region(2.5, 0.8), region(1.8, 0.3));+ (a.start_sec, a.end_sec, b.start_sec, b.end_sec) = (5.0 * k, 10.0 * k, 11.0 * k, 15.0 * k);+ [a, b]+ };+ let full_camera =+ |k: f64| [SceneCameraFullscreenRegion { clip_index: None, start_sec: 18.0 * k, end_sec: 22.0 * k }];+ let (sped, plain) = (zooms(4.0), zooms(1.0));+ assert_eq!(connected_pairs(&sped, &clock).len(), 1, "la paire doit se chaîner");+ for step in 0..=1000 {+ let t = step as f32 * 0.1;+ let a = zoom_state_in(&sped, t, None, &CameraFrame::NONE, &clock);+ let b = zoom_state_at(&plain, t / 4.0, None);+ assert!((a.scale - b.scale).abs() < 1e-4, "t={t} : {} vs {}", a.scale, b.scale);+ assert!((a.focus[0] - b.focus[0]).abs() < 1e-4, "t={t}");+ let a = camera_fullscreen_progress_at(&full_camera(4.0), t, &clock);+ let b = camera_fullscreen_progress_at(&full_camera(1.0), t / 4.0, &ScreenClock::default());+ assert!((a - b).abs() < 1e-4, "Full Camera t={t} : {a} vs {b}");+ }+ }++ /// Le cas réel : la speed region commence au milieu de l'ease-in. Le zoom doit durer autant de+ /// frames de sortie qu'à 1× (l'export avance de `vitesse / fps` de source par frame), sans saut.+ #[test]+ fn a_zoom_straddling_a_speed_region_lasts_as_many_frames_as_at_1x() {+ let mut r = region(2.0, 0.5);+ (r.start_sec, r.end_sec) = (10.0, 12.0);+ let walk = |speeds: &[SceneSpeedRegion]| {+ let clock = ScreenClock::new(speeds, 0);+ let (mut frames, mut prev, mut worst_step) = (0usize, 1.0f32, 0.0f32);+ // Les instants que l'export compose : `début + k·vitesse/fps` dans chaque span.+ for seg in speed_segments_for_window(speeds, 0.0, 20.0, 60.0) {+ for k in 0..seg.frame_count {+ let t = (seg.start_sec + k as f64 * seg.speed / 60.0) as f32;+ let scale = zoom_state_in(&[r.clone()], t, None, &CameraFrame::NONE, &clock).scale;+ if scale > 1.0 && scale < 2.0 {+ frames += 1;+ }+ worst_step = worst_step.max((scale - prev).abs());+ prev = scale;+ }+ }+ (frames, worst_step)+ };+ let (plain_frames, plain_step) = walk(&[]);+ let (sped_frames, sped_step) = walk(&[speed(None, 9.5, 11.0, 8.0)]);+ assert!(plain_frames.abs_diff(sped_frames) <= 2, "{plain_frames} vs {sped_frames} frames");+ assert!(sped_step <= plain_step + 0.01, "saut de {sped_step} (1× : {plain_step})");}}@@ -2600,25 +2788,25 @@ mod follow_camera_tests {let tr = track(|_| (0.85, 0.5));let f = whole(&tr);let r = [region("follow-cursor", 2.0, 8.0)];- let full = zoom_state_in(&r, 5.0, Some(&tr), &f);+ let full = zoom_state_in(&r, 5.0, Some(&tr), &f, &ScreenClock::default());assert_eq!((full.rotation, full.tilt, full.click_impact, full.camera), ([0.0; 3], 0.0, 1.0, 1.0));assert_eq!((full.scale, full.focus), (2.0, [0.5, 0.5]));assert!(full.aim[0] > 0.7 && (full.aim[1] - 0.5).abs() < 1e-3, "{:?}", full.aim);assert!((full.orbit[0] - 0.85).abs() < 1e-3 && (full.orbit[1] - 0.5).abs() < 1e-3, "{:?}", full.orbit);- let easing = zoom_state_in(&r, 1.5, Some(&tr), &f);+ let easing = zoom_state_in(&r, 1.5, Some(&tr), &f, &ScreenClock::default());assert!(easing.camera > 0.0 && easing.camera < 1.0, "{}", easing.camera);let raw = follow_at(&r[0], 1.5, &f);assert_eq!((easing.aim, easing.orbit), (weighted(raw.aim, easing.camera), weighted(raw.orbit, easing.camera)));assert_eq!(easing.focus, [0.5, 0.5]);- let out = zoom_state_in(&r, 0.0, Some(&tr), &f);+ let out = zoom_state_in(&r, 0.0, Some(&tr), &f, &ScreenClock::default());assert_eq!((out.scale, out.rotation, out.camera, out.aim, out.orbit), (1.0, [0.0; 3], 0.0, [0.5; 2], [0.5; 2]));// Sans piste, la caméra vise le centre, au repos.let blind = zoom_state_at(&r, 5.0, None);assert_eq!((blind.aim, blind.orbit), ([0.5, 0.5], [0.5, 0.5]));// Un angle fixe garde exactement son état.- let iso = zoom_state_in(&[region("iso", 2.0, 8.0)], 5.0, Some(&tr), &f);+ let iso = zoom_state_in(&[region("iso", 2.0, 8.0)], 5.0, Some(&tr), &f, &ScreenClock::default());assert_eq!((iso.rotation, iso.camera, iso.click_impact), ([-12.0, -18.0, -2.0], 0.0, 1.0));- let unknown = zoom_state_in(&[region("orbit", 2.0, 8.0)], 5.0, Some(&tr), &f);+ let unknown = zoom_state_in(&[region("orbit", 2.0, 8.0)], 5.0, Some(&tr), &f, &ScreenClock::default());assert_eq!((unknown.rotation, unknown.tilt, unknown.camera), ([0.0; 3], 0.0, 0.0));}@@ -2629,8 +2817,8 @@ mod follow_camera_tests {let mut auto = region("follow-cursor", 2.0, 8.0);auto.focus_mode = Some("auto".into());let manual = region("follow-cursor", 2.0, 8.0);- let a = zoom_state_in(&[auto], 5.0, Some(&tr), &whole(&tr));- let m = zoom_state_in(&[manual], 5.0, Some(&tr), &whole(&tr));+ let a = zoom_state_in(&[auto], 5.0, Some(&tr), &whole(&tr), &ScreenClock::default());+ let m = zoom_state_in(&[manual], 5.0, Some(&tr), &whole(&tr), &ScreenClock::default());assert_eq!((a.aim, a.focus), (m.aim, m.focus));assert!(a.aim[0] > 0.7 && a.aim[1] < 0.35, "{:?}", a.aim);}@@ -2651,7 +2839,7 @@ mod follow_camera_tests {for k in 0..=400 {// La transition chaînée couvre [4, 5] s, le palier la suit jusqu'à 4,5 s.let t = 3.9 + k as f32 * 1.3 / 400.0;- let s = zoom_state_in(®ions, t, Some(&tr), &f);+ let s = zoom_state_in(®ions, t, Some(&tr), &f, &ScreenClock::default());assert!(s.camera == 0.0 || is_identity_rotation(s.rotation), "t {t} : {s:?}", s = (s.camera, s.rotation));if both {assert_eq!(s.camera, 1.0, "t {t}");@@ -2674,7 +2862,7 @@ mod follow_camera_tests {let f = whole(&tr);let r = [region("follow-cursor", 2.0, 8.0)];let at = |i: usize| {- let s = zoom_state_in(&r, 1.0 + i as f32 / 30.0, Some(&tr), &f);+ let s = zoom_state_in(&r, 1.0 + i as f32 / 30.0, Some(&tr), &f, &ScreenClock::default());(s.camera, s.aim, s.orbit, s.scale)};let forward: Vec<_> = (0..240).map(at).collect();diff --git a/src/components/ai-edition/PreviewCanvas.tsx b/src/components/ai-edition/PreviewCanvas.tsxindex 522bf5f45..247f7a2ab 100644--- a/src/components/ai-edition/PreviewCanvas.tsx+++ b/src/components/ai-edition/PreviewCanvas.tsx@@ -298,8 +298,9 @@ export function PreviewCanvas(props: PreviewCanvasProps) {computeCameraFullscreenProgress(props.cameraFullscreenRegions ?? [],Math.round(props.currentTimeSec * 1000),+ props.speedRegions,),- [props.cameraFullscreenRegions, props.currentTimeSec],+ [props.cameraFullscreenRegions, props.currentTimeSec, props.speedRegions],);const effectiveLayout = useMemo<WebcamCompositeLayout | null>(() => {if (!layout?.webcamRect || cameraFullscreenProgress <= 0) return layout;diff --git a/src/components/ai-edition/VirtualPreview.tsx b/src/components/ai-edition/VirtualPreview.tsxindex feb174ff8..3d73f92ed 100644--- a/src/components/ai-edition/VirtualPreview.tsx+++ b/src/components/ai-edition/VirtualPreview.tsx@@ -996,19 +996,17 @@ export function VirtualPreview({useEffect(() => {const frame = videoFrameRef.current;if (!frame) return;- // ponytail: scale the zoom-in/out transition windows by the current- // playback rate so the transition stays wall-clock constant inside- // speed regions. The cursor still flies through (ruler + playhead- // read source-time), only the easing duration is decoupled.- const activeSpeedRegion = findActiveSpeedRegion(- speedRegionsRef.current,- Math.round(virtualTimeSec * 1000),- );- const playbackRate = activeSpeedRegion?.speed ?? 1;+ // Speed regions speed the footage up, not the zoom transitions: they are timed on+ // screen time, like the compositor that draws the picture this box stands in for.const transform =zoomRegions.length === 0? IDENTITY_ZOOM_TRANSFORM- : computeZoomPreviewTransform(zoomRegions, virtualTimeSec * 1000, undefined, playbackRate);+ : computeZoomPreviewTransform(+ zoomRegions,+ virtualTimeSec * 1000,+ undefined,+ speedRegionsRef.current,+ );frame.style.transform = `translate(${transform.translateXPercent}%, ${transform.translateYPercent}%) scale(${transform.scale})`;}, [zoomRegions, virtualTimeSec]);diff --git a/src/lib/ai-edition/timeline/speed.ts b/src/lib/ai-edition/timeline/speed.tsindex 765edb6a2..e90eb922f 100644--- a/src/lib/ai-edition/timeline/speed.ts+++ b/src/lib/ai-edition/timeline/speed.ts@@ -16,3 +16,23 @@ export interface SpeedRegion {export function findActiveSpeedRegion(regions: SpeedRegion[], timeMs: number): SpeedRegion | null {return regions.find((region) => timeMs >= region.startMs && timeMs < region.endMs) ?? null;}++/**+ * The time a viewer sees pass at `timeMs`: ∫ dt / speed, up to a constant. Zoom and Full+ * Camera transitions are timed on it, so a speed region speeds the footage up and not the+ * camera move (#683). Mirror of `ScreenClock` in `crates/compositor/src/regions.rs`, overlaps+ * included: the region that starts first keeps the shared span.+ */+export function screenTimeMs(regions: readonly SpeedRegion[], timeMs: number): number {+ let screen = timeMs;+ let coveredTo = Number.NEGATIVE_INFINITY;+ for (const region of [...regions].sort((a, b) => a.startMs - b.startMs)) {+ const start = Math.max(region.startMs, coveredTo);+ if (region.endMs <= start) continue;+ if (timeMs <= start) break;+ coveredTo = region.endMs;+ const speed = Number.isFinite(region.speed) && region.speed > 0 ? region.speed : 1;+ screen -= (Math.min(timeMs, region.endMs) - start) * (1 - 1 / speed);+ }+ return screen;+}diff --git a/src/lib/ai-edition/timeline/zoom-preview.test.ts b/src/lib/ai-edition/timeline/zoom-preview.test.tsnew file mode 100644index 000000000..24841e016--- /dev/null+++ b/src/lib/ai-edition/timeline/zoom-preview.test.ts@@ -0,0 +1,64 @@+import { describe, expect, it } from "vitest";+import type { AxcutZoomRegion } from "../schema";+import { screenTimeMs } from "./speed";+import { computeZoomPreviewTransform } from "./zoom-preview";+import { ZOOM_DEPTH_SCALES } from "./zoom-scale";++function zoom(startMs: number, endMs: number): AxcutZoomRegion {+ return { id: `z${startMs}`, startMs, endMs, depth: 4, focus: { cx: 0.8, cy: 0.3 } };+}++describe("screenTimeMs", () => {+ it("runs slower than the timeline inside a speed region, once per overlapping span", () => {+ const regions = [{ id: "s", startMs: 2000, endMs: 6000, speed: 4 }];+ expect(screenTimeMs(regions, 1000)).toBe(1000);+ expect(screenTimeMs(regions, 4000)).toBe(2500);+ expect(screenTimeMs(regions, 8000)).toBe(5000);+ // The first region keeps [4000, 6000); the second only counts on [6000, 8000).+ const overlapping = [...regions, { id: "t", startMs: 4000, endMs: 8000, speed: 2 }];+ expect(screenTimeMs(overlapping, 8000)).toBe(4000);+ });+});++describe("computeZoomPreviewTransform pace", () => {+ // Mirror of `a_zoom_moves_at_a_comfortable_pace_at_every_level` (compositor): perceived speed+ // is |d ln(scale)/dt|, and the old fixed window reached 16/s at 5× (#683).+ it("stays under 3 e-folds/s at every level and lands exactly on the region start", () => {+ for (const depth of [1, 2, 3, 4, 5, 6] as const) {+ const region = { ...zoom(2000, 8000), depth };+ const lnScale = (t: number) => Math.log(computeZoomPreviewTransform([region], t).scale);+ let peak = 0;+ for (let t = 0; t < 2000; t += 5) {+ peak = Math.max(peak, Math.abs(lnScale(t + 5) - lnScale(t)) / 0.005);+ }+ expect(peak).toBeLessThan(3);+ expect(computeZoomPreviewTransform([region], 2000).scale).toBe(ZOOM_DEPTH_SCALES[depth]);+ }+ });++ it("moves the focus point to the centre linearly on screen, like the compositor", () => {+ // 0.7 stays inside the frame at 2.2×, so the focus clamp leaves it alone.+ const region = { ...zoom(2000, 8000), focus: { cx: 0.7, cy: 0.5 } };+ const target = ZOOM_DEPTH_SCALES[4];+ for (let t = 800; t <= 2000; t += 50) {+ const { scale, translateXPercent } = computeZoomPreviewTransform([region], t);+ const progress = Math.log(scale) / Math.log(target);+ const focusOnScreen = translateXPercent / 100 + 0.7 * scale;+ expect(focusOnScreen).toBeCloseTo(0.7 + (0.5 - 0.7) * progress, 6);+ }+ });+});++describe("computeZoomPreviewTransform under a speed region", () => {+ // A uniform 4× is a pure time scale for the footage: the camera must move exactly like a+ // region four times shorter played at 1× (mirror of the compositor's own test).+ it("scales the footage, not the camera move", () => {+ const speedRegions = [{ id: "s", startMs: 0, endMs: 1_000_000, speed: 4 }];+ for (let t = 0; t <= 60_000; t += 100) {+ const sped = computeZoomPreviewTransform([zoom(20_000, 40_000)], t, undefined, speedRegions);+ const plain = computeZoomPreviewTransform([zoom(5_000, 10_000)], t / 4);+ expect(sped.scale).toBeCloseTo(plain.scale, 6);+ expect(sped.translateXPercent).toBeCloseTo(plain.translateXPercent, 4);+ }+ });+});diff --git a/src/lib/ai-edition/timeline/zoom-preview.ts b/src/lib/ai-edition/timeline/zoom-preview.tsindex 18b04daad..c4a8a96a7 100644--- a/src/lib/ai-edition/timeline/zoom-preview.ts+++ b/src/lib/ai-edition/timeline/zoom-preview.ts@@ -18,6 +18,7 @@ import { getZoomScale } from "@/components/video-editor/types";import type { AxcutZoomRegion } from "@/lib/ai-edition/schema";import { findDominantRegion } from "@/lib/zoomMath/zoomRegionUtils";import { computeZoomTransform } from "@/lib/zoomMath/zoomTransform";+import type { SpeedRegion } from "./speed";export interface ZoomPreviewTransform {scale: number;@@ -54,22 +55,21 @@ function toLegacyZoomRegion(region: AxcutZoomRegion): LegacyZoomRegion {* coordinate space as `zoomRegion.startMs`/`endMs` (the timeline shown in* the ruler, not raw source-media time).*- * `playbackRate` scales the zoom-in/out transition windows in source-time- * so the transition keeps its authored wall-clock duration inside speed- * regions. Defaults to 1 (no scaling).+ * `speedRegions` (same time space) keep the zoom-in/out transitions at their+ * on-screen duration while the footage under them is sped up.*/export function computeZoomPreviewTransform(zoomRegions: AxcutZoomRegion[],virtualTimeMs: number,cursorTelemetry?: CursorTelemetryPoint[],- playbackRate = 1,+ speedRegions?: SpeedRegion[],): ZoomPreviewTransform {if (zoomRegions.length === 0) return IDENTITY_ZOOM_TRANSFORM;const legacyRegions = zoomRegions.map(toLegacyZoomRegion);const dominant = findDominantRegion(legacyRegions, virtualTimeMs, {cursorTelemetry,- playbackRate,+ speedRegions,});if (!dominant.region || dominant.strength <= 0) return IDENTITY_ZOOM_TRANSFORM;diff --git a/src/lib/zoomMath/cameraFullscreenUtils.ts b/src/lib/zoomMath/cameraFullscreenUtils.tsindex bec701edc..6c8211d32 100644--- a/src/lib/zoomMath/cameraFullscreenUtils.ts+++ b/src/lib/zoomMath/cameraFullscreenUtils.ts@@ -1,4 +1,5 @@import type { CameraFullscreenRegion } from "@/components/video-editor/types";+import { type SpeedRegion, screenTimeMs } from "@/lib/ai-edition/timeline/speed";import { TRANSITION_WINDOW_MS } from "./constants";import { easeOutScreenStudio } from "./mathUtils";@@ -15,32 +16,36 @@ const LEAD_OUT_WINDOW_MS = TRANSITION_WINDOW_MS * 1.5;* window than the lead-in). Outside [startMs, endMs] progress is always 0. The* transition windows are clamped to at most half the region's duration so short* regions still ease in/out fully within their own bounds instead of overlapping.+ * Windows are measured on screen time (`screenTimeMs`), like zoom's.*/function computeCameraFullscreenRegionStrength(region: CameraFullscreenRegion,timeMs: number,+ speedRegions: readonly SpeedRegion[],): number {if (timeMs <= region.startMs || timeMs >= region.endMs) {return 0;}- const duration = region.endMs - region.startMs;- const halfDuration = duration / 2;+ const start = screenTimeMs(speedRegions, region.startMs);+ const end = screenTimeMs(speedRegions, region.endMs);+ const t = screenTimeMs(speedRegions, timeMs);+ const halfDuration = (end - start) / 2;const leadInWindow = Math.min(TRANSITION_WINDOW_MS, halfDuration);const leadOutWindow = Math.min(LEAD_OUT_WINDOW_MS, halfDuration);- const leadInEnd = region.startMs + leadInWindow;- const leadOutStart = region.endMs - leadOutWindow;+ const leadInEnd = start + leadInWindow;+ const leadOutStart = end - leadOutWindow;- if (timeMs < leadInEnd) {- const progress = leadInWindow > 0 ? (timeMs - region.startMs) / leadInWindow : 1;+ if (t < leadInEnd) {+ const progress = leadInWindow > 0 ? (t - start) / leadInWindow : 1;return easeOutScreenStudio(progress);}- if (timeMs <= leadOutStart) {+ if (t <= leadOutStart) {return 1;}- const progress = leadOutWindow > 0 ? (region.endMs - timeMs) / leadOutWindow : 0;+ const progress = leadOutWindow > 0 ? (end - t) / leadOutWindow : 0;return easeOutScreenStudio(progress);}@@ -54,10 +59,11 @@ function computeCameraFullscreenRegionStrength(export function computeCameraFullscreenProgress(regions: CameraFullscreenRegion[],timeMs: number,+ speedRegions: readonly SpeedRegion[] = [],): number {let strongest = 0;for (const region of regions) {- const strength = computeCameraFullscreenRegionStrength(region, timeMs);+ const strength = computeCameraFullscreenRegionStrength(region, timeMs, speedRegions);if (strength > strongest) {strongest = strength;}diff --git a/src/lib/zoomMath/constants.ts b/src/lib/zoomMath/constants.tsindex 355b611ce..f45e4fd08 100644--- a/src/lib/zoomMath/constants.ts+++ b/src/lib/zoomMath/constants.ts@@ -2,7 +2,10 @@ import type { ZoomFocus } from "@/components/video-editor/types";export const DEFAULT_FOCUS: ZoomFocus = { cx: 0.5, cy: 0.5 };export const TRANSITION_WINDOW_MS = 1015.05;-export const ZOOM_IN_TRANSITION_WINDOW_MS = TRANSITION_WINDOW_MS * 1.5;+// A zoom transition lasts BASE + PER_LN · ln(scale) on screen: ~0.7 s at 1.25×, ~0.9 s at the+// default 1.8×, ~1.5 s at 5×. Mirror of `zoom_transition_s` (crates/compositor/src/regions.rs).+export const ZOOM_TRANSITION_BASE_MS = 600;+export const ZOOM_TRANSITION_PER_LN_MS = 550;export const SMOOTHING_FACTOR = 0.12;export const ZOOM_TRANSLATION_DEADZONE_PX = 1.25;export const ZOOM_SCALE_DEADZONE = 0.002;diff --git a/src/lib/zoomMath/mathUtils.ts b/src/lib/zoomMath/mathUtils.tsindex fdf1afb4f..1ab9649ba 100644--- a/src/lib/zoomMath/mathUtils.ts+++ b/src/lib/zoomMath/mathUtils.ts@@ -51,6 +51,24 @@ export function easeOutScreenStudio(t: number) {return cubicBezier(0.16, 1, 0.3, 1, t);}+const SPRING_OMEGA_T = 7;+const SPRING_END = 1 - (1 + SPRING_OMEGA_T) * Math.exp(-SPRING_OMEGA_T);++/**+ * Critically damped spring rise, scaled to land exactly on 1 at the end of the window: it+ * leaves at zero velocity and settles without overshoot. Mirror of `ease_spring` (Rust).+ */+export function easeSpring(t: number) {+ const x = SPRING_OMEGA_T * clamp01(t);+ return (1 - (1 + x) * Math.exp(-x)) / SPRING_END;+}++/** Zoom scale between `a` and `b`, interpolated in log space — the way a zoom is perceived. */+export function scaleLerp(a: number, b: number, t: number) {+ const from = Math.max(a, 1e-3);+ return from * (Math.max(b, 1e-3) / from) ** t;+}+/*** Ease-out cubic. Used for zoom-out transitions so strength eases to zero.*/diff --git a/src/lib/zoomMath/motionSmoothing.ts b/src/lib/zoomMath/motionSmoothing.tsindex e2cec6fd1..6d8f8f0ac 100644--- a/src/lib/zoomMath/motionSmoothing.ts+++ b/src/lib/zoomMath/motionSmoothing.ts@@ -137,13 +137,3 @@ export function getCursorSpringConfig(smoothingFactor: number): SpringConfig {restSpeed: 0.01,};}--export function getZoomSpringConfig(): SpringConfig {- return {- stiffness: 320,- damping: 40,- mass: 0.92,- restDelta: 0.0005,- restSpeed: 0.015,- };-}diff --git a/src/lib/zoomMath/zoomRegionUtils.ts b/src/lib/zoomMath/zoomRegionUtils.tsindex 85a91a98a..fd0fc9856 100644--- a/src/lib/zoomMath/zoomRegionUtils.ts+++ b/src/lib/zoomMath/zoomRegionUtils.ts@@ -10,26 +10,33 @@ import {getZoomScale,lerpRotation3D,} from "@/components/video-editor/types";+import { type SpeedRegion, screenTimeMs } from "@/lib/ai-edition/timeline/speed";import { clamp01 } from "@/utils/math";-import { TRANSITION_WINDOW_MS, ZOOM_IN_TRANSITION_WINDOW_MS } from "./constants";+import { ZOOM_TRANSITION_BASE_MS, ZOOM_TRANSITION_PER_LN_MS } from "./constants";import { interpolateCursorAt } from "./cursorFollowUtils";import { clampFocusToScale } from "./focusUtils";-import { cubicBezier, easeOutScreenStudio } from "./mathUtils";+import { cubicBezier, easeSpring, scaleLerp } from "./mathUtils";const CHAINED_ZOOM_PAN_GAP_MS = 1500;const CONNECTED_ZOOM_PAN_DURATION_MS = 1000;-const ZOOM_IN_OVERLAP_MS = 500;++/** Timeline ms → screen ms. Transition windows are measured on it, see `screenTimeMs`. */+type ScreenClock = (timeMs: number) => number;++const sameTime: ScreenClock = (timeMs) => timeMs;type DominantRegionOptions = {connectZooms?: boolean;cursorTelemetry?: CursorTelemetryPoint[];viewportRatio?: ViewportRatio;- playbackRate?: number;+ /** The timeline's speed regions: transitions keep their on-screen duration inside them. */+ speedRegions?: SpeedRegion[];};type ConnectedRegionPair = {currentRegion: ZoomRegion;nextRegion: ZoomRegion;+ /** Screen ms, like the gap that chains the pair. */transitionStart: number;transitionEnd: number;};@@ -50,39 +57,35 @@ function easeConnectedPan(value: number) {return cubicBezier(0.1, 0.0, 0.2, 1.0, value);}-// ponytail: `playbackRate` lets the caller scale the lead-in / lead-out-// windows in source-time so the zoom transition stays wall-clock constant-// inside speed regions (2× speed → window is 2× source-ms → takes 1×-// wall-clock-ms to traverse). Hold span between `zoomInEnd` and-// `region.endMs` stays in source-time, so the zoomed state still flies-// through under speed regions — that's the duration the user expects-// to scale.+// The zoom lands exactly on `startMs` and leaves from `endMs`; both moves last longer for a+// deeper zoom. The windows are measured on the screen clock, so a transition keeps its+// on-screen duration inside a speed region while the hold between them still flies through+// with the footage it covers. Mirror of `zoom_region_strength` (crates/compositor/src/regions.rs).export function computeRegionStrength(region: ZoomRegion,timeMs: number,- playbackRate = 1,+ toScreen: ScreenClock = sameTime,): number {- const zoomInWindow = ZOOM_IN_TRANSITION_WINDOW_MS * playbackRate;- const zoomOutWindow = TRANSITION_WINDOW_MS * playbackRate;- const zoomInEnd = region.startMs + ZOOM_IN_OVERLAP_MS;- const leadInStart = zoomInEnd - zoomInWindow;- const leadOutEnd = region.endMs + zoomOutWindow;-- if (timeMs < leadInStart || timeMs > leadOutEnd) {+ const start = toScreen(region.startMs);+ const end = toScreen(region.endMs);+ const t = toScreen(timeMs);+ const window =+ ZOOM_TRANSITION_BASE_MS ++ ZOOM_TRANSITION_PER_LN_MS * Math.log(Math.max(1, getZoomScale(region)));++ if (t < start - window || t > end + window) {return 0;}- if (timeMs < zoomInEnd) {- const progress = (timeMs - leadInStart) / zoomInWindow;- return easeOutScreenStudio(progress);+ if (t < start) {+ return easeSpring((t - (start - window)) / window);}- if (timeMs <= region.endMs) {+ if (t <= end) {return 1;}- const progress = clamp01((timeMs - region.endMs) / zoomOutWindow);- return 1 - easeOutScreenStudio(progress);+ return 1 - easeSpring((t - end) / window);}function getLinearFocus(start: ZoomFocus, end: ZoomFocus, amount: number): ZoomFocus {@@ -121,14 +124,15 @@ function getResolvedFocus(return clampFocusToScale(focus, zoomScale, viewportRatio);}-function getConnectedRegionPairs(regions: ZoomRegion[]) {+function getConnectedRegionPairs(regions: ZoomRegion[], toScreen: ScreenClock) {const sortedRegions = [...regions].sort((a, b) => a.startMs - b.startMs);const pairs: ConnectedRegionPair[] = [];for (let index = 0; index < sortedRegions.length - 1; index += 1) {const currentRegion = sortedRegions[index];const nextRegion = sortedRegions[index + 1];- const gapMs = nextRegion.startMs - currentRegion.endMs;+ const transitionStart = toScreen(currentRegion.endMs);+ const gapMs = toScreen(nextRegion.startMs) - transitionStart;if (gapMs > CHAINED_ZOOM_PAN_GAP_MS) {continue;@@ -137,8 +141,8 @@ function getConnectedRegionPairs(regions: ZoomRegion[]) {pairs.push({currentRegion,nextRegion,- transitionStart: currentRegion.endMs,- transitionEnd: currentRegion.endMs + CONNECTED_ZOOM_PAN_DURATION_MS,+ transitionStart,+ transitionEnd: transitionStart + CONNECTED_ZOOM_PAN_DURATION_MS,});}@@ -149,10 +153,11 @@ function getActiveRegion(regions: ZoomRegion[],timeMs: number,connectedPairs: ConnectedRegionPair[],+ toScreen: ScreenClock,cursorTelemetry?: CursorTelemetryPoint[],viewportRatio?: ViewportRatio,- playbackRate = 1,) {+ const screenMs = toScreen(timeMs);const activeRegions = regions.map((region) => {const outgoingPair = connectedPairs.find((pair) => pair.currentRegion.id === region.id);@@ -161,11 +166,11 @@ function getActiveRegion(}const incomingPair = connectedPairs.find((pair) => pair.nextRegion.id === region.id);- if (incomingPair && timeMs < incomingPair.transitionEnd) {+ if (incomingPair && screenMs < incomingPair.transitionEnd) {return { region, strength: 0 };}- return { region, strength: computeRegionStrength(region, timeMs, playbackRate) };+ return { region, strength: computeRegionStrength(region, timeMs, toScreen) };}).filter((entry) => entry.strength > 0).sort((left, right) => {@@ -196,12 +201,13 @@ function getActiveRegion(function getConnectedRegionHold(timeMs: number,+ screenMs: number,connectedPairs: ConnectedRegionPair[],cursorTelemetry?: CursorTelemetryPoint[],viewportRatio?: ViewportRatio,) {for (const pair of connectedPairs) {- if (timeMs > pair.transitionEnd && timeMs < pair.nextRegion.startMs) {+ if (screenMs > pair.transitionEnd && timeMs < pair.nextRegion.startMs) {const nextScale = getZoomScale(pair.nextRegion);return {region: {@@ -227,22 +233,23 @@ function getConnectedRegionHold(function getConnectedRegionTransition(connectedPairs: ConnectedRegionPair[],timeMs: number,+ screenMs: number,cursorTelemetry?: CursorTelemetryPoint[],viewportRatio?: ViewportRatio,) {for (const pair of connectedPairs) {const { currentRegion, nextRegion, transitionStart, transitionEnd } = pair;- if (timeMs < transitionStart || timeMs > transitionEnd) {+ if (screenMs < transitionStart || screenMs > transitionEnd) {continue;}const transitionProgress = easeConnectedPan(- clamp01((timeMs - transitionStart) / Math.max(1, transitionEnd - transitionStart)),+ clamp01((screenMs - transitionStart) / Math.max(1, transitionEnd - transitionStart)),);const currentScale = getZoomScale(currentRegion);const nextScale = getZoomScale(nextRegion);- const transitionScale = lerp(currentScale, nextScale, transitionProgress);+ const transitionScale = scaleLerp(currentScale, nextScale, transitionProgress);// Both regions share the same timeMs, so interpolate cursor once and reuse.const sharedCursorFocus =cursorTelemetry && cursorTelemetry.length > 0@@ -302,7 +309,7 @@ type DominantRegionResult = {let dominantRegionCache: {regions: ZoomRegion[];timeMsKey: number;- playbackRateKey: number;+ speedRegions: SpeedRegion[] | undefined;telemetry: CursorTelemetryPoint[] | undefined;connectZooms: boolean;viewportRatio: ViewportRatio | undefined;@@ -317,31 +324,40 @@ export function findDominantRegion(const connectZooms = !!options.connectZooms;const telemetry = options.cursorTelemetry;const vr = options.viewportRatio;- const playbackRate = options.playbackRate ?? 1;+ const speedRegions = options.speedRegions;const timeMsKey = Math.round(timeMs);- const playbackRateKey = Math.round(playbackRate * 1000);if (dominantRegionCache &&dominantRegionCache.regions === regions &&dominantRegionCache.timeMsKey === timeMsKey &&+ dominantRegionCache.speedRegions === speedRegions &&dominantRegionCache.telemetry === telemetry &&dominantRegionCache.connectZooms === connectZooms &&- dominantRegionCache.viewportRatio === vr &&- dominantRegionCache.playbackRateKey === playbackRateKey+ dominantRegionCache.viewportRatio === vr) {return dominantRegionCache.result;}- const connectedPairs = connectZooms ? getConnectedRegionPairs(regions) : [];+ const toScreen: ScreenClock = speedRegions?.length+ ? (ms) => screenTimeMs(speedRegions, ms)+ : sameTime;+ const screenMs = toScreen(timeMs);+ const connectedPairs = connectZooms ? getConnectedRegionPairs(regions, toScreen) : [];let result: DominantRegionResult;if (connectZooms) {- const connectedTransition = getConnectedRegionTransition(connectedPairs, timeMs, telemetry, vr);+ const connectedTransition = getConnectedRegionTransition(+ connectedPairs,+ timeMs,+ screenMs,+ telemetry,+ vr,+ );if (connectedTransition) {result = connectedTransition;} else {- const connectedHold = getConnectedRegionHold(timeMs, connectedPairs, telemetry, vr);+ const connectedHold = getConnectedRegionHold(timeMs, screenMs, connectedPairs, telemetry, vr);if (connectedHold) {result = { ...connectedHold, transition: null };} else {@@ -349,9 +365,9 @@ export function findDominantRegion(regions,timeMs,connectedPairs,+ toScreen,telemetry,vr,- playbackRate,);result = activeRegion? { ...activeRegion, transition: null }@@ -365,14 +381,7 @@ export function findDominantRegion(}}} else {- const activeRegion = getActiveRegion(- regions,- timeMs,- connectedPairs,- telemetry,- vr,- playbackRate,- );+ const activeRegion = getActiveRegion(regions, timeMs, connectedPairs, toScreen, telemetry, vr);result = activeRegion? { ...activeRegion, transition: null }: {@@ -387,7 +396,7 @@ export function findDominantRegion(dominantRegionCache = {regions,timeMsKey,- playbackRateKey,+ speedRegions,telemetry,connectZooms,viewportRatio: vr,diff --git a/src/lib/zoomMath/zoomSpring.test.ts b/src/lib/zoomMath/zoomSpring.test.tsdeleted file mode 100644index c21134262..000000000--- a/src/lib/zoomMath/zoomSpring.test.ts+++ /dev/null@@ -1,63 +0,0 @@-import { describe, expect, it } from "vitest";-import { createZoomSpringState, resetZoomSpring, stepZoomSpring } from "./zoomSpring";--const DT = 1000 / 60;--describe("zoom spring chase", () => {- it("resetZoomSpring snaps every axis exactly to the target", () => {- const state = createZoomSpringState();- resetZoomSpring(state, { scale: 1.8, x: -120, y: 40 });- expect(stepZoomSpring(state, { scale: 1.8, x: -120, y: 40 }, DT)).toEqual({- scale: 1.8,- x: -120,- y: 40,- });- });-- it("eases into a jumped target instead of snapping (velocity continuity)", () => {- const state = createZoomSpringState();- resetZoomSpring(state, { scale: 1, x: 0, y: 0 });- // Target jumps from 1 to 2; a single step must NOT teleport there.- const first = stepZoomSpring(state, { scale: 2, x: 0, y: 0 }, DT);- expect(first.scale).toBeGreaterThan(1);- expect(first.scale).toBeLessThan(2);- });-- it("converges to a static target without overshooting it", () => {- const state = createZoomSpringState();- resetZoomSpring(state, { scale: 1, x: 0, y: 0 });- const target = { scale: 2.2, x: 0, y: 0 };- let maxScale = 1;- let last = 1;- for (let i = 0; i < 200; i++) {- last = stepZoomSpring(state, target, DT).scale;- maxScale = Math.max(maxScale, last);- }- expect(last).toBeCloseTo(2.2, 2); // settled onto the target- expect(maxScale).toBeLessThanOrEqual(2.2 + 1e-6); // never overshot past it- });-- it("does not overshoot when the target reverses mid-motion", () => {- const state = createZoomSpringState();- resetZoomSpring(state, { scale: 1, x: 0, y: 0 });- // Build upward momentum chasing a high target...- for (let i = 0; i < 8; i++) stepZoomSpring(state, { scale: 3, x: 0, y: 0 }, DT);- // ...then reverse the target below the current value; momentum must not carry it past.- const reverseTarget = { scale: 1.5, x: 0, y: 0 };- let min = Number.POSITIVE_INFINITY;- for (let i = 0; i < 200; i++) {- min = Math.min(min, stepZoomSpring(state, reverseTarget, DT).scale);- }- expect(min).toBeGreaterThanOrEqual(1.5 - 1e-6); // never dipped below the reversed target- });-- it("steps each axis independently", () => {- const state = createZoomSpringState();- resetZoomSpring(state, { scale: 1, x: 0, y: 0 });- const out = stepZoomSpring(state, { scale: 1, x: 100, y: 0 }, DT);- expect(out.scale).toBe(1); // already at target → unchanged- expect(out.x).toBeGreaterThan(0);- expect(out.x).toBeLessThan(100);- expect(out.y).toBe(0);- });-});diff --git a/src/lib/zoomMath/zoomSpring.ts b/src/lib/zoomMath/zoomSpring.tsdeleted file mode 100644index 94e19250e..000000000--- a/src/lib/zoomMath/zoomSpring.ts+++ /dev/null@@ -1,85 +0,0 @@-import {- createSpringState,- getZoomSpringConfig,- type SpringState,- stepSpringValue,-} from "./motionSmoothing";--/**- * Spring-chase for the camera zoom transform.- *- * computeZoomTransform is a time-driven target shaped by an ease curve. Applying it- * straight to the camera reproduces every velocity discontinuity (the ease-in launch,- * seams between close regions), which reads as a jerk. Instead we chase the target with- * a per-axis spring: the target keeps the authored timing, the spring keeps the rendered- * motion velocity-continuous.- */--export interface ZoomTransform {- scale: number;- x: number;- y: number;-}--export interface ZoomSpringState {- scale: SpringState;- x: SpringState;- y: SpringState;-}--export function createZoomSpringState(): ZoomSpringState {- return {- scale: createSpringState(1),- x: createSpringState(0),- y: createSpringState(0),- };-}--/** Snap every axis straight to the target (used on seek / pause / first frame). */-export function resetZoomSpring(state: ZoomSpringState, target: ZoomTransform): void {- for (const [axis, value] of [- [state.scale, target.scale],- [state.x, target.x],- [state.y, target.y],- ] as const) {- axis.value = value;- axis.velocity = 0;- axis.initialized = true;- }-}--/**- * Step one axis toward target with a moving-target overshoot clamp. The target moves- * every frame, so a fast spring can carry velocity past it on a reversal and wobble. If- * the step crosses the target, snap to it and zero the velocity to stay quick without jelly.- */-function stepAxis(- axis: SpringState,- target: number,- deltaMs: number,- config: ReturnType<typeof getZoomSpringConfig>,-): number {- const before = axis.initialized ? axis.value : target;- const after = stepSpringValue(axis, target, deltaMs, config);- const crossed = (before <= target && after > target) || (before >= target && after < target);- if (crossed) {- axis.value = target;- axis.velocity = 0;- return target;- }- return after;-}--/** Advance the spring toward target by deltaMs (content time); returns the smoothed transform. */-export function stepZoomSpring(- state: ZoomSpringState,- target: ZoomTransform,- deltaMs: number,-): ZoomTransform {- const config = getZoomSpringConfig();- return {- scale: stepAxis(state.scale, target.scale, deltaMs, config),- x: stepAxis(state.x, target.x, deltaMs, config),- y: stepAxis(state.y, target.y, deltaMs, config),- };-}diff --git a/src/lib/zoomMath/zoomTransform.ts b/src/lib/zoomMath/zoomTransform.tsindex 9bb29480e..6d82dea90 100644--- a/src/lib/zoomMath/zoomTransform.ts+++ b/src/lib/zoomMath/zoomTransform.ts@@ -4,6 +4,8 @@// no callers and went with the Pixi export path. What is left is the geometry// the overlay still needs, and it depends on nothing but arithmetic.+import { scaleLerp } from "./mathUtils";+interface AppliedTransform {scale: number;x: number;@@ -42,13 +44,13 @@ export function computeZoomTransform({const focusStagePxY = focusY * stageSize.height;const stageCenterX = stageSize.width / 2;const stageCenterY = stageSize.height / 2;- const scale = 1 + (zoomScale - 1) * progress;- const finalX = stageCenterX - focusStagePxX * zoomScale;- const finalY = stageCenterY - focusStagePxY * zoomScale;+ // Log-space scale (`scaleLerp`), while the focus point still travels to the centre linearly+ // on screen — the compositor's trajectory (`zoom_state_in`, crates/compositor/src/regions.rs).+ const scale = scaleLerp(1, zoomScale, progress);return {scale,- x: finalX * progress,- y: finalY * progress,+ x: focusStagePxX + (stageCenterX - focusStagePxX) * progress - focusStagePxX * scale,+ y: focusStagePxY + (stageCenterY - focusStagePxY) * progress - focusStagePxY * scale,};}diff --git a/technical-documentation/architecture/timeline-model.md b/technical-documentation/architecture/timeline-model.mdindex 8170beb50..e0529111e 100644--- a/technical-documentation/architecture/timeline-model.md+++ b/technical-documentation/architecture/timeline-model.md@@ -215,7 +215,7 @@ the contract a reviewer can grade against. Each is asserted inthe region hard on its own span: full strength inside, nothing outside, no ease-in/outwindow and no chaining with a neighbouring zoom. An export never composes a frame atthose source times, so the entry is inert there — without the gate a zoom's ease-in- (1.5 s before its start) would reach the kept frames beside the cut and the preview+ (up to 1.5 s before its start) would reach the kept frames beside the cut and the previewwould show what the export does not.- **A named clip beats anything inferred from (assetId, sourceTime), and clip ORDER isnever an input.** Asserted indiff --git a/technical-documentation/testing/manual-e2e-checklist.md b/technical-documentation/testing/manual-e2e-checklist.mdindex 30fb05ec1..7970498df 100644--- a/technical-documentation/testing/manual-e2e-checklist.md+++ b/technical-documentation/testing/manual-e2e-checklist.md@@ -633,3 +633,4 @@ The mask comes from the native compositor (ONNX Runtime + the vendored selfie-se| 2026-09-16 | worktree `wf_62afabe4-4fb-7` on `feat/3d-depth-of-field` @ `7587de8e` + the macOS golden and bench commits; `compositor_view.node` rebuilt from this tree by `npm run build:native:compositor` (string probe `DOF_MAX_LOD` HIT, control `OPENSCREEN_EXPORT_ENCODER` HIT), ffmpeg DLLs hash-identical to the vendored SDK; renderer rebuilt with `npm run build-vite` | Windows 11 26200, NVENC export | Partial — no defect | **Depth of field on a tilted zoom, through the app's real export (`electron . export <project> -o <mp4>`).** Source: synthetic 1920×1080 text-and-grid clip. Three legacy projects: `iso` zoom with focus at 0.92/0.08 and no `depthOfField` key (the default must apply), the same with `depthOfField: false`, and a flat zoom. Frame at 3 s: with the default the far (bottom-left) half of the tilted screen is visibly defocused and the near half stays sharp; with `false` the whole plane is sharp; the flat project renders a flat, sharp screen. Export wall time was the same with and without the effect (2.22–2.36 s over two warm runs each). **Not covered:** the GUI editor. Computer-use access to `electron.exe` was declined for this run, so the toggle on, the toggle off and the disabled state on a project without a tilt were checked only by the jsdom test `depthOfFieldToggle.test.tsx`. The preview cost was measured by the A/B harness instead (`tilted_depth_of_field.rs`, preview shape at 1280×720 + `readback_direct`: +0.03 ms/frame on hardware, +2.5 ms/frame on WARP). macOS and Linux rendering were not run here (the macOS golden runs on macOS CI; the Linux golden is opt-in under WSL). || 2026-09-24 | installed `v1.13.0-rc.4` — CI-built DMG `Openscreen-macOS-Apple-Silicon-1.13.0-rc.4.dmg` from the GitHub Release (tag `187e0d8d`), Developer ID signed + notarized (`spctl`: accepted, Notarized Developer ID), About reports `1.13.0-rc.4 (dmg)`; native payload one uniformly stamped set (all `darwin-arm64` files 2026-09-22 10:05) | macOS 26.5 (25F71), M1 Mac mini, one 3840×2160 display; **no camera and no microphone attached** | Partial — 8 defects, none blocking in what ran | **Full-file attempt with real OS mouse/keyboard; everything not run is listed.** **Passed:** launch/HUD (layout toggle, drag follows pointer and stays dropped, language menu, minimize → tray refocus, close/relaunch, no orphan processes after Quit); source picker (Screens/Windows tabs); record with countdown, pause freezes timer, resume, restart resets, cancel opens no editor; stop from HUD **and** from tray *Stop Recording* (tray icon turns red while recording); recording 3840×2160 H.264 + AAC 48 kHz filled edge to edge (measured: 0 dark px on all four borders); system audio captured (−10.9 dB mean); relaunched **without** the protection flag → `[content-protection] OFF … macOS 26.5.0` logged, HUD visible on screen and **absent from the recorded frame**. Editor: rename, Media/Edit/Rec modes, chat panel, play/pause, seek bar + ruler seek, trim edges + playback skips the trim, zoom levels/3D camera (Off, 3 fixed angles, orbit) in preview, auto zooms from clicks, speed presets + custom 2.5× + 150 → "can't go higher than 100×" toast, text annotation (text/colour/background/typewriter), arrow (direction/stroke), blur (mosaic/gaussian/oval), delete + ⌘Z/⌘⇧Z, second clip by drag from Media, reorder (modifiers stay anchored to their clip, checked in the document), Edit Clip crop (↓ on W = 99.97395 = one px of 3840, partial "8" stays editable, 80 % crop reframes), clip delete leaves other clip's modifiers. Transcript: local Whisper on `whispercpp-metal` (4.5× RT), "no data leaves the device" notice, word click seeks, cue highlight, Backspace cuts a word (trim created), double-click correction propagates to captions and to the translation, **typing between words is inert in the packaged build**; captions on/off, Top/Left anchor with relabelled sliders, translation FR via provider then delete → original back. Chat (DeepSeek): 2-op turn applied and undone/redone as one unit, "cut the silences" explained instead of guessing, rewind cancel leaves everything, rewind confirm rolls back. Imported audio: pill named after the file, gain/fades/mute/loop controls, **exported** gain exactly −4.0 dB, fades at the track's own edges (1.45 s ramps), loop fills to the end with no seam, mute → track absent (noise floor), recording audio unchanged under the bed, track not time-stretched by a 2× region and cut at the last frame without pulling the fade forward, **still audible in an export after an app restart**. Export: MP4/GIF options + dimensions, progress reaches 100 %, frame math exact (take 2: 1086 − 55.5 trim − 18.5 speed = 1012.1 expected, **1013** written; take 1: 1032.6 expected, **1032** written; audio = video duration in both at 30 fps), no silence hole at speed boundaries (`silencedetect`, the one gap maps to a pause already in the source), caption plate left edge **x = 192** for `insetX 10` and top edge y = 16 for 1.5 % (measured on PPM), annotation/captions do not follow a zoom, 3D tilt + text + oval blur + cursor all in exported frames; GIF cancel returns to options with no partial file, full GIF 1280×720, 508 frames, infinite loop, opens in Preview; MP4 opens in QuickTime. Settings: background image/colour/gradient, padding/roundness/shadow, cursor hide + style, light theme (gradient picker + dialogs follow), French UI incl. app menu and wordmark menu, custom shortcut (T→Y works, restored), ⌘S/⌘O dialog. App menu About / Save Diagnostics (valid JSON bundle) / Check for Updates → "up to date (1.13.0-rc.4)"; same from the HUD panel (which shows version, "No microphone found", "No camera found"); tray Update Settings has the 3 modes and the pick survives a restart; editor bounds (resize, maximize, un-maximize persisted; zero-size + `maximized:"yes"` file → sane default window). **Defects:** (1) *Preview only* — a text annotation with an animation renders inconsistently **during playback** in the native preview (blank, partial "R", or complete across repeated plays of the same span) while paused seeks and the export are correct; related: the first paused frame after creating an annotation or reopening a project is sometimes stale until the next seek. (2) Clicking the editor behind the Export modal while the native *Save Exported Video* panel is up sends that panel behind the editor: invisible, modal stuck on "Starting…", its Cancel inert — recovered only by pressing the panel's Cancel through Accessibility; reproduced twice. (3) HUD dialogs (Check for Updates from the HUD panel) grey a ~900×700 area of the desktop — **already fixed on `main` by #733, not in rc.4: cherry-pick candidate**. (4) GIF delay is truncated, not rounded (`crates/compositor/src/gif_export.rs:231`, `100 / fps`): 15 fps → 6 cs → plays at 16.7 fps, 30.48 s for a 33.87 s programme (+11 %, not the ~4 % the comment allows); 30 fps has the same error. (5) Hovering a Backspace-cut transcript word shows no *Restore* button (undo and the trim inspector still restore). (6) Whisper appends a hallucinated repeat of the whole transcript over the trailing ~8 s of silence, stacked at 34.4 s. (7) The "frame-stepped and muted" hint (`speed.previewFrameSteppingHint`) is rendered nowhere at 20×. (8) Cosmetic: the shortcuts dialog lists Undo/Redo as Ctrl+Z / Ctrl+Shift+Z / Ctrl+Y on macOS. **Checklist drift, not defects:** no loop or fullscreen transport control exists (`transport.loop` key unused); blur has no intensity/block-size control (fixed 12/12) and freehand only for legacy docs; projects autosave, so the unsaved indicator and Save/Discard/Cancel prompt never appear; the app menu puts Save Diagnostics between About and Check for Updates. **Skipped — no hardware:** microphone (mic-only, mic+system balance, HUD mic prompt), webcam PiP/layouts/shapes/full-camera/shrink-on-zoom, AI camera background (no webcam track), voice-over, second display at another scale factor; **single Space:** record while switching Spaces; **driver limits:** Ctrl/Shift/middle-mouse timeline zoom/pan (modifier+scroll never lands), Esc on menus; **not run:** chat history/rename/delete/new-conversation switch, compact context, copy message, API-key entry and device-flow panels, auto-enhance AI path, update download/install/restart flows (no newer release), old-project migration and legacy caption annotations, region merge/repel/cross-boundary split, clip copy/paste, transcript silence-span trim, re-transcription, word insertion (dev-only), notes window exclusion, Intel/Store/Windows/Linux blocks. Main-process logs clean (no error lines) across both launches; defect screenshots kept locally. || 2026-09-24 | installed `v1.13.0-rc.6` — CI-built DMG `Openscreen-macOS-Apple-Silicon-1.13.0-rc.6.dmg` from the GitHub Release (tag `6eb86b17`, build run 35990025043), Developer ID signed + notarized (`spctl`: Notarized Developer ID); native payload one uniformly stamped set (34 files, 2026-09-24 13:10). rc.6 = rc.5 (#733 backport) + cherry-picks of #748, #749, #750 (2 commits), #719 (2 commits), #666 | macOS 26.5 (25F71), M1 Mac mini, one 3840×2160 display; no camera, no microphone | Pass — risk-scoped slice, no defect | **Scoped to what rc.5→rc.6 changed, not a full-file run** (the full pass is the rc.4 row). Real OS mouse/keyboard; every level, duration and frame claim measured on exported files. **#733 HUD dialogs:** HUD device-settings → Check for Updates shows "up to date (1.13.0-rc.6)" with **no grey rectangle** over the desktop (rc.4: ~900×700 greyed). **#743 file panels (widest blast radius — every save/open dialog):** Export MP4 → *Save Exported Video* is now a sheet on the editor; three clicks on the editor behind the modal leave it attached and visible (rc.4: panel fell behind, modal stuck on "Starting…"); Cancel returns the modal to its options. Open Project → *Browse files…* and the audio-import picker (`m`) also open as sheets on the editor and complete. **#744 GIF timing:** GUI GIF export 15 fps / Medium: 517 frames, delays 7/6 cs alternating (345×7 + 172×6), playback **34.47 s = frames/15 exactly**, against 34.40 s for the MP4 of the same project (rc.4: 30.48 s for a 33.87 s programme); CLI GIF 15 fps: 543 frames, 36.20 s = 543/15. **#747:** Keyboard Shortcuts → Fixed shows Undo "⌘ + Z" and Redo "⌘ + ⇧ + Z / ⌘ + Y". **#719 CLI export of v2 projects:** three hand-written v2 projects over a real take — with `cropRegion {0.25,0.25,0.5,0.5}` the CLI export on **rc.4 ignored the crop (full frame)**, on rc.6 it renders the centre crop; `cursorSize: 6` renders a cursor twice the default (3.0) size, compared frame-for-frame against the same project without the key; an out-of-range crop `{-0.2,0.5,0.6,0.8}` exports without error (clamped); the v2 crop project also opens in the GUI with the crop applied. **#666 imported-audio gain:** the Output level slider now goes well below −12 dB (set −37.5 and −39.0 dB); exported level of the 1 kHz bed by single-bin lock-in over 11–13 s: **−31.1 dBFS at −4 dB (rc.4) → −65.9 dBFS at −39 dB (rc.6), Δ 34.8 dB for 35 dB requested**, muted floor −96.2 dBFS. **Smoke:** record from the editor's Rec stage (tray icon red, stop from tray *Stop Recording*) → editor opens on the 13.23 s 3840×2160 H.264 + AAC take with an auto zoom → add a trim (0.68 s) → Export MP4 1080p30: 12.60 s (13.23 − 0.68 = 12.55 expected, within 2 frames). Main-process log: no error lines. **Not covered:** everything outside this slice (see the rc.4 row); #743 on Windows/Linux (the helper keeps owning the HUD there — unit-tested only); the native-bridge project save path was exercised only through Open; webcam/mic still untestable on this machine. Open, not in rc.6: #742 (animated annotation during playback, preview only), #745 (not reproduced), #729 (Whisper hallucination on trailing silence). |+| 2026-09-24 | `claude/zoom-speed-adjustment-fb8abd`, the zoom-pace PR for #683, on `d951e532`; `compositor_view.node` rebuilt from that tree (its native code is the PR's) by `npm run build:native:compositor` (2026-09-24 22:17), ffmpeg DLLs hash-identical to the vendored SDK; renderer rebuilt with `npm run build-vite` | Windows 11 26200 | Partial — no defect | **Zoom pace and speed regions, through the app's real export (`electron . export <project> -o <mp4>`).** Source: synthetic 1920×1080 clip, a 160 px white square centred. Two legacy projects: `plain` at 1× with a 1.25× zoom on [2 s, 3 s] and a 5× zoom on [6 s, 8 s]; `sped` with the whole clip at 4× and the same zooms at 4× the source times. Zoom scale measured on every frame of the 60 fps exports (area-weighted width of the square). New addon: `plain` and `sped` identical frame for frame (max \|Δscale\| 0.0001); 1.25× moves 2→98 % in 0.53 s, peak 0.9 e-folds/s; 5× in 1.12 s, peak 2.8 e-folds/s; each zoom reaches 98 % before its region starts and leaves when it ends. Same app build pointed at the 2026-09-13 addon (`OPENSCREEN_COMPOSITOR_VIEW_NODE`): 5× peaks at 13 e-folds/s at 1× and 31 at 4×, where the whole zoom-in takes 0.18 s. **Not covered:** the GUI editor preview (same `plan_frame` as the export, not driven), Full Camera under a speed region and chained zooms (unit-tested only), macOS and Linux rendering. |