Skip to content

🎥 Make videos programmatically with React

@remotion/effects: Remove EffectInternals, use cyan tint preview

JonnyBurgera2417a1ae127
diff --git a/packages/docs/docs/effects/tint.mdx b/packages/docs/docs/effects/tint.mdx
index 3172229f68..530ba3c056 100644
--- a/packages/docs/docs/effects/tint.mdx
+++ b/packages/docs/docs/effects/tint.mdx
@@ -26,7 +26,7 @@ export const MyComp: React.FC = () => {
<AbsoluteFill>
<Video
src="https://remotion.media/video.mp4"
- effects={[tint({color: '#ff0080', amount: 0.4})]}
+ effects={[tint({color: '#1ec8ff', amount: 0.7})]}
/>
</AbsoluteFill>
);
diff --git a/packages/docs/static/img/effects-tint-preview.jpg b/packages/docs/static/img/effects-tint-preview.jpg
index 66fcd8800f..1e5eaecdec 100644
Binary files a/packages/docs/static/img/effects-tint-preview.jpg and b/packages/docs/static/img/effects-tint-preview.jpg differ
diff --git a/packages/effects/src/effect-internals.ts b/packages/effects/src/effect-internals.ts
deleted file mode 100644
index baedcacf88..0000000000
--- a/packages/effects/src/effect-internals.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import {halftone} from './halftone.js';
-
-export const EffectInternals = {
- halftone,
-} as const;
diff --git a/packages/effects/src/index.ts b/packages/effects/src/index.ts
index 045eabdd99..cb0ff5c3b5 100644
--- a/packages/effects/src/index.ts
+++ b/packages/effects/src/index.ts
@@ -1 +1 @@
-export {EffectInternals} from './effect-internals.js';
+export {};
diff --git a/packages/example/src/AnimatedImage/Effects.tsx b/packages/example/src/AnimatedImage/Effects.tsx
index e059209ac3..13f01b467e 100644
--- a/packages/example/src/AnimatedImage/Effects.tsx
+++ b/packages/example/src/AnimatedImage/Effects.tsx
@@ -1,5 +1,5 @@
-import {EffectInternals} from '@remotion/effects';
import {blur} from '@remotion/effects/blur';
+import {tint} from '@remotion/effects/tint';
import {StudioInternals} from '@remotion/studio';
import React from 'react';
import {
@@ -76,7 +76,7 @@ const Comp: React.FC = () => {
blur({
radius: blurRadius,
}),
- EffectInternals.tint({
+ tint({
color: '#41f500',
amount: 0.35,
}),
diff --git a/packages/example/src/EffectsTestbed/EffectsTestbed.tsx b/packages/example/src/EffectsTestbed/EffectsTestbed.tsx
index 1bd1e47ba1..47c1422565 100644
--- a/packages/example/src/EffectsTestbed/EffectsTestbed.tsx
+++ b/packages/example/src/EffectsTestbed/EffectsTestbed.tsx
@@ -1,5 +1,6 @@
-import {EffectInternals} from '@remotion/effects';
import {blur} from '@remotion/effects/blur';
+import {halftone} from '@remotion/effects/halftone';
+import {tint} from '@remotion/effects/tint';
import {wave} from '@remotion/effects/wave';
import {LightLeakInternals} from '@remotion/light-leaks';
import {Video} from '@remotion/media';
@@ -176,7 +177,7 @@ export const EffectsTestbed: React.FC = () => {
muted
loop
objectFit="cover"
- effects={[EffectInternals.tint({color: '#ff5fa2', amount: 0.6})]}
+ effects={[tint({color: '#ff5fa2', amount: 0.6})]}
/>
</Tile>
<Tile title="halftone" subtitle="circles, dotSize 12, on luminance">
@@ -187,7 +188,7 @@ export const EffectsTestbed: React.FC = () => {
loop
objectFit="cover"
effects={[
- EffectInternals.halftone({
+ halftone({
shape: 'circle',
dotSize: 12,
dotSpacing: 12,
diff --git a/packages/example/src/EffectsTestbed/VideoEffectsFastRefresh.tsx b/packages/example/src/EffectsTestbed/VideoEffectsFastRefresh.tsx
index e9c29952d7..d114a2757f 100644
--- a/packages/example/src/EffectsTestbed/VideoEffectsFastRefresh.tsx
+++ b/packages/example/src/EffectsTestbed/VideoEffectsFastRefresh.tsx
@@ -1,7 +1,7 @@
/**
* Minimal repro for https://github.com/remotion-dev/remotion/issues/7449
*
- * `<Video>` does not fast-refresh effects when `EffectInternals.tint()` params change in code.
+ * `<Video>` does not fast-refresh effects when `tint()` params change in code.
*
* Repro:
* 1. `cd packages/example && bun run dev`
@@ -11,7 +11,7 @@
* 5. Expected: the video tint updates immediately
* 6. Bug: the canvas keeps the old tint until you seek or remount
*/
-import {EffectInternals} from '@remotion/effects';
+import {tint} from '@remotion/effects/tint';
import {Video} from '@remotion/media';
import React from 'react';
import {AbsoluteFill, Solid} from 'remotion';
@@ -105,7 +105,7 @@ export const VideoEffectsFastRefresh: React.FC = () => {
&lt;Video&gt; (bug surface)
</div>
<div>
- EffectInternals.tint(
+ tint(
{`{color: '${TINT_COLOR}', amount: ${TINT_AMOUNT}}`})
</div>
</div>
@@ -115,7 +115,7 @@ export const VideoEffectsFastRefresh: React.FC = () => {
muted
loop
objectFit="cover"
- effects={[EffectInternals.tint({color: TINT_COLOR, amount: 0.57})]}
+ effects={[tint({color: TINT_COLOR, amount: 0.57})]}
/>
</div>
<div style={panelStyle}>
@@ -133,7 +133,7 @@ export const VideoEffectsFastRefresh: React.FC = () => {
height={1080}
color="#3b82f6"
style={mediaStyle}
- effects={[EffectInternals.tint({color: TINT_COLOR, amount: 0.2})]}
+ effects={[tint({color: TINT_COLOR, amount: 0.2})]}
/>
</div>
</div>
diff --git a/packages/example/src/Gif/GifEffects.tsx b/packages/example/src/Gif/GifEffects.tsx
index b985238857..cefece5ae6 100644
--- a/packages/example/src/Gif/GifEffects.tsx
+++ b/packages/example/src/Gif/GifEffects.tsx
@@ -1,5 +1,6 @@
-import {EffectInternals} from '@remotion/effects';
import {blur} from '@remotion/effects/blur';
+import {halftone} from '@remotion/effects/halftone';
+import {tint} from '@remotion/effects/tint';
import {wave} from '@remotion/effects/wave';
import {Gif} from '@remotion/gif';
import {StudioInternals} from '@remotion/studio';
@@ -127,7 +128,7 @@ const StackedGif: React.FC = () => {
fit="contain"
style={tileGifStyle}
effects={[
- EffectInternals.tint({color: '#ff5fa2', amount: 0.4}),
+ tint({color: '#ff5fa2', amount: 0.4}),
wave({
phase,
amplitude: 12,
@@ -169,7 +170,7 @@ const Comp: React.FC = () => {
src={GIF_SRC}
fit="contain"
style={tileGifStyle}
- effects={[EffectInternals.tint({color: '#ff5fa2', amount: 0.6})]}
+ effects={[tint({color: '#ff5fa2', amount: 0.6})]}
/>
</Tile>
<Tile title="halftone" subtitle="circles, dotSize 12, on luminance">
@@ -178,7 +179,7 @@ const Comp: React.FC = () => {
fit="contain"
style={tileGifStyle}
effects={[
- EffectInternals.halftone({
+ halftone({
shape: 'circle',
dotSize: 12,
dotSpacing: 12,
diff --git a/packages/example/src/HtmlInCanvas/compose-webgl-crt.tsx b/packages/example/src/HtmlInCanvas/compose-webgl-crt.tsx
index 7ab5bd0263..9b69f6725e 100644
--- a/packages/example/src/HtmlInCanvas/compose-webgl-crt.tsx
+++ b/packages/example/src/HtmlInCanvas/compose-webgl-crt.tsx
@@ -1,4 +1,4 @@
-import {EffectInternals} from '@remotion/effects';
+import {tint} from '@remotion/effects/tint';
import React, {useCallback, useRef} from 'react';
import {
HtmlInCanvas,
@@ -229,7 +229,7 @@ export const HtmlInCanvasComposeWebGLCrt: React.FC = () => {
height={height}
onInit={onInit}
onPaint={onPaint}
- effects={[EffectInternals.tint({color: 'red'})]}
+ effects={[tint({color: 'red'})]}
style={{
backgroundColor: 'white',
color: 'black',
diff --git a/packages/example/src/HtmlInCanvas/effects-tint-preview.tsx b/packages/example/src/HtmlInCanvas/effects-tint-preview.tsx
index e84d87a24b..e78c438b79 100644
--- a/packages/example/src/HtmlInCanvas/effects-tint-preview.tsx
+++ b/packages/example/src/HtmlInCanvas/effects-tint-preview.tsx
@@ -10,7 +10,7 @@ export const EffectsTintPreview: React.FC = () => {
<HtmlInCanvas
width={width}
height={height}
- effects={[tint({color: '#ff0080', amount: 0.5})]}
+ effects={[tint({color: '#1ec8ff', amount: 0.7})]}
>
<EffectsPreviewImage />
</HtmlInCanvas>
diff --git a/packages/example/src/HtmlInCanvas/react-svg.tsx b/packages/example/src/HtmlInCanvas/react-svg.tsx
index 43a4b53040..9c9313fd35 100644
--- a/packages/example/src/HtmlInCanvas/react-svg.tsx
+++ b/packages/example/src/HtmlInCanvas/react-svg.tsx
@@ -1,4 +1,5 @@
-import {EffectInternals} from '@remotion/effects';
+import {halftone} from '@remotion/effects/halftone';
+import {tint} from '@remotion/effects/tint';
import React from 'react';
import {HtmlInCanvas, useVideoConfig} from 'remotion';
import ReactSvg from '../ReactSvg';
@@ -15,12 +16,12 @@ export const HtmlInCanvasReactSvg: React.FC<{
width={width}
height={height}
effects={[
- EffectInternals.halftone({
+ halftone({
dotSize: 30,
dotSpacing: 20,
shape: 'square',
}),
- EffectInternals.tint({color: 'green', amount: 1}),
+ tint({color: 'green', amount: 1}),
]}
>
<ReactSvg transparent={transparent} />
diff --git a/packages/example/src/LostNodePathE2e/LostNodePathRepro.tsx b/packages/example/src/LostNodePathE2e/LostNodePathRepro.tsx
index eeefbb51fe..1a2d350ffe 100644
--- a/packages/example/src/LostNodePathE2e/LostNodePathRepro.tsx
+++ b/packages/example/src/LostNodePathE2e/LostNodePathRepro.tsx
@@ -1,4 +1,5 @@
-import {EffectInternals} from '@remotion/effects';
+import {halftone} from '@remotion/effects/halftone';
+import {tint} from '@remotion/effects/tint';
import React from 'react';
import {AbsoluteFill, Internals, Sequence, useVideoConfig} from 'remotion';
import {SimpleSvg} from './SimpleSvg';
@@ -6,12 +7,12 @@ import {SimpleSvg} from './SimpleSvg';
export const LostNodePathRepro: React.FC = () => {
const {durationInFrames} = useVideoConfig();
const memoizedEffects = Internals.useMemoizedEffectDefinitions([
- EffectInternals.halftone({
+ halftone({
dotSize: 30,
dotSpacing: 20,
shape: 'square',
}),
- EffectInternals.tint({color: 'green', amount: 1}),
+ tint({color: 'green', amount: 1}),
]);
return (
diff --git a/packages/example/src/Rive/RiveEffects.tsx b/packages/example/src/Rive/RiveEffects.tsx
index 939e1ea2dc..35a438d989 100644
--- a/packages/example/src/Rive/RiveEffects.tsx
+++ b/packages/example/src/Rive/RiveEffects.tsx
@@ -1,5 +1,6 @@
-import {EffectInternals} from '@remotion/effects';
import {blur} from '@remotion/effects/blur';
+import {halftone} from '@remotion/effects/halftone';
+import {tint} from '@remotion/effects/tint';
import {wave} from '@remotion/effects/wave';
import {RemotionRiveCanvas} from '@remotion/rive';
import {StudioInternals} from '@remotion/studio';
@@ -121,7 +122,7 @@ const StackedRive: React.FC = () => {
src={RIVE_SRC}
style={tileRiveStyle}
effects={[
- EffectInternals.tint({color: '#ff5fa2', amount: 0.4}),
+ tint({color: '#ff5fa2', amount: 0.4}),
wave({
phase,
amplitude: 12,
@@ -162,7 +163,7 @@ const Comp: React.FC = () => {
<RemotionRiveCanvas
src={RIVE_SRC}
style={tileRiveStyle}
- effects={[EffectInternals.tint({color: '#ff5fa2', amount: 0.6})]}
+ effects={[tint({color: '#ff5fa2', amount: 0.6})]}
/>
</Tile>
<Tile title="halftone" subtitle="circles, dotSize 12, on luminance">
@@ -170,7 +171,7 @@ const Comp: React.FC = () => {
src={RIVE_SRC}
style={tileRiveStyle}
effects={[
- EffectInternals.halftone({
+ halftone({
shape: 'circle',
dotSize: 12,
dotSpacing: 12,
diff --git a/packages/studio-server/src/test/compute-effect-props-status.test.ts b/packages/studio-server/src/test/compute-effect-props-status.test.ts
index 1210e5d126..0f480cb7a2 100644
--- a/packages/studio-server/src/test/compute-effect-props-status.test.ts
+++ b/packages/studio-server/src/test/compute-effect-props-status.test.ts
@@ -7,7 +7,7 @@ import {lineColumnToNodePath} from './test-utils';
const buildInput = (
effects: string,
) => `import {HtmlInCanvas} from '@remotion/html-in-canvas';
-import {EffectInternals} from '@remotion/effects';
+import {tint} from '@remotion/effects/tint';
export const Comp = () => {
\treturn (
@@ -29,9 +29,7 @@ const findJsx = (input: string) => {
};
test('computeEffectPropStatus reports static props as canUpdate=true with codeValue', () => {
- const input = buildInput(
- '[EffectInternals.tint({color: "red", opacity: 0.5})]',
- );
+ const input = buildInput('[tint({color: "red", opacity: 0.5})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
effectIndex: 0,
@@ -48,9 +46,7 @@ test('computeEffectPropStatus reports static props as canUpdate=true with codeVa
});
test('computeEffectPropStatus reports computed props', () => {
- const input = buildInput(
- '[EffectInternals.tint({color: getColor(), opacity: 0.5})]',
- );
+ const input = buildInput('[tint({color: getColor(), opacity: 0.5})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
effectIndex: 0,
@@ -68,7 +64,7 @@ test('computeEffectPropStatus reports computed props', () => {
test('computeEffectPropStatus reports keyframes for inline interpolated effect props', () => {
const input = buildInput(
- '[EffectInternals.tint({amount: interpolate(frame, [0, 100], [0.2, 0.8])})]',
+ '[tint({amount: interpolate(frame, [0, 100], [0.2, 0.8])})]',
);
const result = computeEffectPropStatus({
jsx: findJsx(input),
@@ -92,7 +88,7 @@ test('computeEffectPropStatus reports keyframes for inline interpolated effect p
});
test('computeEffectPropStatus reports unset props as undefined codeValue', () => {
- const input = buildInput('[EffectInternals.tint({color: "red"})]');
+ const input = buildInput('[tint({color: "red"})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
effectIndex: 0,
@@ -109,9 +105,7 @@ test('computeEffectPropStatus reports unset props as undefined codeValue', () =>
});
test('computeEffectPropStatus flags non-call expressions', () => {
- const input = buildInput(
- '[someEffect, EffectInternals.tint({color: "red"})]',
- );
+ const input = buildInput('[someEffect, tint({color: "red"})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
effectIndex: 0,
@@ -127,7 +121,7 @@ test('computeEffectPropStatus flags non-call expressions', () => {
});
test('computeEffectPropStatus flags out-of-range effect indices', () => {
- const input = buildInput('[EffectInternals.tint({color: "red"})]');
+ const input = buildInput('[tint({color: "red"})]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
effectIndex: 5,
@@ -143,7 +137,7 @@ test('computeEffectPropStatus flags out-of-range effect indices', () => {
});
test('computeEffectPropStatus treats non-object first arg as computed', () => {
- const input = buildInput('[EffectInternals.tint(getParams())]');
+ const input = buildInput('[tint(getParams())]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
effectIndex: 0,
@@ -159,7 +153,7 @@ test('computeEffectPropStatus treats non-object first arg as computed', () => {
});
test('computeEffectPropStatus treats zero-arg effect as editable with undefined props', () => {
- const input = buildInput('[EffectInternals.tint()]');
+ const input = buildInput('[tint()]');
const result = computeEffectPropStatus({
jsx: findJsx(input),
effectIndex: 0,
diff --git a/packages/studio-server/src/test/delete-effect.test.ts b/packages/studio-server/src/test/delete-effect.test.ts
index 24f13c2e46..8caa92e184 100644
--- a/packages/studio-server/src/test/delete-effect.test.ts
+++ b/packages/studio-server/src/test/delete-effect.test.ts
@@ -5,7 +5,7 @@ import {lineColumnToNodePath} from './test-utils';
const buildInput = (
effects: string,
) => `import {HtmlInCanvas} from '@remotion/html-in-canvas';
-import {EffectInternals} from '@remotion/effects';
+import {tint} from '@remotion/effects/tint';
export const Comp = () => {
return (
@@ -17,7 +17,7 @@ export const Comp = () => {
`;
test('deleteEffect removes the only effect and the effects prop', async () => {
- const input = buildInput('[EffectInternals.tint({color: "red"})]');
+ const input = buildInput('[tint({color: "red"})]');
const {output, effectLabel} = await deleteEffect({
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
@@ -26,13 +26,13 @@ test('deleteEffect removes the only effect and the effects prop', async () => {
expect(effectLabel).toBe('tint()');
expect(output).not.toContain('effects=');
- expect(output).not.toContain('EffectInternals.tint');
+ expect(output).not.toContain('tint(');
expect(output).toContain('<HtmlInCanvas>');
});
test('deleteEffect removes the targeted effect by index', async () => {
const input = buildInput(
- '[EffectInternals.tint({color: "red"}), EffectInternals.tint({color: "green"}), EffectInternals.tint({color: "blue"})]',
+ '[tint({color: "red"}), tint({color: "green"}), tint({color: "blue"})]',
);
const {output} = await deleteEffect({
input,
@@ -47,9 +47,7 @@ test('deleteEffect removes the targeted effect by index', async () => {
});
test('deleteEffect keeps the effects prop when other effects remain', async () => {
- const input = buildInput(
- '[EffectInternals.tint({color: "red"}), EffectInternals.tint({color: "green"})]',
- );
+ const input = buildInput('[tint({color: "red"}), tint({color: "green"})]');
const {output} = await deleteEffect({
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
@@ -62,7 +60,7 @@ test('deleteEffect keeps the effects prop when other effects remain', async () =
});
test('deleteEffect throws when effect index is out of range', async () => {
- const input = buildInput('[EffectInternals.tint({color: "red"})]');
+ const input = buildInput('[tint({color: "red"})]');
await expect(
deleteEffect({
input,
@@ -84,9 +82,7 @@ test('deleteEffect throws when effects are not an inline array', async () => {
});
test('deleteEffect throws when the target effect is unsupported', async () => {
- const input = buildInput(
- '[EffectInternals.tint({color: "red"}), ...effects]',
- );
+ const input = buildInput('[tint({color: "red"}), ...effects]');
await expect(
deleteEffect({
input,
diff --git a/packages/studio-server/src/test/update-effect-props.test.ts b/packages/studio-server/src/test/update-effect-props.test.ts
index 5c78c50579..3a416a8f01 100644
--- a/packages/studio-server/src/test/update-effect-props.test.ts
+++ b/packages/studio-server/src/test/update-effect-props.test.ts
@@ -5,7 +5,7 @@ import {lineColumnToNodePath} from './test-utils';
const buildInput = (
effects: string,
) => `import {HtmlInCanvas} from '@remotion/html-in-canvas';
-import {EffectInternals} from '@remotion/effects';
+import {tint} from '@remotion/effects/tint';
export const Comp = () => {
\treturn (
@@ -17,9 +17,7 @@ export const Comp = () => {
`;
test('updateEffectProps updates an existing prop on the right effect', () => {
- const input = buildInput(
- '[EffectInternals.tint({color: "red", opacity: 0.5})]',
- );
+ const input = buildInput('[tint({color: "red", opacity: 0.5})]');
const {serialized} = updateEffectPropsAst({
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
@@ -32,7 +30,7 @@ test('updateEffectProps updates an existing prop on the right effect', () => {
});
test('updateEffectProps adds a missing prop', () => {
- const input = buildInput('[EffectInternals.tint({color: "red"})]');
+ const input = buildInput('[tint({color: "red"})]');
const {serialized, effectCallee} = updateEffectPropsAst({
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
@@ -46,9 +44,7 @@ test('updateEffectProps adds a missing prop', () => {
});
test('updateEffectProps removes a prop equal to default', () => {
- const input = buildInput(
- '[EffectInternals.tint({color: "red", opacity: 0.5})]',
- );
+ const input = buildInput('[tint({color: "red", opacity: 0.5})]');
const {serialized} = updateEffectPropsAst({
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
@@ -62,7 +58,7 @@ test('updateEffectProps removes a prop equal to default', () => {
test('updateEffectProps targets the correct effect by index when there are multiple', () => {
const input = buildInput(
- '[EffectInternals.tint({color: "red"}), EffectInternals.tint({color: "green", opacity: 0.4})]',
+ '[tint({color: "red"}), tint({color: "green", opacity: 0.4})]',
);
const {serialized} = updateEffectPropsAst({
input,
@@ -77,7 +73,7 @@ test('updateEffectProps targets the correct effect by index when there are multi
});
test('updateEffectProps throws when effect index is out of range', () => {
- const input = buildInput('[EffectInternals.tint({color: "red"})]');
+ const input = buildInput('[tint({color: "red"})]');
expect(() => {
updateEffectPropsAst({
input,
@@ -89,7 +85,7 @@ test('updateEffectProps throws when effect index is out of range', () => {
});
test('updateEffectProps inserts object literal when effect has no arguments', () => {
- const input = buildInput('[EffectInternals.tint()]');
+ const input = buildInput('[tint()]');
const {serialized} = updateEffectPropsAst({
input,
sequenceNodePath: lineColumnToNodePath(input, 6),
@@ -102,7 +98,7 @@ test('updateEffectProps inserts object literal when effect has no arguments', ()
});
test('updateEffectProps throws when first arg is not an object literal', () => {
- const input = buildInput('[EffectInternals.tint(getParams())]');
+ const input = buildInput('[tint(getParams())]');
expect(() => {
updateEffectPropsAst({
input,