Created
May 5, 2015 18:19
-
-
Save tomgp/ce9f9a5fcfd8b6f76203 to your computer and use it in GitHub Desktop.
get an SVG transform attribute and split it into an object with properties
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 parseTransform (a){ | |
var b={}; | |
a = a.match(/(\w+\((\-?\d+\.?\d*e?\-?\d*,?)+\))+/g); | |
for (var i in a){ | |
if(a.hasOwnProperty(i)){ | |
var c = a[i].match(/[\w\.\-]+/g); | |
b[c.shift()] = c; | |
} | |
} | |
return b; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment