Zak's关于How to animate an object along a GeoJSON path using d3.js?的问答是一个如何使圆圈沿d3.svg.line()生成的路径移动的示例:
// via Zak's fiddle @ http://jsfiddle.net/5m35J/6/
duration = 10000;
circle.transition()
.duration(duration)
.ease("linear")
.attrTween("transform", function (d, i) {
return function (t) {
var p = pathNode.getPointAtLength(pathLength*t);
return "translate(" + [p.x, p.y] + ")";
}
});
参考这段代码,有可能知道在动画的给定帧中,圆圈何时到达了线上的特定点?我如何识别圆圈何时通过构成线条的特定坐标,例如:
[-75.195794106, 43.092815735,"140.7"]
感谢。