rel-svg-path

define a path using only relative points

rel-svg-path

Define a path using only relative points. Most SVG drawing tools will export paths using absolute points though it can be nicer to tweak them manually when all the points are relative.

With your favourite package manager:

  • packin: packin add jkroso/rel-svg-path
  • component: component install jkroso/rel-svg-path
  • npm: npm install rel-svg-path

then in you code:

var rel = require('rel-svg-path')
rel([['M',10,20],['L',50, 40]]) // => [['m',10,20],['l',40,20]] 

Installation:

git clone https://github.com/jkroso/rel-svg-path.git
cd rel-svg-path
make install

Then just pipe path data to it:

echo "M10 20 50 40" | rel-svg-path

Just run make and navigate your browser to test/index.html