packages/docs/docs/paths/center-path.mdx
Part of the @remotion/paths package. Available from v4.0.486
Translates an SVG path so that the center of the bounding box is at a target point.
By default, the path is centered around 0, 0.
import { centerPath } from "@remotion/paths";
const newPath = centerPath("M 10 10 L 20 20"); // M -5 -5 L 5 5
The original SVG path.
The point that the center of the bounding box should be translated to. Default: {x: 0, y: 0}.
import { centerPath } from "@remotion/paths";
const newPath = centerPath("M 10 10 L 20 20", { x: 100, y: 50 }); // M 95 45 L 105 55
Returns a new string containing the translated path.
This function will throw if the SVG path is invalid.