Skip to content

🎥 Make videos programmatically with React

Fix checkerboard bleed without blurring custom cursors

JonnyBurger34121f20cb7f
diff --git a/packages/mac-cursors/src/MacOSCursor.tsx b/packages/mac-cursors/src/MacOSCursor.tsx
index 68af189db6..de81318e8f 100644
--- a/packages/mac-cursors/src/MacOSCursor.tsx
+++ b/packages/mac-cursors/src/MacOSCursor.tsx
@@ -6,7 +6,13 @@ import type {
InteractivitySchema,
SequenceControls,
} from 'remotion';
-import {Freeze, Sequence, Interactive, Internals} from 'remotion';
+import {
+ Freeze,
+ Sequence,
+ Interactive,
+ Internals,
+ useCurrentScale,
+} from 'remotion';
import {macOSCursorNames, resolveCursor} from './resolve-cursor';
export type MacOSCursorProps = InteractiveBaseProps &
@@ -74,6 +80,7 @@ const MacOSCursorInner: React.FC<
const refForOutline = React.useRef<SVGSVGElement | null>(null);
const width = resolved?.width ?? undefined;
const height = resolved?.height ?? undefined;
+ const currentScale = useCurrentScale({dontThrowIfOutsideOfRemotion: true});
const {
effectivePremountFor,
@@ -132,7 +139,9 @@ const MacOSCursorInner: React.FC<
...premountingStyle,
}}
>
+ {/* Reload custom SVG images when the preview scale changes. */}
<image
+ key={cursor === 'custom' ? currentScale : undefined}
href={resolved.src}
width={width}
height={height}
diff --git a/packages/studio/src/components/Preview.tsx b/packages/studio/src/components/Preview.tsx
index 2cce496895..39c7575e9c 100644
--- a/packages/studio/src/components/Preview.tsx
+++ b/packages/studio/src/components/Preview.tsx
@@ -73,9 +73,8 @@ const containerStyle = (options: {
return {
transform: `scale(${options.scale})`,
// Keep the scaled composition on its own layer so the checkerboard does
- // not bleed through its edges at fractional preview scales. Using
- // 'transform' caches the rasterization scale and blurs content after zooming.
- willChange: 'opacity',
+ // not bleed through its edges at fractional preview scales.
+ willChange: 'transform',
marginLeft: options.xCorrection,
marginTop: options.yCorrection,
width: options.width,