Skip to content

Instantly share code, notes, and snippets.

@Tom-Alexander
Created April 28, 2016 19:57
Show Gist options
  • Save Tom-Alexander/d23fe9a480b2573ccfaec7c7e4aa0b23 to your computer and use it in GitHub Desktop.
Save Tom-Alexander/d23fe9a480b2573ccfaec7c7e4aa0b23 to your computer and use it in GitHub Desktop.
Converts an SVG polygon to a path
function pathFromPolygon(points) {
var p = points.split(/\s+/);
var path = '';
for( var i = 0, len = p.length; i < len; i++ ) {
path += (i && 'L' || 'M') + p[i]
}
return path;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment