click-to-zoom via transform
Clicking a US state smoothly zooms the map to that state, centering it and enlarging it fourfold; clicking again restores the full national view. The example builds an interactive state map with D3, using `d3.geo.albersUsa` for the projection and `topojson` to process geographic data. Zoom animation is driven by D3 transitions, which update an SVG `g` element’s `transform` attribute and adjust the stroke width to maintain visual consistency. State borders and a clickable background rect facilitate the interaction, with active states highlighted in orange.
AI-generated descriptionPart of a series of examples. See:
- mousewheel-zoom + click-to-center via projection
- click-to-center via projection
- click-to-center via transform
- click-to-zoom via transform
More recently, see the Zoom to Bounding Box example.
forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/2206590'>click-to-zoom via transform</a>