reversePath()
Part of the @remotion/paths package.
Reverses a path so the end and start are switched.
tsximport {reversePath } from "@remotion/paths";constreversedPath =reversePath ("M 0 0 L 100 0");console .log (reversedPath ); // "L 100 0 M 0 0"
tsximport {reversePath } from "@remotion/paths";constreversedPath =reversePath ("M 0 0 L 100 0");console .log (reversedPath ); // "L 100 0 M 0 0"
The function will throw if the path is invalid:
tsxreversePath ("remotion"); // Error: Malformed path data: ...
tsxreversePath ("remotion"); // Error: Malformed path data: ...
Credits
Source code stems mostly from svg-path-reverse.