Kinetic UI
Back to Introduction
Marquees

Velocity Marquee

A premium scrolling marquee that dynamically accelerates and decelerates based on the user's scroll speed, built with Framer Motion.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add velocity-marquee
Velocity Marquee
Build FasterShip BetterNever Settle
Build FasterShip BetterNever Settle
Build FasterShip BetterNever Settle
Build FasterShip BetterNever Settle
Framer Motion
Tailwind CSS
React Server Components
Responsive
Type Safe
Framer Motion
Tailwind CSS
React Server Components
Responsive
Type Safe
Framer Motion
Tailwind CSS
React Server Components
Responsive
Type Safe
Framer Motion
Tailwind CSS
React Server Components
Responsive
Type Safe

Scroll up and down quickly to see the marquee accelerate.

Installation

npx kinetic-ui-cli@latest add velocity-marquee

Usage

import { VelocityMarquee } from "@/components/creative/velocity-marquee";

export default function Page() {
  return (
    <VelocityMarquee baseVelocity={5}>
      <span className="text-4xl font-bold px-4">
        Scroll fast to see me accelerate!
      </span>
    </VelocityMarquee>
  );
}

How it works

This component leverages Framer Motion's useScroll and useVelocity hooks to calculate how fast the user is scrolling the page.

  1. Velocity Tracking: As you scroll, useVelocity outputs the scroll speed in pixels per second.
  2. Spring Dampening: We pass the raw velocity into a useSpring to smooth out sudden stops (so the marquee doesn't jerk violently when you stop scrolling).
  3. Animation Loop: A useAnimationFrame loop continuously updates the x position of the items. It calculates the offset by combining the baseVelocity with the dampened scroll velocity factor.
  4. Wrapping: Finally, wrap() ensures that when the items scroll out of view on one side, they seamlessly snap back to the other side to create the infinite illusion.

Usage Guide

1. Import the Component

Import the component into your React or Next.js page:

import { VelocityMarquee } from "@/components/creative/velocity-marquee";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { VelocityMarquee } from "@/components/creative/velocity-marquee";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <VelocityMarquee
        baseVelocity{10}
        itemClassName="example"
        repeatCount{10}
      >
        <div>Content goes here</div>
      </VelocityMarquee>
    </div>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.