Skip to Content
Neshel-UI
Animations (experimental)Reference

@neshel-ui/animations/media

Every export of @neshel-ui/animations/media, generated from its declarations.

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.

Signatures, members and defaults, generated from the built declarations. For explanations and examples read the guide.

  • BlurUpImage component

    M02 — a native `<img>` with a blurred placeholder until it is decoded (visible without JavaScript).

    (props: BlurUpImageProps): Element
  • CompareSlider component

    M04 — before/after comparison with a native range input (keyboard, touch, pointer, value text).

    (props: CompareSliderProps): Element
  • Crossfade component

    M08 — stacked slides cross-fading to `index` (inactive slides inert and hidden from AT).

    (props: CrossfadeProps): Element
  • Duotone component

    M05 — duotone transition on the single child (image untouched; filter restored on cleanup).

    ({ children, controlRef, ...options }: DuotoneProps): Element
  • HoverPan component

    M10 — the single media child follows the pointer inside a clipping frame.

    (props: HoverPanProps): Element
  • KenBurns component

    M01 — a clipping frame (`div.neshel-kenburns`) around one image or video.

    (props: KenBurnsProps): Element
  • Lightbox component

    M07 — thumbnail button + native modal `<dialog>` with a FLIP zoom (focus, Escape, scroll lock).

    (props: LightboxProps): Element
  • LoadReveal component

    M03 — reveal the single `<img>` child when (and only if) it finishes loading.

    ({ children, controlRef, ...options }: LoadRevealProps): Element
  • PixelDissolve component

    M09 — block dissolve between stacked images on a decorative canvas (cross-fade fallback).

    (props: PixelDissolveProps): Element
  • cameraValues function

    Bounded pose → channel values (`translate` in % of the media box).

    (scale: number, x: number, y: number): { scale: string; translate: string; }
  • createBlurUp function

    M02 — a blurred placeholder layer fades out as the decoded image fades in.

    (frame: HTMLElement, options?: BlurUpOptions | undefined): MediaRevealControl
  • createCompareSlider function
    (root: HTMLElement, options?: CompareSliderOptions | undefined): CompareControl
  • createCrossfade function

    M08 — cross-fade between slides; interruptible from the current opacities.

    (container: HTMLElement, options?: CrossfadeOptions | undefined): CrossfadeControl
  • createDuotone function
    (element: Element, options?: DuotoneOptions | undefined): ProgressControl
  • createHoverPan function

    M10 — the media follows the pointer inside its frame (bounded, springy, restored on leave).

    (frame: HTMLElement, options?: HoverPanOptions | undefined): HoverPanControl
  • createKenBurns function

    M01 — slow bounded camera move over an image or video inside a clipping frame.

    (media: Element, options?: KenBurnsOptions | undefined): ProgressControl
  • createLightboxZoom function
    (options: LightboxZoomOptions): LightboxControl
  • createLoadReveal function

    M03 — the image is revealed by a clip when (and only if) it finishes loading.

    (img: HTMLImageElement, options?: LoadRevealOptions | undefined): MediaRevealControl
  • createPixelDissolve function

    M09 — block dissolve between images on a Canvas 2D surface; cross-fade fallback.

    (container: HTMLElement, options?: PixelDissolveOptions | undefined): DissolveControl
  • createVideoScrub function
    (video: HTMLVideoElement, options?: VideoScrubOptions | undefined): VideoScrubControl
  • getMediaDebugInfo function
    (): MediaDebugInfo
  • getMediaSupport function
    (): MediaSupport
  • useKenBurns function

    M01 — Ken Burns on a media element you render inside a clipping frame.

    (ref: RefObject<Element | null>, options?: KenBurnsOptions | undefined): RefObject<ProgressControl | null>
  • useVideoScrub function

    M06 — scrub a `<video>` you render from a 0–1 progress source (never plays it).

    (ref: RefObject<HTMLVideoElement | null>, options: VideoScrubOptions): RefObject<VideoScrubControl | null>
  • watchImage function
    (img: HTMLImageElement, onChange: (state: ImageLoadState) => void, options?: WatchImageOptions | undefined): () => void
  • BlurUpOptions interface

    BlurUpOptions

    BlurUpOptions
    PropTypeDefaultDescription
    blurnumber—Placeholder blur in px (0–40, default 16).
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    imageHTMLImageElement—The image (default: the frame's first img).
    onStateChange(state: MediaRevealState) => void——
    placeholderstring—Placeholder: a tiny image URL/data URI, a CSS gradient or a colour (default a neutral tint).
    reducedMotionReducedMotion——
    replayboolean—Animate an image that is already loaded at attach time (default false: shown at once).
    revealTimeoutnumber—ms after which a still-loading image is revealed anyway (500–60000, default 8000).
  • CameraPose interface

    CameraPose

    CameraPose
    PropTypeDefaultDescription
    scalenumber—Uniform zoom 1–3.
    xnumber—−1 (left) … 1 (right) of the pan allowance.
    ynumber—−1 (top) … 1 (bottom) of the pan allowance.
  • CompareControl interface

    CompareControl

    CompareControl
    PropTypeDefaultDescription
    destroy(required)() => void——
    set(required)(value: number) => void—Set the value (0–100) without animation.
    value(required)number——
  • CompareSliderOptions interface

    CompareSliderOptions

    CompareSliderOptions
    PropTypeDefaultDescription
    onValueChange(value: number) => void——
    orientation"horizontal" | "vertical"——
    stepnumber—Keyboard step (0.1–25, default 1).
    valuenumber500–100 (default 50): share of the before image.
    valueText(value: number) => string"N% before, M% after"Value text for assistive technology (default "N% before, M% after").
  • CrossfadeControl interface

    CrossfadeControl

    CrossfadeControl
    PropTypeDefaultDescription
    count(required)number——
    destroy(required)() => void——
    index(required)number——
    next(required)() => void——
    pause(required)() => void—Stop autoplay (WCAG 2.2.2).
    play(required)() => void——
    prev(required)() => void——
    show(required)(index: number) => void——
  • CrossfadeOptions interface

    CrossfadeOptions

    CrossfadeOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    indexnumber0Initial slide (default 0).
    intervalnumber—Autoplay interval in ms (≥ 2000; none by default). Paused on hover, focus inside and hidden pages.
    onIndexChange(index: number) => void——
    reducedMotionReducedMotion——
  • DissolveControl interface

    DissolveControl

    DissolveControl
    PropTypeDefaultDescription
    destroy(required)() => void——
    index(required)number——
    mode(required)"dissolve" | "fade" | "none"—dissolve (canvas) or fade (fallback) — of the last transition.
    running(required)boolean——
    show(required)(index: number) => void——
  • DuotoneOptions interface

    DuotoneOptions

    DuotoneOptions
    PropTypeDefaultDescription
    amountnumber1Final amount of duotone 0–1 (default 1).
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    highlightstring#f2c14eColour of the highlights (default #f2c14e).
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    shadowstring#1b1f3aColour of the shadows (default #1b1f3a). Hex #rgb/#rrggbb or rgb(r g b).
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
  • GalleryOptions interface

    GalleryOptions

    GalleryOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    indexnumber0Initial slide (default 0).
    onIndexChange(index: number) => void——
    reducedMotionReducedMotion——
  • HoverPanControl interface

    HoverPanControl

    HoverPanControl
    PropTypeDefaultDescription
    destroy(required)() => void——
    reset(required)() => void—Back to the rest pose.
  • HoverPanOptions interface

    HoverPanOptions

    HoverPanOptions
    PropTypeDefaultDescription
    keyboardboolean—Focusable frame with arrow-key panning (for images whose detail is information; needs a name).
    mediaElement—The element that moves (default: the frame's first element child).
    pointerTypesreadonly ("mouse" | "pen" | "touch")[]—Pointer types that pan (default mouse and pen; touch scrolls the page).
    reducedMotionReducedMotion——
    scalenumber1.4Zoom while hovering 1.05–3 (default 1.4).
    springSpringOptions——
    stepnumber—Keyboard step as a fraction of the pan range (0.02–0.5, default 0.1).
  • KenBurnsOptions interface

    KenBurnsOptions

    KenBurnsOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    fromCameraPose{ scale: 1.05, x: 0, y: 0 }Start pose (default { scale: 1.05, x: 0, y: 0 }).
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    repeatnumber—Extra runs (0–1000 or Infinity, explicit; default 0). Paused off-screen and on hidden pages.
    toCameraPose{ scale: 1.18, x: 0.4, y: -0.3 }End pose (default { scale: 1.18, x: 0.4, y: -0.3 }).
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
    yoyobooleantrueAlternate direction between runs (default true).
  • LightboxControl interface

    LightboxControl

    LightboxControl
    PropTypeDefaultDescription
    close(required)() => void—Animated close (immediate under reduced motion).
    destroy(required)() => void——
    open(required)() => void——
    state(required)"closed" | "open" | "closing"——
  • LightboxZoomOptions interface

    LightboxZoomOptions

    LightboxZoomOptions
    PropTypeDefaultDescription
    dialog(required)HTMLDialogElement——
    durationnumber—ms of the zoom (0–2000, default 380).
    getThumbnail(required)() => Element | null—The thumbnail to zoom from/to (measured at open and close).
    image(required)HTMLElement—The large image (or any element) that zooms.
    onOpenChange(open: boolean) => void——
    reducedMotionReducedMotion——
  • LoadRevealOptions interface

    LoadRevealOptions

    LoadRevealOptions
    PropTypeDefaultDescription
    direction"up" | "down" | "left" | "right"upEdge the reveal travels toward (default up for inset, right for wipe).
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onStateChange(state: MediaRevealState) => void——
    reducedMotionReducedMotion——
    replayboolean—Animate an image that is already loaded at attach time (default false: shown at once).
    revealTimeoutnumber—ms after which a still-loading image is revealed anyway (500–60000, default 8000).
    shape"inset" | "circle" | "wipe"—inset (edge wipe, default), circle (from the centre) or wipe (horizontal).
  • MediaDebugInfo interface

    MediaDebugInfo

    MediaDebugInfo
    PropTypeDefaultDescription
    cells(required)number——
    effects(required)number——
    filters(required)number——
    framesPresented(required)number——
    hidden(required)number——
    scrollLocks(required)number——
    seeksCoalesced(required)number——
    seeksIssued(required)number——
    seeksRequested(required)number——
    surfaces(required)number——
    watchers(required)number——
  • MediaRevealControl interface

    MediaRevealControl

    MediaRevealControl
    PropTypeDefaultDescription
    destroy(required)() => void——
    reveal(required)() => void—Show the image now (no animation).
    state(required)MediaRevealState——
  • MediaRevealOptions interface

    MediaRevealOptions

    MediaRevealOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onStateChange(state: MediaRevealState) => void——
    reducedMotionReducedMotion——
    replayboolean—Animate an image that is already loaded at attach time (default false: shown at once).
    revealTimeoutnumber—ms after which a still-loading image is revealed anyway (500–60000, default 8000).
  • MediaSupport interface

    MediaSupport

    MediaSupport
    PropTypeDefaultDescription
    canvas2d(required)boolean——
    clipPath(required)boolean——
    decode(required)boolean——
    dialog(required)boolean——
    fastSeek(required)boolean——
    inert(required)boolean——
    videoFrameCallback(required)boolean——
  • PixelDissolveOptions interface

    PixelDissolveOptions

    PixelDissolveOptions
    PropTypeDefaultDescription
    cellnumber—Cell size in CSS px (4–64, default 16); enlarged when the grid would exceed maxCells.
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    indexnumber0Initial slide (default 0).
    maxCellsnumber—Upper bound of cells (64–4096, default 4096).
    maxDprnumber—Canvas DPR cap (1–3, default 2).
    onIndexChange(index: number) => void——
    reducedMotionReducedMotion——
    seednumber1Order seed (default 1).
  • ProgressControl interface

    ProgressControl

    ProgressControl
    PropTypeDefaultDescription
    cancel(required)() => void——
    destroy(required)() => void—Idempotent: stops, releases and restores.
    drive(required)(source: ProgressSource) => () => void—Follow a 0–1 source instead of the own clock; returns the unsubscribe.
    finish(required)() => void——
    finished(required)Promise<MotionResult>—Promise of the current (or next) run.
    pause(required)() => void——
    play(required)() => void——
    progress(required)number—Rendered progress 0–1.
    reverse(required)() => void——
    seek(required)(progress: number) => void—Render the effect at a time fraction 0–1 of its run (eased).
    state(required)MotionState——
    track(required)(options?: ProgressTrackOptions) => ProgressTrack—A value track for createTimeline().add(…): the timeline clock drives this effect.
  • ProgressEffectOptions interface

    ProgressEffectOptions

    ProgressEffectOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
  • ProgressSource interface

    ProgressSource

    Any 0–1 progress source (the 011 ScrollProgress and motion values fit).

    ProgressSource
    PropTypeDefaultDescription
    get(required)() => number——
    subscribe(required)(listener: (progress: number) => void) => () => void——
  • VideoScrubControl interface

    VideoScrubControl

    VideoScrubControl
    PropTypeDefaultDescription
    destroy(required)() => void——
    drive(required)(source: ProgressSource) => () => void—Follow another source; returns the unsubscribe.
    seek(required)(progress: number) => void—Request a progress 0–1 directly.
    state(required)"waiting" | "ready" | "reduced"—waiting (no metadata yet), ready, reduced.
    target(required)number—Newest requested time (s) or NaN.
  • VideoScrubOptions interface

    VideoScrubOptions

    VideoScrubOptions
    PropTypeDefaultDescription
    precision"exact" | "fast"—exact (default) or fast (keyframe seeks via fastSeek where available).
    progressProgressSource—0–1 source (required unless you call drive() later).
    rangereadonly [number, number]—Time range in s mapped to 0–1 (default the whole duration).
    reducedMotionReducedMotion——
    restTimenumber—s shown under reduced motion (default: the current time).
    restorebooleanfalseRestore the original currentTime on destroy (default false).
    tolerancenumber—s; smaller differences are not sought (0–1, default 1/60).
  • WatchImageOptions interface

    WatchImageOptions

    WatchImageOptions
    PropTypeDefaultDescription
    decodebooleantrueAwait img.decode() after load (default true).
  • BlurUpImageProps type

    BlurUpImageProps

    BlurUpImageProps
    PropTypeDefaultDescription
    blurnumber—Placeholder blur in px (0–40, default 16).
    controlRefRefObject<C | null>——
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    frameClassNamestring—Class of the wrapper span.neshel-blurup.
    onRevealStateChangeBlurUpOptions["onStateChange"]——
    placeholderstring—Placeholder: a tiny image URL/data URI, a CSS gradient or a colour (default a neutral tint).
    reducedMotionReducedMotion——
    replayboolean—Animate an image that is already loaded at attach time (default false: shown at once).
    revealTimeoutnumber—ms after which a still-loading image is revealed anyway (500–60000, default 8000).

    Also accepts the props of: React DOM attributes.

  • CompareSliderProps type

    CompareSliderProps

    CompareSliderProps
    PropTypeDefaultDescription
    after(required)ReactNode——
    before(required)ReactNode——
    controlRefRefObject<C | null>——
    defaultValuenumber——
    jumps{ before: string; after: string; }—Labels of optional "show before"/"show after" buttons (comparison without dragging).
    label(required)string—Accessible name of the slider (required).
    onValueChange(value: number) => void——
    orientation"horizontal" | "vertical"——
    stepnumber——
    valuenumber—Controlled value 0–100.
    valueText(value: number) => string——

    Also accepts the props of: React DOM attributes.

  • CrossfadeProps type

    CrossfadeProps

    CrossfadeProps
    PropTypeDefaultDescription
    children(required)ReactNode——
    controlRefRefObject<C | null>——
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    indexnumber0Initial slide (default 0).
    intervalnumber—Autoplay interval in ms (≥ 2000; none by default). Paused on hover, focus inside and hidden pages.
    onIndexChange(index: number) => void——
    reducedMotionReducedMotion——

    Also accepts the props of: React DOM attributes.

  • DuotoneProps type

    DuotoneProps

    DuotoneProps
    PropTypeDefaultDescription
    amountnumber1Final amount of duotone 0–1 (default 1).
    children(required)ReactElement——
    controlRefRefObject<C | null>——
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    highlightstring#f2c14eColour of the highlights (default #f2c14e).
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    shadowstring#1b1f3aColour of the shadows (default #1b1f3a). Hex #rgb/#rrggbb or rgb(r g b).
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
  • HoverPanProps type

    HoverPanProps

    HoverPanProps
    PropTypeDefaultDescription
    children(required)ReactElement——
    controlRefRefObject<C | null>——
    keyboardboolean—Focusable frame with arrow-key panning (for images whose detail is information; needs a name).
    labelstring—Accessible name of the focusable frame (required with keyboard).
    pointerTypesreadonly ("mouse" | "pen" | "touch")[]—Pointer types that pan (default mouse and pen; touch scrolls the page).
    reducedMotionReducedMotion——
    scalenumber1.4Zoom while hovering 1.05–3 (default 1.4).
    springSpringOptions——
    stepnumber—Keyboard step as a fraction of the pan range (0.02–0.5, default 0.1).

    Also accepts the props of: React DOM attributes.

  • ImageLoadState type

    Image load watcher (Phase 015, internal; research R1, contracts/media-api.md §1). Reports `loading`, `loaded` or `error` for an `<img>` WITHOUT missing a `load` that happened before it was attached: the first report is synchronous from `complete`/`naturalWidth`. `load` waits for `decode()` (rejection tolerated — the state is re-read) so a reveal never shows a half-decoded frame. A MutationObserver on `src`/`srcset`/`sizes` re-evaluates after an explicit source change; answers of an older generation are dropped. Native attributes are never written. A responsive `srcset` candidate swap (viewport/DPR) keeps the current image visible, so it only reports `loaded` again.

    "loading" | "loaded" | "error"
  • KenBurnsProps type

    KenBurnsProps

    KenBurnsProps
    PropTypeDefaultDescription
    children(required)ReactElement——
    controlRefRefObject<C | null>——
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    fromCameraPose{ scale: 1.05, x: 0, y: 0 }Start pose (default { scale: 1.05, x: 0, y: 0 }).
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    repeatnumber—Extra runs (0–1000 or Infinity, explicit; default 0). Paused off-screen and on hidden pages.
    toCameraPose{ scale: 1.18, x: 0.4, y: -0.3 }End pose (default { scale: 1.18, x: 0.4, y: -0.3 }).
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
    yoyobooleantrueAlternate direction between runs (default true).

    Also accepts the props of: React DOM attributes.

  • LightboxProps type

    LightboxProps

    LightboxProps
    PropTypeDefaultDescription
    children(required)ReactNode—Large content; its first element zooms from the thumbnail.
    classNamestring——
    closeLabelstring——
    controlRefRefObject<C | null>——
    durationnumber——
    label(required)string—Accessible name of the dialog (required).
    onOpenChange(open: boolean) => void——
    reducedMotionLightboxOptionsPolicy——
    thumbnail(required)ReactElement—The thumbnail (usually an <img>); rendered inside the trigger button.
    triggerLabelstring—Accessible name of the trigger (default: the thumbnail's alt text).
  • LoadRevealProps type

    LoadRevealProps

    LoadRevealProps
    PropTypeDefaultDescription
    children(required)ReactElement—One native <img>.
    controlRefRefObject<C | null>——
    direction"up" | "down" | "left" | "right"upEdge the reveal travels toward (default up for inset, right for wipe).
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onStateChange(state: MediaRevealState) => void——
    reducedMotionReducedMotion——
    replayboolean—Animate an image that is already loaded at attach time (default false: shown at once).
    revealTimeoutnumber—ms after which a still-loading image is revealed anyway (500–60000, default 8000).
    shape"inset" | "circle" | "wipe"—inset (edge wipe, default), circle (from the centre) or wipe (horizontal).
  • MediaRevealState type
    "loading" | "revealing" | "shown" | "error"
  • PixelDissolveProps type

    PixelDissolveProps

    PixelDissolveProps
    PropTypeDefaultDescription
    cellnumber—Cell size in CSS px (4–64, default 16); enlarged when the grid would exceed maxCells.
    children(required)ReactNode——
    controlRefRefObject<C | null>——
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    indexnumber0Initial slide (default 0).
    maxCellsnumber—Upper bound of cells (64–4096, default 4096).
    maxDprnumber—Canvas DPR cap (1–3, default 2).
    onIndexChange(index: number) => void——
    reducedMotionReducedMotion——
    seednumber1Order seed (default 1).

    Also accepts the props of: React DOM attributes.

  • ProgressTrigger type
    "visible" | "mount" | "manual"
Edit on GitHub