path-rite

scalePath

Scale a path uniformly from the origin.

scalePath(svgPath: string, factor: number): string

svgPath — SVG path d-attribute string.

factor — Scale factor. Values greater than 1 enlarge, less than 1 shrink.

Returns — A new SVG path string scaled from the origin.

// Double the size of a shape
const bigger = pathRite.scalePath("M 0 0 L 50 0 L 50 50 Z", 2);