Masonry

Responsive masonry grid layout with GSAP animations

Usage

import Masonry from './Masonry';

const items = [
    {
      id: "1",
      img: "https://picsum.photos/id/1015/600/900?grayscale",
      url: "https://example.com/one",
      height: 400,
    },
    {
      id: "2",
      img: "https://picsum.photos/id/1011/600/750?grayscale",
      url: "https://example.com/two",
      height: 250,
    },
    {
      id: "3",
      img: "https://picsum.photos/id/1020/600/800?grayscale",
      url: "https://example.com/three",
      height: 600,
    },
    // ... more items
];

<Masonry
  items={items}
  ease="power3.out"
  duration={0.6}
  stagger={0.05}
  animateFrom="bottom"
  scaleOnHover={true}
  hoverScale={0.95}
  blurToFocus={true}
  colorShiftOnHover={false}
/>

Props

PropTypeDefaultDescription
itemsItem[]-Array of items to display
easestring'power3.out'GSAP easing function
durationnumber0.6Animation duration
staggernumber0.05Stagger delay between items
animateFrom'bottom' | 'top' | 'left' | 'right' | 'center' | 'random''bottom'Initial animation direction
scaleOnHoverbooleantrueEnable scale animation on hover
hoverScalenumber0.95Scale factor on hover
blurToFocusbooleantrueBlur to focus animation
colorShiftOnHoverbooleanfalseColor shift overlay on hover