Background
Beams With Collision
Dynamic energy beams that explode on impact. This React component creates spectacular particle effects when animated beams collide with surfaces, perfect for Next.js gaming interfaces and interactive showcases.
Powered by
Installation
npx shadcn@latest add https://www.shadcn.io/registry/background-beams-with-collision.json
npx shadcn@latest add https://www.shadcn.io/registry/background-beams-with-collision.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/background-beams-with-collision.json
bunx shadcn@latest add https://www.shadcn.io/registry/background-beams-with-collision.json
Features
- Real-time collision detection with boundary calculations that trigger particle explosions on beam contact
- Dynamic particle effects featuring 20 randomized particles per explosion with authentic physics
- Continuous beam animation with infinite sequences using varied timing and positioning
- Gradient beam styling with indigo-to-purple transitions and customizable visual properties
- Performance optimized using Framer Motion for smooth animations without frame drops
- TypeScript support with complete collision coordinate and beam parameter definitions
- Responsive design with collision detection adapting to container dimensions
- shadcn/ui compatibility integrating seamlessly with Tailwind CSS design systems
Use Cases
This free open source React component works well for:
- Gaming interfaces - Energy weapon effects and impact visualizations in Next.js games
- Tech demonstrations - Showcase particle physics capabilities using TypeScript and JavaScript
- Interactive portfolios - Dramatic backgrounds for creative showcases built with shadcn/ui
- Product launches - High-impact visual effects for announcement pages
- Dashboard layouts - Sci-fi themed interfaces with beam collision effects
- Music applications - Visual effects that can sync with audio using Tailwind CSS animations
Implementation Notes
- Component uses absolute positioning within a relative container
- Collision detection runs every 50ms using
getBoundingClientRect()
calculations - Each explosion spawns 20 particles with randomized trajectories and decay timing
- Beams regenerate automatically after collision events for continuous animation
- Requires collision surface element with proper container reference
- Compatible with shadcn/ui and Tailwind CSS styling
- Uses Framer Motion for hardware-accelerated particle animations
- Memory management includes automatic cleanup to prevent accumulation
Beams
Flowing energy streams that create organic movement patterns. These animated SVG paths bring life to static layouts with graceful gradient waves perfect for modern React applications.
Boxes
Interactive isometric grid with vibrant hover effects. This React component creates stunning 3D-perspective layouts perfect for Next.js applications requiring dynamic visual engagement and professional depth.