path-rite

scalePathAround

Scale a path uniformly around a center point.

scalePathAround(svgPath: string, factor: number, centerX: number, centerY: number): string

svgPath — SVG path d-attribute string.

factor — Scale factor.

centerX — X coordinate of the scale center.

centerY — Y coordinate of the scale center.

Returns — A new SVG path string scaled around the given center point.

// Scale a shape to half size around its center at (50, 50)
const smaller = pathRite.scalePathAround("M 0 0 L 100 0 L 100 100 Z", 0.5, 50, 50);