Introducing Magic UI Pro - 50+ blocks and templates to build beautiful landing pages in minutes.

Command Palette

Search for a command to run...

Docs
Scroll Based Velocity

Scroll Based Velocity

Scrolling text whose speed changes based on scroll speed

Velocity Scroll
Velocity Scroll

Installation

Usage

import {
  ScrollVelocityContainer,
  ScrollVelocityRow,
} from "@/components/magicui/scroll-based-velocity";
<ScrollVelocityContainer className="text-4xl md:text-7xl font-bold">
  <ScrollVelocityRow baseVelocity={20} direction={1}>
    Velocity Scroll
  </ScrollVelocityRow>
  <ScrollVelocityRow baseVelocity={20} direction={-1}>
    Velocity Scroll
  </ScrollVelocityRow>
</ScrollVelocityContainer>

Props

ScrollVelocityContainer

PropTypeDefaultDescription
classNamestring-The class name to be applied to the component
childrenReactNode-Content to be animated

ScrollVelocityRow

PropTypeDefaultDescription
classNamestring-The class name to be applied to the row container
childrenReactNode-Content to be duplicated and scrolled
baseVelocitynumber5Base scroll velocity percentage of content width
direction1 | -11Scroll direction (1 = left-to-right, -1 = reverse)

Performance

  • Pauses updates when offscreen and when the tab is hidden.
  • Respects user preference for reduced motion.