Skip to main content

getLength()

Part of the @remotion/paths package.

Gets the length of an SVG path. The argument must be a valid SVG path property.

A number is returned if the path is valid:

import { getLength } from "@remotion/paths";

const length = getLength("M 0 0 L 100 0");
console.log(length); // 100

The function will throw if the path is invalid:

getLength("remotion"); // Error: Malformed path data: ...

Credits

Source code stems mostly from svg-path-properties.

See also