Skip to content

Instantly share code, notes, and snippets.

@vitrum
Created February 8, 2014 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitrum/8876191 to your computer and use it in GitHub Desktop.
Save vitrum/8876191 to your computer and use it in GitHub Desktop.
getTransform
function getTransform(el) {
var results = el.style.transform.match(/matrix(?:(3d)\(\d+(?:, \d+)*(?:, (\d+))(?:, (\d+))(?:, (\d+)), \d+\)|\(\d+(?:, \d+)*(?:, (\d+))(?:, (\d+))\))/)
if(!results) return [0, 0, 0];
if(results[1] == '3d') return results.slice(2,5);
results.push(0);
return results.slice(5, 8);
}
@vitrum
Copy link
Author

vitrum commented Feb 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment