🎥 Make videos programmatically with React
explorers
Jonny Burgerc2c212494572
diff --git a/packages/docs/components/demos/Rect.tsx b/packages/docs/components/demos/Rect.tsxnew file mode 100644index 0000000000..4f8d2fb7f6--- /dev/null+++ b/packages/docs/components/demos/Rect.tsx@@ -0,0 +1,26 @@+import { Rect } from "@remotion/shapes";+import React from "react";+import { AbsoluteFill } from "remotion";++export const RectDemo: React.FC<{+ width: number;+ height: number;+ edgeRoundness: number;+ darkMode: boolean;+}> = ({ width, height, edgeRoundness, darkMode }) => {+ return (+ <AbsoluteFill+ style={{+ justifyContent: "center",+ alignItems: "center",+ }}+ >+ <Rect+ fill={darkMode ? "white" : "#222"}+ edgeRoundness={edgeRoundness}+ width={width}+ height={height}+ />+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/index.tsx b/packages/docs/components/demos/index.tsxindex 4f522414cc..5f3338c4fb 100644--- a/packages/docs/components/demos/index.tsx+++ b/packages/docs/components/demos/index.tsx@@ -4,7 +4,7 @@ import React, { useState } from "react";import { Control } from "./control";import styles from "./styles.module.css";import type { DemoType } from "./types";-import { noiseDemo, triangleDemo } from "./types";+import { noiseDemo, rectDemo, triangleDemo } from "./types";const container: React.CSSProperties = {overflow: "hidden",@@ -14,7 +14,7 @@ const container: React.CSSProperties = {marginBottom: 40,};-const demos: DemoType[] = [noiseDemo, triangleDemo];+const demos: DemoType[] = [noiseDemo, triangleDemo, rectDemo];export const Demo: React.FC<{type: string;diff --git a/packages/docs/components/demos/types.ts b/packages/docs/components/demos/types.tsindex cda2b5efb6..a5ab699cf9 100644--- a/packages/docs/components/demos/types.ts+++ b/packages/docs/components/demos/types.ts@@ -1,4 +1,5 @@import { NoiseComp } from "./NoiseDemo";+import { RectDemo } from "./Rect";import { TriangleDemo } from "./Triangle";export type Option = {@@ -36,6 +37,45 @@ export type DemoType = {autoPlay: boolean;};+export const rectDemo: DemoType = {+ comp: RectDemo,+ compWidth: 1280,+ compHeight: 400,+ durationInFrames: 150,+ fps: 30,+ id: "rect",+ autoPlay: false,+ options: [+ {+ default: 200,+ max: 1000,+ step: 5,+ min: 1,+ type: "numeric",+ name: "width",+ optional: "no",+ },+ {+ default: 200,+ max: 1000,+ step: 5,+ min: 1,+ type: "numeric",+ name: "height",+ optional: "no",+ },+ {+ name: "edgeRoundness",+ default: 1,+ max: 2,+ min: -2,+ step: 0.01,+ type: "numeric",+ optional: "default-disabled",+ },+ ],+};+export const triangleDemo: DemoType = {comp: TriangleDemo,compWidth: 1280,diff --git a/packages/docs/docs/shapes/rect.md b/packages/docs/docs/shapes/rect.mdindex 92ed564b39..137d61bf83 100644--- a/packages/docs/docs/shapes/rect.md+++ b/packages/docs/docs/shapes/rect.md@@ -10,6 +10,10 @@ _Part of the [` @remotion/shapes`](/docs/shapes) package._Renders an SVG element containing a rectangle.+## Explorer++<Demo type="rect"/>+## Example```tsx twoslash title="src/Rect.tsx"