[英]D3JS - animate a circle along an svg path at a constant speed
I'd like to move a circle along a path using d3.js. 我想使用d3.js沿路径移动一个圆圈。 I used the code from Mike Bostocks' website here:
我使用了Mike Bostocks网站上的代码:
http://bl.ocks.org/KoGor/8162640 http://bl.ocks.org/KoGor/8162640
I'd like to move my circle at a constant speed along the path and have it moving immediately after it has been added to my svg. 我想沿着路径以恒定的速度移动我的圆圈,并在它被添加到我的svg之后立即移动它。 I cannot see how to twist the code here to make it work.
我无法看到如何在这里扭曲代码使其工作。
Does anybody have an idea how to do this? 有人知道怎么做吗?
Best 最好
You should just add a line 你应该添加一行
.ease("linear")
after .duration(7500)
, and you should be all set. 在
.duration(7500)
,你应该全力以赴。
This is documentation on ease() , but you should read all that is related to transitions, while you ate at it... 这是关于ease()的文档 ,但你应该阅读所有与转换相关的内容,同时你吃了它...
Here is also a test example for various possibilities related to ease()
: 这里还有一个与
ease()
相关的各种可能性的测试示例 :
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.