Skip to content

🎥 Make videos programmatically with React

Elements: Wrap effect backgrounds in styled AbsoluteFill

Jonny Burger86f3c923ac2e
diff --git a/packages/docs/elements/backgrounds/liquid-contours/liquid-contours.tsx b/packages/docs/elements/backgrounds/liquid-contours/liquid-contours.tsx
index bac7f78691..ac09e8d9fd 100644
--- a/packages/docs/elements/backgrounds/liquid-contours/liquid-contours.tsx
+++ b/packages/docs/elements/backgrounds/liquid-contours/liquid-contours.tsx
@@ -1,6 +1,7 @@
import {liquidContours} from '@remotion/effects/liquid-contours';
import React from 'react';
import {
+ AbsoluteFill,
Interactive,
interpolate,
Solid,
@@ -14,19 +15,20 @@ const LiquidContoursInner: React.FC<InteractiveTransformProps> = ({style}) => {
const {height, width} = useVideoConfig();
return (
- <Solid
- style={style}
- color="#dff4ff"
- width={width}
- height={height}
- effects={[
- liquidContours({
- firstColor: '#dff4ff',
- secondColor: '#7cc6ff',
- phase: interpolate(frame, [0, 240], [3.23, 4.23]),
- }),
- ]}
- />
+ <AbsoluteFill style={style} showInTimeline={false}>
+ <Solid
+ color="#dff4ff"
+ width={width}
+ height={height}
+ effects={[
+ liquidContours({
+ firstColor: '#dff4ff',
+ secondColor: '#7cc6ff',
+ phase: interpolate(frame, [0, 240], [3.23, 4.23]),
+ }),
+ ]}
+ />
+ </AbsoluteFill>
);
};
diff --git a/packages/docs/elements/backgrounds/moving-waves/moving-waves.tsx b/packages/docs/elements/backgrounds/moving-waves/moving-waves.tsx
index 76c9dad326..3342a668b4 100644
--- a/packages/docs/elements/backgrounds/moving-waves/moving-waves.tsx
+++ b/packages/docs/elements/backgrounds/moving-waves/moving-waves.tsx
@@ -1,6 +1,7 @@
import {waves} from '@remotion/effects/waves';
import React from 'react';
import {
+ AbsoluteFill,
Interactive,
Solid,
useCurrentFrame,
@@ -13,25 +14,26 @@ const MovingWavesInner: React.FC<InteractiveTransformProps> = ({style}) => {
const {durationInFrames, height, width} = useVideoConfig();
return (
- <Solid
- style={style}
- color="#dff4ff"
- width={width}
- height={height}
- effects={[
- waves({
- colors: ['#dff4ff', '#7cc6ff'],
- direction: 'horizontal',
- thickness: 56,
- gap: 0,
- angle: 0,
- offset: (frame / durationInFrames) * 448,
- amplitude: 24,
- wavelength: 160,
- phase: 0,
- }),
- ]}
- />
+ <AbsoluteFill style={style} showInTimeline={false}>
+ <Solid
+ color="#dff4ff"
+ width={width}
+ height={height}
+ effects={[
+ waves({
+ colors: ['#dff4ff', '#7cc6ff'],
+ direction: 'horizontal',
+ thickness: 56,
+ gap: 0,
+ angle: 0,
+ offset: (frame / durationInFrames) * 448,
+ amplitude: 24,
+ wavelength: 160,
+ phase: 0,
+ }),
+ ]}
+ />
+ </AbsoluteFill>
);
};
diff --git a/packages/docs/elements/backgrounds/moving-zigzags/moving-zigzags.tsx b/packages/docs/elements/backgrounds/moving-zigzags/moving-zigzags.tsx
index 09e6e464dd..c3a2770201 100644
--- a/packages/docs/elements/backgrounds/moving-zigzags/moving-zigzags.tsx
+++ b/packages/docs/elements/backgrounds/moving-zigzags/moving-zigzags.tsx
@@ -1,6 +1,7 @@
import {zigzag} from '@remotion/effects/zigzag';
import React from 'react';
import {
+ AbsoluteFill,
Interactive,
Solid,
useCurrentFrame,
@@ -13,24 +14,25 @@ const MovingZigzagsInner: React.FC<InteractiveTransformProps> = ({style}) => {
const {durationInFrames, height, width} = useVideoConfig();
return (
- <Solid
- style={style}
- color="#dff4ff"
- width={width}
- height={height}
- effects={[
- zigzag({
- colors: ['#dff4ff', '#7cc6ff'],
- direction: 'horizontal',
- thickness: 40,
- gap: 0,
- angle: 0,
- offset: (frame / durationInFrames) * 480,
- amplitude: 40,
- wavelength: 160,
- }),
- ]}
- />
+ <AbsoluteFill style={style} showInTimeline={false}>
+ <Solid
+ color="#dff4ff"
+ width={width}
+ height={height}
+ effects={[
+ zigzag({
+ colors: ['#dff4ff', '#7cc6ff'],
+ direction: 'horizontal',
+ thickness: 40,
+ gap: 0,
+ angle: 0,
+ offset: (frame / durationInFrames) * 480,
+ amplitude: 40,
+ wavelength: 160,
+ }),
+ ]}
+ />
+ </AbsoluteFill>
);
};
diff --git a/packages/docs/elements/backgrounds/notebook-paper/notebook-paper.tsx b/packages/docs/elements/backgrounds/notebook-paper/notebook-paper.tsx
index c7a623539e..be3f2aa70c 100644
--- a/packages/docs/elements/backgrounds/notebook-paper/notebook-paper.tsx
+++ b/packages/docs/elements/backgrounds/notebook-paper/notebook-paper.tsx
@@ -2,6 +2,7 @@ import {gridlines} from '@remotion/effects/gridlines';
import {paper} from '@remotion/effects/paper';
import React from 'react';
import {
+ AbsoluteFill,
Interactive,
Solid,
useVideoConfig,
@@ -12,32 +13,33 @@ const NotebookPaperInner: React.FC<InteractiveTransformProps> = ({style}) => {
const {height, width} = useVideoConfig();
return (
- <Solid
- style={style}
- color={'#ffffff'}
- width={width}
- height={height}
- effects={[
- paper({
- amount: 0.38,
- colorFront: 'white',
- colorBack: 'white',
- contrast: 0.18,
- roughness: 0.18,
- fiber: 0.28,
- crumples: 0.1,
- folds: 0.12,
- seed: 24,
- scale: 0.8,
- drops: 0,
- }),
- gridlines({
- gridSize: 54,
- lineWidth: 3.4,
- lineColor: 'rgba(76, 101, 128, 0.16)',
- }),
- ]}
- />
+ <AbsoluteFill style={style} showInTimeline={false}>
+ <Solid
+ color={'#ffffff'}
+ width={width}
+ height={height}
+ effects={[
+ paper({
+ amount: 0.38,
+ colorFront: 'white',
+ colorBack: 'white',
+ contrast: 0.18,
+ roughness: 0.18,
+ fiber: 0.28,
+ crumples: 0.1,
+ folds: 0.12,
+ seed: 24,
+ scale: 0.8,
+ drops: 0,
+ }),
+ gridlines({
+ gridSize: 54,
+ lineWidth: 3.4,
+ lineColor: 'rgba(76, 101, 128, 0.16)',
+ }),
+ ]}
+ />
+ </AbsoluteFill>
);
};
diff --git a/packages/docs/elements/backgrounds/paper-texture/paper-texture.tsx b/packages/docs/elements/backgrounds/paper-texture/paper-texture.tsx
index 01d4f9756d..5c72f47686 100644
--- a/packages/docs/elements/backgrounds/paper-texture/paper-texture.tsx
+++ b/packages/docs/elements/backgrounds/paper-texture/paper-texture.tsx
@@ -1,6 +1,7 @@
import {paper} from '@remotion/effects/paper';
import React from 'react';
import {
+ AbsoluteFill,
Interactive,
interpolate,
Solid,
@@ -14,23 +15,24 @@ const PaperTextureInner: React.FC<InteractiveTransformProps> = ({style}) => {
const {height, width} = useVideoConfig();
return (
- <Solid
- style={style}
- color="white"
- width={width}
- height={height}
- effects={[
- paper({
- colorFront: 'white',
- colorBack: 'white',
- seed: interpolate(frame, [0, 120], [0, 1000], {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- posterize: 30,
+ <AbsoluteFill style={style} showInTimeline={false}>
+ <Solid
+ color="white"
+ width={width}
+ height={height}
+ effects={[
+ paper({
+ colorFront: 'white',
+ colorBack: 'white',
+ seed: interpolate(frame, [0, 120], [0, 1000], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ posterize: 30,
+ }),
}),
- }),
- ]}
- />
+ ]}
+ />
+ </AbsoluteFill>
);
};
diff --git a/packages/docs/elements/backgrounds/rotating-starburst/rotating-starburst.tsx b/packages/docs/elements/backgrounds/rotating-starburst/rotating-starburst.tsx
index a2e8f91dd7..37dcb24972 100644
--- a/packages/docs/elements/backgrounds/rotating-starburst/rotating-starburst.tsx
+++ b/packages/docs/elements/backgrounds/rotating-starburst/rotating-starburst.tsx
@@ -1,6 +1,7 @@
import {starburst} from '@remotion/effects/starburst';
import React from 'react';
import {
+ AbsoluteFill,
Interactive,
interpolate,
Solid,
@@ -16,20 +17,21 @@ const RotatingStarburstInner: React.FC<InteractiveTransformProps> = ({
const {height, width} = useVideoConfig();
return (
- <Solid
- style={style}
- color="#dff4ff"
- width={width}
- height={height}
- effects={[
- starburst({
- rays: 28,
- colors: ['#dff4ff', '#7cc6ff'],
- rotation: interpolate(frame, [0, 2000], [0, 360]),
- origin: [0.5, 0.5],
- }),
- ]}
- />
+ <AbsoluteFill style={style} showInTimeline={false}>
+ <Solid
+ color="#dff4ff"
+ width={width}
+ height={height}
+ effects={[
+ starburst({
+ rays: 28,
+ colors: ['#dff4ff', '#7cc6ff'],
+ rotation: interpolate(frame, [0, 2000], [0, 360]),
+ origin: [0.5, 0.5],
+ }),
+ ]}
+ />
+ </AbsoluteFill>
);
};
diff --git a/packages/example/src/RoughNotation/paper-texture.element.tsx b/packages/example/src/RoughNotation/paper-texture.element.tsx
index 1eb5ac020c..0ede68078e 100644
--- a/packages/example/src/RoughNotation/paper-texture.element.tsx
+++ b/packages/example/src/RoughNotation/paper-texture.element.tsx
@@ -1,6 +1,7 @@
import {paper} from '@remotion/effects/paper';
import React from 'react';
import {
+ AbsoluteFill,
Interactive,
interpolate,
Solid,
@@ -12,23 +13,24 @@ const PaperTextureInner: React.FC<InteractiveTransformProps> = ({style}) => {
const frame = useCurrentFrame();
return (
- <Solid
- style={style}
- color="white"
- width={1920}
- height={1080}
- effects={[
- paper({
- colorFront: 'white',
- colorBack: 'white',
- seed: interpolate(frame, [0, 120], [0, 1000], {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- posterize: 30,
+ <AbsoluteFill style={style} showInTimeline={false}>
+ <Solid
+ color="white"
+ width={1920}
+ height={1080}
+ effects={[
+ paper({
+ colorFront: 'white',
+ colorBack: 'white',
+ seed: interpolate(frame, [0, 120], [0, 1000], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ posterize: 30,
+ }),
}),
- }),
- ]}
- />
+ ]}
+ />
+ </AbsoluteFill>
);
};
diff --git a/packages/example/src/paper-texture.element.tsx b/packages/example/src/paper-texture.element.tsx
index 01d4f9756d..5c72f47686 100644
--- a/packages/example/src/paper-texture.element.tsx
+++ b/packages/example/src/paper-texture.element.tsx
@@ -1,6 +1,7 @@
import {paper} from '@remotion/effects/paper';
import React from 'react';
import {
+ AbsoluteFill,
Interactive,
interpolate,
Solid,
@@ -14,23 +15,24 @@ const PaperTextureInner: React.FC<InteractiveTransformProps> = ({style}) => {
const {height, width} = useVideoConfig();
return (
- <Solid
- style={style}
- color="white"
- width={width}
- height={height}
- effects={[
- paper({
- colorFront: 'white',
- colorBack: 'white',
- seed: interpolate(frame, [0, 120], [0, 1000], {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- posterize: 30,
+ <AbsoluteFill style={style} showInTimeline={false}>
+ <Solid
+ color="white"
+ width={width}
+ height={height}
+ effects={[
+ paper({
+ colorFront: 'white',
+ colorBack: 'white',
+ seed: interpolate(frame, [0, 120], [0, 1000], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ posterize: 30,
+ }),
}),
- }),
- ]}
- />
+ ]}
+ />
+ </AbsoluteFill>
);
};