Skip to content

🎥 Make videos programmatically with React

triangledemo

Jonny Burgere834d3991462
diff --git a/packages/docs/components/demos/Triangle.tsx b/packages/docs/components/demos/Triangle.tsx
new file mode 100644
index 0000000000..fc225d49be
--- /dev/null
+++ b/packages/docs/components/demos/Triangle.tsx
@@ -0,0 +1,19 @@
+import { Triangle } from "@remotion/shapes";
+import React from "react";
+import { AbsoluteFill } from "remotion";
+
+export const TriangleDemo: React.FC<{
+ length: number;
+ edgeRoundness: number;
+}> = ({ length, edgeRoundness }) => {
+ return (
+ <AbsoluteFill
+ style={{
+ justifyContent: "center",
+ alignItems: "center",
+ }}
+ >
+ <Triangle edgeRoundness={edgeRoundness} direction="up" length={length} />
+ </AbsoluteFill>
+ );
+};
diff --git a/packages/docs/components/demos/index.tsx b/packages/docs/components/demos/index.tsx
index ddb5e881df..3acbf39a2a 100644
--- a/packages/docs/components/demos/index.tsx
+++ b/packages/docs/components/demos/index.tsx
@@ -3,7 +3,7 @@ import React, { useState } from "react";
import { Control } from "./control";
import styles from "./styles.module.css";
import type { DemoType } from "./types";
-import { noiseDemo } from "./types";
+import { noiseDemo, triangleDemo } from "./types";
const container: React.CSSProperties = {
overflow: "hidden",
@@ -13,7 +13,7 @@ const container: React.CSSProperties = {
marginBottom: 40,
};
-const demos: DemoType[] = [noiseDemo];
+const demos: DemoType[] = [noiseDemo, triangleDemo];
export const Demo: React.FC<{
type: string;
diff --git a/packages/docs/components/demos/types.ts b/packages/docs/components/demos/types.ts
index f8bc9fcb47..53852c6ee7 100644
--- a/packages/docs/components/demos/types.ts
+++ b/packages/docs/components/demos/types.ts
@@ -1,4 +1,5 @@
import { NoiseComp } from "./NoiseDemo";
+import { TriangleDemo } from "./Triangle";
export type Option = { name: string } & (
| {
@@ -24,6 +25,35 @@ export type DemoType = {
fps: number;
durationInFrames: number;
options: Option[];
+ autoPlay: boolean;
+};
+
+export const triangleDemo: DemoType = {
+ comp: TriangleDemo,
+ compWidth: 1280,
+ compHeight: 400,
+ durationInFrames: 150,
+ fps: 30,
+ id: "triangle",
+ autoPlay: false,
+ options: [
+ {
+ default: 200,
+ max: 1000,
+ step: 5,
+ min: 1,
+ type: "numeric",
+ name: "length",
+ },
+ {
+ name: "edgeRoundness",
+ default: 1,
+ max: 2,
+ min: -2,
+ step: 0.01,
+ type: "numeric",
+ },
+ ],
};
export const noiseDemo: DemoType = {
@@ -33,6 +63,7 @@ export const noiseDemo: DemoType = {
durationInFrames: 150,
fps: 30,
id: "noise",
+ autoPlay: true,
options: [
{
default: 0.01,
diff --git a/packages/docs/docs/shapes/triangle.md b/packages/docs/docs/shapes/triangle.md
index 581469b3f7..d338885db0 100644
--- a/packages/docs/docs/shapes/triangle.md
+++ b/packages/docs/docs/shapes/triangle.md
@@ -10,6 +10,10 @@ _Part of the [` @remotion/shapes`](/docs/shapes) package._
Renders an SVG element containing a triangle with same length on all sides.
+## Explorer
+
+<Demo type="triangle" />
+
## Example
```tsx twoslash title="src/Triangle.tsx"