css3 转换 matrix3d 值 [英] css3 converting matrix3d values

查看:45
本文介绍了css3 转换 matrix3d 值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何获取 matrix3d 的 rotateX 和 rotateY 值,例如:

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!

推荐答案

我也不擅长数学,所以这需要比我更了解的人检查一下:

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/

这篇关于css3 转换 matrix3d 值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆