Skip to content

🎥 Make videos programmatically with React

`remotion`: Remove frame from effect system; use explicit progress/evolution

Jonny Burger47817fe00c7c
diff --git a/packages/core/src/HtmlInCanvas.tsx b/packages/core/src/HtmlInCanvas.tsx
index 7e1bbd9326..cba265b5e5 100644
--- a/packages/core/src/HtmlInCanvas.tsx
+++ b/packages/core/src/HtmlInCanvas.tsx
@@ -25,7 +25,6 @@ import type {
SequenceProps,
} from './Sequence.js';
import {Sequence} from './Sequence.js';
-import {useCurrentFrame} from './use-current-frame.js';
import {useDelayRender} from './use-delay-render.js';
import {useVideoConfig} from './use-video-config.js';
import {wrapInSchema} from './wrap-in-schema.js';
@@ -306,8 +305,6 @@ const HtmlInCanvasContent = forwardRef<
cancelRender(new Error(HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
}
- const frame = useCurrentFrame();
-
const canvas2dRef = useRef<HTMLCanvasElement | null>(null);
const divRef = useRef<HTMLDivElement | null>(null);
@@ -335,8 +332,6 @@ const HtmlInCanvasContent = forwardRef<
// Refs so the paint handler always reads fresh values.
const effectsRef = useRef(memoizedEffects);
effectsRef.current = memoizedEffects;
- const frameRef = useRef(frame);
- frameRef.current = frame;
const onPaintRef = useRef(onPaint);
onPaintRef.current = onPaint;
const onInitRef = useRef(onInit);
@@ -416,7 +411,6 @@ const HtmlInCanvasContent = forwardRef<
source: offscreenCanvas,
effects: effectsRef.current,
output: canvas2dRef.current!,
- frame: frameRef.current,
width,
height,
});
diff --git a/packages/core/src/effects/Solid.tsx b/packages/core/src/effects/Solid.tsx
index 108f5f081e..2a7ee893e9 100644
--- a/packages/core/src/effects/Solid.tsx
+++ b/packages/core/src/effects/Solid.tsx
@@ -13,7 +13,6 @@ import {
} from '../sequence-field-schema.js';
import type {SequenceProps} from '../Sequence.js';
import {Sequence} from '../Sequence.js';
-import {useCurrentFrame} from '../use-current-frame.js';
import {useDelayRender} from '../use-delay-render.js';
import {wrapInSchema} from '../wrap-in-schema.js';
import type {EffectsProp} from './effect-types.js';
@@ -80,7 +79,6 @@ const SolidInner: React.FC<
overrideId,
ref,
}) => {
- const frame = useCurrentFrame();
const {delayRender, continueRender, cancelRender} = useDelayRender();
const [outputCanvas, setOutputCanvas] = useState<HTMLCanvasElement | null>(
@@ -124,7 +122,7 @@ const SolidInner: React.FC<
return;
}
- const handle = delayRender(`Solid effect chain (frame ${frame})`);
+ const handle = delayRender('Solid effect chain');
if (!chainState) {
continueRender(handle);
@@ -149,7 +147,6 @@ const SolidInner: React.FC<
source: sourceCanvas,
effects: memoizedEffects,
output: outputCanvas,
- frame,
width,
height,
})
@@ -166,7 +163,6 @@ const SolidInner: React.FC<
continueRender(handle);
};
}, [
- frame,
color,
outputCanvas,
sourceCanvas,
diff --git a/packages/core/src/effects/create-effect.ts b/packages/core/src/effects/create-effect.ts
index f2bcaafadb..23dac8b80a 100644
--- a/packages/core/src/effects/create-effect.ts
+++ b/packages/core/src/effects/create-effect.ts
@@ -15,7 +15,7 @@ export const disabledEffectField: SequenceFieldSchema = {
description: 'Disabled',
};
-// Defines an effect and returns a factory that produces per-frame descriptors.
+// Defines an effect and returns a factory that produces effect descriptors.
// The returned function is the public API effect authors expose to users:
//
// export const blur = createEffect<BlurParams, BlurState>({ ... });
diff --git a/packages/core/src/effects/effect-types.ts b/packages/core/src/effects/effect-types.ts
index bfce97a029..9a1935f3d3 100644
--- a/packages/core/src/effects/effect-types.ts
+++ b/packages/core/src/effects/effect-types.ts
@@ -23,7 +23,6 @@ export type EffectApplyParams<P, S> = {
readonly target: HTMLCanvasElement;
readonly state: S;
readonly params: P;
- readonly frame: number;
readonly width: number;
readonly height: number;
readonly gpuDevice: AnyGpuDevice | null;
diff --git a/packages/core/src/effects/run-effect-chain.ts b/packages/core/src/effects/run-effect-chain.ts
index 880e2dc8e0..820482e7d3 100644
--- a/packages/core/src/effects/run-effect-chain.ts
+++ b/packages/core/src/effects/run-effect-chain.ts
@@ -54,7 +54,6 @@ export type RunEffectChainOptions = {
readonly source: CanvasImageSource;
readonly effects: EffectDefinitionAndStack<unknown>[];
readonly output: HTMLCanvasElement;
- readonly frame: number;
readonly width: number;
readonly height: number;
};
@@ -67,7 +66,6 @@ export const runEffectChain = async ({
source,
effects,
output,
- frame,
width,
height,
}: RunEffectChainOptions): Promise<boolean> => {
@@ -130,7 +128,6 @@ export const runEffectChain = async ({
target: dst,
state: setupState,
params: eff.params,
- frame,
width,
height,
gpuDevice,
diff --git a/packages/effects/src/wave.ts b/packages/effects/src/wave.ts
index a32e3c7cbc..372b2eacaa 100644
--- a/packages/effects/src/wave.ts
+++ b/packages/effects/src/wave.ts
@@ -1,11 +1,49 @@
+import type {SequenceSchema} from 'remotion';
import {Internals} from 'remotion';
const {createEffect} = Internals;
+export const waveSchema = {
+ amplitude: {
+ type: 'number',
+ min: 0,
+ max: 500,
+ step: 1,
+ default: 60,
+ description: 'Amplitude',
+ },
+ wavelength: {
+ type: 'number',
+ min: 1,
+ max: 2000,
+ step: 1,
+ default: 240,
+ description: 'Wavelength',
+ },
+ evolution: {
+ type: 'number',
+ default: 0,
+ description: 'Evolution',
+ },
+ sliceWidth: {
+ type: 'number',
+ min: 1,
+ max: 100,
+ step: 1,
+ default: 4,
+ description: 'Slice width',
+ },
+ background: {
+ type: 'color',
+ default: 'transparent',
+ description: 'Background',
+ },
+} as const satisfies SequenceSchema;
+
export type WaveParams = {
readonly amplitude?: number;
readonly wavelength?: number;
- readonly speed?: number;
+ readonly evolution?: number;
readonly sliceWidth?: number;
readonly background?: string;
};
@@ -13,7 +51,7 @@ export type WaveParams = {
type WaveResolved = {
amplitude: number;
wavelength: number;
- speed: number;
+ evolution: number;
sliceWidth: number;
background: string;
};
@@ -21,23 +59,24 @@ type WaveResolved = {
const resolve = (p: WaveParams): WaveResolved => ({
amplitude: p.amplitude ?? 60,
wavelength: p.wavelength ?? 240,
- speed: p.speed ?? 1 / 6,
+ evolution: p.evolution ?? 0,
sliceWidth: p.sliceWidth ?? 4,
background: p.background ?? 'transparent',
});
// Vertical-displacement wave effect: shifts vertical slices of the source
-// up/down with a sine wave that animates over time. Operates on the 2D backend.
+// up/down with a sine wave phase driven by `evolution`. Operates on the 2D
+// backend.
export const wave = createEffect<WaveParams, null>({
type: 'remotion/wave',
label: 'Wave',
backend: '2d',
calculateKey: (params) => {
const r = resolve(params);
- return `wave-${r.amplitude}-${r.wavelength}-${r.speed}-${r.sliceWidth}-${r.background}`;
+ return `wave-${r.amplitude}-${r.wavelength}-${r.evolution}-${r.sliceWidth}-${r.background}`;
},
setup: () => null,
- apply: ({source, target, frame, width, height, params}) => {
+ apply: ({source, target, width, height, params}) => {
const ctx = target.getContext('2d');
if (!ctx) {
throw new Error(
@@ -55,8 +94,7 @@ export const wave = createEffect<WaveParams, null>({
for (let x = 0; x < width; x += r.sliceWidth) {
const offset =
- Math.sin((x / r.wavelength) * Math.PI * 2 + frame * r.speed) *
- r.amplitude;
+ Math.sin((x / r.wavelength) * Math.PI * 2 + r.evolution) * r.amplitude;
ctx.drawImage(
source,
x,
@@ -71,5 +109,5 @@ export const wave = createEffect<WaveParams, null>({
}
},
cleanup: () => undefined,
- schema: null,
+ schema: waveSchema,
});
diff --git a/packages/example/src/EffectsTestbed/EffectsTestbed.tsx b/packages/example/src/EffectsTestbed/EffectsTestbed.tsx
index 4b34536607..f8c2e735e6 100644
--- a/packages/example/src/EffectsTestbed/EffectsTestbed.tsx
+++ b/packages/example/src/EffectsTestbed/EffectsTestbed.tsx
@@ -6,7 +6,13 @@ import {LightLeakInternals} from '@remotion/light-leaks';
import {Video} from '@remotion/media';
import {StarburstInternals} from '@remotion/starburst';
import React from 'react';
-import {AbsoluteFill, Experimental, staticFile} from 'remotion';
+import {
+ AbsoluteFill,
+ Experimental,
+ staticFile,
+ useCurrentFrame,
+ useVideoConfig,
+} from 'remotion';
const SAMPLE_VIDEO = staticFile('bigbuckbunny.mp4');
@@ -77,6 +83,81 @@ const tileVideoStyle: React.CSSProperties = {
height: '100%',
};
+const AnimatedWaveVideo: React.FC = () => {
+ const frame = useCurrentFrame();
+ const evolution = frame * 0.2;
+
+ return (
+ <Video
+ src={SAMPLE_VIDEO}
+ style={tileVideoStyle}
+ muted
+ loop
+ objectFit="cover"
+ _experimentalEffects={[
+ wave({
+ amplitude: 22,
+ wavelength: 180,
+ evolution,
+ sliceWidth: 4,
+ background: '#020617',
+ }),
+ ]}
+ />
+ );
+};
+
+const AnimatedLightLeakSolid: React.FC = () => {
+ const frame = useCurrentFrame();
+ const {durationInFrames} = useVideoConfig();
+ const progress = durationInFrames <= 1 ? 0 : frame / (durationInFrames - 1);
+
+ return (
+ <Experimental.Solid
+ width={400}
+ height={300}
+ color="#ff5fa2"
+ style={tileVideoStyle}
+ _experimentalEffects={[
+ LightLeakInternals.lightLeak({
+ seed: 1,
+ hueShift: 30,
+ progress,
+ }),
+ ]}
+ />
+ );
+};
+
+const AnimatedStackVideo: React.FC = () => {
+ const frame = useCurrentFrame();
+ const evolution = frame * 0.2;
+
+ return (
+ <Video
+ src={SAMPLE_VIDEO}
+ style={tileVideoStyle}
+ muted
+ loop
+ objectFit="cover"
+ _experimentalEffects={[
+ StarburstInternals.starburst({
+ colors: ['#ff5fa2', '#ff0000'],
+ rays: 12,
+ }),
+ blur({radius: 24}),
+ wave({
+ amplitude: 22,
+ wavelength: 180,
+ evolution,
+ sliceWidth: 4,
+ background: '#020617',
+ }),
+ ]}
+ />
+ );
+};
+
export const EffectsTestbed: React.FC = () => {
return (
<AbsoluteFill
@@ -126,23 +207,8 @@ export const EffectsTestbed: React.FC = () => {
]}
/>
</Tile>
- <Tile title="wave" subtitle="amplitude 22, animated">
- <Video
- src={SAMPLE_VIDEO}
- style={tileVideoStyle}
- muted
- loop
- objectFit="cover"
- _experimentalEffects={[
- wave({
- amplitude: 22,
- wavelength: 180,
- speed: 0.2,
- sliceWidth: 4,
- background: '#020617',
- }),
- ]}
- />
+ <Tile title="wave" subtitle="amplitude 22, evolution from frame">
+ <AnimatedWaveVideo />
</Tile>
</div>
<div style={{flex: 1, display: 'flex', flexDirection: 'row', gap: 16}}>
@@ -156,41 +222,13 @@ export const EffectsTestbed: React.FC = () => {
_experimentalEffects={[blur({radius: 24})]}
/>
</Tile>
- <Tile title="solid" subtitle="light leak">
- <Experimental.Solid
- width={400}
- height={300}
- color="#ff5fa2"
- style={tileVideoStyle}
- _experimentalEffects={[
- LightLeakInternals.lightLeak({seed: 1, hueShift: 30}),
- ]}
- />
+ <Tile title="solid" subtitle="light leak, progress from frame">
+ <AnimatedLightLeakSolid />
</Tile>
</div>
<div style={{flex: 1, display: 'flex', flexDirection: 'row', gap: 16}}>
- <Tile title="starburst" subtitle="separable Gaussian, radius 24">
- <Video
- src={SAMPLE_VIDEO}
- style={tileVideoStyle}
- muted
- loop
- objectFit="cover"
- _experimentalEffects={[
- StarburstInternals.starburst({
- colors: ['#ff5fa2', '#ff0000'],
- rays: 12,
- }),
- blur({radius: 24}),
- wave({
- amplitude: 22,
- wavelength: 180,
- speed: 0.2,
- sliceWidth: 4,
- background: '#020617',
- }),
- ]}
- />
+ <Tile title="starburst" subtitle="starburst + blur + wave">
+ <AnimatedStackVideo />
</Tile>
</div>
</AbsoluteFill>
diff --git a/packages/light-leaks/src/light-leak-internals.ts b/packages/light-leaks/src/light-leak-internals.ts
index 4c1e93c1ef..5d80fe4c5d 100644
--- a/packages/light-leaks/src/light-leak-internals.ts
+++ b/packages/light-leaks/src/light-leak-internals.ts
@@ -12,36 +12,33 @@ export const lightLeakEffectSchema = {
default: 0,
description: 'Hue Shift',
},
- durationInFrames: {
+ progress: {
type: 'number',
- min: 1,
- max: 100_000,
- step: 1,
- default: 300,
- description: 'Duration in frames',
+ min: 0,
+ max: 1,
+ step: 0.01,
+ default: 0,
+ description: 'Progress',
},
} as const satisfies SequenceSchema;
export type LightLeakEffectParams = {
readonly seed?: number;
readonly hueShift?: number;
- /**
- * Controls evolve/retract timing, matching `<LightLeak>` when set to the same
- * duration as your composition or sequence.
- */
- readonly durationInFrames?: number;
+ /** Evolve/retract phase from 0 (start) to 1 (end). */
+ readonly progress?: number;
};
type LightLeakResolved = {
seed: number;
hueShift: number;
- durationInFrames: number;
+ progress: number;
};
const resolve = (p: LightLeakEffectParams): LightLeakResolved => ({
seed: p.seed ?? 0,
hueShift: p.hueShift ?? 0,
- durationInFrames: p.durationInFrames ?? 300,
+ progress: p.progress ?? 0,
});
const LIGHT_LEAK_VS = /* glsl */ `#version 300 es
@@ -199,7 +196,7 @@ const lightLeak = createEffect<LightLeakEffectParams, LightLeakGlState>({
backend: 'webgl2',
calculateKey: (params) => {
const r = resolve(params);
- return `light-leak-${r.seed}-${r.hueShift}-${r.durationInFrames}`;
+ return `light-leak-${r.seed}-${r.hueShift}-${r.progress}`;
},
setup: (target) => {
const gl = target.getContext('webgl2', {
@@ -273,7 +270,7 @@ const lightLeak = createEffect<LightLeakEffectParams, LightLeakGlState>({
uResolution: gl.getUniformLocation(program, 'resolution'),
};
},
- apply: ({source, width, height, params, state, frame}) => {
+ apply: ({source, width, height, params, state}) => {
const r = resolve(params);
if (typeof r.seed !== 'number' || !Number.isFinite(r.seed)) {
@@ -294,8 +291,7 @@ const lightLeak = createEffect<LightLeakEffectParams, LightLeakGlState>({
);
}
- const duration = r.durationInFrames;
- const normalized = duration <= 1 ? 0 : frame / (duration - 1);
+ const normalized = Math.min(1, Math.max(0, r.progress));
const evolveProgress = Math.min(1, normalized * 2);
const retractProgress = Math.max(0, normalized * 2 - 1);
diff --git a/packages/media/src/audio/audio-for-preview.tsx b/packages/media/src/audio/audio-for-preview.tsx
index b94b41e849..f6b9ec508a 100644
--- a/packages/media/src/audio/audio-for-preview.tsx
+++ b/packages/media/src/audio/audio-for-preview.tsx
@@ -213,7 +213,6 @@ const AudioForPreviewAssertedShowing: React.FC<NewAudioForPreviewProps> = ({
tagType: 'audio',
getEffects: () => [],
getEffectChainState: () => null,
- getCurrentFrame: () => 0,
});
mediaPlayerRef.current = player;
diff --git a/packages/media/src/media-player.ts b/packages/media/src/media-player.ts
index b968d8a3ca..41a111ec21 100644
--- a/packages/media/src/media-player.ts
+++ b/packages/media/src/media-player.ts
@@ -79,8 +79,6 @@ export class MediaPlayer {
height: number,
) => EffectChainState | null;
- private getCurrentFrame: () => number;
-
private initializationPromise: Promise<MediaPlayerInitResult> | null = null;
private bufferState: ReturnType<typeof useBufferState>;
@@ -113,7 +111,6 @@ export class MediaPlayer {
tagType,
getEffects,
getEffectChainState,
- getCurrentFrame,
}: {
canvas: HTMLCanvasElement | OffscreenCanvas | null;
src: string;
@@ -141,7 +138,6 @@ export class MediaPlayer {
width: number,
height: number,
) => EffectChainState | null;
- getCurrentFrame: () => number;
}) {
this.canvas = canvas ?? null;
this.src = src;
@@ -177,7 +173,6 @@ export class MediaPlayer {
this.tagType = tagType;
this.getEffects = getEffects;
this.getEffectChainState = getEffectChainState;
- this.getCurrentFrame = getCurrentFrame;
if (canvas) {
const context = canvas.getContext('2d', {
@@ -338,7 +333,6 @@ export class MediaPlayer {
getIsLooping: () => this.loop,
getEffects: this.getEffects,
getEffectChainState: this.getEffectChainState,
- getCurrentFrame: this.getCurrentFrame,
});
}
diff --git a/packages/media/src/test/media-player.test.ts b/packages/media/src/test/media-player.test.ts
index 3768e53914..fe636d38bd 100644
--- a/packages/media/src/test/media-player.test.ts
+++ b/packages/media/src/test/media-player.test.ts
@@ -56,7 +56,6 @@ test('audio-only file should initialize without `audioStreamIndex` (regression f
sequenceOffset: 0,
credentials: undefined,
tagType: 'audio',
- getCurrentFrame: () => 0,
getEffects: () => [],
getEffectChainState: () => null,
});
@@ -124,7 +123,6 @@ test('dispose should immediately unblock playback delays', async () => {
tagType: 'video',
getEffects: () => [],
getEffectChainState: () => null,
- getCurrentFrame: () => 0,
});
await player.initialize(0, false);
diff --git a/packages/media/src/test/trim-change-seek.test.ts b/packages/media/src/test/trim-change-seek.test.ts
index 5985186f6f..466cd31597 100644
--- a/packages/media/src/test/trim-change-seek.test.ts
+++ b/packages/media/src/test/trim-change-seek.test.ts
@@ -26,7 +26,6 @@ test('setTrimBefore and setTrimAfter should update frame when paused', async ()
tagType: 'video',
getEffects: () => [],
getEffectChainState: () => null,
- getCurrentFrame: () => 0,
});
await player.initialize(0, false);
diff --git a/packages/media/src/test/video-iterator-manager.test.ts b/packages/media/src/test/video-iterator-manager.test.ts
index 10af193a3a..eb81a306b4 100644
--- a/packages/media/src/test/video-iterator-manager.test.ts
+++ b/packages/media/src/test/video-iterator-manager.test.ts
@@ -50,7 +50,6 @@ test('seek should not cause overlapping block/unblock cycles', async () => {
getIsLooping: () => false,
getEffects: () => [],
getEffectChainState: () => null,
- getCurrentFrame: () => 0,
});
const nonceManager = makeNonceManager();
@@ -104,7 +103,6 @@ test('rapid sequential seeks should not cause overlapping blocks', async () => {
getIsLooping: () => false,
getEffects: () => [],
getEffectChainState: () => null,
- getCurrentFrame: () => 0,
});
const nonceManager = makeNonceManager();
diff --git a/packages/media/src/test/video-with-no-frames-in-beginning.test.ts b/packages/media/src/test/video-with-no-frames-in-beginning.test.ts
index 6973f57e49..b64124716b 100644
--- a/packages/media/src/test/video-with-no-frames-in-beginning.test.ts
+++ b/packages/media/src/test/video-with-no-frames-in-beginning.test.ts
@@ -42,7 +42,6 @@ test('in preview, should properly buffer and draw frames', async (t) => {
getOnVideoFrameCallback: () => null,
getEffects: () => [],
getEffectChainState: () => null,
- getCurrentFrame: () => 0,
});
const nonceManager = makeNonceManager();
diff --git a/packages/media/src/video-iterator-manager.ts b/packages/media/src/video-iterator-manager.ts
index c78a8ad066..a130ae34f8 100644
--- a/packages/media/src/video-iterator-manager.ts
+++ b/packages/media/src/video-iterator-manager.ts
@@ -29,7 +29,6 @@ export const videoIteratorManager = async ({
getIsLooping,
getEffects,
getEffectChainState,
- getCurrentFrame,
}: {
videoTrack: InputVideoTrack;
delayPlaybackHandleIfNotPremounting: () => DelayPlaybackIfNotPremounting;
@@ -46,7 +45,6 @@ export const videoIteratorManager = async ({
width: number,
height: number,
) => EffectChainState | null;
- getCurrentFrame: () => number;
}) => {
let videoIteratorsCreated = 0;
let videoFrameIterator: VideoIterator | null = null;
@@ -85,7 +83,6 @@ export const videoIteratorManager = async ({
source: frame.canvas,
effects,
output: canvas,
- frame: getCurrentFrame(),
width: canvas.width,
height: canvas.height,
});
diff --git a/packages/media/src/video/video-for-preview.tsx b/packages/media/src/video/video-for-preview.tsx
index 59affda809..eb35c8743c 100644
--- a/packages/media/src/video/video-for-preview.tsx
+++ b/packages/media/src/video/video-for-preview.tsx
@@ -144,8 +144,6 @@ const VideoForPreviewAssertedShowing: React.FC<
const effectChainStateRef = useRef(effectChainState);
effectChainStateRef.current = effectChainState;
- const frameRef = useRef(frame);
- frameRef.current = frame;
const parentSequence = useContext(SequenceContext);
const isPremounting = Boolean(parentSequence?.premounting);
@@ -281,7 +279,6 @@ const VideoForPreviewAssertedShowing: React.FC<
getEffects: () => experimentalEffectsRef.current,
getEffectChainState: (width, height) =>
effectChainStateRef.current?.get(width, height)!,
- getCurrentFrame: () => frameRef.current,
});
mediaPlayerRef.current = player;
diff --git a/packages/transitions/src/html-in-canvas-presentation.tsx b/packages/transitions/src/html-in-canvas-presentation.tsx
index 06aff0763b..a995308aae 100644
--- a/packages/transitions/src/html-in-canvas-presentation.tsx
+++ b/packages/transitions/src/html-in-canvas-presentation.tsx
@@ -5,7 +5,7 @@ import {
useDelayRender,
type EffectsProp,
} from 'remotion';
-import {AbsoluteFill, Internals, useCurrentFrame} from 'remotion';
+import {AbsoluteFill, Internals} from 'remotion';
import type {DrawFunction} from './TransitionSeries';
import type {
TransitionPresentation,
@@ -50,10 +50,6 @@ export const HtmlInCanvasPresentation = <
const passedPropsRef = useRef(passedProps);
passedPropsRef.current = passedProps;
- const frame = useCurrentFrame();
- const frameRef = useRef(frame);
- frameRef.current = frame;
-
const memoizedEffects = Internals.useMemoizedEffects({
effects: _experimentalEffects ?? [],
overrideId: null,
@@ -112,7 +108,6 @@ export const HtmlInCanvasPresentation = <
state: chainState.get(width, height)!,
source: offscreenCanvas,
effects: effectsRef.current ?? [],
- frame: frameRef.current,
width,
height,
output: canvasRef.current,