π₯ Make videos programmatically with React
document lottiefiles
Jonny Burger94d31dd1df22
diff --git a/packages/docs/docs/lottie/lottie-aftereffects.md b/packages/docs/docs/lottie/lottie-aftereffects.mdindex 99d2eea561..eef582779d 100644--- a/packages/docs/docs/lottie/lottie-aftereffects.md+++ b/packages/docs/docs/lottie/lottie-aftereffects.md@@ -1,7 +1,7 @@---id: lottie-aftereffects-title: Import from After Effects-slug: aftereffects+title: Importing from After Effects+slug: after-effects---import {InlineStep} from '../../components/InlineStep';@@ -89,3 +89,7 @@ const Balloons = () => {It is advised to make your composition the same size and duration as the original composition in After Effects. Congrats, you're playing an After Effects animation in Remotion! π<img src="/img/lottie/result.gif"/>++## See also++- [Using LottieFiles](/docs/lottie/lottiefiels)diff --git a/packages/docs/docs/lottie/lottie-lottiefiles.md b/packages/docs/docs/lottie/lottie-lottiefiles.mdnew file mode 100644index 0000000000..466f6c6a50--- /dev/null+++ b/packages/docs/docs/lottie/lottie-lottiefiles.md@@ -0,0 +1,57 @@+---+id: lottie-lottiefiles+sidebar_label: "Find Lottie files"+title: "Finding Lottie files to use"+slug: lottiefiles+---++import {InlineStep} from '../../components/InlineStep';++[LottieFiles](https://lottiefiles.com) is a website where people can share and download Lottie files.++<img src="/img/lottie/lottiefiles.png" />++<br/>+<br/>++If you find a file that you like, click on it, then click `Download` <InlineStep>1</InlineStep> and choose `Lottie JSON` <InlineStep>2</InlineStep> as the format.+<img src="/img/lottie/lottiefiles-instructions.png" />++### Import the file into Remotion++Copy the file into the Remotion project. The recommended way is to the the JSON inside the `public/` folder of Remotion (create it if necessary) and then load it using [`staticFile()`](/docs/staticfile):++```tsx twoslash title="Animation.tsx"+import { continueRender, delayRender, staticFile } from "remotion";+import { useEffect, useState } from "react";+import { Lottie, LottieAnimationData } from "@remotion/lottie";++const Balloons = () => {+ const [handle] = useState(() => delayRender("Loading Lottie animation"));++ const [animationData, setAnimationData] =+ useState<LottieAnimationData | null>(null);++ useEffect(() => {+ fetch(staticFile("animation.json"))+ .then((data) => data.json())+ .then((json) => {+ setAnimationData(json);+ continueRender(handle);+ })+ .catch((err) => {+ console.log("Animation failed to load", err);+ });+ }, [handle]);++ if (!animationData) {+ return null;+ }++ return <Lottie animationData={animationData} />;+};+```++## See also++- [Importing from After Effects](/docs/lottie/after-effects)diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex 5f61d4ba3e..b64981b5c9 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -239,6 +239,7 @@ module.exports = {"lottie/lottie-staticfile","lottie/lottie-remote","lottie/lottie-aftereffects",+ "lottie/lottie-lottiefiles",],},{diff --git a/packages/docs/static/img/lottie/lottiefiles-instructions.png b/packages/docs/static/img/lottie/lottiefiles-instructions.pngnew file mode 100644index 0000000000..9365b3acc5Binary files /dev/null and b/packages/docs/static/img/lottie/lottiefiles-instructions.png differdiff --git a/packages/docs/static/img/lottie/lottiefiles.png b/packages/docs/static/img/lottie/lottiefiles.pngnew file mode 100644index 0000000000..d2bb2951f9Binary files /dev/null and b/packages/docs/static/img/lottie/lottiefiles.png differ