是否有js插件将矩阵参数转换为css3 transform属性? [英] Is there js plugin convert the matrix parameter to css3 transform property?

查看:140
本文介绍了是否有js插件将矩阵参数转换为css3 transform属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有css3转换风格:

Suppose I have css3 transform style:

img
{
   -webkit-transform:rotate(10deg) translate(100px,20px);
   -moz-transform:rotate(10deg) translate(100px,20px);
}

那么我使用jquery get it style:

then I use jquery get it style:

console.log($('#clone').css('-moz-transform'));

它只返回一个系列号:

matrix(0.984808, 0.173648, -0.173648, 0.984808, 95.0078px, 37.061px)

是否有一个js插件可以将矩阵数转换为转换?或者转到另一边?

Is there a js plugin which could turn the matrix number to the transform?Or turn to the other side?

推荐答案

您得到的数字是Rotation和Translation矩阵相乘的结果。

Numbers you're getting are the result of multiplying Rotation and Translation matrices.

虽然对于你的情况,你可以很容易地通过做纸上的数学,获得你需要的公式,对于增加的条款数量,这将是一个可爱的任务(你需要知道原始trasforms的结构,以扭转它们)。

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).

以下链接可以帮助您:

http://www.useragentman.com/blog/2011/01/07/css3-matrix-transform-for-the-mathematically-挑战/

为什么不直接从Javascript代码中设置所需的值,因此无需从矩阵中获取它们?

Why not just set those value you need from Javascript code and therefore eliminate need for geting them from matrix at all?

这篇关于是否有js插件将矩阵参数转换为css3 transform属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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