Skip to main content
100%

Zoom to Bounding Box II

✓ Published0🌍 Public
EEvertLagerberg
Last edited May 3, 2016
Created on Sep 3, 2016

This interactive map of the United States lets users click any state to zoom smoothly to its bounding box, while also supporting free pan and zoom via mouse or touch. The visualization uses D3.js v3 with an AlbersUSA projection and TopoJSON state boundaries, rendered as SVG paths. Clicking a state triggers a 750-millisecond zoom transition, adjusting the zoom behavior’s scale and translate to fit the selected feature, while the active state highlights in orange. The zoomed function updates the group’s transform and stroke width inversely with scale, and the background rectangle resets the view when clicked.

AI-generated description

A variant of the Zoom to Bounding Box example that uses zoom transitions to smoothly interpolate between different views. This example also allows you to freely pan and zoom with the mouse (or touch).

gpl-3.0 Licensed

Similar vizzes