path-rite

rotatePath

Rotate a path around the origin.

rotatePath(svgPath: string, angle: number): string

svgPath — SVG path d-attribute string.

angle — Rotation angle in radians.

Returns — A new SVG path string rotated around the origin.

// Rotate 90 degrees (pi/2 radians) around origin
const rotated = pathRite.rotatePath("M 0 0 L 100 0 L 100 100 Z", Math.PI / 2);