我试图使用SVG <set>
标记对动画进行动画翻转,但即使指定了dur =“1s”,转换也是即时的(在Firefox,Safari,Opera和Chrome中)。SVG <set>标记的dur属性不生成
<html>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red">
<set attributeType="CSS" attributeName="fill" to="green" begin="mouseover" end="mouseout" dur="1s" />
</circle>
</svg>
</body>
</html>
我能做到,我想用两个<animate>
标签的效果,但我希望能够以应用可能,我想保留不同的初始颜色过渡到多个元素(此方法需要我指定第二个动画标签中的初始颜色为“红色”)。
<html>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red">
<animate attributeType="CSS" attributeName="fill" to="green" begin="mouseover" dur="1s" fill="freeze" />
<animate attributeType="CSS" attributeName="fill" to="red" begin="mouseout" dur="1s" fill="freeze"/>
</circle>
</svg>
</body>
</html>
在第一代码段的<set>
标签保留了初始颜色,但过渡不显示动画。如果我对w3规范的理解是正确的,那应该是 - 这看起来像是一个特定于浏览器的错误,还是我误解了w3规范?有没有更好的方法来解决这个问题?
摄制情况:http://jsfiddle.net/4xx5p/(这是在Safari以及Firefox的真) – Phrogz 2012-04-10 00:59:59
感谢您验证它不会在Safari工作,要么;我刚刚在Opera和Chrome中进行了测试,我也在那里得到了相同的行为。 – yasashiku 2012-04-10 03:55:33