Created
February 8, 2014 03:20
-
-
Save vitrum/8876191 to your computer and use it in GitHub Desktop.
getTransform
This file contains hidden or 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 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); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can see this form CSS-Tricks: http://css-tricks.com/get-value-of-css-rotation-through-javascript/
Try http://jsfiddle.net/vitrum/66jA4/