Circling Elements
fancy/circling-elementsFreeComponent
A ui component.
Install it
npx shadcn@latest add https://www.fancycomponents.dev/r/circling-elements.jsonSource
1"use client"23import { Children } from "react"4import { motion } from "motion/react"56import { cn } from "@/lib/utils"78type CirclingElementsProps = {9 children: React.ReactNode10 radius?: number11 duration?: number // in seconds12 easing?: string13 direction?: "normal" | "reverse"14 className?: string15 pauseOnHover?: boolean16}1718const CirclingElements: React.FC<CirclingElementsProps> = ({19 children,20 radius = 100,21 duration = 10,22 easing = "linear",23 direction = "normal",24 className,25 pauseOnHover = false,26}) => {27 return (28 <div className={cn("relative z-0 group/circling", className)}>29 {Children.map(children, (child, index) => {30 const offset = (index * 360) / Children.count(children)3132 const animationProps = {33 "--circling-duration": duration,34 "--circling-radius": radius,35 "--circling-offset": offset,36 "--circling-direction": direction === "reverse" ? -1 : 1,37 animation: `circling ${duration}s ${easing} infinite`,38 animationName: "circling",39 animationDuration: `${duration}s`,40 animationTimingFunction: easing,41 animationIterationCount: "infinite",42 } as React.CSSProperties4344 return (45 <motion.div46 key={index}47 style={animationProps}48 className={cn(49 "transform-gpu animate-circling absolute -translate-x-1/2 -translate-y-1/2",50 pauseOnHover &&51 "group-hover/circling:![animation-play-state:paused]"52 )}53 >54 {child}55 </motion.div>56 )57 })}58 </div>59 )60}6162export default CirclingElements
What it pulls in
npm packages
Files it writes
More from fancy
All 158 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Gradient With Svganimated-gradient-with-svg | fancy | Components | Free | no deps | |
| Basic Number Tickerbasic-number-ticker | fancy | Components | Free | 1 dep | |
| Box Carouselbox-carousel | fancy | Components | Free | 1 dep | |
| Breathing Textbreathing-text | fancy | Components | Free | 1 dep | |
| Css Boxcss-box | fancy | Components | Free | 1 dep | |
| Cursor Attractor And Gravitycursor-attractor-and-gravity | fancy | Components | Free | 5 deps | |
| Drag Elementsdrag-elements | fancy | Components | Free | 1 dep | |
| Elastic Lineelastic-line | fancy | Components | Free | 1 dep |
