【发布时间】:2015-03-17 09:37:23
【问题描述】:
我实际上是 snap SVG 中的一个爬行婴儿,鉴于在线可用资源的数量对于像我这样的新手来说是不够的,我想我会在这里问。我想学习如何使用 CSS3 动画来制作我在 SVG 中生成的动画,但是我最近发现,FF、IE 在 SVG 中的 CSS3 动画和 CSS3 转换存在一些问题,所以我只使用 webkit,我决定为其他人使用 Snap SVG,我想你知道我的意思。无论如何,这是动画的一瞥:
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="711.1px" height="717.1px" viewBox="0 0 711.1 717.1" enable-background="new 0 0 711.1 717.1" xml:space="preserve">
<circle class="circle" fill="none" stroke="#FD4F00" stroke-width="66" stroke-miterlimit="10" cx="355.55" cy="358.55" r="285.956"/>
</svg>
这是 CSS3 动画:
.circle {
stroke-dasharray: 2000;
stroke-dashoffset: 2000;
-webkit-animation: dash 5s linear alternate infinite;
-webkit-transform-origin: 50% 50% ;
-webkit-transform: rotate(-90deg) ;
}
@-webkit-keyframes dash {
from {
stroke-dashoffset: 2000;
}
to {
stroke-dashoffset: 0;
}
}
Here is the Fiddle, to see the Full animation in action 所以你可以在这里看到我在说什么。
感谢您的帮助,我很抱歉,因为我是 Snap SVG 的新手,我真的不知道如何实现该动画,所以我希望从这个迷你项目中学习。
编辑:好的,我已经完成了动画Here is a Fiddle。现在唯一的问题是,如何使用 snap.svg 调整 repeatCount ?您能告诉我如何调整 Snap.svg 中的 repeatCount 吗?感谢您的帮助!
【问题讨论】:
标签: javascript jquery css svg