tween
ComponentsTemplatesShowcaseContact

Command Palette

Search for a command to run...

Getting Started
  • Introduction
  • Installation
  • StoryNew
Guides
  • Motion Principles
  • Scroll and Smooth Scroll
  • Performance and Accessibility
Scroll Animations
  • Sticky Cards Scroll
  • Rise Fan Cards Scroll
  • Rotate Stack Scroll
  • Doodle Lens ScrollNew
  • Slit Open Hero ScrollNew
  • Logo Mask Zoom ScrollNew
  • ASCII Dissolve ScrollNew
  • Lottie Flight ScrollNew
  • Inline Icon Text ScrollNew
  • Starfield ScrollNew
  • Name Swap ScrollNew
  • Spotlight Gallery HeroNew
  • Slit Rotate Hero ScrollNew
  • Stroke Cover ScrollNew
  • Stroke Rows ScrollNew
Text Animations
  • Text Skew Reveal
  • Block Text Reveal
Hover & Cursor
  • Image Trail Cursor
  • Cursor Depth Logo
  • Physics Tag Drop
  • Elastic Card ListNew
  • Magnetic Cards SpringNew
Sliders & Carousels
  • Wheel Fullscreen Carousel
  • Ripple Displacement Slider
  • Three.js Blend Slider
  • Stacked Deck Slider
  • Orbit Cylinder SliderNew
  • Fan Stack SliderNew
  • Exponential Strip SliderNew
  • Dual Column SliderNew
Galleries & Grids
  • Scroll Wave Gallery
Menus & Navigation
  • Shrink Page MenuNew
Preloaders & Intros
  • Floating Items RevealNew
  • Word Cycle RevealNew
  • Tile Grid LoaderNew
Page Transitions
  • Panel Assembly TransitionNew
3D & WebGL
  • Fractal Glass Hero
  • Fluid Cursor Canvas
  • Fluid Portrait Hero
  • Fluid Gradient Canvas
  • Inversion Lens HoverNew
UI Elements
  • Circular Widgets
  • Vinyl Cover
  • Image Explosion Footer
  • Accordion Image FramesNew

(Tween) — Motion registry

Animated components & full sites, one command away.

Product

  • Components
  • Templates
  • Installation
  • Guides
  • Blog
  • Contact

Categories

  • Scroll Animations
  • Text Animations
  • Hover & Cursor
  • Sliders & Carousels
  • Galleries & Grids
  • Menus & Navigation
  • Preloaders & Intros
  • Page Transitions
  • 3D & WebGL
  • UI Elements
TWEEN
ease: power2.inOut0.00s
© 2026 TweenBack to topBuilt by mohammad
  1. Docs/
  2. Components/
  3. Name Swap Scroll

Name Swap Scroll

PreviousNext

A pinned frame where giant SVG names squash and stretch on scaleY to hand over one by one while square visuals scale in from the corner and drift away.

Open in
name-swap-scroll-demo
components/ui/name-swap-scroll-demo.tsx
import { NameSwapScroll } from "@/registry/tween/name-swap-scroll"

export function NameSwapScrollDemo() {
  return <NameSwapScroll />
}

Installation

pnpm dlx shadcn@latest add https://tweenui.dev/r/name-swap-scroll.json

Usage

import { NameSwapScroll } from "@/components/ui/name-swap-scroll"
<NameSwapScroll
  visuals={["/plates/0362.jpg", "/plates/0548.jpg"]}
  names={[
    {
      label: "PLATES",
      d: "M0 0H100V20H0Z",
      viewBox: "0 0 100 20",
      fill: "#F4D23C",
    },
    { label: "0362", d: "...", viewBox: "...", fill: "#E0249A" },
    { label: "0548", d: "...", viewBox: "...", fill: "#FF6A13" },
  ]}
/>

How it works

The frame pins for one viewport height per name after the first. Names are inline SVG paths drawn with preserveAspectRatio="none", so each one stretches to fill the frame (the first at full width, the rest at three quarters, aligned right).

Scroll progress is mapped to a position along the list. The current name collapses with scaleY from its top edge while the next one grows from its bottom edge, so they appear to push each other out. Each visual scales in from the bottom-left corner during its step, then shrinks and drifts up by driftAmount percent during the next one.

The trigger uses usePreviewScroller, and a ResizeObserver rebuilds it on resize. With prefers-reduced-motion: reduce the header and first visual are shown statically.

Props

PropTypeDefaultDescription
namesNameSwapName[]7 names{ label, d, viewBox, fill }. The first is the header; the rest pair with visuals.
visualsstring[]6 photosImages that scale in, one per name after the header. Defaults load from Unsplash.
driftAmountnumber300How far (in % of its height) a visual drifts up as it exits.
backgroundstring"#0f0f0f"Frame background.
scrollerHTMLElement | string | null—Optional ScrollTrigger scroller; defaults to the preview one.
classNamestring—Extra classes on the outer container.
Starfield ScrollSpotlight Gallery Hero

On This Page

InstallationUsageHow it worksProps

Contribute

  • Report an issue
  • Request a feature
  • Edit this page