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
- Backlight New
- Avatar Circles
- Bento Grid
- Blur Fade
- Border Beam
- Cool Mode
- Dia Text Reveal New
- Dither Shader New
- Dock
- Dot Pattern
- Dotted Map New
- File Tree
- Flickering Grid
- Grid Pattern
- Hero Video Dialog
- Hyper Text
- Icon Cloud
- Interactive Hover Button
- Lens
- Light Rays
- Line Shadow Text
- Magic Card
- Marquee
- Meteors
- Morphing Text New
- Motion Grid Beta
- Neon Gradient Card
- Number Ticker
- Orbiting Circles
- Pixel Image New
- Pointer
- Progressive Blur
- Pulsating Button
- Rainbow Button
- Retro Grid
- Ripple
- Ripple Button
- Scroll Progress
- Shimmer Button
- Shine Border
- Smooth Cursor
- 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 |