我需要使用变换矩阵来动画化一个元素的 transform: scale。
我希望将其从 0 缩放到 1。 如果我使用以下代码,它可以正常工作:
.container {
width: 200px;
height: 100px;
background: yellow;
transform: scale(0);
transition: transform 1s;
}
.container.open {
transform: scale(1);
}
https://jsfiddle.net/w4kuth78/1/
如果我使用矩阵本身,它是不起作用的。
.container {
width: 200px;
height: 100px;
background: yellow;
transform: matrix(0, 0, 0, 0, 0, 0);
transition: transform 1s;
}
.container.open {
transform: matrix(1, 0, 0, 1, 0, 0);
}
https://jsfiddle.net/m7qpetkh/1/
我做错了什么还是这个代码根本就不起作用?我有疑问,因为它在Chrome和Firefox中都不起作用...
控制台调试输出显示,在从0缩放到1时,矩阵也从matrix(0,0,0,0,0,0)设置为matrix(1,0,0,1,0,0)。
编辑:
完全混乱...如果我将矩阵中的scaleX和scaleY值更改为0.1或0.01,则可以正常工作...哇