Css高阶用法(一) matrix

html-css011

Css高阶用法(一) matrix,第1张

"点积" 是把 对称的元素相乘,然后把结果加起来:

(1, 2, 3) • (7, 9, 11) = 1×7 + 2×9 + 3×11 = 58

我们把第一个元素相配(1 和 7),然后相乘。第二个元素(2 和 9) 和第三个元素(3 和 11)也一样,然后把结果加起来。

总共有6个可动的参数,这六个参数分别控制不同的变换

| a b 0 |

| c d 0 |

| tx ty 1 |

当矩阵为1的单元矩阵的时候,表明该图形没有变换

缩放:scale(sx, sy) 等同于 matrix(sx, 0, 0, sy, 0, 0)

平移:translate(tx, ty) 等同于 matrix(1, 0, 0, 1, tx, ty)

旋转:rotate(deg) 等同于 matrix(cos(deg), sin(deg), -sin(deg), cos(deg), 0, 0)

拉伸:skew(degx, degy) 等同于 matrix(1, tan(degy), tan(degx), 1, 0, 0)

rotate(deg) === matrix(cos(deg), sin(deg), -sin(deg), cos(deg), 0, 0)

由(x,y)旋转到(x',y ')

所以 css中的矩阵表示为:

matrix(cos(deg), sin(deg), -sin(deg), cos(deg), 0, 0)

http://tridiv.com/

让一个物体水平和垂直运动

https://cubic-bezier.com/#.17,.67,.83,.67

https://developer.mozilla.org/zh-CN/docs/Web/CSS/Reference

https://www.shuxuele.com/algebra/matrix-introduction.html

https://www.shuxuele.com/algebra/matrix-multiplying.html

https://www.zhangxinxu.com/wordpress/2012/06/css3-transform-matrix-%E7%9F%A9%E9%98%B5/

https://segmentfault.com/a/1190000009036596

按顺时针排列,四个数字分别对应:margin-top margin-right margin-bottom margin-left,只写0 200px 是相互对称 0 200PX 0 200PX这个是简便的缩写