AnimatedBeam

Animated SVG beams that connect elements with smooth gradients and customizable curves.

Basic Usage

1
5
2
HUB
6
3
7

Props

PropTypeDefaultDescription
containerRefHTMLElement-Container element reference (required)
fromRefHTMLElement-Starting element reference (required)
toRefHTMLElement-Ending element reference (required)
curvaturenumber0Curve amount (positive/negative for direction)
reversebooleanfalseReverse animation direction
pathColorstringgrayStatic path color
pathWidthnumber2Path stroke width
pathOpacitynumber0.2Static path opacity
gradientStartColorstring#FFAA40Animated gradient start color
gradientStopColorstring#9C40FFAnimated gradient stop color
durationnumberRandom (4-7s)Animation duration in seconds
delaynumber0Animation delay in seconds
startXOffsetnumber0X offset from start element center
startYOffsetnumber0Y offset from start element center
endXOffsetnumber0X offset from end element center
endYOffsetnumber0Y offset from end element center

Usage Notes

Element References

The component requires element references using Svelte's bind:this directive. Make sure all references are bound before rendering the AnimatedBeam.

Curvature

Use positive values for upward curves and negative values for downward curves. The value represents the vertical offset of the curve's control point.

Responsive Behavior

The component automatically updates the beam paths when the container is resized using ResizeObserver.