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

Animated Arc

Draw an animated curved line between two points on the map.

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 arc component:

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

Curve Height

The height prop controls how much the arc curves away from a straight line. It's a multiplier relative to the distance between origin and destination. Use 0 for a straight line, or values like 0.3-0.5 for visible curves.

Custom Styling

Customize the arc appearance with color, width, and markerColor. The marker follows the arc tip during animation.

Dashed Lines

Use dashArray to create dashed line patterns. The array specifies [dash length, gap length] in pixels.

Properties

PropertyTypeDefaultDescription
idstringrequiredUnique identifier for the arc
origin[number, number]requiredStarting point [longitude, latitude]
destination[number, number]requiredEnding point [longitude, latitude]
colorstring"#3b82f6"Arc line color
widthnumber4Line width in pixels
opacitynumber1Line opacity (0-1)
dashArray[number, number]-Dash pattern [dash, gap]
heightnumber0.3Curve height multiplier (0 = straight)
segmentsnumber50Curve smoothness (more = smoother)
durationnumber2000Animation duration in ms
autoStartbooleantrueStart animation on mount
loopbooleanfalseLoop the animation
loopDelaynumber500Delay between loops in ms
showMarkerbooleantrueShow traveling marker at arc tip
markerColorstring-Traveling marker color (defaults to line color)
showOriginMarkerbooleantrueShow marker at origin point
originMarkerColorstring-Origin marker color (defaults to line color)
showDestinationMarkerbooleantrueShow marker at destination when animation completes
destinationMarkerColorstring-Destination marker color (defaults to line color)
onComplete() => void-Callback when animation completes

Use Cases

Flight Routes

Visualize flight paths between airports with curved trajectories.

Package Delivery

Show delivery routes from warehouses to customers.

Data Transfer

Illustrate data flowing between servers or data centers.

Network Connections

Show point-to-point connections in network visualizations.