npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kerj/react-parallax-path

v0.1.3

Published

Scroll-driven parallax animations with SVG path following for React

Readme

@kerj/react-parallax-path

Scroll-driven parallax animations with SVG path following for React. Zero dependencies, lightweight, and framework-agnostic.

Features

  • 🎯 Parallax Layers - Speed-based parallax with X/Y/diagonal directions
  • 🛤️ SVG Path Following - Elements follow complex SVG curves as you scroll
  • 🎢 Smooth Easing - 10+ built-in easing functions + custom cubic bezier
  • 📍 Path Segments - Define regions with enter/exit/progress events
  • 🔄 Auto-rotation - Elements rotate to follow path tangent
  • 📦 Scroll Containers - Works with window or custom scroll containers
  • High Performance - RAF-based updates with optional ref subscriptions

Installation

npm install @kerj/react-parallax-path
# or
yarn add @kerj/react-parallax-path

Quick Start

Basic Parallax

import { ParallaxProvider, ParallaxLayer } from "@kerj/react-parallax-path";

function App() {
  return (
    <ParallaxProvider>
      <div style={{ height: "300vh" }}>
        <ParallaxLayer speed={0.5}>
          <div>Slow layer (background feel)</div>
        </ParallaxLayer>

        <ParallaxLayer speed={1.5}>
          <div>Fast layer (foreground feel)</div>
        </ParallaxLayer>

        <ParallaxLayer speed={-0.5}>
          <div>Reverse direction</div>
        </ParallaxLayer>
      </div>
    </ParallaxProvider>
  );
}

SVG Path Following

import {
  PathFollowerProvider,
  ScrollingPath,
  FixedFollower,
} from "@kerj/react-parallax-path";

const MY_PATH = `
  M 200 0
  C 280 150, 300 300, 240 450
  C 180 550, 150 650, 180 750
`;

function App() {
  return (
    <PathFollowerProvider smooth smoothing={0.15}>
      <ScrollingPath path={MY_PATH} height="400vh" viewBox={[400, 800]} glow />

      <FixedFollower autoRotate>
        <div className="orb" />
      </FixedFollower>
    </PathFollowerProvider>
  );
}

API Reference

ParallaxProvider

Wraps your app to enable parallax effects.

<ParallaxProvider
  throttle={0} // Throttle scroll updates (ms)
  smooth={false} // Enable smooth scroll behavior
  scrollContainer={ref} // Custom scroll container (RefObject)
>
  {children}
</ParallaxProvider>

ParallaxLayer

A layer that moves at a different speed relative to scroll.

<ParallaxLayer
  speed={0.5} // Speed multiplier (0.5 = half speed, 2 = double)
  direction="y" // "x", "y", or { x: 1, y: 0.5 }
  motionPath={pathData} // SVG path string, element, or function
  pathOffset={0} // Offset along path (0-1)
  autoRotate={false} // Rotate to follow path tangent
  scrollOffset={0} // Pixel offset for effect start
>
  {children}
</ParallaxLayer>

PathFollowerProvider

Provides path-following context for scroll-synchronized animations.

<PathFollowerProvider
  easing="smoothStep"    // Easing name or function
  smooth={true}          // Enable position smoothing
  smoothing={0.12}       // Smoothing factor (0-1, lower = smoother)
  segments={[...]}       // Path segment definitions
  scrollContainer={ref}  // Custom scroll container
>
  {children}
</PathFollowerProvider>

ScrollingPath

Renders the visible SVG path.

<ScrollingPath
  path={pathData} // SVG path data string
  height="500vh" // Scrollable height
  viewBox={[400, 2000]} // SVG viewBox dimensions
  stroke="url(#gradient)" // Stroke color or gradient
  strokeWidth={3} // Path stroke width
  glow={true} // Enable glow effect
  glowColor="#8b5cf6" // Custom glow color
  opacity={0.6} // Path opacity
  strokeDasharray="15 8" // Dash pattern
/>

FixedFollower

Element that follows the path position.

<FixedFollower
  autoRotate={true} // Rotate to match path direction
  rotationOffset={90} // Additional rotation offset (degrees)
>
  {children}
</FixedFollower>

usePathFollower

Hook for accessing path state in components.

const {
  scrollProgress, // Raw scroll progress (0-1)
  pathProgress, // Position along path (0-1)
  position, // { x, y } in SVG coords
  screenPosition, // { x, y } in screen pixels
  angle, // Tangent angle in degrees
  direction, // 1 (down) or -1 (up)
  velocity, // Scroll speed
  subscribeToSegment,
  isSegmentActive,
  getActiveSegments,
} = usePathFollower();

usePathFollowerRef

High-performance hook using direct DOM updates.

const elementRef = useRef(null);

usePathFollowerRef(elementRef, {
  onUpdate: (state) => {
    // Apply transforms directly to DOM
  },
});

Path Segments

Define regions along the path with events.

const segments = [
  { id: "intro", start: 0, end: 0.3, label: "Introduction" },
  { id: "main", start: 0.3, end: 0.7, label: "Main Content" },
  { id: "outro", start: 0.7, end: 1, label: "Outro" },
];

// Subscribe to events
const { subscribeToSegment } = usePathFollower();

useEffect(() => {
  return subscribeToSegment("intro", (event) => {
    if (event.type === "enter") console.log("Entered intro!");
    if (event.type === "exit") console.log("Left intro!");
    // event.segmentProgress = 0-1 within segment
  });
}, []);

Easing Functions

Built-in easing options:

  • linear - No easing
  • easeInQuad, easeOutQuad, easeInOutQuad
  • easeInCubic, easeOutCubic, easeInOutCubic
  • easeOutExpo, easeInOutExpo
  • smoothStep, smootherStep

Custom cubic bezier:

import { cubicBezier } from '@kerj/react-parallax-path';

<PathFollowerProvider easing={cubicBezier(0.4, 0, 0.2, 1)}>

Scroll Container Support

Use with custom scroll containers:

const scrollRef = useRef(null);

<div ref={scrollRef} style={{ height: 400, overflowY: "auto" }}>
  <ParallaxProvider scrollContainer={scrollRef}>
    {/* content */}
  </ParallaxProvider>
</div>;

Utility Exports

import {
  // Core components
  ParallaxProvider,
  ParallaxLayer,
  PathFollowerProvider,
  ScrollingPath,
  FixedFollower,

  // Hooks
  useParallax,
  usePathFollower,
  usePathFollowerRef,
  useScrollContainer,

  // Utilities
  easings,
  cubicBezier,
  applyEasing,
  SegmentTracker,
  createSegmentPresets,
  normalizeDirection,
  clamp,

  // Types
  type PathFollowerState,
  type PathSegment,
  type SegmentEvent,
  type ParallaxConfig,
  type EasingName,
} from "@kerj/react-parallax-path";

License

MIT