Created
April 28, 2016 19:57
-
-
Save Tom-Alexander/d23fe9a480b2573ccfaec7c7e4aa0b23 to your computer and use it in GitHub Desktop.
Converts an SVG polygon to a path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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