Skip to Content
Neshel-UI
Animations (experimental)Effects

Cinematic & Scenes

The 10 effects C01–C10: 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.

Cinematic effects share one idea: a timeline is a pure function of time that renders through each element's motion host, so it can be sought, scrubbed and reversed and it composes with every other effect. Server markup is the visible content; covers, lenses and bars are package layers (aria-hidden, inert) that appear only with JavaScript. Every effect offers track() so that a timeline can sequence it.

C01 · Timeline

useTimeline builds a timeline for a component and destroys it with it; createTimeline is the engine. add places tracks one after another, at a label or with offsets such as "-=300"; play, pause, reverse and seek(0–1) control it.

Import
@neshel-ui/animations/cinematic
API
createTimeline, useTimeline
Stylesheet
none needed
Reduced motion
instant — the end state appears at once
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: C01
Preview theme: C01

Loading the example…

c01.tsx
"use client";
import { useTimeline } from "@neshel-ui/animations/cinematic";
import { Button } from "@neshel-ui/components";
import { useRef } from "react";

export default function C01Example() {
  const first = useRef<HTMLDivElement>(null);
  const second = useRef<HTMLDivElement>(null);
  const timeline = useTimeline((tl) => {
    if (!first.current || !second.current) return;
    tl.add({ target: first.current, to: { x: 200 }, duration: 700 });
    tl.label("overlap", "-=300");
    tl.add({ target: second.current, to: { x: 200, rotate: 180 }, duration: 700 }, "overlap");
  }, []);
  return (
    <div className="grid gap-3">
      <div ref={first} className="h-8 w-12 rounded bg-neshel-primary" />
      <div ref={second} className="h-8 w-12 rounded bg-neshel-accent" />
      <div className="flex flex-wrap gap-2">
        <Button onClick={() => timeline.play()}>Play</Button>
        <Button variant="outline" onClick={() => timeline.pause()}>
          Pause
        </Button>
        <Button variant="outline" onClick={() => timeline.reverse()}>
          Reverse
        </Button>
        <Button variant="outline" onClick={() => timeline.seek(0.5)}>
          Seek 50 %
        </Button>
      </div>
    </div>
  );
}
Options: TimelineOptions

TimelineOptions

TimelineOptions
PropTypeDefaultDescription
conflictsConflictPolicy—Conflict reporting of exclusive channels (pose blur, effect tracks).
onComplete(result: MotionResult) => void—Once per completed run.
onRepeat(iteration: number) => void——
onStart() => void——
onUpdate(time: number, progress: number) => void——
reducedMotionReducedMotion——
repeatnumber—Extra iterations: 0 (default) … 1000, or Infinity (explicit only).
timeScalenumber10.1–10 (default 1).
whenHidden"pause" | "finish"—While the page is hidden: stop the clock (default) or finish.
yoyobooleanfalseAlternate the direction of every repeat (default false).

C02 · Scene chapters

<SceneChapters> divides a progress into <Chapter>s by weight; each <SceneSegment> animates a part of its chapter (span). Give it the source of a <ScrollScene> or a controlled progress; onChapterChange reports the active one.

Import
@neshel-ui/animations/cinematic
API
SceneChapters, Chapter, SceneSegment, createSceneChapters
Stylesheet
@neshel-ui/animations/cinematic.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: C02
Preview theme: C02

Loading the example…

c02.tsx
"use client";
import "@neshel-ui/animations/cinematic.css";
import { Chapter, SceneChapters, SceneSegment } from "@neshel-ui/animations/cinematic";
import { fadeUp } from "@neshel-ui/animations/entrance";
import { useState } from "react";

export default function C02Example() {
  const [progress, setProgress] = useState(0.2);
  return (
    <div className="grid gap-4">
      <label className="grid gap-1">
        Progress (a ScrollScene provides it on a page)
        <input
          type="range"
          min={0}
          max={1}
          step={0.01}
          value={progress}
          onChange={(event) => setProgress(Number(event.currentTarget.value))}
        />
      </label>
      <SceneChapters progress={progress} className="grid gap-3">
        <Chapter id="arrival">
          <SceneSegment
            effect={fadeUp}
            className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
          >
            Arrival
          </SceneSegment>
        </Chapter>
        <Chapter id="journey" weight={2}>
          <SceneSegment
            from={{ x: -120, opacity: 0 }}
            span={[0, 0.6]}
            className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
          >
            The journey lasts twice as long
          </SceneSegment>
        </Chapter>
      </SceneChapters>
    </div>
  );
}
Options: SceneChaptersOptions

SceneChaptersOptions

SceneChaptersOptions
PropTypeDefaultDescription
chapters(required)readonly ChapterInput[]——
onChapterChange(id: string, index: number) => void——
reducedMotionReducedMotion——
unitnumber—Clock duration when played without a source, ms per weight unit (100–20000, default 1500).

C03 · Camera

<CameraStage> pans and zooms over a large canvas. useCamera() moves it: camera.to({ focus: element }) or { x, y, zoom }. Keyboard focus inside the canvas brings the camera along, and without JavaScript it is a scrollable region.

Import
@neshel-ui/animations/cinematic
API
CameraStage, useCamera, createCamera
Stylesheet
@neshel-ui/animations/cinematic.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: C03
Preview theme: C03

Loading the example…

c03.tsx
"use client";
import "@neshel-ui/animations/cinematic.css";
import { CameraStage, useCamera } from "@neshel-ui/animations/cinematic";
import { Button } from "@neshel-ui/components";
import { useRef } from "react";

export default function C03Example() {
  const camera = useCamera();
  const places = useRef<Array<HTMLButtonElement | null>>([]);
  return (
    <div className="grid gap-3">
      <CameraStage
        label="Map"
        camera={camera}
        minZoom={0.25}
        className="h-64 rounded-xl border border-neshel-border"
      >
        <div className="grid w-[1000px] grid-cols-3 gap-10 p-10">
          {["North", "East", "South", "West", "Harbour", "Summit"].map((name, index) => (
            <button
              key={name}
              type="button"
              className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground h-40"
              ref={(node) => {
                places.current[index] = node;
              }}
            >
              {name}
            </button>
          ))}
        </div>
      </CameraStage>
      <div className="flex gap-2">
        <Button
          variant="outline"
          onClick={() => {
            const place = places.current[4];
            if (place) void camera.to({ focus: place });
          }}
        >
          Go to the harbour
        </Button>
        <Button variant="outline" onClick={() => void camera.to({ x: 500, y: 220, zoom: 0.3 })}>
          Overview
        </Button>
      </div>
    </div>
  );
}
Options: CameraOptions

CameraOptions

CameraOptions
PropTypeDefaultDescription
bounds"contain" | "none"—"contain" keeps the canvas covering the stage (default); "none" allows any pose.
followFocusbooleantruePan to elements that receive keyboard focus inside the canvas (default true).
initialPartial<CameraPose>—Initial pose (default: canvas centre at zoom 1).
maxZoomnumber41–10 (default 4).
minZoomnumber0.50.1–1 (default 0.5).
onChange(pose: CameraPose) => void——
paddingnumber—Space around a focused element (0–400, default 24).
reducedMotionReducedMotion——

C04 · Split reveal

<SplitReveal> covers its content with two halves that part along direction ("x" or "y"). open controls it; without open it reveals once when mounted on the client.

Import
@neshel-ui/animations/cinematic
API
SplitReveal, createCover
Stylesheet
@neshel-ui/animations/cinematic.css
Reduced motion
instant — the end state appears at once
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: C04
Preview theme: C04

Loading the example…

c04.tsx
"use client";
import "@neshel-ui/animations/cinematic.css";
import { SplitReveal } from "@neshel-ui/animations/cinematic";
import { Button } from "@neshel-ui/components";
import { useState } from "react";

export default function C04Example() {
  const [open, setOpen] = useState(true);
  return (
    <div className="grid justify-items-start gap-3">
      <SplitReveal
        open={open}
        direction="x"
        className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
      >
        The cover opens in two halves
      </SplitReveal>
      <Button variant="outline" onClick={() => setOpen(!open)}>
        {open ? "Cover" : "Open"}
      </Button>
    </div>
  );
}
Options: CoverOptions

CoverOptions

CoverOptions
PropTypeDefaultDescription
coveredbooleantrueStart covered (default true) or open.
patternCoverPattern"split-x"Default "split-x".
reducedMotionReducedMotion——
slatsnumber—Shutter slats (2–12, default 6).

C05 · Curtain and shutter

<CurtainReveal> opens from the centre with pattern="curtain" or in slats with pattern="shutter". The content underneath receives no writes and stays in the accessibility tree.

Import
@neshel-ui/animations/cinematic
API
CurtainReveal, createCover
Stylesheet
@neshel-ui/animations/cinematic.css
Reduced motion
instant — the end state appears at once
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: C05
Preview theme: C05

Loading the example…

c05.tsx
"use client";
import "@neshel-ui/animations/cinematic.css";
import { CurtainReveal } from "@neshel-ui/animations/cinematic";
import { Button } from "@neshel-ui/components";
import { useState } from "react";

export default function C05Example() {
  const [open, setOpen] = useState(true);
  return (
    <div className="grid justify-items-start gap-3">
      <CurtainReveal
        open={open}
        pattern="curtain"
        className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
      >
        Curtain
      </CurtainReveal>
      <CurtainReveal
        open={open}
        pattern="shutter"
        slats={8}
        className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
      >
        Shutter with eight slats
      </CurtainReveal>
      <Button variant="outline" onClick={() => setOpen(!open)}>
        {open ? "Close" : "Open"}
      </Button>
    </div>
  );
}
Options: CoverOptions

CoverOptions

CoverOptions
PropTypeDefaultDescription
coveredbooleantrueStart covered (default true) or open.
patternCoverPattern"split-x"Default "split-x".
reducedMotionReducedMotion——
slatsnumber—Shutter slats (2–12, default 6).

C06 · Title sequence

<TitleSequence> plays its element children one after another with an entrance effect every interval ms, over an optional background. It does not split text: each child is one line.

Import
@neshel-ui/animations/cinematic
API
TitleSequence, titleSequence
Stylesheet
@neshel-ui/animations/cinematic.css
Reduced motion
fade — opacity only, no travel
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: C06
Preview theme: C06

Rooted in faith

Built with hope

c06.tsx
"use client";
import "@neshel-ui/animations/cinematic.css";
import { TitleSequence } from "@neshel-ui/animations/cinematic";
import { fadeUp } from "@neshel-ui/animations/entrance";
import { Button } from "@neshel-ui/components";
import { useState } from "react";

export default function C06Example() {
  const [run, setRun] = useState(0);
  return (
    <div className="grid justify-items-start gap-3">
      <TitleSequence effect={fadeUp} interval={180} replay={run} className="p-4">
        <p className="text-2xl font-semibold">Rooted in faith</p>
        <p>Built with hope</p>
      </TitleSequence>
      <Button variant="outline" onClick={() => setRun(run + 1)}>
        Replay
      </Button>
    </div>
  );
}
Options: TitleSequenceOptions

TitleSequenceOptions

TitleSequenceOptions
PropTypeDefaultDescription
atTimelinePosition—Where the sequence starts in the timeline (default its current end).
backgroundElement | null——
backgroundDurationnumber—ms (0–10000, default 1200).
backgroundFromPose{ opacity: 0, scale: 1.08 }Background start pose (default { opacity: 0, scale: 1.08 }); it ends at identity.
effect(required)PresetInput<any, any>—Entrance (definition or preset) triggered for every line.
intervalnumber—ms between line starts (0–1000, default 120).
lines(required)readonly Element[]——
optionsobject—Options merged into the effect's options for every line.
reducedMotionReducedMotion——

C07 · Spotlight and vignette

<Spotlight> dims the stage except a circle around target (radius, padding). The dimmed content stays interactive; the lens is decoration, so describe the step in text.

Import
@neshel-ui/animations/cinematic
API
Spotlight, createSpotlight
Stylesheet
@neshel-ui/animations/cinematic.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: C07
Preview theme: C07

Loading the example…

c07.tsx
"use client";
import "@neshel-ui/animations/cinematic.css";
import { Spotlight } from "@neshel-ui/animations/cinematic";
import { Button } from "@neshel-ui/components";
import { useRef, useState } from "react";

export default function C07Example() {
  const steps = useRef<Array<HTMLLIElement | null>>([]);
  const [lit, setLit] = useState<number | null>(null);
  return (
    <div className="grid gap-3">
      <Spotlight
        target={lit === null ? null : steps.current[lit]}
        radius={60}
        className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
      >
        <ul className="flex gap-12">
          {["Plan", "Build", "Ship"].map((step, index) => (
            <li
              key={step}
              ref={(node) => {
                steps.current[index] = node;
              }}
            >
              {step}
            </li>
          ))}
        </ul>
      </Spotlight>
      <div className="flex gap-2">
        {[0, 1, 2].map((index) => (
          <Button key={index} variant="outline" onClick={() => setLit(index)}>
            Light {index + 1}
          </Button>
        ))}
        <Button variant="outline" onClick={() => setLit(null)}>
          Clear
        </Button>
      </div>
    </div>
  );
}
Options: SpotlightOptions

SpotlightOptions

SpotlightOptions
PropTypeDefaultDescription
paddingnumber—Extra space around a focused element's box (0–200, default 16).
radiusnumber—Default radius of the lit circle around a focused element (24–800, default 120).
reducedMotionReducedMotion——

C08 · Depth of field

<DepthOfField> blurs its children by their distance to the focus index: falloff (4 px per step) up to maxBlur (8). At most six layers; −1 keeps everything sharp.

Import
@neshel-ui/animations/cinematic
API
DepthOfField, createDepthOfField
Stylesheet
@neshel-ui/animations/cinematic.css
Reduced motion
static — the decoration or content stays still
Performance
Repaints the element (colour, gradient, clip, mask, blur or stroke) while it runs; keep the area small.
Preview: C08
Preview theme: C08

Loading the example…

c08.tsx
"use client";
import "@neshel-ui/animations/cinematic.css";
import { DepthOfField } from "@neshel-ui/animations/cinematic";
import { Button } from "@neshel-ui/components";
import { useState } from "react";

export default function C08Example() {
  const [focus, setFocus] = useState(-1);
  return (
    <div className="grid gap-3">
      <DepthOfField focus={focus} className="grid gap-2">
        {["Foreground", "Subject", "Background"].map((layer) => (
          <div
            key={layer}
            className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground"
          >
            {layer}
          </div>
        ))}
      </DepthOfField>
      <div className="flex flex-wrap gap-2">
        {["Foreground", "Subject", "Background"].map((layer, index) => (
          <Button key={layer} variant="outline" onClick={() => setFocus(index)}>
            {layer}
          </Button>
        ))}
        <Button variant="outline" onClick={() => setFocus(-1)}>
          All sharp
        </Button>
      </div>
    </div>
  );
}
Options: DepthOfFieldOptions

DepthOfFieldOptions

DepthOfFieldOptions
PropTypeDefaultDescription
falloffnumber—Blur per layer of distance in px (0–12, default 4).
focusnumber—Initially focused layer (default none: everything sharp).
maxBlurnumber—Blur cap in px (0–12, default 8).
prioritynumber0Priority of the filter claims (default 0).
reducedMotionReducedMotion——
scalenumber—Scale reduction per layer of distance (0–0.1, default 0.02).

C09 · Storyboard

<Storyboard> is a carousel of <StoryboardFrame>s with rotation, previous, next and stop controls and a label. autoplay is opt-in, pauses on hover, focus, off screen and hidden pages, and never runs under reduced motion. The controls are unstyled buttons; if your CSS resets button padding, give them at least 24 × 24 px.

Import
@neshel-ui/animations/cinematic
API
Storyboard, StoryboardFrame, createStoryboard
Stylesheet
@neshel-ui/animations/cinematic.css
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: C09
Preview theme: C09

Loading the example…

c09.tsx
"use client";
import "@neshel-ui/animations/cinematic.css";
import { Storyboard, StoryboardFrame } from "@neshel-ui/animations/cinematic";

export default function C09Example() {
  return (
    <Storyboard
      label="A day"
      interval={5000}
      transition="slide"
      // The controls are plain buttons: with a CSS reset, give them a 24 px target size.
      className="[&_button]:min-h-6 [&_button]:min-w-6"
    >
      {["Sunrise", "Noon", "Dusk"].map((moment) => (
        <StoryboardFrame key={moment} label={moment}>
          <p className="rounded-xl border border-neshel-border bg-neshel-surface p-6 text-neshel-surface-foreground">
            {moment}
          </p>
        </StoryboardFrame>
      ))}
    </Storyboard>
  );
}
Options: StoryboardOptions

StoryboardOptions

StoryboardOptions
PropTypeDefaultDescription
autoplayboolean—Start rotating automatically (default false; never under reduced motion).
durationnumber—ms of a frame change (0–2000, default 450).
intervalnumber—ms per frame while autoplaying (2000–30000, default 5000).
loopbooleantrueWrap from the last frame to the first (default true).
onChange(index: number, cause: "user" | "autoplay") => void——
onPlayingChange(playing: boolean) => void——
reducedMotionReducedMotion——
startnumber0Initial frame (default 0).
transition"fade" | "slide""fade"Frame change (default "fade").

C10 · Letterbox

<Letterbox> slides two bars in while active, for a ratio of 2.39 by default. It renders a positioned frame; the content is not resized.

Import
@neshel-ui/animations/cinematic
API
Letterbox, createLetterbox
Stylesheet
@neshel-ui/animations/cinematic.css
Reduced motion
instant — the end state appears at once
Performance
Transform and opacity, one write per frame through the shared scheduler; no layout work per frame.
Preview: C10
Preview theme: C10

Loading the example…

c10.tsx
"use client";
import "@neshel-ui/animations/cinematic.css";
import { Letterbox } from "@neshel-ui/animations/cinematic";
import { Button } from "@neshel-ui/components";
import { useState } from "react";

export default function C10Example() {
  const [active, setActive] = useState(false);
  return (
    <div className="grid gap-3">
      <Letterbox
        active={active}
        ratio={2.39}
        className="grid h-56 max-w-md place-items-center rounded-xl bg-neshel-muted"
      >
        The scene
      </Letterbox>
      <Button variant="outline" onClick={() => setActive(!active)} className="justify-self-start">
        Cinema bars
      </Button>
    </div>
  );
}
Options: LetterboxOptions

LetterboxOptions

LetterboxOptions
PropTypeDefaultDescription
reducedMotionReducedMotion——
shownbooleanfalseStart with the bars shown (default false).
Edit on GitHub

On this page