svg-line-segments

1.0.0 • Public • Published

svg-line-segments

turn a linearized svg into an array of paths of [x,y] pairs

example

var segments = require('svg-line-segments');
var linearize = require('svg-linearize');
var loadsvg = require('load-svg');
 
loadsvg('face.svg', function (err, svg) {
    var points = segments(linearize(svg));
    document.body.innerText = JSON.stringify(points);
});

Compile with browserify and serve up the bundle in a directory with a face.svg file:

$ beefy points.js

methods

var segments = require('svg-line-segments')

var points = segments(svg)

Given a linearized svg image with paths that only contain M and L commands, return an array arrays of points for each <path> in the svg or null if the svg isn't linearized.

You can linearize an svg with svg-linearize.

install

With npm do:

npm install svg-line-segments

license

MIT

Package Sidebar

Install

npm i svg-line-segments

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • nopersonsmodules