path-rite

reroundPath

Rebuild a path with new corner radii using bezier curve approximation.

reroundPath(svgPath: string, radius: number): string

svgPath — SVG path d-attribute string.

radius — Corner radius in SVG units. Corners are replaced with cubic bezier curves approximating circular arcs.

Returns — A new SVG path string with rounded corners.

// Round the corners of a square
const rounded = pathRite.reroundPath("M 0 0 L 100 0 L 100 100 L 0 100 Z", 10);