Getting Started
Components
- Animated Beam
- Animated Circular Progress Bar
- Animated Gradient Text
- Animated Grid Pattern
- Animated List
- Animated Shiny Text
- Animated Theme Toggler
- Aurora Text
- Avatar Circles
- Bento Grid New
- Blur Fade
- Border Beam
- Cool Mode
- Dither Shader New
- Dock New
- Dot Pattern
- Dotted Map New
- File Tree
- Flickering Grid
- Grid Pattern
- Hero Video Dialog
- Hyper Text New
- Icon Cloud New
- Interactive Hover Button
- Lens New
- Light Rays New
- Line Shadow Text New
- Magic Card New
- Marquee
- Meteors New
- Morphing Text New
- Motion Grid New
- Neon Gradient Card New
- Number Ticker
- Orbiting Circles New
- Pixel Image New
- Pointer New
- Progressive Blur New
- Pulsating Button
- Rainbow Button
- Retro Grid New
- Ripple
- Ripple Button
- Scroll Progress
- Shimmer Button
- Shine Border New
- Smooth Cursor New
- Striped Pattern New
- Text Animate
- Typing Animation
- Video Text
- Warp Background
- Word Rotate Beta
Animated Beam
An animated beam of light which travels along a path. Useful for showcasing the "integration" features of a website.
motion-sv
Installation
pnpm dlx shadcn-svelte@latest add https://sv-animations.vercel.app/r/animated-beam.json
Install dependencies
Install the required packages for this component:
pnpm add motion-sv
Copy the Source Code
Copy and paste the following code into your project:
animated-beam.svelte
index.ts
types.ts
use-gradient-coordinates.svelte.ts
use-path-calculator.svelte.ts
use-resize-observer.svelte.ts
Folder Structure
Folder Structure
Examples
With Curvature
Reverse Direction
Bi Directional Beams
Multiple Beams Inputs
Multiple Beams Outputs
Props
Animated Beam
A component for creating animated beam effects between elements.
| Name | Type | Default | Description |
|---|---|---|---|
class | string | "" | Additional CSS classes to apply |
containerRef | HTMLElement | null | null | Reference to the container element |
fromRef | HTMLElement | null | null | Reference to the starting element |
toRef | HTMLElement | null | null | Reference to the ending element |
curvature | number | 0 | Curvature of the beam path |
reverse | boolean | false | Reverse the animation direction |
duration | number | Math.random() * 3 + 4 | Duration of the animation in seconds |
delay | number | 0 | Delay before animation starts |
pathColor | string | "gray" | Color of the beam path |
pathWidth | number | 2 | Width of the beam path |
pathOpacity | number | 0.2 | Opacity of the beam path |
gradientStartColor | string | "#ffaa40" | Starting color of the gradient |
gradientStopColor | string | "#9c40ff" | Ending color of the gradient |
startXOffset | number | 0 | X offset for the start position |
startYOffset | number | 0 | Y offset for the start position |
endXOffset | number | 0 | X offset for the end position |
endYOffset | number | 0 | Y offset for the end position |