Back to library
INTERACTION_105

Image Mask Reveal.

The image uncovers behind a mask while it settles from a slow zoom. Clipped to zero height with the image scaled to 1.12 before the trigger; opening the clip upward while the image scales back to 1 once entry into view.

CATEGORY
Images
COMPLEXITY
Easy
TECH
CSS
PLATFORM
Both
PERFORMANCE
Light
LIVE PLAYGROUND
CSS / CSS
/* Image Mask Reveal — The image uncovers behind a mask while it settles from a slow zoom. */
.image-mask-reveal {
  --dur: 900ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --stagger: 60ms;
  will-change: transform, opacity;
}

.image-mask-reveal > * {
  opacity: 0;
  transform: translateY(14px);
  animation: image-mask-reveal-in var(--dur) var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

/* clipped to zero height with the image scaled to 1.12 -> opening the clip upward while the image scales back to 1 */
@keyframes image-mask-reveal-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-mask-reveal > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
React / TSX
import { useEffect, useRef } from "react";

/** Image Mask Reveal — trigger: entry into view */
export function ImageMaskReveal({ children }: { children: React.ReactNode }) {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
      el.dataset["state"] = "in";
      return;
    }
    const io = new IntersectionObserver(
      ([entry]) => {
        if (entry?.isIntersecting) {
          el.dataset["state"] = "in";
          io.unobserve(el);
        }
      },
      { threshold: 0.2 },
    );
    io.observe(el);
    return () => io.disconnect();
  }, []);

  return (
    <div ref={ref} className="image-mask-reveal" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

Media
INTERACTION_107CSS

Parallax Image

The image drifts slower than the frame that contains it.

Images / LightView
INTERACTION_116CSS

Horizontal Gallery Reveal

A gallery track slides sideways while images uncover in turn.

Images / MediumView
Media
INTERACTION_108CSS + JS

Cursor Zoom

The image magnifies around the exact pointer position.

Images / LightView
Media
INTERACTION_109CSS + JS

Image Trail

Thumbnails trail the cursor and fade out behind it.

Images / MediumView