matrix() 方法
matrix() 方法把所有 2D 转换方法组合在一起。
matrix() 方法需要六个参数,包含数学函数,允许您:旋转、缩放、移动以及倾斜元素。
示例代码
如何使用 matrix 方法将 div 元素旋转 30 度:
div
{
transform:matrix(0.866,0.5,-0.5,0.866,0,0);
-ms-transform:matrix(0.866,0.5,-0.5,0.866,0,0); /* IE 9 */
-moz-transform:matrix(0.866,0.5,-0.5,0.866,0,0); /* Firefox */
-webkit-transform:matrix(0.866,0.5,-0.5,0.866,0,0); /* Safari and Chrome */
-o-transform:matrix(0.866,0.5,-0.5,0.866,0,0); /* Opera */
}
$v.lab.setValue({ active:'css', html:' <!DOCTYPE HTML>\n
\n
\n \n \n\n
你好。这是一个 div 元素。\n
\n
\n
你好。这是一个 div 元素。\n
\n
\n
\n',
css:'
div\n
{\n
width:100px;\n
height:75px;\n
background-color:yellow;\n
border:1px solid black;\n
}\n
div#div2\n
{\n
transform:matrix(0.866,0.5,-0.5,0.866,0,0);\n
-ms-transform:matrix(0.866,0.5,-0.5,0.866,0,0); / IE 9 /\n
-moz-transform:matrix(0.866,0.5,-0.5,0.866,0,0); / Firefox /\n
-webkit-transform:matrix(0.866,0.5,-0.5,0.866,0,0); / Safari and Chrome /\n
-o-transform:matrix(0.866,0.5,-0.5,0.866,0,0); / Opera /\n
}\n
'
});