Dotted Map
svelte-animations/dotted-mapFreeBlock
A world map component rendered with dots, supporting custom markers with staggered entrance animations.
Install it
npx shadcn@latest add https://sv-animations.vercel.app/r/dotted-map.jsonSource
1<script lang="ts">2 import { createMap } from "piri";3 import { cn } from "$UTILS$.js";45 interface Marker extends Record<string, unknown> {6 lat: number;7 lng: number;8 size?: number;9 }1011 interface Props {12 width?: number;13 height?: number;14 mapSamples?: number;15 markers?: Marker[];16 dotColor?: string;17 markerColor?: string;18 dotRadius?: number;19 stagger?: boolean;20 class?: string;21 style?: string;22 }2324 let {25 width = 150,26 height = 75,27 mapSamples = 5000,28 markers = [],29 markerColor = "#FF6900",30 dotColor = "currentColor",31 dotRadius = 0.2,32 stagger = true,33 class: className,34 style,35 }: Props = $props();3637 let map = $derived(38 createMap({39 width,40 height,41 mapSamples,42 radius: dotRadius,43 grid: stagger ? "diagonal" : "vertical",44 })45 );4647 let points = $derived(map.points);48 let processedMarkers = $derived(49 map.addMarkers(markers) as Array<{ x: number; y: number; size?: number }>50 );51</script>5253<svg54 viewBox="0 0 {width} {height}"55 class={cn("text-gray-500 dark:text-gray-500", className)}56 style="width: 100%; height: 100%; {style || ''}"57>58 {#each points as point}59 <circle cx={point.x} cy={point.y} r={dotRadius} fill={dotColor} />60 {/each}61 {#each processedMarkers as marker}62 <circle cx={marker.x} cy={marker.y} r={marker.size ?? dotRadius} fill={markerColor} />63 {/each}64</svg>
What it pulls in
npm packages
Files it writes
More from Svelte Animations
All 66 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Beamanimated-beam | Svelte Animations | Blocks | Free | 1 dep · 6 files | |
| Animated Circular Progress Baranimated-circular-progress-bar | Svelte Animations | Blocks | Free | no deps · 2 files | |
| Animated Gradient Textanimated-gradient-text | Svelte Animations | Blocks | Free | no deps · 2 files | |
| Animated Grid Patternanimated-grid-pattern | Svelte Animations | Blocks | Free | 1 dep · 2 files | |
| Animated Listanimated-list | Svelte Animations | Blocks | Free | 1 dep · 2 files | |
| Animated Shiny Textanimated-shiny-text | Svelte Animations | Blocks | Free | no deps | |
| Animated Theme Toggleranimated-theme-toggler | Svelte Animations | Blocks | Free | no deps · 2 files | |
| Arc Timelinearc-timeline | Svelte Animations | Blocks | Free | no deps · 3 files |
