path-rite

translatePath

Move a path by a given offset.

translatePath(svgPath: string, dx: number, dy: number): string

svgPath — SVG path d-attribute string.

dx — Horizontal offset.

dy — Vertical offset.

Returns — A new SVG path string shifted by (dx, dy).

// Move a shape 50 units right and 20 units down
const moved = pathRite.translatePath("M 0 0 L 100 0 L 100 100 Z", 50, 20);