我用Snap SVG创建了一个Codepen: Codepen
我试图让SVG齿轮在自己的中心点上无限循环旋转。
这在Internet Explorer上可以实现,但在Mozilla Firefox和Google Chrome上失败。
Chrome和Firefox中心点似乎错误,因此齿轮会移出其位置。 我使用以下代码进行旋转:
Chrome和Firefox中心点似乎错误,因此齿轮会移出其位置。 我使用以下代码进行旋转:
对于旋转,我使用了以下代码:
function infRotate(el, time, cw) {
var box = el.getBBox();
el.transform('r0,' + box.cx + ',' + box.cy);
if (cw)
el.animate({transform: 'r360,' + box.cx + ', ' + box.cy}, time, mina.linear, infRotate.bind(null, el, time, cw));
else
el.animate({transform: 'r-360,' + box.cx + ', ' + box.cy}, time, mina.linear, infRotate.bind(null, el, time, cw));
}
我需要在Firefox和Chrome中找到正确的中心点,我该怎么做?谢谢您的帮助。