1
现在,我想将我的简单动画SVG转换为使用CSS动画,但我不确定如何执行映射。在这个特定的svg中有两个动画元素。SMIL to CSS动画:单个元素上的多个动画
#embedded {
color: red;
}
<svg id="embedded" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
<circle cx="50" cy="50" r="45" stroke="rgba(43,43,43,0.3)" fill="none" stroke-width="10" stroke-linecap="round"/>
<circle cx="50" cy="50" r="45" stroke="currentColor" fill="none" stroke-width="6" stroke-linecap="round">
<animate attributeName="stroke-dashoffset" dur="2s" repeatCount="indefinite" from="0" to="502"/>
<animate attributeName="stroke-dasharray" dur="2s" repeatCount="indefinite" values="150.6 100.4;1 250;150.6 100.4"/>
</circle>
</svg>
虽然我似乎开始了罚款与这些CSS规则我很快就陷入
stroke-dasharray: 150.6 100.4 1 250 150.6 100.4;
animation-duration: 2s;
animation-iteration-count: infinite;
stroke-dashoffset: ?;
将完整映射会是什么样子?它有可能吗? Sara Soueidan说,并不是所有的动画都可以使用使用SMIL的CSS。
哇,这是正确的太好了! – oligofren
不客气@oligofren。乐于帮助。顺便说一下,我最近读到,即使Chrome正在重新考虑他们关于废弃SMIL动画的决定。所以也许所有的都不会丢失:) – Harry
在相关的说明:http://stackoverflow.com/questions/42246883 – oligofren