centerPath()
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.
center-path.tsimport {centerPath } from "@remotion/paths"; constnewPath =centerPath ("M 10 10 L 20 20"); // M -5 -5 L 5 5
Arguments
path
The original SVG path.
target?
The point that the center of the bounding box should be translated to. Default: {x: 0, y: 0}.
center-path-target.tsimport {centerPath } from "@remotion/paths"; constnewPath =centerPath ("M 10 10 L 20 20", {x : 100,y : 50 }); // M 95 45 L 105 55
Return value
Returns a new string containing the translated path.
This function will throw if the SVG path is invalid.