【发布时间】:2016-08-27 17:01:24
【问题描述】:
我试图弄清楚如何使用http://snapsvg.io 使我的文本沿着圆形路径连续循环。我已经能够让它沿着路径移动,但它一旦到达终点就停止了。
这是一个 jsfiddle:https://jsfiddle.net/12x6q368/
<svg id="svgout" width="100%" height="100%" viewBox="0 0 960 560" style="enable-background:new 0 0 960 560;" xml:space="preserve"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
</svg>
<script>
var s = Snap("#svgout");
var path = "M830.3,379.4c-17.2,73.3-202.5,92.4-413.8,42.7S48,272.7,65.2,199.4 s202.5-92.4,413.8-42.7S847.6,306.2,830.3,379.4z";
var text = s.text(1000,50,'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.')
.attr({ 'textpath': path })
.textPath.animate({ 'startOffset': -2000 }, 4000 );
</script>
如有必要,我也愿意使用其他库。
【问题讨论】:
标签: javascript animation svg path snap.svg