forked from Laughing0900/vite-portfolio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorbitingCircles.tsx
58 lines (55 loc) · 1.56 KB
/
orbitingCircles.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { cn } from "@/lib/utils";
export interface OrbitingCirclesProps {
className?: string;
children?: React.ReactNode;
reverse?: boolean;
duration?: number;
delay?: number;
radius?: number;
path?: boolean;
}
export default function OrbitingCircles({
className,
children,
reverse,
duration = 20,
delay = 10,
radius = 50,
path = true,
}: OrbitingCirclesProps) {
return (
<>
{path && (
<svg
xmlns="http://www.w3.org/2000/svg"
version="1.1"
className="pointer-events-none absolute inset-0 size-full"
>
<circle
className="stroke-white/10 stroke-1"
cx="50%"
cy="50%"
r={radius}
fill="none"
/>
</svg>
)}
<div
style={
{
"--duration": duration,
"--radius": radius,
animationDelay: `-${delay}s`,
} as React.CSSProperties
}
className={cn(
"animate-orbit absolute flex size-full transform-gpu items-center justify-center rounded-full border bg-white/10",
{ "[animation-direction:reverse]": reverse },
className
)}
>
{children}
</div>
</>
);
}