by toufka · 6y ago · 0 comments
There are many that allow you to generate an svg, but it's been hard to find those that allow you to manipulate an existing svg.
const path = new Svg('M 0 0 L 1 1');
path.translate(1, 2); // Translates (x:1pt , y:2pt)
path.scale(2, 3); // Scales (x:200%, y:300%)
path.setRelative(true); // Converts the path to use only relative commands
path.asString(); // Export the path with no minification
path.asString(1, true); // Export the path with 4 decimals, and minification
I wanted to publish them separately on npm, but didn't had time to do it :)