【发布时间】:2017-07-04 01:39:09
【问题描述】:
现在SMIL is dying 我想将我的简单动画 SVG 转换为使用 CSS 动画,但我不太确定如何进行映射。在这个特定的 svg 中有 两个 动画元素。
#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 表示并非所有动画都可以使用 CSS 实现,而使用 SMIL 可以实现。
【问题讨论】:
标签: css animation css-animations svg-animate smil