Skip to content

πŸŽ₯ Make videos programmatically with React

Docs: Rewrite Figma import guide (#9699)

Jonny Burgerc7911c34ab08
diff --git a/packages/docs/docs/figma.mdx b/packages/docs/docs/figma.mdx
index 575b23ccd0..279374d947 100644
--- a/packages/docs/docs/figma.mdx
+++ b/packages/docs/docs/figma.mdx
@@ -2,131 +2,32 @@
image: /generated/articles-docs-figma.png
id: figma
title: Import from Figma
-crumb: "The best of both"
+crumb: 'The best of both'
---
-You can export a design from Figma as an SVG file and import it as a React component in Remotion and then animate it.
+# Import from Figma<AvailableFrom v="4.0.495" />
-## Open the Figma design
+There are two ways to import layers from Figma into Remotion Studio.
-We are going to use a copy of [Streamline's Vector illustrations](https://www.figma.com/community/file/1118919399684035468).
+## Copy as SVG
-![Thumbnail](/img/export-figma/banner.png)
+This is the more reliable method. Right-click a layer and select **Copy/Paste as** β†’ **Copy as SVG**.
-## Grouping vector elements in Figma
+![Copying a layer as SVG in Figma](/img/export-figma/copy-as-svg.png)
-If not already done, group the items you want to export together or frame them in Figma.
+Paste the copied layer into Remotion Studio.
-![figma-grouping](/img/export-figma/figma-grouping.gif)
+## Copy layer directly
-Groups will be represented as `<g>` elements in SVG and if you want to animate multiple items together, it can be useful to group them.
+You can also copy a layer directly and paste it into Remotion Studio.
-## Export as SVG
+Only some layer types are supported. Images are a notable exclusion.
-You can export any design by copying it as SVG markup &mdash; you can do that by right-clicking on the design itself and selecting the **Copy/Paste as** option.
+## Copy into code
-![exporting as SVG](/img/export-figma/copy-as-svg.png)
+You can also copy SVG into Remotion markup.
-Next, you need to convert the SVG into a React component. Often, you can just paste the SVG into React markup and it will work.
-
-Alternatively, use the [SVGR playground](https://react-svgr.com/playground/) to reliably convert SVG into React components.
-
-## Importing SVG in Remotion
-
-Paste the component into a Remotion project and [register a `<Composition>`](/docs/composition).
-An example can be found in this [repository](https://github.com/kaf-lamed-beyt/remo-sample).
-
-![](/img/export-figma/editor-pink.png)
-
-## Animate SVG markup
-
-Locate the element that you want to animate and add a style property to it.
-In this case, let's animate the `<g>` element that contains the rocket.
-
-```tsx twoslash
-import { AbsoluteFill, useCurrentFrame, useVideoConfig } from "remotion";
-
-export const Rocket: React.FC = () => {
- const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
-
- return (
- <AbsoluteFill
- style={{
- backgroundColor: "pink",
- justifyContent: "center",
- alignItems: "center",
- }}
- >
- <svg
- width="800"
- height="800"
- viewBox="0 0 394 394"
- fill="none"
- xmlns="http://www.w3.org/2000/svg"
- >
- <g
- id="vehicle"
- style={{
- transformOrigin: "center center",
- transformBox: "fill-box",
- }}
- >
- // vehicle's paths
- </g>
- </svg>
- </AbsoluteFill>
- );
-};
-```
-
-Adding `{transformOrigin: "center center", transformBox: "fill-box"}` will ensure that the transformations center is it's own center.
-
-Let's create two spring animations, one for scale and one for transformation:
-
-```tsx twoslash
-import { interpolate, spring } from "remotion";
-const fps = 30;
-const frame = 0;
-// ---cut---
-const up = spring({
- fps,
- frame: frame - 20,
- config: {
- damping: 20,
- mass: 15,
- },
-});
-
-const scale = spring({
- fps,
- frame,
- config: {
- stiffness: 200,
- },
-});
-
-const launch = `translateY(${interpolate(up, [0, 1], [0, -3000])}px)`;
-```
-
-The `scale` will go from 0 to 1 and `launch` animates from `0` to `-3000px`. Apply the styles to the element:
-
-```tsx {3}
-<g
- id="vehicle"
- style={{
- transform: `scale(${scale}) ${launch}`,
- transformOrigin: "center center",
- transformBox: "fill-box",
- }}
->
- {/* ... */}
-</g>
-```
-
-![rocket svg](https://res.cloudinary.com/meje/image/upload/v1665432945/article%20assets/rocket_clhn8w.gif)
-
-You have animated a rocket! πŸš€
+Copy SVG as described above and run it through an [SVG to JSX converter](https://react-svgr.com/playground/). Then paste the result into the React markup that powers your Remotion video.
## See also
diff --git a/packages/docs/static/img/export-figma/banner.png b/packages/docs/static/img/export-figma/banner.png
deleted file mode 100644
index 1ac2dfa08b..0000000000
Binary files a/packages/docs/static/img/export-figma/banner.png and /dev/null differ
diff --git a/packages/docs/static/img/export-figma/copy-as-svg.png b/packages/docs/static/img/export-figma/copy-as-svg.png
index efb085e0f4..a3654701b3 100644
Binary files a/packages/docs/static/img/export-figma/copy-as-svg.png and b/packages/docs/static/img/export-figma/copy-as-svg.png differ
diff --git a/packages/docs/static/img/export-figma/editor-pink.png b/packages/docs/static/img/export-figma/editor-pink.png
deleted file mode 100644
index 4ee6dedb65..0000000000
Binary files a/packages/docs/static/img/export-figma/editor-pink.png and /dev/null differ
diff --git a/packages/docs/static/img/export-figma/figma-grouping.gif b/packages/docs/static/img/export-figma/figma-grouping.gif
deleted file mode 100644
index 6303096687..0000000000
Binary files a/packages/docs/static/img/export-figma/figma-grouping.gif and /dev/null differ
diff --git a/packages/docs/static/img/export-figma/rocket.gif b/packages/docs/static/img/export-figma/rocket.gif
deleted file mode 100644
index 45a146e18f..0000000000
Binary files a/packages/docs/static/img/export-figma/rocket.gif and /dev/null differ