Bounce Cards
Web (React)
A stack of playing cards that fan out and straighten out interactively when hovered.
A stack of playing cards that fan out and straighten out interactively when hovered. This component dynamically calculates transform positions and spring physics using purely Framer Motion, skipping heavy libraries like GSAP.
Installation
CLI
npx @modus-ui/cli add bounce-cardsManual
- Copy the code from the component tab.
- Create a file at
components/ui/bounce-cards.tsx. - Paste the code.
Usage
tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
images | string[] | [] | Image URLs for the cards. |
containerWidth | number | string | 400 | Width of the container. |
containerHeight | number | string | 400 | Height of the container. |
animationDelay | number | 0.5 | Delay in seconds before the cards bounce in. |
animationStagger | number | 0.06 | Delay in seconds between each card. |
enableHover | boolean | false | Spreads the cards apart when one is hovered. |
transformStyles | string[] | [...] | CSS transform for each card's resting position. |
Comments