getLength()
Part of the @remotion/paths
package.
Gets the length of an SVG path. The length must
A number is returned if the path is valid:
tsx
import {getLength } from "@remotion/paths";constlength =getLength ("M 0 0 L 100 0");console .log (length ); // 100
tsx
import {getLength } from "@remotion/paths";constlength =getLength ("M 0 0 L 100 0");console .log (length ); // 100
The function will throw if the path is invalid:
tsx
getLength ("remotion"); // Error: Malformed path data: ...
tsx
getLength ("remotion"); // Error: Malformed path data: ...
Credits
Source code stems mostly from svg-path-properties.