css3 converting matrix3d values

拜拜、爱过 提交于 2019-12-19 21:50:08

问题


I want to know how to get the rotateX and rotateY values of a matrix3d such as this:

matrix3d(0.9999999970415847, 0, 0.00007692093651178932, 0, 0, 1, 0, 0, -0.00007692093651178932, 0, 0.9999999970415847, 0, 0, 0, 300, 1)

does anybody know how to this ? I would really appreciate the help especially since I am not really the math type of person. thnx!


回答1:


I'm not good at math either, so this needs some checking by someone with more knowledge than me:

var matrix = new WebKitCSSMatrix(el.style.webkitTransform);
var rotationX = Math.acos(matrix.a) * (180/pi);
var rotationY = Math.asin(matrix.b) * (180/pi);

You can view a demo here:

http://jsfiddle.net/YsCF5/



来源:https://stackoverflow.com/questions/8890888/css3-converting-matrix3d-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!