Skip to Content
Neshel-UI
Animations (experimental)Reference

@neshel-ui/animations/gpu

Every export of @neshel-ui/animations/gpu, 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.

  • DepthParallax component

    D10 — 2.5D parallax from an explicit depth map (`div.neshel-gpu-frame`).

    (props: DepthParallaxProps): Element
  • DisplacementHover component

    D08 — displacement-map distortion on hover/focus (`div.neshel-gpu-frame`).

    (props: DisplacementHoverProps): Element
  • PageCurl component

    D04 — page curl: the front page peels off and reveals the page underneath (`div.neshel-pagecurl`).

    (props: PageCurlProps): Element
  • Ripple component

    D06 — liquid ripples on an image (`div.neshel-gpu-frame`).

    (props: RippleProps): Element
  • configureGpu function
    (config?: GpuConfig | undefined): void
  • createDepthParallax function
    (frame: HTMLElement, options: DepthParallaxOptions): DepthParallaxControl
  • createDisplacementHover function
    (frame: HTMLElement, options?: DisplacementHoverOptions | undefined): DisplacementControl
  • createPageCurl function
    (frame: HTMLElement, options?: PageCurlOptions | undefined): PageCurlControl
  • createRipple function
    (frame: HTMLElement, options?: RippleOptions | undefined): RippleControl
  • getGpuDebugInfo function
    (): { surfaces: number; contexts: number; waiting: number; programs: number; shaders: number; buffers: number; textures: number; vertexArrays: number; textureBytes: number; drawingBufferBytes: number; frames: number; draws: number; compileErrors: number; losses: number; lost: number; restores: number; evictions: number; fallbacks: number; effects: number; }
  • getGpuSupport function
    (): GpuSupport
  • DEPTH_ASPECT_TOLERANCE const

    Aspect tolerance between the image and its depth map.

    0.02
  • DepthParallaxControl interface

    DepthParallaxControl

    DepthParallaxControl
    PropTypeDefaultDescription
    destroy(required)() => void——
    drive(required)(source: ProgressSource) => () => void——
    mode(required)GpuMode——
    pose(required){ x: number; y: number; }——
    probe(required)(x: number, y: number) => number[] | undefined——
    reason(required)GpuReason | undefined——
    seek(required)(progress: number) => void—Render the pose at progress between from and to (exact).
  • DepthParallaxOptions interface

    DepthParallaxOptions

    DepthParallaxOptions
    PropTypeDefaultDescription
    crossOrigin"anonymous" | "use-credentials"——
    depth(required)MapSource—Grayscale depth map (required): URL, <img>, <canvas> or ImageBitmap.
    focusnumber0.5Depth that stays still 0–1 (default 0.5).
    fromParallaxPose—Poses of seek(0) and seek(1) (default x −1 → 1).
    imageHTMLImageElement | HTMLCanvasElement——
    intensitynumber—0–1 (≤ 0.06 UV; default 0.5).
    invertboolean—Black = near (default false: white = near).
    maxDprnumber——
    pointerbooleantrueFollow the pointer (default true).
    pointerTypesreadonly ("mouse" | "pen" | "touch")[]——
    reducedMotionReducedMotion——
    springSpringOptions——
    stepsnumber8Refinement steps 1–16 (default 8).
    toParallaxPose——
  • DisplacementControl interface

    DisplacementControl

    DisplacementControl
    PropTypeDefaultDescription
    amount(required)number—Rendered amount 0–1.
    destroy(required)() => void——
    mode(required)GpuMode——
    probe(required)(x: number, y: number) => number[] | undefined——
    reason(required)GpuReason | undefined——
    set(required)(amount: number) => void—Animate the amount (programmatic or external progress).
  • DisplacementHoverOptions interface

    DisplacementHoverOptions

    DisplacementHoverOptions
    PropTypeDefaultDescription
    channels"rg" | "r" | "g"——
    crossOrigin"anonymous" | "use-credentials"——
    edge"clamp" | "mirror" | "fade"——
    focusbooleantrueAlso on :focus-visible within the frame (default true).
    imageHTMLImageElement | HTMLCanvasElement——
    mapMapSource | "noise"—URL, <img>, <canvas>, ImageBitmap or "noise" (default).
    maxDprnumber——
    pointerTypesreadonly ("mouse" | "pen" | "touch")[]——
    reducedMotionReducedMotion——
    scalenumber1Map tiling 0.25–4 (default 1).
    seednumber1Seed of the built-in noise map (default 1).
    springSpringOptions——
    strengthnumber—0–1 (≤ 0.08 UV; default 0.5).
  • GpuConfig interface

    GpuConfig

    GpuConfig
    PropTypeDefaultDescription
    maxContextsnumber—Simultaneous WebGL2 contexts 1–8 (default 6; browsers keep ~16 per page).
    maxDprnumber2Device-pixel-ratio cap 1–3 (default 2).
    maxTextureSizenumber—Largest texture side px 256–8192 (default 4096; also capped by the device).
    memoryBudgetnumber96Estimated GPU memory budget in MB 16–512 (default 96).
    simulate{ unsupported?: boolean; shaderFailure?: boolean; textureFailure?: boolean; }—Testing aid (package-only switches, never consumer GLSL): unsupported behaves as if WebGL2 were missing, shaderFailure makes the next program link fail, textureFailure makes uploads fail. Lets apps verify their fallbacks; off by default.
  • GpuSupport interface

    GpuSupport

    GpuSupport
    PropTypeDefaultDescription
    reason"server" | "unsupported"——
    webgl2(required)boolean——
  • PageCurlControl interface

    PageCurlControl

    PageCurlControl
    PropTypeDefaultDescription
    cancel(required)() => void——
    destroy(required)() => void——
    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.
    mode(required)"gpu" | "css" | "static"—"gpu": mesh deformation; "css": rigid turn; "static": instant swap (no driver available or reduced).
    pause(required)() => void——
    play(required)() => void——
    probe(required)(x: number, y: number) => number[] | undefined——
    progress(required)number—Rendered progress 0–1.
    reason(required)GpuReason | undefined——
    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.
  • PageCurlOptions interface

    PageCurlOptions

    PageCurlOptions
    PropTypeDefaultDescription
    backstring#f1f5f9CSS colour of the page's reverse (default #f1f5f9).
    cornerCorner——
    driver"auto" | "gpu" | "css"—"auto" (GPU, CSS fallback), "gpu" (static without WebGL2) or "css" (rigid turn; live HTML).
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    frontHTMLElement—The page that turns (GPU: <img>/<canvas>; CSS: any element; default: the frame's first child).
    maxDprnumber——
    mesh"small" | "medium" | "large" | { columns: number; rows: number; }—"small" 16×12, "medium" 32×24, "large" 64×48 or { columns, rows } ≤ 128×96.
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    radiusnumber0.1Curl radius as a fraction of the diagonal 0.02–0.4 (default 0.1).
    reducedMotionReducedMotion——
    shadingnumber0.60–1 (default 0.6).
    trigger"manual" | "mount"—"manual" (default) or "mount".
    underHTMLElement—The page revealed underneath (default: the frame's second child, optional).
  • ParallaxPose interface

    ParallaxPose

    ParallaxPose
    PropTypeDefaultDescription
    xnumber—−1 (left) … 1 (right).
    ynumber—−1 (top) … 1 (bottom).
  • 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——
  • ProgressTrack interface

    ProgressTrack

    A C01 value track (timeline.add(effect.track())).

    ProgressTrack
    PropTypeDefaultDescription
    duration(required)number——
    easing(required)Easing | EasingPreset——
    from(required)number——
    idstring——
    to(required)number——
    value(required)MotionValue——
  • RippleControl interface

    RippleControl

    RippleControl
    PropTypeDefaultDescription
    active(required)boolean—Whether waves are still moving (a clock task exists).
    clear(required)() => void——
    destroy(required)() => void——
    drive(required)(source: ProgressSource) => () => void——
    impact(required)(x?: number, y?: number, strength?: number) => void—Add an impact at (x, y) in 0–1 frame coordinates (default centre).
    mode(required)GpuMode——
    probe(required)(x: number, y: number) => number[] | undefined—Debug probe (lab/tests): RGBA at (x, y) after a synchronous draw.
    reason(required)GpuReason | undefined——
    seek(required)(progress: number) => void——
  • RippleOptions interface

    RippleOptions

    RippleOptions
    PropTypeDefaultDescription
    amplitudenumber—0–1 (≤ 0.03 UV; default 0.5).
    dampingnumber2.50.5–6 per second (default 2.5).
    durationnumber2400ms of the seek/drive timeline 200–10000 (default 2400).
    frequencynumber10.5–4 (default 1).
    imageHTMLImageElement | HTMLCanvasElement—The raster source (default: the frame's first img/canvas).
    maxDprnumber——
    maxImpactsnumber41–8 simultaneous impacts (default 4).
    reducedMotionReducedMotion——
    seednumber1Integer seed of the seek/drive pattern (default 1).
    speednumber0.450.1–1.5 UV per second (default 0.45).
    trigger"pointer" | "hover" | "manual"——
  • DepthParallaxProps type

    DepthParallaxProps

    DepthParallaxProps
    PropTypeDefaultDescription
    children(required)ReactElement—One native <img> (or <canvas>): the content that stays accessible.
    controlRefRefObject<C | null>——
    crossOrigin"anonymous" | "use-credentials"——
    depth(required)MapSource—Grayscale depth map (required): URL, <img>, <canvas> or ImageBitmap.
    focusnumber0.5Depth that stays still 0–1 (default 0.5).
    fromParallaxPose—Poses of seek(0) and seek(1) (default x −1 → 1).
    intensitynumber—0–1 (≤ 0.06 UV; default 0.5).
    invertboolean—Black = near (default false: white = near).
    maxDprnumber——
    pointerbooleantrueFollow the pointer (default true).
    pointerTypesreadonly ("mouse" | "pen" | "touch")[]——
    reducedMotionReducedMotion——
    springSpringOptions——
    stepsnumber8Refinement steps 1–16 (default 8).
    toParallaxPose——

    Also accepts the props of: React DOM attributes.

  • DisplacementHoverProps type

    DisplacementHoverProps

    DisplacementHoverProps
    PropTypeDefaultDescription
    channels"rg" | "r" | "g"——
    children(required)ReactElement—One native <img> (or <canvas>): the content that stays accessible.
    controlRefRefObject<C | null>——
    crossOrigin"anonymous" | "use-credentials"——
    edge"clamp" | "mirror" | "fade"——
    focusbooleantrueAlso on :focus-visible within the frame (default true).
    mapMapSource | "noise"—URL, <img>, <canvas>, ImageBitmap or "noise" (default).
    maxDprnumber——
    pointerTypesreadonly ("mouse" | "pen" | "touch")[]——
    reducedMotionReducedMotion——
    scalenumber1Map tiling 0.25–4 (default 1).
    seednumber1Seed of the built-in noise map (default 1).
    springSpringOptions——
    strengthnumber—0–1 (≤ 0.08 UV; default 0.5).

    Also accepts the props of: React DOM attributes.

  • GpuDebugInfo type

    GpuDebugInfo

    GpuDebugInfo
    PropTypeDefaultDescription
    buffers(required)number——
    compileErrors(required)number——
    contexts(required)number—WebGL2 contexts currently held.
    drawingBufferBytes(required)number—Estimated drawing-buffer bytes (w × h × 4 × (depth ? 2 : 1)).
    draws(required)number—Surface draws.
    effects(required)number—Live GPU effects.
    evictions(required)number——
    fallbacks(required)number——
    frames(required)number—Frames in which the shared draw task ran.
    losses(required)number——
    lost(required)number—Surfaces whose context is currently lost (waiting for a restore or a recreation).
    programs(required)number——
    restores(required)number——
    shaders(required)number——
    surfaces(required)number—Surfaces created and not released.
    textureBytes(required)number—Estimated texture bytes (w × h × 4).
    textures(required)number——
    vertexArrays(required)number——
    waiting(required)number—Surfaces waiting for a context (budget reached, nothing evictable).
  • GpuMode type
    "gpu" | "static" | "fallback"
  • GpuReason type
    "unsupported" | "shader" | "cors" | "texture" | "memory" | "budget" | "lost"
  • MapSource type
    string | HTMLImageElement | HTMLCanvasElement | ImageBitmap
  • PageCurlProps type

    PageCurlProps

    PageCurlProps
    PropTypeDefaultDescription
    backstring#f1f5f9CSS colour of the page's reverse (default #f1f5f9).
    controlRefRefObject<C | null>——
    cornerCorner——
    driver"auto" | "gpu" | "css"—"auto" (GPU, CSS fallback), "gpu" (static without WebGL2) or "css" (rigid turn; live HTML).
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    front(required)ReactNode—The page that turns (an <img> for the GPU driver, any element for driver="css").
    maxDprnumber——
    mesh"small" | "medium" | "large" | { columns: number; rows: number; }—"small" 16×12, "medium" 32×24, "large" 64×48 or { columns, rows } ≤ 128×96.
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    radiusnumber0.1Curl radius as a fraction of the diagonal 0.02–0.4 (default 0.1).
    reducedMotionReducedMotion——
    shadingnumber0.60–1 (default 0.6).
    trigger"manual" | "mount"—"manual" (default) or "mount".
    underReactNode—The page underneath (any accessible content).

    Also accepts the props of: React DOM attributes.

  • RippleProps type

    RippleProps

    RippleProps
    PropTypeDefaultDescription
    amplitudenumber—0–1 (≤ 0.03 UV; default 0.5).
    children(required)ReactElement—One native <img> (or <canvas>): the content that stays accessible.
    controlRefRefObject<C | null>——
    dampingnumber2.50.5–6 per second (default 2.5).
    durationnumber2400ms of the seek/drive timeline 200–10000 (default 2400).
    frequencynumber10.5–4 (default 1).
    maxDprnumber——
    maxImpactsnumber41–8 simultaneous impacts (default 4).
    reducedMotionReducedMotion——
    seednumber1Integer seed of the seek/drive pattern (default 1).
    speednumber0.450.1–1.5 UV per second (default 0.45).
    trigger"pointer" | "hover" | "manual"——

    Also accepts the props of: React DOM attributes.

Edit on GitHub