Skip to content

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

fix: update orbiting circles logic

Dillion Verma02023ce23aeb
diff --git a/registry/components/example/orbiting-circles-demo.tsx b/registry/components/example/orbiting-circles-demo.tsx
index 7cb03fa1..f085f7b2 100644
--- a/registry/components/example/orbiting-circles-demo.tsx
+++ b/registry/components/example/orbiting-circles-demo.tsx
@@ -3,7 +3,7 @@ import { BarChartIcon, LinkIcon } from "lucide-react";
export default function OrbitingCirclesDemo() {
return (
- <div className="relative flex h-full w-full max-w-[32rem] items-center justify-center overflow-hidden rounded-lg border bg-background px-40 pb-40 pt-8 md:pb-60 md:shadow-xl">
+ <div className="relative flex h-[400px] w-full max-w-[32rem] items-center justify-center overflow-hidden rounded-lg border bg-background md:shadow-xl">
<span className="pointer-events-none whitespace-pre-wrap bg-gradient-to-b from-black to-gray-300/80 bg-clip-text text-center text-8xl font-semibold leading-none text-transparent dark:from-white dark:to-slate-900/10">
Circles
</span>
diff --git a/registry/components/magicui/orbiting-circles.tsx b/registry/components/magicui/orbiting-circles.tsx
index e0908c2f..bcd96f0d 100644
--- a/registry/components/magicui/orbiting-circles.tsx
+++ b/registry/components/magicui/orbiting-circles.tsx
@@ -7,6 +7,7 @@ export default function OrbitingCircles({
duration = 20,
delay = 10,
radius = 50,
+ path = true,
}: {
className?: string;
children?: React.ReactNode;
@@ -14,23 +15,44 @@ export default function OrbitingCircles({
duration?: number;
delay?: number;
radius?: number;
+ path?: boolean;
}) {
return (
- <div
- style={
- {
- "--duration": duration,
- "--radius": radius,
- "--delay": -delay,
- } as React.CSSProperties
- }
- className={cn(
- "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform-gpu animate-orbit items-center justify-center rounded-full border bg-black/10 [animation-delay:calc(var(--delay)*1000ms)] dark:bg-white/10",
- { "[animation-direction:reverse]": reverse },
- className,
+ <>
+ {path && (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ className="pointer-events-none absolute inset-0 h-full w-full"
+ >
+ <circle
+ cx="50%"
+ cy="50%"
+ r={radius}
+ stroke="black"
+ stroke-width="1"
+ fill="none"
+ strokeDasharray={"4 4"}
+ />
+ </svg>
)}
- >
- {children}
- </div>
+
+ <div
+ style={
+ {
+ "--duration": duration,
+ "--radius": radius,
+ "--delay": -delay,
+ } as React.CSSProperties
+ }
+ className={cn(
+ "absolute flex h-full w-full transform-gpu animate-orbit items-center justify-center rounded-full border bg-black/10 [animation-delay:calc(var(--delay)*1000ms)] dark:bg-white/10",
+ { "[animation-direction:reverse]": reverse },
+ className,
+ )}
+ >
+ {children}
+ </div>
+ </>
);
}