Fork of Svelte + D3: Map (with visible hidden canvas) on canvas with zoom on click
✓ Published0🌍 Public
Ttrystansiew@gmail.com
Last edited Jun 18, 2024
Created on Jun 18, 2024
This interactive map of US counties uses D3’s geoAlbersUsa projection and geoPath to draw each county’s outlines onto two overlapping canvas layers. The top layer renders semi-transparent steel-blue shapes, while the hidden bottom layer paints each county with a unique color ID; the browser’s Canvas getImageData function reads pixels under the mouse to identify hovered counties for highlighting. Clicking a county triggers a smooth, animated zoom via a Svelte tweened transform, with a press of Escape returning to the full view.
AI-generated descriptionMIT Licensed