Back to library
INTERACTION_113

Cinematic Image Entrance.

The image arrives with a letterbox open and a slow push-in. Letterbox bars closed over the image, scaled to 1.08 before the trigger; opening the bars while the image eases back to scale 1 once page load after fonts are ready.

CATEGORY
Images
COMPLEXITY
Intermediate
TECH
CSS
PLATFORM
Both
PERFORMANCE
Light
LIVE PLAYGROUND
CSS / CSS
/* Cinematic Image Entrance — The image arrives with a letterbox open and a slow push-in. */
.cinematic-image-entrance {
  --dur: 1.2s;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --stagger: 60ms;
  will-change: transform, opacity;
}

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

/* letterbox bars closed over the image, scaled to 1.08 -> opening the bars while the image eases back to scale 1 */
@keyframes cinematic-image-entrance-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

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

/** Cinematic Image Entrance — trigger: page load after fonts are ready */
export function CinematicImageEntrance({ 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="cinematic-image-entrance" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

INTERACTION_115CSS

Layered Image Depth

Foreground, subject and background layers move at different rates.

Images / LightView
INTERACTION_105CSS

Image Mask Reveal

The image uncovers behind a mask while it settles from a slow zoom.

Images / LightView
INTERACTION_106CSS + JS

Before And After Slider

A draggable handle wipes between two versions of an image.

Images / LightView
Media
INTERACTION_107CSS

Parallax Image

The image drifts slower than the frame that contains it.

Images / LightView