Skip to content

🎥 Make videos programmatically with React

feat: update documentation example of circle, triangle and square to correct the params

Alex Fernandez47ecc512dd75
diff --git a/packages/docs/docs/shapes/circle.md b/packages/docs/docs/shapes/circle.md
index 16c103d041..b01d5d3bbc 100644
--- a/packages/docs/docs/shapes/circle.md
+++ b/packages/docs/docs/shapes/circle.md
@@ -1,5 +1,5 @@
---
-image: /generated/articles-docs-paths-circle.png
+image: /generated/articles-docs-shapes-circle.png
title: <Circle />
crumb: "@remotion/shapes"
---
@@ -37,13 +37,13 @@ export const MyComposition = () => {
alignItems: "center",
}}
>
- <Circle
- width={100}
- height={100}
- fill="green"
- stroke="red"
- strokeWidth={1}
- />
+ <Circle
+ width={100}
+ height={100}
+ fill="green"
+ stroke="red"
+ strokeWidth={1}
+ />
</AbsoluteFill>
);
};
@@ -52,4 +52,4 @@ export const MyComposition = () => {
## See also
- [makeCircle()](/docs/shapes/make-circle)
- [`@remotion/shapes`](/docs/shapes)
-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/make-triangle.tsx)
+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/circle.tsx)
diff --git a/packages/docs/docs/shapes/make-circle.md b/packages/docs/docs/shapes/make-circle.md
index 673ef04c0d..d13692606b 100644
--- a/packages/docs/docs/shapes/make-circle.md
+++ b/packages/docs/docs/shapes/make-circle.md
@@ -1,5 +1,5 @@
---
-image: /generated/articles-docs-paths-make-circle.png
+image: /generated/articles-docs-shapes-make-circle.png
title: makeCircle()
crumb: "@remotion/shapes"
---
@@ -19,7 +19,7 @@ An object with the following arguments:
- `radius`: `number` - The radius of the circle. A value lower or equal to zero disables rendering of the circle
-Generate Circle path
+Example Circle path generation
```tsx twoslash
import { makeCircle } from "@remotion/shapes";
@@ -34,4 +34,4 @@ console.log(circlePath); // M 50 50 m -50, 0 a 50,50 0 1,0 100,0 50,50 0 1,0 -1
- [makeTriangle()](/docs/shapes/make-triangle)
- [makeSquare()](/docs/shapes/make-square)
- [`@remotion/shapes`](/docs/shapes)
-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/paths/src/make-triangle.tsx)
+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/make-triangle.ts)
diff --git a/packages/docs/docs/shapes/make-square.md b/packages/docs/docs/shapes/make-square.md
index a64e1421da..2bf09df495 100644
--- a/packages/docs/docs/shapes/make-square.md
+++ b/packages/docs/docs/shapes/make-square.md
@@ -1,5 +1,5 @@
---
-image: /generated/articles-docs-paths-make-square.png
+image: /generated/articles-docs-shapes-make-square.png
title: makeSquare()
crumb: "@remotion/shapes"
---
@@ -20,8 +20,7 @@ An object with the following arguments:
- `size`: `number` - The size of the square inside the path
-
-Generate Square path
+Example Square path generation
```tsx twoslash
import { makeSquare } from "@remotion/shapes";
@@ -37,4 +36,4 @@ console.log(square); // M 50, 50 l 100, 0 l 0, 100 l -100, 0 Z
- [makeTriangle()](/docs/shapes/make-triangle)
- [makeCircle()](/docs/shapes/make-circle)
- [`@remotion/shapes`](/docs/shapes)
-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/make-square.tsx)
+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/make-square.ts)
diff --git a/packages/docs/docs/shapes/make-triangle.md b/packages/docs/docs/shapes/make-triangle.md
index 18ac6b2f2e..25ff69a102 100644
--- a/packages/docs/docs/shapes/make-triangle.md
+++ b/packages/docs/docs/shapes/make-triangle.md
@@ -1,5 +1,5 @@
---
-image: /generated/articles-docs-paths-make-triangle.png
+image: /generated/articles-docs-shapes-make-triangle.png
title: makeTriangle()
crumb: "@remotion/shapes"
---
@@ -20,7 +20,8 @@ An object with the following arguments:
- `height`: `number` - The height of the triangle.
- `direction`: `string` - The identifier what kind of rectangle, possible values `left`, `right`, `top` and `bottom`
-Generate Right Triangle string path
+
+Example Triangle path generation
```tsx twoslash
import { makeTriangle } from "@remotion/shapes";
@@ -41,4 +42,4 @@ Source code stems mostly from [triangle](https://stackblitz.com/edit/react-trian
- [makeCircle()](/docs/shapes/make-circle)
- [makeSquare()](/docs/shapes/make-square)
- [`@remotion/shapes`](/docs/shapes)
-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/make-triangle.tsx)
+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/make-triangle.ts)
diff --git a/packages/docs/docs/shapes/square.md b/packages/docs/docs/shapes/square.md
index a0915ba8cc..44d9ac313e 100644
--- a/packages/docs/docs/shapes/square.md
+++ b/packages/docs/docs/shapes/square.md
@@ -13,19 +13,18 @@ Generate Square SVG component
### `options`
An object with the following arguments:
-- `width`: `number` - The x axis coordinate of the center of the circle
-- `height`: `number` - The y axis coordinate of the center of the circle
-- `fill`: `string` `optional` - The radius of the circle. A value lower or equal to zero disables rendering of the circle
-- `stroke`: `number` - The x axis coordinate of the center of the circle
-- `strokeWidth`: `number` - The y axis coordinate of the center of the circle
-- `style`: `React.CSSProperties` - The radius of the circle. A value lower or equal to zero disables rendering of the circle
+- `width`: `number` - The width of the svg
+- `height`: `number` - The height of the svg
+- `size`: `number` - The size of the square
+- `fill`: `string` - The fill color
+- `style`: `React.CSSProperties` - The css styles applied to `svg` component
-Use Square SVG into Remotion
+Example Square SVG
```tsx twoslash
-import { Circle } from "@remotion/shapes";
+import { Square } from "@remotion/shapes";
import { AbsoluteFill } from "remotion";
export const MyComposition = () => {
@@ -37,13 +36,7 @@ export const MyComposition = () => {
alignItems: "center",
}}
>
- <Circle
- width={100}
- height={100}
- fill="green"
- stroke="red"
- strokeWidth={1}
- />
+ <Square width={200} height={200} size={100} fill="red" />
</AbsoluteFill>
);
};
@@ -53,4 +46,4 @@ export const MyComposition = () => {
- [makeTriangle()](/docs/shapes/make-triangle)
- [makeSquare()](/docs/shapes/make-square)
- [`@remotion/shapes`](/docs/shapes)
-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/paths/src/make-triangle.tsx)
+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/paths/src/square.tsx)
diff --git a/packages/docs/docs/shapes/triangle.md b/packages/docs/docs/shapes/triangle.md
index 5114de52f5..741ff712a2 100644
--- a/packages/docs/docs/shapes/triangle.md
+++ b/packages/docs/docs/shapes/triangle.md
@@ -13,19 +13,18 @@ Generate Triangle SVG component
### `options`
An object with the following arguments:
-- `width`: `number` - The x axis coordinate of the center of the circle
-- `height`: `number` - The y axis coordinate of the center of the circle
-- `fill`: `string` `optional` - The radius of the circle. A value lower or equal to zero disables rendering of the circle
-- `stroke`: `number` - The x axis coordinate of the center of the circle
-- `strokeWidth`: `number` - The y axis coordinate of the center of the circle
+- `width`: `number` - The width of the triangle
+- `height`: `number` - he height of the triangle
+- `fill`: `string` `optional` - The fill color
+- `direction`: `string` - The identifier what kind of rectangle, possible values `left`, `right`, `top` and `bottom`
- `style`: `React.CSSProperties` - The radius of the circle. A value lower or equal to zero disables rendering of the circle
-Use Triangle SVG into Remotion
+Example Triangle SVG
```tsx twoslash
-import { Circle } from "@remotion/shapes";
+import { Triangle } from "@remotion/shapes";
import { AbsoluteFill } from "remotion";
export const MyComposition = () => {
@@ -37,13 +36,12 @@ export const MyComposition = () => {
alignItems: "center",
}}
>
- <Circle
- width={100}
- height={100}
- fill="green"
- stroke="red"
- strokeWidth={1}
- />
+ <Triangle
+ width={100}
+ height={100}
+ fill="red"
+ direction="left"
+ />
</AbsoluteFill>
);
};
@@ -51,4 +49,4 @@ export const MyComposition = () => {
## See also
- [makeTriangle()](/docs/shapes/make-triangle)
-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/make-triangle.tsx)
+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/triangle.tsx)
diff --git a/packages/example/src/Shapes/TriangleTest.tsx b/packages/example/src/Shapes/TriangleTest.tsx
index 4810fcef33..5e7c6faece 100644
--- a/packages/example/src/Shapes/TriangleTest.tsx
+++ b/packages/example/src/Shapes/TriangleTest.tsx
@@ -21,7 +21,6 @@ const TriangleTest: React.FC = () => {
height={100}
fill="red"
direction="left"
- color="green"
/>
<Triangle
@@ -32,7 +31,6 @@ const TriangleTest: React.FC = () => {
height={100}
fill="red"
direction="right"
- color="green"
/>
<Triangle
style={{
@@ -42,7 +40,6 @@ const TriangleTest: React.FC = () => {
height={100}
fill="red"
direction="top"
- color="green"
/>
<Triangle
style={{
@@ -52,7 +49,6 @@ const TriangleTest: React.FC = () => {
height={100}
fill="red"
direction="bottom"
- color="green"
/>
</AbsoluteFill>
);
diff --git a/packages/shapes/src/triangle.tsx b/packages/shapes/src/triangle.tsx
index 2e5a423a5a..0e69d07798 100644
--- a/packages/shapes/src/triangle.tsx
+++ b/packages/shapes/src/triangle.tsx
@@ -4,7 +4,6 @@ import {makeTriangle} from './make-triangle';
export type TriangleProps = {
width: number;
height: number;
- color: string;
fill?: string;
direction: 'right' | 'left' | 'top' | 'bottom';
style?: React.CSSProperties;