Skip to content

🎥 Make videos programmatically with React

layers

Jonny Burger1fc73e73c218
diff --git a/packages/docs/docs/layers.mdx b/packages/docs/docs/layers.mdx
new file mode 100644
index 0000000000..80490134d8
--- /dev/null
+++ b/packages/docs/docs/layers.mdx
@@ -0,0 +1,33 @@
+---
+image: /generated/articles-docs-layers.png
+id: layers
+title: Layers
+crumb: "Designing videos"
+---
+
+Unlike normal websites, a video has fixed dimensions. That means, it is okay to use `position: "absolute"`!
+
+In Remotion, you often want to "layer" elements on top of each other.
+This is a common pattern in video editors, and in Photoshop.
+
+An easy way to do it is using the [`<AbsoluteFill>`](/docs/absolute-fill) component:
+
+```tsx twoslash title="MyComp.tsx"
+import React from "react";
+import { AbsoluteFill, Img, staticFile } from "remotion";
+
+export const MyComp: React.FC = () => {
+ return (
+ <AbsoluteFill>
+ <AbsoluteFill>
+ <Img src={staticFile("bg.png")} />
+ </AbsoluteFill>
+ <AbsoluteFill>
+ <h1>This text appears on top of the video!</h1>
+ </AbsoluteFill>
+ </AbsoluteFill>
+ );
+};
+```
+
+This will render the text on top of the image.
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index fed4c063d8..de08009689 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -510,6 +510,7 @@ module.exports = {
label: "Designing videos",
items: [
"transforms",
+ "layers",
"assets",
"transitioning",
"use-img-and-iframe",
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 345dbcb4d3..decf654adc 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -1413,6 +1413,13 @@ export const articles = [
compId: "articles-docs-lambda",
crumb: null,
},
+ {
+ id: "layers",
+ title: "Layers",
+ relativePath: "docs/layers.mdx",
+ compId: "articles-docs-layers",
+ crumb: "Designing videos",
+ },
{
id: "layout-utils/fill-text-box",
title: "fillTextBox()",
@@ -2019,7 +2026,7 @@ export const articles = [
},
{
id: "scaling",
- title: "Scaling",
+ title: "Sizing",
relativePath: "docs/player/scaling.md",
compId: "articles-docs-player-scaling",
crumb: "@remotion/player",
@@ -2972,7 +2979,7 @@ export const articles = [
{
id: "use-current-scale",
title: "useCurrentScale()",
- relativePath: "docs/use-current-scale.md",
+ relativePath: "docs/use-current-scale.mdx",
compId: "articles-docs-use-current-scale",
crumb: "API",
},