normalizePath()
Part of the @remotion/paths
package.
Removes all relative coordinates from a path and converts them into absolute coordinates.
Returns a string if the path is valid:
tsx
import {normalizePath } from "@remotion/paths";constreversedPath =normalizePath ("M 50 50 L 150 50");console .log (reversedPath ); // "M 50 50 L 150 50"
tsx
import {normalizePath } from "@remotion/paths";constreversedPath =normalizePath ("M 50 50 L 150 50");console .log (reversedPath ); // "M 50 50 L 150 50"
The function will throw if the path is invalid:
tsx
normalizePath ("remotion"); // Error: Malformed path data: ...
tsx
normalizePath ("remotion"); // Error: Malformed path data: ...
Credits
Source code stems mostly from svg-path-reverse.