Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

fix: export animation desync — use content time for zoom spring delta

webadderall0101d8cf491f
diff --git a/package.json b/package.json
index c6096e24..977cbda6 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
"url": "https://github.com/webadderall/Recordly/issues"
},
"private": true,
- "version": "1.1.19",
+ "version": "1.1.20",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src/lib/exporter/frameRenderer.ts b/src/lib/exporter/frameRenderer.ts
index b71a2fee..33f3f686 100644
--- a/src/lib/exporter/frameRenderer.ts
+++ b/src/lib/exporter/frameRenderer.ts
@@ -170,7 +170,7 @@ export class FrameRenderer {
private springX: SpringState;
private springY: SpringState;
private cursorFollowCamera: CursorFollowCameraState;
- private lastFrameTimeMs: number | null = null;
+ private lastContentTimeMs: number | null = null;
private cursorOverlay: PixiCursorOverlay | null = null;
private webcamForwardFrameSource: ForwardFrameSource | null = null;
private webcamDecodedFrame: VideoFrame | null = null;
@@ -1137,12 +1137,12 @@ export class FrameRenderer {
focusY: state.focusY,
});
- // Spring-driven zoom animation for export
- const now = performance.now();
- const deltaMs = this.lastFrameTimeMs !== null
- ? now - this.lastFrameTimeMs
+ // Spring-driven zoom animation for export — use content time, not wall-clock,
+ // so the spring advances at the same rate as the video regardless of render speed.
+ const deltaMs = this.lastContentTimeMs !== null
+ ? timeMs - this.lastContentTimeMs
: 1000 / 60;
- this.lastFrameTimeMs = now;
+ this.lastContentTimeMs = timeMs;
const zoomSpringConfig = getZoomSpringConfig(this.config.zoomSmoothness);
diff --git a/src/lib/exporter/modernFrameRenderer.ts b/src/lib/exporter/modernFrameRenderer.ts
index 37b19e3a..b2b63117 100644
--- a/src/lib/exporter/modernFrameRenderer.ts
+++ b/src/lib/exporter/modernFrameRenderer.ts
@@ -341,7 +341,7 @@ export class FrameRenderer {
private springX: SpringState;
private springY: SpringState;
private cursorFollowCamera: CursorFollowCameraState;
- private lastFrameTimeMs: number | null = null;
+ private lastContentTimeMs: number | null = null;
private layoutCache: LayoutCache | null = null;
private currentVideoTime = 0;
private lastMotionVector = { x: 0, y: 0 };
@@ -2242,12 +2242,12 @@ export class FrameRenderer {
focusY: state.focusY,
});
- // Spring-driven zoom animation for export
- const now = performance.now();
- const deltaMs = this.lastFrameTimeMs !== null
- ? now - this.lastFrameTimeMs
+ // Spring-driven zoom animation for export — use content time, not wall-clock,
+ // so the spring advances at the same rate as the video regardless of render speed.
+ const deltaMs = this.lastContentTimeMs !== null
+ ? timeMs - this.lastContentTimeMs
: 1000 / 60;
- this.lastFrameTimeMs = now;
+ this.lastContentTimeMs = timeMs;
const zoomSpringConfig = getZoomSpringConfig(this.config.zoomSmoothness);