⚠️ Early Stage Project: This library is not production-ready yet. Developers should use it with caution and expect breaking changes.

Animated Markers

Animate markers smoothly along paths for real-time tracking and visualization.

Installation

First, make sure you have the base map component installed:

npx shadcn@latest add https://terrae.vercel.app/maps/map.json

Then install the animated marker component:

npx shadcn@latest add https://terrae.vercel.app/maps/map-marker-animated.json

Properties

PropertyTypeDefaultDescription
idstringrequiredUnique identifier for the marker
coordinatesArray<[number, number]>requiredArray of [longitude, latitude] coordinates defining the path
colorstring"#3b82f6"Marker color
sizenumber10Marker radius in pixels
durationnumber5000Animation duration in milliseconds
autoStartbooleantrueStart animation automatically on mount
loopbooleanfalseLoop the animation continuously
showPathbooleanfalseShow the path/route line
pathColorstring"#3b82f6"Path line color
pathWidthnumber4Path line width in pixels
onComplete() => voidundefinedCallback when animation completes

Restart Animation

Control animation playback by restarting the animation on demand.

Multiple Markers

Animate multiple markers simultaneously by rendering several MapMarkerAnimated components.

Use Cases

Delivery Tracking

Real-time delivery tracking with ETAs and live updates

Ride-Sharing

Live vehicle location updates for ride-sharing apps

Fleet Management

Track and visualize fleet vehicles in real-time

Trip Playback

Historical route playback for past trips and travels

Activity Tracking

Running, cycling, and sports activity visualization

Flight Tracking

Animate aircraft along flight paths and routes

Performance Tips

  • Limit the number of simultaneously animated markers
  • Use cancelAnimationFrame to stop animations when not needed
  • Simplify routes by removing unnecessary intermediate points
  • Consider using web workers for complex path calculations
  • Throttle updates if animating many markers simultaneously