Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

🐛 fix: refactor meteors

Dillion Verma2a08851b705c
diff --git a/registry/components/magicui/meteors.tsx b/registry/components/magicui/meteors.tsx
index 30477a3d..3e1ef60e 100644
--- a/registry/components/magicui/meteors.tsx
+++ b/registry/components/magicui/meteors.tsx
@@ -12,8 +12,8 @@ export const Meteors = ({ number = 20 }: MeteorsProps) => {
useEffect(() => {
const styles = [...new Array(number)].map(() => ({
top: -5,
- left: Math.floor(Math.random() * 800 - 400) + "px",
- animationDelay: Math.random() * 0.6 + 0.2 + "s",
+ left: Math.floor(Math.random() * window.innerWidth) + "px",
+ animationDelay: Math.random() * 1 + 0.2 + "s",
animationDuration: Math.floor(Math.random() * 8 + 2) + "s",
}));
setMeteorStyles(styles);
@@ -26,21 +26,12 @@ export const Meteors = ({ number = 20 }: MeteorsProps) => {
<span
key={idx}
className={clsx(
- "absolute top-1/2 left-1/2 h-0.5 w-0.5 rotate-[215deg] animate-meteor rounded-[9999px] bg-slate-500 shadow-[0_0_0_1px_#ffffff10]"
+ "absolute top-1/2 left-1/2 h-0.5 w-0.5 rotate-[215deg] animate-meteor rounded-[9999px] bg-slate-500 shadow-[0_0_0_1px_#ffffff10] -z-10"
)}
style={style}
>
{/* Meteor Tail */}
- <div
- style={{
- position: "absolute",
- top: "50%",
- transform: "translateY(-50%)",
- width: "50px",
- height: "1px",
- background: "linear-gradient(90deg, #64748b, transparent)",
- }}
- />
+ <div className="-z-10 absolute w-[50px] h-[1px] bg-gradient-to-r from-slate-500 to-transparent top-1/2 -translate-y-1/2" />
</span>
))}
</>