Skip to content

Instantly share code, notes, and snippets.

@tomgp
Created May 5, 2015 18:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomgp/ce9f9a5fcfd8b6f76203 to your computer and use it in GitHub Desktop.
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
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