Skip to main content
100%

Fork of Svelte + D3: Map (with visible hidden canvas) on canvas with zoom on click

✓ Published0🌍 Public

This interactive map of US counties allows users to click on a county to zoom into it, with an animated transition, and press Escape to zoom back out. The visualization uses a dual-canvas approach: one visible canvas renders the map in steel blue, while a second hidden canvas uses color-coded pick IDs for hit detection, with mouse position read via Canvas `getImageData` to identify hovered counties. The map is drawn using `d3.geoPath` with a `geoAlbersUsa` projection from GeoJSON county boundaries, while the zoom animation is powered by Svelte’s `tweened` motion primitive from `svelte/motion`.

AI-generated description
MIT Licensed

Similar vizzes