I am getting up to speed with D3 and stumbled upon an excellent script that binds nodes with elliptical arcs. All I am trying (and failing) to achieve is to create a circle and to animate it so that it runs along the arc between two nodes -say between node A and node B.
我正在快速使用D3并偶然发现一个优秀的脚本,它将节点与椭圆弧绑定在一起。我正在尝试(并且失败)实现的是创建一个圆并对其进行动画处理,使其沿着节点A和节点B之间的两个节点之间的弧线运行。
I think my issue is that I am failing to properly reference the arcs (or 'links'). The piece of code that should be doing this is as follows:
我认为我的问题是我无法正确引用弧(或“链接”)。应该这样做的代码如下:
UPDATED --------
var pathx = d3.select("path#A->B"),
I think I am nearly there. Please find the jsfiddle thus far -the bit that is supposed to animate the circle can be found between the //animations
and //end animations
tags. http://jsfiddle.net/Guill84/uxy8d9vs/3/
我想我快到了。请找到目前为止的jsfiddle - 可以在//动画和//结束动画标签之间找到应该为圆圈设置动画的位。 http://jsfiddle.net/Guill84/uxy8d9vs/3/
I am basically trying to adapt this working example here: http://bl.ocks.org/KoGor/8162640
我基本上试图在这里调整这个工作示例:http://bl.ocks.org/KoGor/8162640
1 个解决方案
#1
0
The reason I could not get the animation to work was because the script was running before the dom had finished loading ...
我无法让动画工作的原因是因为脚本在dom完成加载之前运行了...
Delaying the animations by a second or so solved the issue. Am surprised D3 cannot handle this better though.
将动画延迟一秒左右就解决了这个问题。我很惊讶D3无法更好地处理这个问题。
#1
0
The reason I could not get the animation to work was because the script was running before the dom had finished loading ...
我无法让动画工作的原因是因为脚本在dom完成加载之前运行了...
Delaying the animations by a second or so solved the issue. Am surprised D3 cannot handle this better though.
将动画延迟一秒左右就解决了这个问题。我很惊讶D3无法更好地处理这个问题。