【发布时间】:2016-09-18 00:03:17
【问题描述】:
我当前的 SVG 是使用 SVG SMIL 动画制作的:
<?xml version="1.0" encoding="utf-8"?>
<svg height="512px" viewBox="0 0 100 100" width="512px" xmlns="http://www.w3.org/2000/svg">
<g transform="scale(0.8) translate(-0.6, -0.6)">
<g id="spinner">
<path d="M50 15A35 35 0 1 0 74.787 25.213" fill="none" stroke="#19a29c" stroke-width="8px"/>
<path d="M50 0L50 30L66 15L50 0" fill="#19a29c"/>
<animateTransform attributeName="transform" dur="1.5s" from="0 50 50" repeatCount="indefinite" to="360 50 50" type="rotate"/>
</g>
</g>
</svg>
SVG SMIL 动画在 IE 中不受支持,并且在 Chrome 中已被弃用: http://caniuse.com/#feat=svg-smil
我想用 CSS 动画替换动画部分,使动画得到更广泛的支持和未来的证明:http://caniuse.com/#feat=css-animation
如何将以下 SVG SMIL 动画替换为 CSS 动画?
<animateTransform attributeName="transform" dur="1.5s" from="0 50 50" repeatCount="indefinite" to="360 50 50" type="rotate"/>
【问题讨论】:
-
使用 shim 会更容易,这将是一行更改而不是重写所有代码?
标签: css animation svg css-animations