Skip to content

🎥 Make videos programmatically with React

better documentation

Jonny Burger7d197da4e9d4
diff --git a/packages/docs/docs/paths/get-length.md b/packages/docs/docs/paths/get-length.md
index 523004a569..04a9078f70 100644
--- a/packages/docs/docs/paths/get-length.md
+++ b/packages/docs/docs/paths/get-length.md
@@ -22,3 +22,9 @@ import { getLength } from "@remotion/paths";
// ---cut---
getLength("remotion"); // Error: Malformed path data: ...
```
+
+## See also
+
+- [getPointAtLength()](/docs/paths/get-point-at-length)
+- [getTangentAtLength()](/docs/paths/get-point-at-length)
+- [`@remotion/paths`](/docs/paths)
diff --git a/packages/docs/docs/paths/get-parts.md b/packages/docs/docs/paths/get-parts.md
index 41374b7ce8..75d895d4e3 100644
--- a/packages/docs/docs/paths/get-parts.md
+++ b/packages/docs/docs/paths/get-parts.md
@@ -115,3 +115,7 @@ const parts = getParts(`
// ---cut---
console.log(parts[0].getTangentAtLength(50)); // { x: 1, y: 0 }
```
+
+## See also
+
+- [`@remotion/paths`](/docs/paths)
diff --git a/packages/docs/docs/paths/get-point-at-length.md b/packages/docs/docs/paths/get-point-at-length.md
index 34d48f42ab..97fedeb5a2 100644
--- a/packages/docs/docs/paths/get-point-at-length.md
+++ b/packages/docs/docs/paths/get-point-at-length.md
@@ -23,3 +23,22 @@ import { getPointAtLength } from "@remotion/paths";
// ---cut---
getPointAtLength("remotion", 50); // Error: Malformed path data: ...
```
+
+## Example: Getting the middle point of a path
+
+Use [`getLength()`](/docs/paths/get-length) to get the total length of a path and then multiply it with a number between 0 and 1 to get any point on the path. For example, `length * 0.5` to get the coordinate of the middle of the path.
+
+```tsx twoslash
+import { getLength, getPointAtLength } from "@remotion/paths";
+
+const path = "M 0 0 L 100 0";
+const length = getLength(path);
+const point = getPointAtLength(path, length * 0.5);
+
+console.log(point); // { x: 50, y: 0 }
+```
+
+## See also
+
+- [getLength()](/docs/paths/get-length)
+- [`@remotion/paths`](/docs/paths)
diff --git a/packages/docs/docs/paths/get-tangent-at-length.md b/packages/docs/docs/paths/get-tangent-at-length.md
index 53fd016349..2ba3927525 100644
--- a/packages/docs/docs/paths/get-tangent-at-length.md
+++ b/packages/docs/docs/paths/get-tangent-at-length.md
@@ -22,3 +22,9 @@ import { getTangentAtLength } from "@remotion/paths";
// ---cut---
getTangentAtLength("remotion", 50); // Error: Malformed path data: ...
```
+
+## See also
+
+- [getLength()](/docs/paths/get-length)
+- [getPointAtLength()](/docs/paths/get-point-at-length)
+- [`@remotion/paths`](/docs/paths)
diff --git a/packages/docs/docs/paths/index.md b/packages/docs/docs/paths/index.md
index 85b189ec2a..ffb205e11d 100644
--- a/packages/docs/docs/paths/index.md
+++ b/packages/docs/docs/paths/index.md
@@ -9,7 +9,7 @@ A package providing utility functions for dealing with SVG paths. This package c
- Documentation with examples
- ESM import style
-No dependencies are needed, meaning this package can be used independently of Remotion. Its license is MIT.
+No dependencies are needed, meaning this package can be used independently of Remotion.
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
@@ -55,3 +55,7 @@ yarn add @remotion/paths
- [`reversePath()`](/docs/paths/reverse-path)
- [`normalizePath()`](/docs/paths/normalize-path)
- [`getTangentAtLength()`](/docs/paths/get-tangent-at-length)
+
+## License
+
+MIT
diff --git a/packages/docs/docs/paths/normalize-path.md b/packages/docs/docs/paths/normalize-path.md
index 4fdf09bc14..9bd7ff9bc0 100644
--- a/packages/docs/docs/paths/normalize-path.md
+++ b/packages/docs/docs/paths/normalize-path.md
@@ -22,3 +22,7 @@ import { normalizePath } from "@remotion/paths";
// ---cut---
normalizePath("remotion"); // Error: Malformed path data: ...
```
+
+## See also
+
+- [`@remotion/paths`](/docs/paths)
diff --git a/packages/docs/docs/paths/reverse-path.md b/packages/docs/docs/paths/reverse-path.md
index e6a9fb7a10..ffafe7bde5 100644
--- a/packages/docs/docs/paths/reverse-path.md
+++ b/packages/docs/docs/paths/reverse-path.md
@@ -20,3 +20,7 @@ import { getLength } from "@remotion/paths";
// ---cut---
getLength("remotion"); // Error: Malformed path data: ...
```
+
+## See also
+
+- [`@remotion/paths`](/docs/paths)
diff --git a/packages/paths/READNE.md b/packages/paths/READNE.md
new file mode 100644
index 0000000000..f66bf8d5ae
--- /dev/null
+++ b/packages/paths/READNE.md
@@ -0,0 +1,23 @@
+## @remotion/paths
+
+A package providing utility functions for dealing with SVG paths. This package consists of code from [`svg-path-properties`](https://www.npmjs.com/package/svg-path-properties) and [`svg-path-reverse`](https://github.com/Pomax/svg-path-reverse#readme) with the following improvements:
+
+- Functional style APIs
+- First class Typescript types
+- Documentation with examples
+- ESM import style
+
+No dependencies are needed, meaning this package can be used independently of Remotion.
+
+## API
+
+- [`getLength()`](https://remotion.dev/docs/paths/get-length)
+- [`getParts()`](https://remotion.dev/docs/paths/get-parts)
+- [`getPointAtLength()`](https://remotion.dev/docs/paths/get-point-at-length)
+- [`reversePath()`](https://remotion.dev/docs/paths/reverse-path)
+- [`normalizePath()`](https://remotion.dev/docs/paths/normalize-path)
+- [`getTangentAtLength()`](https://remotion.dev/docs/paths/get-tangent-at-length)
+
+## License
+
+MIT
diff --git a/packages/paths/package.json b/packages/paths/package.json
index 2380c515e5..76dc3023c5 100644
--- a/packages/paths/package.json
+++ b/packages/paths/package.json
@@ -10,7 +10,7 @@
"build": "tsc -d",
"test": "vitest --run"
},
- "author": "",
+ "author": "Jonny Burger <[email protected]>",
"license": "MIT",
"repository": {
"url": "https://github.com/remotion-dev/remotion"