ReactHive

Zoom Through

Heroes 36

About

A scroll-linked fly-through. A headline hangs in the air with photos scattered around it at different depths. As you scroll you fly forward: the headline rushes past, the photos stream out to the edges, and the middle photo grows until it fills the screen under your own content.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Zoom Through to your project and fits it to your theme.

Code

How Zoom Through is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { ZoomThrough } from "@/components/ui/zoom-through";

const settings = {
  length: 3
};

/* The demo's Google Fonts. In a Next.js app, use next/font/google instead. */
if (typeof document !== "undefined" && !document.getElementById("zoom-through-fonts")) {
  const style = document.createElement("style");
  style.id = "zoom-through-fonts";
  style.textContent = "@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@100..900&display=swap'); .rh-inter-tight { font-family: 'Inter Tight', sans-serif; }";
  document.head.appendChild(style);
}

const bright = [
  {
    "name": "orange-sunglasses",
    "title": "Citrus",
    "alt": "A person in red sunglasses and a green jacket against orange",
    "caption": "Editorial, spring issue",
    "width": 1440,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/3b/3bb078492f3e6b7b2e411adcb66efb67de1d868a71023567df7e49770caf2759.webp"
  },
  {
    "name": "green-dancer",
    "title": "Green Room",
    "alt": "A blurred dancer in white against a green backdrop",
    "caption": "Motion study",
    "width": 1200,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/96/96534974eb49bb0e5a352f251a69da6a4b11a6c691eaa20df96e8c21b665e569.webp"
  },
  {
    "name": "pink-blazer",
    "title": "Pink Hour",
    "alt": "A person in a pink blazer against pink",
    "caption": "Editorial, colour stories",
    "width": 1200,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/3c/3cbe946fb0d67e3ea99ee0c861b1f9a4257f181200234bd461298577e3902b20.webp"
  },
  {
    "name": "yellow-walk",
    "title": "Procession",
    "alt": "A figure in a yellow robe walking, caught in a multiple exposure against orange",
    "caption": "Motion study",
    "width": 1440,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/0a/0aabcb5a22e5bc67dcb561d7b544bd52d518d3040b2f6a45e348d2c77b7e92a0.webp"
  },
  {
    "name": "red-sky",
    "title": "High Noon",
    "alt": "A person in a red outfit against a clear blue sky",
    "caption": "Editorial, summer issue",
    "width": 1800,
    "height": 1221,
    "src": "https://cdn.21st.dev/assets/mirror/88/8817490ab1af62dc8becfbc2c122b30c678b995f1e1e6fc1011538899d2f64bf.webp"
  },
  {
    "name": "spinning-dress",
    "title": "Turn",
    "alt": "A dancer spinning in a swirling, colourful dress",
    "caption": "Motion study",
    "width": 1400,
    "height": 1337,
    "src": "https://cdn.21st.dev/assets/mirror/76/760a67b082183370900b6f059af09fa02a70e18893162ab7003fafddb6a6b968.webp"
  },
  {
    "name": "magenta-hands",
    "title": "Peekaboo",
    "alt": "A person peering through yellow-painted fingers against magenta",
    "caption": "Editorial, colour stories",
    "width": 1195,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/5e/5eea8fe53aa88dd9aba2e1cbcce10d5cb3b74462d4bc28d75f714c265cafbabf.webp"
  },
  {
    "name": "orange-dancers",
    "title": "Heat",
    "alt": "Blurred dancers moving through orange light",
    "caption": "Motion study",
    "width": 1800,
    "height": 1169,
    "src": "https://cdn.21st.dev/assets/mirror/56/568de028f92375c3a70e1ec1a3755c218f95e2a7813d5bd5580195da66bebea6.webp"
  },
  {
    "name": "yellow-jacket",
    "title": "Yellow",
    "alt": "A person in a yellow and black jacket in a yellow room",
    "caption": "Editorial, menswear",
    "width": 1200,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/3e/3e9a39eb7c2d9ec200ae5c009a2556580e4447f25212ee08985792e6626ecb59.webp"
  },
  {
    "name": "stage-dancers",
    "title": "Encore",
    "alt": "Dancers on a dark stage dissolving into trails of pink and blue light",
    "caption": "Motion study",
    "width": 1800,
    "height": 1376,
    "src": "https://cdn.21st.dev/assets/mirror/a4/a46338d079106c75d677588e79e0c89dd6ed83bb1cef4e891d7d0f90eba522f6.webp"
  },
  {
    "name": "green-dress",
    "title": "Orchard",
    "alt": "A person in a green dress holding an apple",
    "caption": "Editorial, autumn issue",
    "width": 1350,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/da/da1c0eb311d45b394f85d1629b83535cacb1386044c497a9bc24d83544b7fadb.webp"
  },
  {
    "name": "violet-blur",
    "title": "Afterglow",
    "alt": "A blurred figure in violet and orange light",
    "caption": "Motion study",
    "width": 1800,
    "height": 1199,
    "src": "https://cdn.21st.dev/assets/mirror/a6/a692ef8f461284b6a292a85bb4c5c284d3cbb7cab8134417e9aeb3f31abf4cee.webp"
  },
  {
    "name": "pink-pair",
    "title": "Two of Us",
    "alt": "Two people in pink sleeves, side by side",
    "caption": "Editorial, colour stories",
    "width": 1350,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/fc/fc2d20e32a94b933a2ebfb333fbbf1ceddc0a12a59403244dfdf0c1789f385de.webp"
  },
  {
    "name": "neon-crowd",
    "title": "Night Market",
    "alt": "A crowd blurred into streaks under neon lights",
    "caption": "Motion study",
    "width": 1800,
    "height": 1199,
    "src": "https://cdn.21st.dev/assets/mirror/f7/f7855a5859c4f254cec2a6a8ce3313196276bd1996b50cdb011c137abc5e6774.webp"
  },
  {
    "name": "red-suit",
    "title": "Red Line",
    "alt": "A person in a red suit against a dark backdrop",
    "caption": "Editorial, tailoring",
    "width": 1201,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/a9/a9a19a4c073cd0d7098c51866a2a1e0f4caf67c042c38c4f47101b2d9e215568.webp"
  },
  {
    "name": "beach-blur",
    "title": "Tide",
    "alt": "A blurred figure in a bright swimsuit on a beach",
    "caption": "Motion study",
    "width": 1200,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/b2/b2ac414c4abb2616d3e6aa5648bfd128dd69032ba412259a0ec170b792f7187f.webp"
  },
  {
    "name": "yellow-blossom",
    "title": "Bloom",
    "alt": "A close portrait framed by yellow blossom",
    "caption": "Editorial, beauty",
    "width": 1200,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/56/5617db928d7b8ef766d82c958d9125b5b4528f7bbd01876b44c12e7a36881f72.webp"
  },
  {
    "name": "hair-flip",
    "title": "Flip",
    "alt": "A person tossing their hair, in sunglasses and a pink top",
    "caption": "Editorial, summer issue",
    "width": 1800,
    "height": 1199,
    "src": "https://cdn.21st.dev/assets/mirror/01/01896b2343d03e64c0525b155db049eb63dbba24bafb214b6dee6252b5965086.webp"
  },
  {
    "name": "blue-suit",
    "title": "Blue Note",
    "alt": "A person in a blue suit sitting on white sheets against teal",
    "caption": "Editorial, tailoring",
    "width": 1200,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/b2/b20736eb1c9511339d0a6dd78b1688b28479e964e741044a08c3dfa5aa7a7cb9.webp"
  },
  {
    "name": "orange-chair",
    "title": "Sit Still",
    "alt": "A person sitting on a wooden chair against orange",
    "caption": "Editorial, menswear",
    "width": 1201,
    "height": 1800,
    "src": "https://cdn.21st.dev/assets/mirror/57/5790842cde5e70321f83073b8ef3e199e7024456bbe26308f241794c8360b10c.webp"
  }
];

const type = { className: "rh-inter-tight", style: { fontFamily: "'Inter Tight', sans-serif" } };

function DemoContent(props: Partial<typeof settings> = {}) {
  const v = { ...settings, ...props };
  const hero = bright.find((p) => p.name === "red-sky")!;
  const rest = bright.filter((p) => p !== hero).slice(0, 12);
  return (
    <main className={`${type.className} bg-[#f2f2f0] text-[#111111]`}>
      <ZoomThrough items={[hero, ...rest]} headline="Step Inside." length={Number(v.length)}>
        <div className="flex h-full flex-col justify-end bg-[linear-gradient(0deg,rgba(0,0,0,0.5),transparent_55%)] p-[5vw] pb-[7vh] text-white">
          <h3 className="max-w-[12ch] text-[clamp(2.4rem,6vw,5.5rem)] leading-[0.92] font-semibold tracking-[-0.045em]">High Noon, Shot in One Afternoon.</h3>
          <p className="mt-5 max-w-[26rem] text-[17px] leading-[25px] text-white/80">Red on blue, a clear sky and a long lens. Keep scrolling for the rest of the story.</p>
        </div>
      </ZoomThrough>
      <section className="flex min-h-[70svh] items-center px-[5vw]">
        <p className="max-w-[18ch] text-[clamp(2rem,5vw,4rem)] leading-[0.95] font-semibold tracking-[-0.04em]">And that&apos;s where the story starts.</p>
      </section>
    </main>
  );
}

/** The demo in its own colours, filling the frame. */
export default function Demo(props: Partial<typeof settings> = {}) {
  return (
    <div className="min-h-svh w-full" style={{ background: "#f2f2f0" }}>
      <DemoContent {...props} />
    </div>
  );
}

More by ReactHive

View all
  • Card Deal

    Card Deal

    253
  • Arc Gallery

    Arc Gallery

    168
  • Fluid Type

    Fluid Type

    152
  • Step Stack

    Step Stack

    109
  • Iris Scroll

    Iris Scroll

    78
  • Card Pack

    Card Pack

    68
  • Word Drum

    Word Drum

    51
  • Colour Wash Slider

    Colour Wash Slider

    40

More in Heroes

View all
  • Agency Hero Section

    Agency Hero Section

    1.1K
  • Real Estate 3D Hero

    Real Estate 3D Hero

    86
  • Responsive Hero Banner

    Responsive Hero Banner

    2.2K
  • SaaS Template

    SaaS Template

    2.8K
  • AI SaaS Workflow Hero

    AI SaaS Workflow Hero

    35
  • Hero

    Hero

    1.4K
  • App Integration Celestial Hero

    App Integration Celestial Hero

    17
  • Chroma Sense Hero

    Chroma Sense Hero

    22