码迷,mamicode.com
首页 > 其他好文 > 详细

matrix矩阵

时间:2014-10-27 17:29:12      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:blog   os   for   sp   div   log   bs   ef   工作   

matrix(a,b,c,d,e,f)

x’        | a c e  |     x

y’    =  | b d f  |     y

1        |  0 0 1  |    1

 

这就是矩阵的运算了,简化为公式:
x’=ax+cy+e
y’=bx+dy+f

 

css3的transform属性很好用,其实可以变换为matrix矩阵工作,只需要给abcdef附上相应的值就可以了。

比如translate(tx,ty)可以由matrix(1,0,0,1,tx,ty)转换而来,计算方法见公式
scale(sx,sy)可以由matrix(sx,0,0,sy,0,0)转变
rotate(θ)可以有matrix(cosθ,sinθ,-sinθ,cosθ,0,0)转变而来
skew(θx,θy)可以由matrix(1,tan(θy),tan(θx),1,0,0)转变过来

matrix矩阵

标签:blog   os   for   sp   div   log   bs   ef   工作   

原文地址:http://www.cnblogs.com/bigdesign/p/4054592.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!