Kinetic UI
Back to Introduction
Scrollytelling

Scroll Driven Path

A scrollytelling primitive that dynamically draws an SVG path based on scroll progress.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add scroll-driven-path
Scroll Driven Path

Scroll Down

Step 1: Ideation

Draw the connections dynamically as users scroll through your narrative.

Step 2: Execution

Framer motion handles the interpolation perfectly via pathLength mapping.

Step 3: Launch

A mesmerizing path that guides the eye exactly where you want it.

End of Path

Installation

npx kinetic-ui-cli@latest add scroll-driven-path

Architecture

This component utilizes Framer Motion's useScroll hook combined with the <motion.path> component.

By mapping the scrollYProgress (a value between 0 and 1) directly to the SVG's pathLength style property, we achieve a flawless, hardware-accelerated "drawing" animation that scrubs back and forth perfectly with the user's scroll wheel. No complex intersection observers required!

Usage Guide

1. Import the Component

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

import { ScrollDrivenPath } from "@/components/creative/scroll-driven-path";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { ScrollDrivenPath } from "@/components/creative/scroll-driven-path";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <ScrollDrivenPath
        pathData="example"
        viewBox="example"
        color="example"
      >
        <div>Content goes here</div>
      </ScrollDrivenPath>
    </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.