Suppose I have css3 transform style:
img
{
-webkit-transform:rotate(10deg) translate(100px,20px);
-moz-transform:rotate(10deg) translate(100px,20px);
}
then I use jquery get it style:
console.log($('#clone').css('-moz-transform'));
it only return me a series number:
matrix(0.984808, 0.173648, -0.173648, 0.984808, 95.0078px, 37.061px)
Is there a js plugin which could turn the matrix number to the transform?Or turn to the other side?
Numbers you're getting are the result of multiplying Rotation and Translation matrices.
Although for your case you could get by easily by doing the math on paper and getting the formulas you need by hand, for increasing number of terms it would be a teadious task (you need to know the structure of original trasforms in order to reverse them as well).
Here's a link that will help you:
http://www.useragentman.com/blog/2011/01/07/css3-matrix-transform-for-the-mathematically-challenged/
Why not just set those value you need from Javascript code and therefore eliminate need for geting them from matrix at all?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With