Skip to content

Instantly share code, notes, and snippets.

@psaia
Created October 17, 2015 00:52
Show Gist options
  • Save psaia/5989aa03f8cdbd09829e to your computer and use it in GitHub Desktop.
Save psaia/5989aa03f8cdbd09829e to your computer and use it in GitHub Desktop.
function convert(path) {
var arr = [];
var len = path.getTotalLength();
var p;
for (var i = 0; i < len; i++) {
p = path.getPointAtLength(i);
arr.push([parseFloat(p.x), parseFloat(p.y)]);
}
return JSON.stringify(arr);
}
convert(document.getElementByTagName('path')[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment