Jumpy
February 3, 2025Animated card component with an elastic effect and cascading scaling when displayed. Its smooth animation, powered by GSAP, adds dynamism and visual appeal to any design. Ideal for highlighting information with style. Insipirated by @ajfreed_design & @GibsonSMurray
Features
- Random image rotation
- Mouse hover interactivity
- Flexible customization
-
Compatibility with
anchor
links
API Reference
Prop | Default | Type | Description |
---|---|---|---|
as | ’div’ | string | HTML element to render as the container component |
images | [] | JumpyItem[] | Array of image objects with src , alt , and optional href property. |
size | ’large’ | 'small' | 'medium' | 'large' | tamaño de las imagenes (responsive by default) |
spacing | ’-ml-6’ | string | margin between images (use margin-left from Tailwind) |
spacingHover | 40 | number | Separation distance when hovering over images |
minRotation | 7 | number | Minimum rotation angle for images in degrees |
maxRotation | 8 | number | Maximum rotation angle for images in degrees |
initEase | ’elastic.out(0.5, 0.4)‘ | gsap.EaseFunction | string | GSAP easing function for initial animation |
hoverEase | ’power4.out’ | gsap.EaseFunction | string | GSAP easing function for hover animation |
imageStyles | - | string | Additional classes for the image |
wrapperStyles | - | string | Additional classes for the wrapper Image |
duration | 0.4 | number | Duration of the animations in seconds. |
Usage
Type: JumpyItem[]
---
import { Jumpy, type JumpyItem } from "@butter-js/ui";
const example: JumpyItem[] = [
{
src: "https://...",
alt: "Image 1",
href: "https://example.com", //To use links, set as="a" on the component
},
//...
];
---
Examples
With text
It adapts quite well when placed within your texts. Since it has the parameter as = "a"
, the href
attribute is enabled, allowing it to function as a link while maintaining its animations.