【发布时间】:2014-11-07 07:37:47
【问题描述】:
我不知道如何准确地描述它。 Here's a fiddle,带有 Base64 格式的 SVG,其内容为:
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg">
<path d="M2 7v2h6c.6 0 1-.5 1-1s-.5-1-1-1H2z" fill="#fff" transform="rotate(135, 8, 8)">
<animateTransform attributeName="transform" begin="0s" dur="0.8s" from="405 8 8" repeatCount="indefinite" to="45 8 8" type="rotate"/>
</path>
<path d="M4.2 7c0 .3-.2.6-.2 1s.1.7.2 1H8c.6 0 1-.5 1-1s-.5-1-1-1H4.2z" fill="#fff" transform="rotate(45, 8, 8)">
<animateTransform attributeName="transform" begin="0s" dur="1.4s" from="135 8 8" repeatCount="indefinite" to="495 8 8" type="rotate"/>
</path>
<circle cx="8" cy="8" fill="none" r="6" stroke="#fff" stroke-width="2"/>
</svg>
(最初它是隐藏在样式表中的不重复背景图像)。
现在,在 Chrome 中,这会产生我所期望的结果:
但在 Firefox 中,发生了一些奇怪的事情(请原谅 gif 的颜色关闭):
如果无论如何它必须强制重新绘制该区域,它似乎只会渲染动画的一帧。此外,多次点击运行会在不同的帧中呈现 SVG,这让我更加困惑(加载文档时它应该位于 0s...)。
这让我很困惑。我只能假设这是一个错误,但我想找到一种解决方法来解决它。我唯一能想到的就是让它每隔一段时间强制重新绘制 SVG 所在的区域,但我不知道该怎么做......
有什么想法吗?
编辑:也许问题出在 SVG 本身,但我仍然不知道是什么。
编辑 2: 如果我 remove the <circle>,问题就会消失。什么??这不是一个可接受的解决方案...
【问题讨论】:
标签: html firefox svg html-rendering svg-animate