This example demonstrates smooth zoom transitions using d3-zoom. Every 2.5 seconds, a circle is randomly selected, and the transform to position the circle at the center of the viewport is computed as follows:
function transform() {
return d3.zoomTransform()
.translate(width / 2, height / 2)
.scale(8)
.translate(-circle.x, -circle.y);
}
Then, transition.call is used to invoke zoom.transform with the new transform, initiating a smooth zoom transition from the current transform.
forked from mbostock's block: Zoom Transitions
https://d3js.org/d3-array.v0.7.min.js
https://d3js.org/d3-random.v0.2.min.js
https://d3js.org/d3-color.v0.4.min.js
https://d3js.org/d3-dispatch.v0.4.min.js
https://d3js.org/d3-ease.v0.7.min.js
https://d3js.org/d3-interpolate.v0.7.min.js
https://d3js.org/d3-selection.v0.7.min.js
https://d3js.org/d3-timer.v0.4.min.js
https://d3js.org/d3-transition.v0.2.min.js
https://d3js.org/d3-zoom.v0.0.min.js