Meteors
magicui/meteorsFreeComponent
A meteor shower effect.
Live preview
live · rendered by the registry
Rendered by magicui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://magicui.design/r/meteors.jsonSource
1"use client"23import React, { useEffect, useState } from "react"45import { cn } from "@/lib/utils"67interface MeteorsProps {8 number?: number9 minDelay?: number10 maxDelay?: number11 minDuration?: number12 maxDuration?: number13 angle?: number14 className?: string15}1617export const Meteors = ({18 number = 20,19 minDelay = 0.2,20 maxDelay = 1.2,21 minDuration = 2,22 maxDuration = 10,23 angle = 215,24 className,25}: MeteorsProps) => {26 const [meteorStyles, setMeteorStyles] = useState<Array<React.CSSProperties>>(27 []28 )2930 useEffect(() => {31 const styles = [...new Array(number)].map(() => ({32 "--angle": -angle + "deg",33 top: "-5%",34 left: `calc(0% + ${Math.floor(Math.random() * window.innerWidth)}px)`,35 animationDelay: Math.random() * (maxDelay - minDelay) + minDelay + "s",36 animationDuration:37 Math.floor(Math.random() * (maxDuration - minDuration) + minDuration) +38 "s",39 }))40 setMeteorStyles(styles)41 }, [number, minDelay, maxDelay, minDuration, maxDuration, angle])4243 return (44 <>45 {[...meteorStyles].map((style, idx) => (46 // Meteor Head47 <span48 key={idx}49 style={{ ...style }}50 className={cn(51 "animate-meteor pointer-events-none absolute size-0.5 rotate-(--angle) rounded-full bg-zinc-500 shadow-[0_0_0_1px_#ffffff10]",52 className53 )}54 >55 {/* Meteor Tail */}56 <div className="pointer-events-none absolute top-1/2 -z-10 h-px w-12.5 -translate-y-1/2 bg-linear-to-r from-zinc-500 to-transparent" />57 </span>58 ))}59 </>60 )61}
Files it writes
More from magicui
All 247 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Androidandroid | magicui | Components | Free | no deps | |
| Animated Beamanimated-beam | magicui | Components | Free | 1 dep | |
| Animated Circular Progress Baranimated-circular-progress-bar | magicui | Components | Free | no deps | |
| Animated Gradient Textanimated-gradient-text | magicui | Components | Free | no deps | |
| Animated Grid Patternanimated-grid-pattern | magicui | Components | Free | 1 dep | |
| Animated Listanimated-list | magicui | Components | Free | 1 dep | |
| Animated Shiny Textanimated-shiny-text | magicui | Components | Free | no deps | |
| Theme Toggleranimated-theme-toggler | magicui | Components | Free | 1 dep |
