Skip to Content
Neshel-UI
Animations (experimental)Effects

Scroll & Parallax

The 11 effects SP01–SP11: purpose, API, options, examples, reduced motion and cost.

Experimental and not on npm

@neshel-ui/animations is a private package (0.0.0). It cannot be installed, and its API may change before a first publication. These pages document what exists in the repository.

These effects map the native scroll position to a property. Geometry is cached and re-read only when it changes, pinning is CSS position: sticky, and nothing hijacks scrolling. Effects inside a <ScrollScene> share its timeline; others create their own, for the page or for a source container. An ancestor with overflow: hidden, auto or scroll becomes the sticky container: use overflow: clip instead.

SP01 · Depth parallax

<ScrollLayer> moves a layer of a scene by distance multiplied by depth, on either axis. Keep text in layers with a depth close to 1 so that it stays readable.

Import
@neshel-ui/animations/scroll
API
depthParallax, ScrollLayer, ScrollScene
Stylesheet
@neshel-ui/animations/scroll.css
Reduced motion
static — the decoration or content stays still
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: SP01
Preview theme: SP01

Loading the example…

sp01.tsx
"use client";
import "@neshel-ui/animations/scroll.css";
import { ScrollLayer, ScrollScene } from "@neshel-ui/animations/scroll";

export default function SP01Example() {
  return (
    <ScrollScene length={2} stageClassName="rounded-xl bg-neshel-muted">
      <ScrollLayer
        depth={0.4}
        distance={300}
        className="absolute left-[10%] top-[45%] size-24 rounded-xl bg-neshel-accent"
        aria-hidden="true"
      />
      <ScrollLayer
        depth={1.4}
        distance={300}
        className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground absolute left-[45%] top-[45%]"
      >
        Foreground layer
      </ScrollLayer>
    </ScrollScene>
  );
}
Options: DepthParallaxOptions

DepthParallaxOptions

DepthParallaxOptions
PropTypeDefaultDescription
axis"x" | "y""y"Movement axis (default "y").
depthnumber—Speed factor: positive moves against the scroll (foreground), negative lags (background). −5…5, default 1.
distancenumber—Travel at depth 1 over the whole range, px (0–2000, default 200).
rangereadonly [RangeInput, RangeInput]—Range of the effect's own timeline (ignored with timeline).
reducedMotionReducedMotion——
scrollAxisScrollAxis"block"Scroll axis of the effect's own timeline (default "block").
smoothboolean | SpringOptions | SpringPreset—SP10 spring smoothing of the effect's own timeline.
sourceElement | Window | null—Scroll container of the effect's own timeline (default: the root scroller).
timelineScrollProgress—A shared timeline (e.g. from useScrollScene()); otherwise the effect creates one.

SP02 · Scrubbed transform

scrubTransform interpolates between two poses (translateX, translateY, rotateZ, scale, opacity) as the element crosses the viewport, with an easing. Scrolling back reverses it exactly.

Import
@neshel-ui/animations/scroll
API
scrubTransform, ScrollEffect
Stylesheet
none needed
Reduced motion
static — the decoration or content stays still
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: SP02
Preview theme: SP02
Scroll moves me; scrolling back reverses me.
sp02.tsx
"use client";
import {
  ScrollEffect,
  type ScrubTransformOptions,
  scrubTransform,
} from "@neshel-ui/animations/scroll";

export default function SP02Example() {
  return (
    <ScrollEffect
      preset={scrubTransform}
      options={
        {
          from: { translateX: -120, rotateZ: -8, opacity: 0.3 },
          to: { translateX: 0, rotateZ: 0, opacity: 1 },
        } satisfies ScrubTransformOptions
      }
      className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
    >
      Scroll moves me; scrolling back reverses me.
    </ScrollEffect>
  );
}
Options: ScrubTransformOptions

ScrubTransformOptions

ScrubTransformOptions
PropTypeDefaultDescription
easingEasing | EasingPreset——
fromScrubPose——
rangereadonly [RangeInput, RangeInput]—Range of the effect's own timeline (ignored with timeline).
reducedMotionReducedMotion——
scrollAxisScrollAxis"block"Scroll axis of the effect's own timeline (default "block").
smoothboolean | SpringOptions | SpringPreset—SP10 spring smoothing of the effect's own timeline.
sourceElement | Window | null—Scroll container of the effect's own timeline (default: the root scroller).
timelineScrollProgress—A shared timeline (e.g. from useScrollScene()); otherwise the effect creates one.
toScrubPose——

SP03 · Scroll progress bar

<ScrollProgressBar> is a decorative, aria-hidden bar for the page or a source; position places it at the top, the bottom or in the flow. scrollProgress writes the same value as --neshel-scroll-progress.

Import
@neshel-ui/animations/scroll
API
ScrollProgressBar, scrollProgress
Stylesheet
@neshel-ui/animations/scroll.css
Reduced motion
reduced — a smaller signal remains because it conveys state
Performance
Writes one custom property, natively with scroll timelines where supported and from cached geometry elsewhere.
Preview: SP03
Preview theme: SP03

Loading the example…

sp03.tsx
"use client";
import "@neshel-ui/animations/scroll.css";
import { ScrollProgressBar } from "@neshel-ui/animations/scroll";
import { useState } from "react";

export default function SP03Example() {
  const [source, setSource] = useState<HTMLElement | null>(null);
  return (
    <div>
      <ScrollProgressBar source={source} position="static" className="text-neshel-primary" />
      <section
        ref={setSource}
        aria-label="Scrollable text"
        tabIndex={0}
        className="h-40 overflow-y-auto rounded-b-xl border border-neshel-border p-4"
      >
        {Array.from({ length: 12 }, (_, index) => (
          <p key={index} className="py-1">
            Paragraph {index + 1}
          </p>
        ))}
      </section>
    </div>
  );
}
Options: ScrollProgressEffectOptions

ScrollProgressEffectOptions

ScrollProgressEffectOptions
PropTypeDefaultDescription
driverDriverPreference—"auto" (default): native scroll timeline when verified, else JS.
rangereadonly [RangeInput, RangeInput]—Range of the effect's own timeline (ignored with timeline).
reducedMotionReducedMotion——
scrollAxisScrollAxis"block"Scroll axis of the effect's own timeline (default "block").
smoothboolean | SpringOptions | SpringPreset—SP10 spring smoothing of the effect's own timeline.
sourceElement | Window | null—Scroll container of the effect's own timeline (default: the root scroller).
timelineScrollProgress—A shared timeline (e.g. from useScrollScene()); otherwise the effect creates one.

SP04 · Horizontal section

<HorizontalScroll> turns vertical scrolling into horizontal travel of a pinned track. layout can be "pinned", "stacked" or "scroll" (a native scroller, used in the example). Focus keeps items in view; under reduced motion it is stacked. Put something focusable in the items: the native scroller is not a tab stop by itself.

Import
@neshel-ui/animations/scroll
API
HorizontalScroll
Stylesheet
@neshel-ui/animations/scroll.css
Reduced motion
static — the decoration or content stays still
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: SP04
Preview theme: SP04

Loading the example…

sp04.tsx
"use client";
import "@neshel-ui/animations/scroll.css";
import { HorizontalScroll } from "@neshel-ui/animations/scroll";

export default function SP04Example() {
  return (
    <HorizontalScroll label="Milestones" layout="scroll">
      {["Idea", "Prototype", "Beta", "Launch", "Growth"].map((item) => (
        <a
          key={item}
          href="#sp04"
          className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground w-64"
        >
          {item}
        </a>
      ))}
    </HorizontalScroll>
  );
}

SP05 · Pinned scene

<ScrollScene> pins a stage for length viewport heights and exposes --neshel-scene-progress to everything inside. useScrollScene() gives the timeline to other effects, such as scene chapters.

Import
@neshel-ui/animations/scroll
API
ScrollScene, pinnedScene
Stylesheet
@neshel-ui/animations/scroll.css
Reduced motion
static — the decoration or content stays still
Performance
Writes one custom property, natively with scroll timelines where supported and from cached geometry elsewhere.
Preview: SP05
Preview theme: SP05

Loading the example…

sp05.tsx
"use client";
import "@neshel-ui/animations/scroll.css";
import { ScrollScene } from "@neshel-ui/animations/scroll";

export default function SP05Example() {
  return (
    <ScrollScene length={2} stageClassName="grid place-items-center rounded-xl bg-neshel-muted">
      <div className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground">
        <p>Pinned by CSS sticky while the page scrolls</p>
        <span
          aria-hidden="true"
          className="mt-3 block h-2 origin-left bg-neshel-primary"
          style={{ transform: "scaleX(var(--neshel-scene-progress, 0))" }}
        />
      </div>
    </ScrollScene>
  );
}
Options: PinnedSceneOptions

PinnedSceneOptions

PinnedSceneOptions
PropTypeDefaultDescription
driverDriverPreference—"auto" (default): native scroll timeline when verified, else JS.
rangereadonly [RangeInput, RangeInput]—Range of the effect's own timeline (ignored with timeline).
reducedMotionReducedMotion——
scrollAxisScrollAxis"block"Scroll axis of the effect's own timeline (default "block").
smoothboolean | SpringOptions | SpringPreset—SP10 spring smoothing of the effect's own timeline.
sourceElement | Window | null—Scroll container of the effect's own timeline (default: the root scroller).
timelineScrollProgress—A shared timeline (e.g. from useScrollScene()); otherwise the effect creates one.

SP06 · Image parallax

<ParallaxImage> moves the first child inside a clipping frame by ±amount pixels and scales it just enough to cover the frame. The native image keeps its attributes.

Import
@neshel-ui/animations/scroll
API
ParallaxImage, imageParallax
Stylesheet
@neshel-ui/animations/scroll.css
Reduced motion
static — the decoration or content stays still
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: SP06
Preview theme: SP06

Loading the example…

sp06.tsx
"use client";
import "@neshel-ui/animations/scroll.css";
import { ParallaxImage } from "@neshel-ui/animations/scroll";
import { picture } from "./picture";

export default function SP06Example() {
  return (
    <ParallaxImage amount={40} className="h-56 max-w-md rounded-xl">
      <img
        src={picture("Parallax", 20, 330)}
        alt="Warm gradient"
        width={640}
        height={400}
        className="h-full w-full object-cover"
      />
    </ParallaxImage>
  );
}
Options: ImageParallaxOptions

ImageParallaxOptions

ImageParallaxOptions
PropTypeDefaultDescription
amountnumber—Travel each way in px (0–400, default 48). The media is scaled to keep the frame covered.
frameElement—The clipping frame (default: the element's parent).
rangereadonly [RangeInput, RangeInput]—Range of the effect's own timeline (ignored with timeline).
reducedMotionReducedMotion——
scrollAxisScrollAxis"block"Scroll axis of the effect's own timeline (default "block").
smoothboolean | SpringOptions | SpringPreset—SP10 spring smoothing of the effect's own timeline.
sourceElement | Window | null—Scroll container of the effect's own timeline (default: the root scroller).
timelineScrollProgress—A shared timeline (e.g. from useScrollScene()); otherwise the effect creates one.

SP07 · Zoom on scroll

zoomOnScroll scales the element between from (1) and to (1.2) over the chosen range. It composes with other transforms on the same element.

Import
@neshel-ui/animations/scroll
API
zoomOnScroll, ScrollEffect
Stylesheet
none needed
Reduced motion
static — the decoration or content stays still
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: SP07
Preview theme: SP07
Grows with the scroll position
sp07.tsx
"use client";
import { ScrollEffect, type ZoomOnScrollOptions, zoomOnScroll } from "@neshel-ui/animations/scroll";

export default function SP07Example() {
  return (
    <ScrollEffect
      preset={zoomOnScroll}
      options={{ from: 0.8, to: 1 } satisfies ZoomOnScrollOptions}
      className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
    >
      Grows with the scroll position
    </ScrollEffect>
  );
}
Options: ZoomOnScrollOptions

ZoomOnScrollOptions

ZoomOnScrollOptions
PropTypeDefaultDescription
easingEasing | EasingPreset——
fromnumber—Scale at progress 0 (0.1–5, default 1).
rangereadonly [RangeInput, RangeInput]—Range of the effect's own timeline (ignored with timeline).
reducedMotionReducedMotion——
scrollAxisScrollAxis"block"Scroll axis of the effect's own timeline (default "block").
smoothboolean | SpringOptions | SpringPreset—SP10 spring smoothing of the effect's own timeline.
sourceElement | Window | null—Scroll container of the effect's own timeline (default: the root scroller).
timelineScrollProgress—A shared timeline (e.g. from useScrollScene()); otherwise the effect creates one.
tonumber—Scale at progress 1 (0.1–5, default 1.2).

SP08 · Scroll colour shift

scrollColorShift mixes 2–8 stops into --neshel-scroll-color, or sets data-neshel-theme on a target with themes. Check the contrast of your text at every stop; under reduced motion the change is stepped.

Import
@neshel-ui/animations/scroll
API
scrollColorShift, ScrollEffect
Stylesheet
none needed
Reduced motion
instant — the end state appears at once
Performance
Repaints the element (colour, gradient, clip, mask, blur or stroke) while it runs; keep the area small.
Preview: SP08
Preview theme: SP08
The background follows the scroll position
sp08.tsx
"use client";
import {
  type ScrollColorShiftOptions,
  ScrollEffect,
  scrollColorShift,
} from "@neshel-ui/animations/scroll";

export default function SP08Example() {
  return (
    <ScrollEffect
      preset={scrollColorShift}
      options={{ stops: ["#193767", "#7c2d12"] } satisfies ScrollColorShiftOptions}
      className="rounded-xl p-8 text-white"
      style={{ background: "var(--neshel-scroll-color, #193767)" }}
    >
      The background follows the scroll position
    </ScrollEffect>
  );
}
Options: ScrollColorShiftOptions

ScrollColorShiftOptions

ScrollColorShiftOptions
PropTypeDefaultDescription
rangereadonly [RangeInput, RangeInput]—Range of the effect's own timeline (ignored with timeline).
reducedMotionReducedMotion——
scrollAxisScrollAxis"block"Scroll axis of the effect's own timeline (default "block").
smoothboolean | SpringOptions | SpringPreset—SP10 spring smoothing of the effect's own timeline.
sourceElement | Window | null—Scroll container of the effect's own timeline (default: the root scroller).
space"oklab" | "oklch" | "srgb""oklab"Interpolation space of color-mix() (default "oklab").
stops(required)readonly string[]—Two or more CSS colours (at most 8).
themeTargetElement—Element receiving data-neshel-theme (default: the element).
themesreadonly string[]—Optional theme names (one per stop) written to data-neshel-theme on themeTarget.
timelineScrollProgress—A shared timeline (e.g. from useScrollScene()); otherwise the effect creates one.

SP09 · Sticky stack

<StickyStack> makes its children sticky cards that pile up; top and offset are CSS lengths and scale shrinks covered cards. Cards taller than the viewport cannot be read completely.

Import
@neshel-ui/animations/scroll
API
StickyStack, stickyStack
Stylesheet
@neshel-ui/animations/scroll.css
Reduced motion
static — the decoration or content stays still
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: SP09
Preview theme: SP09

Loading the example…

sp09.tsx
"use client";
import "@neshel-ui/animations/scroll.css";
import { StickyStack } from "@neshel-ui/animations/scroll";

export default function SP09Example() {
  return (
    <StickyStack top="5rem" offset="1rem" className="grid gap-6">
      {["First", "Second", "Third"].map((item) => (
        <div
          key={item}
          className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground h-48"
        >
          {item}
        </div>
      ))}
    </StickyStack>
  );
}
Options: StickyStackOptions

StickyStackOptions

StickyStackOptions
PropTypeDefaultDescription
rangereadonly [RangeInput, RangeInput]—Range of the effect's own timeline (ignored with timeline).
reducedMotionReducedMotion——
scalenumber—Scale removed from a fully covered card (0–0.5, default 0.05; 0 = CSS-only stacking).
scrollAxisScrollAxis"block"Scroll axis of the effect's own timeline (default "block").
smoothboolean | SpringOptions | SpringPreset—SP10 spring smoothing of the effect's own timeline.
sourceElement | Window | null—Scroll container of the effect's own timeline (default: the root scroller).
timelineScrollProgress—A shared timeline (e.g. from useScrollScene()); otherwise the effect creates one.

SP10 · Smooth scrub

The smooth option of <ScrollScene>, useScrollProgress and createScrollProgress passes progress through a spring. The page scroll itself is never smoothed; only what follows it is.

Import
@neshel-ui/animations/scroll
API
createScrollProgress, useScrollProgress, ScrollScene
Stylesheet
none needed
Reduced motion
off — no motion at all
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: SP10
Preview theme: SP10

The same progress through a spring

sp10.tsx
"use client";
import { ScrollScene } from "@neshel-ui/animations/scroll";

export default function SP10Example() {
  return (
    <ScrollScene
      length={2}
      smooth
      stageClassName="grid place-items-center rounded-xl bg-neshel-muted"
    >
      <div className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground">
        <p>The same progress through a spring</p>
        <span
          aria-hidden="true"
          className="mt-3 block h-2 origin-left bg-neshel-primary"
          style={{ transform: "scaleX(var(--neshel-scene-progress, 0))" }}
        />
      </div>
    </ScrollScene>
  );
}
Options: ScrollProgressOptions

ScrollProgressOptions

ScrollProgressOptions
PropTypeDefaultDescription
axisScrollAxis——
rangereadonly [RangeInput, RangeInput]——
reducedMotionReducedMotion"user"Reduced-motion policy for smoothing (default "user").
smoothboolean | SpringOptions | SpringPreset—SP10: spring-smoothed progress (true = prototype spring 90/20).
sourceElement | Window | null—Scroll container; omitted, null or window → the root scroller.
subjectElement | null—Element whose view range is tracked; omit for the source's whole scroll range.

SP11 · Velocity skew

velocitySkew leans the element with the scroll velocity, limited by max degrees, and springs back to zero. Keep it small: it is decorative and turns off under reduced motion.

Import
@neshel-ui/animations/scroll
API
velocitySkew, ScrollEffect
Stylesheet
none needed
Reduced motion
off — no motion at all
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: SP11
Preview theme: SP11
Scroll fast: I lean with the velocity and spring back.
sp11.tsx
"use client";
import { ScrollEffect, type VelocitySkewOptions, velocitySkew } from "@neshel-ui/animations/scroll";

export default function SP11Example() {
  return (
    <ScrollEffect
      preset={velocitySkew}
      options={{ max: 8 } satisfies VelocitySkewOptions}
      className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
    >
      Scroll fast: I lean with the velocity and spring back.
    </ScrollEffect>
  );
}
Options: VelocitySkewOptions

VelocitySkewOptions

VelocitySkewOptions
PropTypeDefaultDescription
axis"x" | "y"——
factornumber—Degrees per px/s (0–0.05, default 0.003).
maxnumber—Maximum skew in degrees (0–30, default 8).
reducedMotionReducedMotion——
sourceElement | Window | null——
springSpringOptions——
Edit on GitHub

On this page