Components
This code creates a visually appealing animated logo rolodex using React, Framer Motion, and Tailwind CSS. It showcases a rotating display of logos, each with a unique background color. The component solves the problem of dynamically displaying multiple logos in an engaging manner, ideal for showcasing brand partnerships, sponsors, or team members.
Here's how it works:
DivOrigami component passes an array of logo elements (LogoItem components) to the LogoRolodex component.LogoRolodex uses setInterval to increment an index, cycling through the logo array. useEffect with a cleanup function ensures the interval is cleared when the component unmounts.motion.div elements are used to create the flipping card effect. AnimatePresence ensures smooth transitions when the index changes. Each motion.div displays the current logo, with one transitioning out (rotateX: -180deg) while the next transitions in (rotateX: 0deg). The clipPath property creates the half-card effect, creating the illusion of a flipping card.twMerge helper function combines class names seamlessly.LogoItem component renders each individual logo with a styled background and icon.This component can be applied in various scenarios, including:
The code leverages several key technologies:
setInterval and useEffect: For managing the animation loop and cleanup.The animation is smooth and visually engaging, enhancing user experience by presenting information in a dynamic and memorable way.
Loading preview...
import { DivOrigami } from "@/components/ui/animated-logo-rolodex";
export default function DemoOne() {
return <DivOrigami />;
}