我创建了 D3 地球仪。我遇到了问题,现在点击绘图,地图放大但它不是平滑放大。我需要用平滑过渡放大地图。 http://projectsdemo.net/globe/v4/
globe.focus = function(d, k) { d3.selectAll('.globe').transition()
.duration(2000)
.tween("transform", function() {
var centroid = d3.geo.centroid(d);
var r = d3.interpolate(projection.rotate(), [-centroid[0], -centroid[1], 0]);
return function(t) {
//projection.rotate(r(t));
pathG.selectAll("path").attr("d", path);
var clipExtent = projection.clipExtent();
//projection.scale(1).translate([0, 0]).clipExtent(null);
//var b = path.bounds(d);
var minScale = 270,
maxScale = minScale * 5;
projection.rotate(r(t)).scale(Math.max(minScale, Math.min(maxScale, k)))
.translate([width / 2, height / 2])
.clipExtent(clipExtent);
}
});