🎥 Make videos programmatically with React
Docs: Add Components guide and animation demos
JonnyBurgerdf601bb2ab2f
diff --git a/packages/brand/package.json b/packages/brand/package.jsonindex d43131dd07..3303179916 100644--- a/packages/brand/package.json+++ b/packages/brand/package.json@@ -14,7 +14,8 @@"bundle": "remotion bundle --rspack --public-path /brand/","capture-docs": "bun scripts/capture-doc-pages.ts","lint": "eslint src",- "render-homepage-assets": "./render-homepage-assets.sh"+ "render-homepage-assets": "./render-homepage-assets.sh",+ "render-docs-animations": "bash render-docs-animations.sh"},"dependencies": {"@mediabunny/prores": "catalog:"diff --git a/packages/brand/render-docs-animations.sh b/packages/brand/render-docs-animations.shnew file mode 100644index 0000000000..abf38876c6--- /dev/null+++ b/packages/brand/render-docs-animations.sh@@ -0,0 +1,24 @@+#!/usr/bin/env bash+set -euo pipefail++cd "$(dirname "$0")"++transparent_webm_flags=(+ --image-format=png+ --pixel-format=yuva420p+ --codec=vp9+ --overwrite+)++bunx remotion render src/DocsAnimations/index.ts AnimatingPropertiesGraphLight ../docs/static/img/animating-properties-left-light.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts AnimatingPropertiesGraphDark ../docs/static/img/animating-properties-left-dark.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts AnimatingPropertiesTextLight ../docs/static/img/animating-properties-right-light.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts AnimatingPropertiesTextDark ../docs/static/img/animating-properties-right-dark.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts EasingGraphLight ../docs/static/img/animating-properties-easing-left-light.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts EasingGraphDark ../docs/static/img/animating-properties-easing-left-dark.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts EasingTextLight ../docs/static/img/animating-properties-easing-right-light.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts EasingTextDark ../docs/static/img/animating-properties-easing-right-dark.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts PosterizationGraphLight ../docs/static/img/animating-properties-posterization-left-light.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts PosterizationGraphDark ../docs/static/img/animating-properties-posterization-left-dark.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts PosterizationTextLight ../docs/static/img/animating-properties-posterization-right-light.webm "${transparent_webm_flags[@]}"+bunx remotion render src/DocsAnimations/index.ts PosterizationTextDark ../docs/static/img/animating-properties-posterization-right-dark.webm "${transparent_webm_flags[@]}"diff --git a/packages/brand/src/DocsAnimations/AnimatingProperties.tsx b/packages/brand/src/DocsAnimations/AnimatingProperties.tsxnew file mode 100644index 0000000000..d8c14607af--- /dev/null+++ b/packages/brand/src/DocsAnimations/AnimatingProperties.tsx@@ -0,0 +1,200 @@+import {useId, useMemo} from 'react';+import {+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+ useVideoConfig,+ type InteractivitySchema,+} from 'remotion';++type Props = {+ readonly theme: 'light' | 'dark';+ readonly animation: 'opacity' | 'easing' | 'posterization';+};++const themeSchema = {+ theme: {+ type: 'enum',+ default: 'light',+ variants: {light: {}, dark: {}},+ keyframable: false,+ description: 'Theme',+ },+ animation: {+ type: 'enum',+ default: 'opacity',+ variants: {opacity: {}, easing: {}, posterization: {}},+ keyframable: false,+ description: 'Animation',+ },+} as const satisfies InteractivitySchema;++const getGraphProgress = (+ frame: number,+ fps: number,+ animation: Props['animation'],+) => {+ return interpolate(frame, [0, 2 * fps], [0, 1], {+ easing:+ animation === 'opacity' ? Easing.linear : Easing.bezier(0.42, 0, 0.58, 1),+ posterize: animation === 'posterization' ? 3 : undefined,+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ });+};++const AnimatingPropertiesGraphInner = ({theme, animation}: Props) => {+ const frame = useCurrentFrame();+ const {fps} = useVideoConfig();+ const clipId = useId();+ const progress = getGraphProgress(frame, fps, animation);+ const path = useMemo(() => {+ return Array.from({length: Math.round(4 * fps) + 1}, (_, pointFrame) => {+ const x = 185 + (pointFrame / (4 * fps)) * 270;+ const y = 315 - getGraphProgress(pointFrame, fps, animation) * 135;+ if (pointFrame === 0) {+ return `M ${x} ${y}`;+ }++ return animation === 'posterization' ? `H ${x} V ${y}` : `L ${x} ${y}`;+ }).join(' ');+ }, [animation, fps]);++ return (+ <Interactive.Svg+ name="Animation graph"+ premountFor={fps}+ width="100%"+ height="100%"+ viewBox="0 0 640 360"+ >+ <defs>+ <clipPath id={clipId}>+ <rect+ x={185}+ y={0}+ width={interpolate(frame, [0, 4 * fps], [0, 270], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ height={360}+ />+ </clipPath>+ </defs>+ <path+ d="M 185 45 V 315 H 455"+ fill="none"+ stroke={theme === 'dark' ? '#444444' : '#d9dde1'}+ strokeWidth={8}+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d={path}+ fill="none"+ stroke={theme === 'dark' ? '#444444' : '#d9dde1'}+ strokeWidth={8}+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d={path}+ fill="none"+ stroke="#0b84f3"+ strokeWidth={8}+ strokeLinecap="round"+ strokeLinejoin="round"+ clipPath={`url(#${clipId})`}+ />+ <circle+ cx={interpolate(frame, [0, 4 * fps], [185, 455], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ cy={315 - progress * 135}+ r={9}+ fill="#0b84f3"+ />+ <text+ x={198}+ y={70}+ fontFamily="Arial, sans-serif"+ fontSize={23}+ fill={theme === 'dark' ? '#ffffff' : '#000000'}+ >+ {animation === 'opacity'+ ? `opacity = ${progress.toFixed(2)}`+ : `translateY = ${Math.round(240 * (1 - progress))}px`}+ </text>+ <text+ x={455}+ y={300}+ textAnchor="end"+ fontFamily="Arial, sans-serif"+ fontSize={23}+ fill={theme === 'dark' ? '#ffffff' : '#000000'}+ >+ {frame} = frame+ </text>+ </Interactive.Svg>+ );+};++export const AnimatingPropertiesGraph = Interactive.withSchema({+ Component: AnimatingPropertiesGraphInner,+ componentName: 'AnimatingPropertiesGraph',+ schema: themeSchema,+ wrapInSequence: true,+ layout: 'absolute-fill',+});++const AnimatingPropertiesTextInner = ({theme, animation}: Props) => {+ const frame = useCurrentFrame();+ const {fps} = useVideoConfig();++ return (+ <Interactive.Div+ name="Hello World"+ premountFor={fps}+ style={{+ position: 'absolute',+ inset: 0,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ fontFamily: 'Arial, sans-serif',+ fontSize: 40,+ fontWeight: 400,+ lineHeight: 1.2,+ color: theme === 'dark' ? '#ffffff' : '#0c0f18',+ opacity:+ animation === 'opacity'+ ? interpolate(frame, [0, 2 * fps], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })+ : 1,+ translate:+ animation === 'opacity'+ ? '0px 0px'+ : interpolate(frame, [0, 2 * fps], ['0px 240px', '0px 0px'], {+ easing: Easing.bezier(0.42, 0, 0.58, 1),+ posterize: animation === 'posterization' ? 3 : undefined,+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ Hello World!+ </Interactive.Div>+ );+};++export const AnimatingPropertiesText = Interactive.withSchema({+ Component: AnimatingPropertiesTextInner,+ componentName: 'AnimatingPropertiesText',+ schema: themeSchema,+ wrapInSequence: true,+ layout: 'absolute-fill',+});diff --git a/packages/brand/src/DocsAnimations/Root.tsx b/packages/brand/src/DocsAnimations/Root.tsxnew file mode 100644index 0000000000..21bf7e5fc7--- /dev/null+++ b/packages/brand/src/DocsAnimations/Root.tsx@@ -0,0 +1,138 @@+import {Composition, Folder} from 'remotion';+import {+ AnimatingPropertiesGraph,+ AnimatingPropertiesText,+} from './AnimatingProperties';++const transparentVideoMetadata = () => ({+ defaultCodec: 'vp9' as const,+ defaultVideoImageFormat: 'png' as const,+ defaultPixelFormat: 'yuva420p' as const,+});++export const DocsAnimationCompositions = () => {+ return (+ <Folder name="DocsAnimations">+ <Composition+ id="AnimatingPropertiesGraphLight"+ component={AnimatingPropertiesGraph}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'light', animation: 'opacity'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="AnimatingPropertiesGraphDark"+ component={AnimatingPropertiesGraph}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'dark', animation: 'opacity'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="AnimatingPropertiesTextLight"+ component={AnimatingPropertiesText}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'light', animation: 'opacity'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="AnimatingPropertiesTextDark"+ component={AnimatingPropertiesText}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'dark', animation: 'opacity'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="EasingGraphLight"+ component={AnimatingPropertiesGraph}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'light', animation: 'easing'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="EasingGraphDark"+ component={AnimatingPropertiesGraph}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'dark', animation: 'easing'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="EasingTextLight"+ component={AnimatingPropertiesText}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'light', animation: 'easing'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="EasingTextDark"+ component={AnimatingPropertiesText}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'dark', animation: 'easing'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="PosterizationGraphLight"+ component={AnimatingPropertiesGraph}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'light', animation: 'posterization'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="PosterizationGraphDark"+ component={AnimatingPropertiesGraph}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'dark', animation: 'posterization'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="PosterizationTextLight"+ component={AnimatingPropertiesText}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'light', animation: 'posterization'}}+ calculateMetadata={transparentVideoMetadata}+ />+ <Composition+ id="PosterizationTextDark"+ component={AnimatingPropertiesText}+ width={640}+ height={360}+ fps={30}+ durationInFrames={120}+ defaultProps={{theme: 'dark', animation: 'posterization'}}+ calculateMetadata={transparentVideoMetadata}+ />+ </Folder>+ );+};diff --git a/packages/brand/src/DocsAnimations/index.ts b/packages/brand/src/DocsAnimations/index.tsnew file mode 100644index 0000000000..5c4de8c7fd--- /dev/null+++ b/packages/brand/src/DocsAnimations/index.ts@@ -0,0 +1,4 @@+import {registerRoot} from 'remotion';+import {DocsAnimationCompositions} from './Root';++registerRoot(DocsAnimationCompositions);diff --git a/packages/brand/src/Root.tsx b/packages/brand/src/Root.tsxindex 912a918684..eb38460461 100644--- a/packages/brand/src/Root.tsx+++ b/packages/brand/src/Root.tsx@@ -39,6 +39,7 @@ import {DesignSystemsResponsive,designSystemsResponsiveDurationInFrames,} from './DesignSystemsResponsive';+import {DocsAnimationCompositions} from './DocsAnimations/Root';import {DocsPagesShowcase,INSTAGRAM_POST_HEIGHT,@@ -175,6 +176,7 @@ import {WebMCPPromo2} from './WebMCPPromo2';export const RemotionRoot: React.FC = () => {return (<>+ <DocsAnimationCompositions /><Folder name="Logo"><Folder name="AnimatedLogo"><Compositiondiff --git a/packages/docs/components/DocsDark.tsx b/packages/docs/components/DocsDark.tsxindex 9c1f03d952..78a9d2c4e9 100644--- a/packages/docs/components/DocsDark.tsx+++ b/packages/docs/components/DocsDark.tsx@@ -92,11 +92,6 @@ export const DualVideoDemo: React.FC<{const videoContainer: React.CSSProperties = useMemo(() => {return {- border:- '1px solid ' +- (colorMode === 'dark'- ? 'transparent'- : 'var(--ifm-color-emphasis-300)'),flex: mobile ? 0 : 1,display: 'block',overflow: 'hidden',@@ -104,7 +99,7 @@ export const DualVideoDemo: React.FC<{aspectRatio: '16/9',position: 'relative',};- }, [colorMode, mobile]);+ }, [mobile]);const playAll = useCallback(() => {ref1.current?.play();@@ -200,25 +195,34 @@ export const AnimatingProperties: React.FC = () => {return (<div><DualVideoDemo- leftDark="/img/animating-properties-left-dark.mp4"- leftLight="/img/animating-properties-left-light.mp4"- rightDark="/img/animating-properties-right-dark.mp4"- rightLight="/img/animating-properties-right-light.mp4"+ leftDark="/img/animating-properties-left-dark.webm"+ leftLight="/img/animating-properties-left-light.webm"+ rightDark="/img/animating-properties-right-dark.webm"+ rightLight="/img/animating-properties-right-light.webm"/></div>);};-export const Springs: React.FC = () => {+export const EasingDemo: React.FC = () => {return (- <div>- <DualVideoDemo- leftDark="/img/spring-left-dark.mp4"- leftLight="/img/spring-left-light.mp4"- rightDark="/img/spring-right-dark.mp4"- rightLight="/img/spring-right-light.mp4"- />- </div>+ <DualVideoDemo+ leftDark="/img/animating-properties-easing-left-dark.webm"+ leftLight="/img/animating-properties-easing-left-light.webm"+ rightDark="/img/animating-properties-easing-right-dark.webm"+ rightLight="/img/animating-properties-easing-right-light.webm"+ />+ );+};++export const PosterizationDemo: React.FC = () => {+ return (+ <DualVideoDemo+ leftDark="/img/animating-properties-posterization-left-dark.webm"+ leftLight="/img/animating-properties-posterization-left-light.webm"+ rightDark="/img/animating-properties-posterization-right-dark.webm"+ rightLight="/img/animating-properties-posterization-right-light.webm"+ />);};diff --git a/packages/docs/docs/animating-properties.mdx b/packages/docs/docs/animating-properties.mdxindex 1cd39aed0f..7e50b0c576 100644--- a/packages/docs/docs/animating-properties.mdx+++ b/packages/docs/docs/animating-properties.mdx@@ -5,95 +5,97 @@ title: Animating propertiescrumb: "The basics"----import {AnimatingProperties, Springs} from '../components/DocsDark'+import {AnimatingProperties, EasingDemo, PosterizationDemo} from '../components/DocsDark';Animation works by changing properties over time.-Let's create a simple fade in animation.+For example: To fade the text in over two seconds, gradually change its `opacity` from `0` to `1`.-If we want to fade the text in over 60 frames, we need to gradually change the `opacity` over time so that it goes from 0 to 1.--```tsx twoslash {4, 15} title="FadeIn.tsx"-import { AbsoluteFill, useCurrentFrame } from "remotion";+```tsx twoslash {3, 9-12, 20-26} title="FadeIn.tsx"+import { interpolate, Interactive, useCurrentFrame, useVideoConfig } from "remotion";// ---cut----export const FadeIn = () => {+const FadeInInner = () => {const frame = useCurrentFrame();-- const opacity = Math.min(1, frame / 60);+ const { fps } = useVideoConfig();return (- <AbsoluteFill+ <Interactive.Divstyle={{- justifyContent: "center",- alignItems: "center",- backgroundColor: "white",fontSize: 80,+ opacity: interpolate(frame, [0, 2 * fps], [0, 1], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ }),}}>- <div style={{ opacity: opacity }}>Hello World!</div>- </AbsoluteFill>+ Hello World!+ </Interactive.Div>);};++export const FadeIn = Interactive.withSchema({+ Component: FadeInInner,+ componentName: "FadeIn",+ schema: {},+ wrapInSequence: true,+ layout: "absolute-fill",+});```<AnimatingProperties />-## Using the interpolate helper function+## Easing-Using the [`interpolate()`](/docs/interpolate) function can make animations more readable. The above animation can also be written as:+Add an `easing` option to apply a curve from [`Easing`](/docs/easing):-```tsx twoslash-import { useCurrentFrame } from "remotion";+```tsx twoslash {4} title="SlideIn.tsx"+import { Easing, interpolate, Interactive, useCurrentFrame, useVideoConfig } from "remotion";const frame = useCurrentFrame();+const { fps } = useVideoConfig();// ---cut----import { interpolate } from "remotion";--const opacity = interpolate(frame, [0, 60], [0, 1], {- /* ^^^^^ ^^^^^ ^^^^- Variable to interpolate ----| | |- Input range ------------------------| |- Output range -------------------------------| */- extrapolateRight: "clamp",-});+<Interactive.Div+ style={{+ translate: interpolate(frame, [0, 2 * fps], ["0px 240px", "0px 0px"], {+ easing: Easing.bezier(0.42, 0, 0.58, 1),+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ }),+ }}+>+ Hello World!+</Interactive.Div>```-In this example, we map the frames 0 to 60 to their opacity values `(0, 0.0166, 0.033, 0.05 ...`) and use the [`extrapolateRight`](/docs/interpolate#extrapolateright) setting to clamp the output so that it never becomes bigger than 1.+<EasingDemo />-## Using `spring()`+See [`Easing`](/docs/easing) for more curves.-The [`spring()`](/docs/spring) helper runs a spring simulation from 0 to 1 by default. Below, we use it to animate the scale of the text.+## Posterization-```tsx twoslash {7-12, 20}-import { spring, useCurrentFrame, useVideoConfig } from "remotion";+[Posterization](/docs/posterization) makes an animation update in steps.+Sometimes this is useful for creating a certain style.-export const MyVideo = () => {- const frame = useCurrentFrame();- const { fps } = useVideoConfig();-- const scale = spring({- fps,- frame,- });-- return (- <div- style={{- flex: 1,- textAlign: "center",- fontSize: "7em",- }}- >- <div style={{ transform: `scale(${scale})` }}>Hello World!</div>- </div>- );-};+```tsx twoslash {5} title="SlideIn.tsx"+import { Easing, interpolate, Interactive, useCurrentFrame, useVideoConfig } from "remotion";+const frame = useCurrentFrame();+const { fps } = useVideoConfig();+// ---cut---+<Interactive.Div+ style={{+ translate: interpolate(frame, [0, 2 * fps], ["0px 240px", "0px 0px"], {+ easing: Easing.bezier(0.42, 0, 0.58, 1),+ posterize: 3,+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ }),+ }}+>+ Hello World!+</Interactive.Div>```-You should see the text jump in.--<Springs />-<br />+With [`posterize: 3`](/docs/interpolate#posterize), the position changes only every three frames.-The default spring configuration leads to a little bit of overshoot, meaning the text will bounce a little bit. See the documentation page for [`spring()`](/docs/spring) to learn how to customize it.+<PosterizationDemo />## Always animate using `useCurrentFrame()`@@ -101,9 +103,15 @@ Watch out for flickering issues during rendering that arise if you write animati[Read more about how Remotion's rendering works](/docs/flickering) - understanding it will help you avoid issues down the road.+## Interactivity guidelines++Using [`interpolate()`](/docs/interpolate) on inline properties is recommended, because it will show up as keyframes in the [Remotion Studio](/docs/studio).+See also: [Interactivity best practices](/docs/studio/interactivity-best-practices)+## See also- [Don't use CSS animations](/docs/troubleshooting/css-animations)- [`interpolate()`](/docs/interpolate)+- [`Easing`](/docs/easing)- [`spring()`](/docs/spring)- [Flickering](/docs/flickering)diff --git a/packages/docs/docs/components.mdx b/packages/docs/docs/components.mdxnew file mode 100644index 0000000000..d54f4b8a98--- /dev/null+++ b/packages/docs/docs/components.mdx@@ -0,0 +1,52 @@+---+image: /generated/articles-docs-components.png+title: Components+crumb: 'Create videos with code'+---++You can render any React/HTML markup in Remotion.+You'll find it useful to use our pre-made components, which have timing primitives built in and show up in the Studio as layers and become interactive.++See the [API reference](/docs/api) for the full list of components, hooks and functions.++## HTML Elements++[`<Interactive.Div>`](/docs/interactive), `<Interactive.Span>`, `<Interactive.Svg>`, and so on work like regular HTML elements, but they make the layer show up in the Studio as a layer and interactive element.++## Video and audio++[`<Video>`](/docs/media/video) and [`<Audio>`](/docs/media/audio) can do the same as regular video tags in the browser - and more, such as pitch shifting and play more formats!++## Images and graphics++- [`<CanvasImage>`](/docs/canvasimage) and [`<Img>`](/docs/img) allow you to show images.+- [`<AnimatedImage>`](/docs/animatedimage) plays animate GIFs, PNGs, AVIFs or WebPs, but only in Chrome.+- [`<Gif>`](/docs/gif/gif) also plays GIFs, in all browsers.++## Grouping clips++- [`<Track>`](/docs/track) puts multiple clips on the row in the Studio timeline.+- [`<Series>`](/docs/series) plays multiple clips after each other. If you change the duration of one clip, others adjust.+- [`<TransitionSeries>`](/docs/transitions/transitionseries) is the same as `<Series>`, but allowing you to place transitions inbetween.++## Animation and 3D++- [`<Lottie>`](/docs/lottie/lottie) plays [Lottie](https://lottie.airbnb.tech/#/) animations, useful for displaying content from After Effects.+- [`<RemotionRiveCanvas>`](/docs/rive/remotionrivecanvas) plays [Rive](https://rive.app/) content.+- [`<ThreeCanvas>`](/docs/three-canvas) enables you to render Three.js content.++## Shapes and annotations++- [`@remotion/shapes`](/docs/shapes) has SVG shapes such as [`<Heart>`](/docs/shapes/heart), [`<Arrow>`](/docs/shapes/arrow) and [`<Star>`](/docs/shapes/star).+- [`@remotion/rough-notation`](/docs/rough-notation/api) allows for animated, hand-drawn annotations such as highlights on text.+- [`<MacOSCursor>`](/docs/mac-cursors/mac-os-cursor) displays a macOS cursor that you can position and animate, for example in a product demo.++## Effects++- [`<Solid>`](/docs/solid) is a simple, generic component, useful for applying [effects](/docs/effects).+- [`<HtmlInCanvas>`](/docs/remotion/html-in-canvas) wraps any content and allows you to add an effect to it.+- [`<HtmlInCanvasMotionBlur>`](/docs/motion-blur/html-in-canvas-motion-blur) adds motion blur to its children.++## Make your own++Use [`Interactive.withSchema()`](/docs/interactive-with-schema) to make your own React components editable in the Studio and inherit timing primitives.diff --git a/packages/docs/docs/create-videos-with-code.mdx b/packages/docs/docs/create-videos-with-code.mdxindex bee5a13628..e827cca90b 100644--- a/packages/docs/docs/create-videos-with-code.mdx+++ b/packages/docs/docs/create-videos-with-code.mdx@@ -16,6 +16,9 @@ By learning how Remotion markup works, you can do more sophisticated videos, opt<TOCItem link="/docs/idea"><strong>The core idea</strong></TOCItem>+ <TOCItem link="/docs/components">+ <strong>Components</strong>+ </TOCItem><TOCItem link="/docs/timing"><strong>Timing and trimming</strong></TOCItem>diff --git a/packages/docs/docs/idea.mdx b/packages/docs/docs/idea.mdxindex aaebfe42da..1ce32d7799 100644--- a/packages/docs/docs/idea.mdx+++ b/packages/docs/docs/idea.mdx@@ -35,6 +35,8 @@ This is an example React component that renders the current frame as text:// @include: example-MyComposition```+Remotion includes [components](/docs/components) for adding text, images, video, audio and shapes.+A video is a function of images over time. If you change content every frame, you'll end up with an animation.## Video propertiesdiff --git a/packages/docs/docs/timing.mdx b/packages/docs/docs/timing.mdxindex 6c9c0987bb..17fee8235e 100644--- a/packages/docs/docs/timing.mdx+++ b/packages/docs/docs/timing.mdx@@ -7,16 +7,7 @@ crumb: 'Getting started'import {TimingTimeline} from '../components/TimingTimeline';-The way timing works is standardized across these components:--- [`<Track>`](/docs/track).-- [`Interactive` elements](/docs/interactive), such as `<Interactive.Div>`, and [`<AbsoluteFill>`](/docs/absolute-fill).-- [`<Img>`](/docs/img), [`<CanvasImage>`](/docs/canvasimage), [`<AnimatedImage>`](/docs/animatedimage), [`<Solid>`](/docs/solid) and [`<HtmlInCanvas>`](/docs/remotion/html-in-canvas).-- [`<HtmlInCanvasMotionBlur>`](/docs/motion-blur/html-in-canvas-motion-blur) from `@remotion/motion-blur`.-- [`<Gif>`](/docs/gif/gif), [`<Lottie>`](/docs/lottie), [`<ThreeCanvas>`](/docs/three-canvas) and [`<RemotionRiveCanvas>`](/docs/rive/remotionrivecanvas).-- [`@remotion/shapes`](/docs/shapes), [`@remotion/rough-notation`](/docs/rough-notation/api), [`<MacOSCursor>`](/docs/mac-cursors/mac-os-cursor).-- [`<Audio>`](/docs/media/audio) and [`<Video>`](/docs/media/video) from `@remotion/media`.-- Custom components built with [`Interactive.withSchema()`](/docs/interactive-with-schema) that expose these props.+All Remotion [components](/docs/components) share the same timing props.## `from`: Move an item@@ -58,9 +49,8 @@ export const MyComposition = () => (## `durationInFrames`: Set the duration`durationInFrames` selects how many frames of the child timeline are shown, starting at `trimBefore`.-The item occupies `durationInFrames / playbackRate` frames in its parent timeline.-<TimingTimeline from={30} durationInFrames={60} trimBefore={45} playbackRate={2} loop={false} />+<TimingTimeline from={30} durationInFrames={30} trimBefore={45} playbackRate={1} loop={false} />```tsx twoslash title="MyComposition.tsx"import {Interactive, useCurrentFrame} from 'remotion';@@ -71,8 +61,7 @@ export const MyComposition = () => (<Interactive.Divfrom={30}trimBefore={45}- durationInFrames={60}- playbackRate={2}+ durationInFrames={30}><Counter /></Interactive.Div>@@ -81,8 +70,6 @@ export const MyComposition = () => (## `playbackRate`: Change speed of an item-`playbackRate` changes the speed of its children.-<TimingTimeline from={30} durationInFrames={60} trimBefore={15} playbackRate={2} loop={false} />```tsx twoslash title="MyComposition.tsx"@@ -126,12 +113,12 @@ export const MyComposition = () => ();```-To set a finite total duration for a loop, wrap it in an outer item with `durationInFrames`.-When `loop` is set, [`<Video>`](/docs/media/video), [`<Audio>`](/docs/media/audio), [`<Lottie>`](/docs/lottie/lottie), [`<Gif>`](/docs/gif/gif), and [`<AnimatedImage>`](/docs/animatedimage) may omit `durationInFrames`. The intrinsic duration after `trimBefore` then defines the loop range.+To loop an item, `durationInFrames` must be set.+The following components are exempt: [`<Video>`](/docs/media/video), [`<Audio>`](/docs/media/audio), [`<Lottie>`](/docs/lottie/lottie), [`<Gif>`](/docs/gif/gif), and [`<AnimatedImage>`](/docs/animatedimage), because they have an intrinsic duration.## Order of operations-Think of the timing props as applying to the content in this order:+The timing props as applying to the content in this order:1. `from` positions the item in its parent timeline.2. `trimBefore` sets the first frame in the child timeline.@@ -141,7 +128,8 @@ Think of the timing props as applying to the content in this order:## Formula-Child components calling [`useCurrentFrame()`](/docs/use-current-frame) get:+Timing props affect what child components retrieve when they call [`useCurrentFrame()`](/docs/use-current-frame).+The formula is as follows:```mdtrimBefore + (frame - from) * playbackRate@@ -157,5 +145,3 @@ trimBefore + ((frame - from) * playbackRate) % durationInFrames- [`<Sequence>`](/docs/sequence)- [`<Loop>`](/docs/loop)-- [Trimming audio](/docs/audio/trimming)-- [Adding a video](/docs/videos/)diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.tsindex 0ea0d7635b..78f93f1f99 100644--- a/packages/docs/sidebars.ts+++ b/packages/docs/sidebars.ts@@ -1167,11 +1167,6 @@ const sidebars: SidebarsConfig = {label: 'Getting started',items: ['getting-started', 'your-first-video'],},- {- type: 'link',- label: 'Templates',- href: '/templates',- },{type: 'category',label: 'Designing visuals',@@ -1200,7 +1195,13 @@ const sidebars: SidebarsConfig = {type: 'category',label: 'Create videos with code',link: {type: 'doc', id: 'create-videos-with-code'},- items: ['idea', 'timing', 'animating-properties', 'reusability'],+ items: [+ 'idea',+ 'components',+ 'timing',+ 'animating-properties',+ 'reusability',+ ],},{type: 'category',@@ -1594,6 +1595,11 @@ const sidebars: SidebarsConfig = {href: '/docs/api',label: 'API Reference',},+ {+ type: 'link',+ label: 'Templates',+ href: '/templates',+ },{type: 'category',diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 77ab3c600b..ab090c20ee 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -2853,6 +2853,15 @@ export const articles = [noAi: false,slug: 'compare-ssr',},+ {+ id: 'components',+ title: 'Components',+ relativePath: 'docs/components.mdx',+ compId: 'articles-docs-components',+ crumb: 'Create videos with code',+ noAi: false,+ slug: 'components',+ },{id: 'composition',title: '<Composition>',diff --git a/packages/docs/static/generated/articles-docs-components.png b/packages/docs/static/generated/articles-docs-components.pngnew file mode 100644index 0000000000..65b6f5b85aBinary files /dev/null and b/packages/docs/static/generated/articles-docs-components.png differdiff --git a/packages/docs/static/img/animating-properties-easing-left-dark.webm b/packages/docs/static/img/animating-properties-easing-left-dark.webmnew file mode 100644index 0000000000..0ac5f599bcBinary files /dev/null and b/packages/docs/static/img/animating-properties-easing-left-dark.webm differdiff --git a/packages/docs/static/img/animating-properties-easing-left-light.webm b/packages/docs/static/img/animating-properties-easing-left-light.webmnew file mode 100644index 0000000000..ef9df215cfBinary files /dev/null and b/packages/docs/static/img/animating-properties-easing-left-light.webm differdiff --git a/packages/docs/static/img/animating-properties-easing-right-dark.webm b/packages/docs/static/img/animating-properties-easing-right-dark.webmnew file mode 100644index 0000000000..8f12b76c1eBinary files /dev/null and b/packages/docs/static/img/animating-properties-easing-right-dark.webm differdiff --git a/packages/docs/static/img/animating-properties-easing-right-light.webm b/packages/docs/static/img/animating-properties-easing-right-light.webmnew file mode 100644index 0000000000..50c94207fdBinary files /dev/null and b/packages/docs/static/img/animating-properties-easing-right-light.webm differdiff --git a/packages/docs/static/img/animating-properties-left-dark.mp4 b/packages/docs/static/img/animating-properties-left-dark.mp4deleted file mode 100644index c92690aeb0..0000000000Binary files a/packages/docs/static/img/animating-properties-left-dark.mp4 and /dev/null differdiff --git a/packages/docs/static/img/animating-properties-left-dark.webm b/packages/docs/static/img/animating-properties-left-dark.webmnew file mode 100644index 0000000000..fc2fe410e8Binary files /dev/null and b/packages/docs/static/img/animating-properties-left-dark.webm differdiff --git a/packages/docs/static/img/animating-properties-left-light.mp4 b/packages/docs/static/img/animating-properties-left-light.mp4deleted file mode 100644index a1a900583b..0000000000Binary files a/packages/docs/static/img/animating-properties-left-light.mp4 and /dev/null differdiff --git a/packages/docs/static/img/animating-properties-left-light.webm b/packages/docs/static/img/animating-properties-left-light.webmnew file mode 100644index 0000000000..5e15350b39Binary files /dev/null and b/packages/docs/static/img/animating-properties-left-light.webm differdiff --git a/packages/docs/static/img/animating-properties-posterization-left-dark.webm b/packages/docs/static/img/animating-properties-posterization-left-dark.webmnew file mode 100644index 0000000000..12646b5db1Binary files /dev/null and b/packages/docs/static/img/animating-properties-posterization-left-dark.webm differdiff --git a/packages/docs/static/img/animating-properties-posterization-left-light.webm b/packages/docs/static/img/animating-properties-posterization-left-light.webmnew file mode 100644index 0000000000..0069465239Binary files /dev/null and b/packages/docs/static/img/animating-properties-posterization-left-light.webm differdiff --git a/packages/docs/static/img/animating-properties-posterization-right-dark.webm b/packages/docs/static/img/animating-properties-posterization-right-dark.webmnew file mode 100644index 0000000000..02a4bdcaf6Binary files /dev/null and b/packages/docs/static/img/animating-properties-posterization-right-dark.webm differdiff --git a/packages/docs/static/img/animating-properties-posterization-right-light.webm b/packages/docs/static/img/animating-properties-posterization-right-light.webmnew file mode 100644index 0000000000..cfac18ba62Binary files /dev/null and b/packages/docs/static/img/animating-properties-posterization-right-light.webm differdiff --git a/packages/docs/static/img/animating-properties-right-dark.mp4 b/packages/docs/static/img/animating-properties-right-dark.mp4deleted file mode 100644index 48234c1371..0000000000Binary files a/packages/docs/static/img/animating-properties-right-dark.mp4 and /dev/null differdiff --git a/packages/docs/static/img/animating-properties-right-dark.webm b/packages/docs/static/img/animating-properties-right-dark.webmnew file mode 100644index 0000000000..21b2cc5b50Binary files /dev/null and b/packages/docs/static/img/animating-properties-right-dark.webm differdiff --git a/packages/docs/static/img/animating-properties-right-light.mp4 b/packages/docs/static/img/animating-properties-right-light.mp4deleted file mode 100644index 4d0ff49f3e..0000000000Binary files a/packages/docs/static/img/animating-properties-right-light.mp4 and /dev/null differdiff --git a/packages/docs/static/img/animating-properties-right-light.webm b/packages/docs/static/img/animating-properties-right-light.webmnew file mode 100644index 0000000000..27e2e3998aBinary files /dev/null and b/packages/docs/static/img/animating-properties-right-light.webm differdiff --git a/packages/docs/static/img/spring-left-dark.mp4 b/packages/docs/static/img/spring-left-dark.mp4deleted file mode 100644index 44d88d5c19..0000000000Binary files a/packages/docs/static/img/spring-left-dark.mp4 and /dev/null differdiff --git a/packages/docs/static/img/spring-left-light.mp4 b/packages/docs/static/img/spring-left-light.mp4deleted file mode 100644index d73d767b28..0000000000Binary files a/packages/docs/static/img/spring-left-light.mp4 and /dev/null differdiff --git a/packages/docs/static/img/spring-right-dark.mp4 b/packages/docs/static/img/spring-right-dark.mp4deleted file mode 100644index 462434df46..0000000000Binary files a/packages/docs/static/img/spring-right-dark.mp4 and /dev/null differdiff --git a/packages/docs/static/img/spring-right-light.mp4 b/packages/docs/static/img/spring-right-light.mp4deleted file mode 100644index b10fcc22e4..0000000000Binary files a/packages/docs/static/img/spring-right-light.mp4 and /dev/null differ