Cinematic & Scenes
The 10 effects C01–C10: purpose, API, options, examples, reduced motion and cost.
Experimental and not on npm
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.
Loading the example…
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| conflicts | ConflictPolicy | — | 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 | — | — |
| reducedMotion | ReducedMotion | — | — |
| repeat | number | — | Extra iterations: 0 (default) … 1000, or Infinity (explicit only). |
| timeScale | number | 1 | 0.1–10 (default 1). |
| whenHidden | "pause" | "finish" | — | While the page is hidden: stop the clock (default) or finish. |
| yoyo | boolean | false | Alternate 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.
Loading the example…
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| chapters(required) | readonly ChapterInput[] | — | — |
| onChapterChange | (id: string, index: number) => void | — | — |
| reducedMotion | ReducedMotion | — | — |
| unit | number | — | 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.
Loading the example…
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| bounds | "contain" | "none" | — | "contain" keeps the canvas covering the stage (default); "none" allows any pose. |
| followFocus | boolean | true | Pan to elements that receive keyboard focus inside the canvas (default true). |
| initial | Partial<CameraPose> | — | Initial pose (default: canvas centre at zoom 1). |
| maxZoom | number | 4 | 1–10 (default 4). |
| minZoom | number | 0.5 | 0.1–1 (default 0.5). |
| onChange | (pose: CameraPose) => void | — | — |
| padding | number | — | Space around a focused element (0–400, default 24). |
| reducedMotion | ReducedMotion | — | — |
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.
Loading the example…
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| covered | boolean | true | Start covered (default true) or open. |
| pattern | CoverPattern | "split-x" | Default "split-x". |
| reducedMotion | ReducedMotion | — | — |
| slats | number | — | 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.
Loading the example…
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| covered | boolean | true | Start covered (default true) or open. |
| pattern | CoverPattern | "split-x" | Default "split-x". |
| reducedMotion | ReducedMotion | — | — |
| slats | number | — | 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.
Rooted in faith
Built with hope
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| at | TimelinePosition | — | Where the sequence starts in the timeline (default its current end). |
| background | Element | null | — | — |
| backgroundDuration | number | — | ms (0–10000, default 1200). |
| backgroundFrom | Pose | { 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. |
| interval | number | — | ms between line starts (0–1000, default 120). |
| lines(required) | readonly Element[] | — | — |
| options | object | — | Options merged into the effect's options for every line. |
| reducedMotion | ReducedMotion | — | — |
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.
Loading the example…
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| padding | number | — | Extra space around a focused element's box (0–200, default 16). |
| radius | number | — | Default radius of the lit circle around a focused element (24–800, default 120). |
| reducedMotion | ReducedMotion | — | — |
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.
Loading the example…
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| falloff | number | — | Blur per layer of distance in px (0–12, default 4). |
| focus | number | — | Initially focused layer (default none: everything sharp). |
| maxBlur | number | — | Blur cap in px (0–12, default 8). |
| priority | number | 0 | Priority of the filter claims (default 0). |
| reducedMotion | ReducedMotion | — | — |
| scale | number | — | 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.
Loading the example…
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| autoplay | boolean | — | Start rotating automatically (default false; never under reduced motion). |
| duration | number | — | ms of a frame change (0–2000, default 450). |
| interval | number | — | ms per frame while autoplaying (2000–30000, default 5000). |
| loop | boolean | true | Wrap from the last frame to the first (default true). |
| onChange | (index: number, cause: "user" | "autoplay") => void | — | — |
| onPlayingChange | (playing: boolean) => void | — | — |
| reducedMotion | ReducedMotion | — | — |
| start | number | 0 | Initial 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.
Loading the example…
"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
| Prop | Type | Default | Description |
|---|---|---|---|
| reducedMotion | ReducedMotion | — | — |
| shown | boolean | false | Start with the bars shown (default false). |