🎥 Make videos programmatically with React
document resetPath()
Jonny Burger0b2e79ebd67c
diff --git a/packages/docs/components/TableOfContents/paths.tsx b/packages/docs/components/TableOfContents/paths.tsxindex 5121343619..839a9e63e6 100644--- a/packages/docs/components/TableOfContents/paths.tsx+++ b/packages/docs/components/TableOfContents/paths.tsx@@ -63,6 +63,12 @@ export const TableOfContents: React.FC = () => {<strong>getBoundingBox()</strong><div>Get the bounding box of a SVG path</div></TOCItem>+ <TOCItem link="/docs/paths/reset-path">+ <strong>resetPath()</strong>+ <div>+ Translates an SVG path to <code>(0, 0)</code>+ </div>+ </TOCItem></Grid></div>);diff --git a/packages/docs/docs/paths/reset-path.md b/packages/docs/docs/paths/reset-path.mdnew file mode 100644index 0000000000..b778fe267c--- /dev/null+++ b/packages/docs/docs/paths/reset-path.md@@ -0,0 +1,23 @@+---+title: resetPath()+crumb: "@remotion/paths"+---++_Part of the [`@remotion/paths`](/docs/paths) package. Available from v3.3.40_++Translates an SVG path so that the top-left corner of the bounding box is at `0,0`. Useful for simplifying the math when transforming the coordinates of an SVG path.++```tsx twoslash title="reset-path.ts"+import { getBoundingBox, resetPath } from "@remotion/paths";++const newPath = resetPath("M 35,50 a 25,25,0,1,1,50,0 a 25,25,0,1,1,-50,0");+const { x1, y1 } = getBoundingBox(newPath);+// {x1: 0, x2: 0};+```++This function will throw if the SVG path is invalid.++## See also++- [`@remotion/paths`](/docs/paths)+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/paths/src/reset-path.ts)diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex 576a3f6fef..ad658d8995 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -264,6 +264,7 @@ module.exports = {"paths/get-subpaths","paths/translate-path","paths/get-bounding-box",+ "paths/reset-path",],},{