path-rite

scalePathXY

Scale a path with separate x and y factors from the origin.

scalePathXY(svgPath: string, sx: number, sy: number): string

svgPath — SVG path d-attribute string.

sx — Horizontal scale factor.

sy — Vertical scale factor.

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

// Stretch horizontally, keep vertical size
const wide = pathRite.scalePathXY("M 0 0 L 50 0 L 50 50 Z", 2, 1);