@neshel-ui/animations/gpu
Every export of @neshel-ui/animations/gpu, generated from its declarations.
Experimental and not on npm
Signatures, members and defaults, generated from the built declarations. For explanations and examples read the guide.
DepthParallaxcomponentD10 — 2.5D parallax from an explicit depth map (`div.neshel-gpu-frame`).
(props: DepthParallaxProps): ElementDisplacementHovercomponentD08 — displacement-map distortion on hover/focus (`div.neshel-gpu-frame`).
(props: DisplacementHoverProps): ElementPageCurlcomponentD04 — page curl: the front page peels off and reveals the page underneath (`div.neshel-pagecurl`).
(props: PageCurlProps): ElementRipplecomponentD06 — liquid ripples on an image (`div.neshel-gpu-frame`).
(props: RippleProps): ElementconfigureGpufunction(config?: GpuConfig | undefined): voidcreateDepthParallaxfunction(frame: HTMLElement, options: DepthParallaxOptions): DepthParallaxControlcreateDisplacementHoverfunction(frame: HTMLElement, options?: DisplacementHoverOptions | undefined): DisplacementControlcreatePageCurlfunction(frame: HTMLElement, options?: PageCurlOptions | undefined): PageCurlControlcreateRipplefunction(frame: HTMLElement, options?: RippleOptions | undefined): RippleControlgetGpuDebugInfofunction(): { 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; }getGpuSupportfunction(): GpuSupportDEPTH_ASPECT_TOLERANCEconstAspect tolerance between the image and its depth map.
0.02DepthParallaxControlinterfaceDepthParallaxControl
DepthParallaxControl Prop Type Default Description 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 progressbetweenfromandto(exact).DepthParallaxOptionsinterfaceDepthParallaxOptions
DepthParallaxOptions Prop Type Default Description crossOrigin "anonymous" | "use-credentials"— — depth(required) MapSource— Grayscale depth map (required): URL, <img>,<canvas>orImageBitmap.focus number0.5Depth that stays still 0–1 (default 0.5). from ParallaxPose— Poses of seek(0)andseek(1)(default x −1 → 1).image HTMLImageElement | HTMLCanvasElement— — intensity number— 0–1 (≤ 0.06 UV; default 0.5). invert boolean— Black = near (default false: white = near). maxDpr number— — pointer booleantrueFollow the pointer (default true). pointerTypes readonly ("mouse" | "pen" | "touch")[]— — reducedMotion ReducedMotion— — spring SpringOptions— — steps number8Refinement steps 1–16 (default 8). to ParallaxPose— — DisplacementControlinterfaceDisplacementControl
DisplacementControl Prop Type Default Description 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). DisplacementHoverOptionsinterfaceDisplacementHoverOptions
DisplacementHoverOptions Prop Type Default Description channels "rg" | "r" | "g"— — crossOrigin "anonymous" | "use-credentials"— — edge "clamp" | "mirror" | "fade"— — focus booleantrueAlso on :focus-visiblewithin the frame (default true).image HTMLImageElement | HTMLCanvasElement— — map MapSource | "noise"— URL, <img>,<canvas>,ImageBitmapor"noise"(default).maxDpr number— — pointerTypes readonly ("mouse" | "pen" | "touch")[]— — reducedMotion ReducedMotion— — scale number1Map tiling 0.25–4 (default 1). seed number1Seed of the built-in noise map (default 1). spring SpringOptions— — strength number— 0–1 (≤ 0.08 UV; default 0.5). GpuConfiginterfaceGpuConfig
GpuConfig Prop Type Default Description maxContexts number— Simultaneous WebGL2 contexts 1–8 (default 6; browsers keep ~16 per page). maxDpr number2Device-pixel-ratio cap 1–3 (default 2). maxTextureSize number— Largest texture side px 256–8192 (default 4096; also capped by the device). memoryBudget number96Estimated GPU memory budget in MB 16–512 (default 96). simulate { unsupported?: boolean; shaderFailure?: boolean; textureFailure?: boolean; }— Testing aid (package-only switches, never consumer GLSL): unsupportedbehaves as if WebGL2 were missing,shaderFailuremakes the next program link fail,textureFailuremakes uploads fail. Lets apps verify their fallbacks; off by default.GpuSupportinterfaceGpuSupport
GpuSupport Prop Type Default Description reason "server" | "unsupported"— — webgl2(required) boolean— — PageCurlControlinterfacePageCurlControl
PageCurlControl Prop Type Default Description 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.PageCurlOptionsinterfacePageCurlOptions
PageCurlOptions Prop Type Default Description back string#f1f5f9CSS colour of the page's reverse (default #f1f5f9).corner Corner— — driver "auto" | "gpu" | "css"— "auto"(GPU, CSS fallback),"gpu"(static without WebGL2) or"css"(rigid turn; live HTML).duration number— ms (0–10000; default per effect). easing Easing | EasingPreset— — front HTMLElement— The page that turns (GPU: <img>/<canvas>; CSS: any element; default: the frame's first child).maxDpr number— — 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— — progress ProgressSource— Drive from a 0–1 source instead of the own clock. radius number0.1Curl radius as a fraction of the diagonal 0.02–0.4 (default 0.1). reducedMotion ReducedMotion— — shading number0.60–1 (default 0.6). trigger "manual" | "mount"— "manual"(default) or"mount".under HTMLElement— The page revealed underneath (default: the frame's second child, optional). ParallaxPoseinterfaceParallaxPose
ParallaxPose Prop Type Default Description x number— −1 (left) … 1 (right). y number— −1 (top) … 1 (bottom). ProgressSourceinterfaceProgressSource
Any 0–1 progress source (the 011
ScrollProgressand motion values fit).ProgressSource Prop Type Default Description get(required) () => number— — subscribe(required) (listener: (progress: number) => void) => () => void— — ProgressTrackinterfaceProgressTrack
A C01 value track (
timeline.add(effect.track())).ProgressTrack Prop Type Default Description duration(required) number— — easing(required) Easing | EasingPreset— — from(required) number— — id string— — to(required) number— — value(required) MotionValue— — RippleControlinterfaceRippleControl
RippleControl Prop Type Default Description 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— — RippleOptionsinterfaceRippleOptions
RippleOptions Prop Type Default Description amplitude number— 0–1 (≤ 0.03 UV; default 0.5). damping number2.50.5–6 per second (default 2.5). duration number2400ms of the seek/drivetimeline 200–10000 (default 2400).frequency number10.5–4 (default 1). image HTMLImageElement | HTMLCanvasElement— The raster source (default: the frame's first img/canvas).maxDpr number— — maxImpacts number41–8 simultaneous impacts (default 4). reducedMotion ReducedMotion— — seed number1Integer seed of the seek/drivepattern (default 1).speed number0.450.1–1.5 UV per second (default 0.45). trigger "pointer" | "hover" | "manual"— — DepthParallaxPropstypeDepthParallaxProps
DepthParallaxProps Prop Type Default Description children(required) ReactElement— One native <img>(or<canvas>): the content that stays accessible.controlRef RefObject<C | null>— — crossOrigin "anonymous" | "use-credentials"— — depth(required) MapSource— Grayscale depth map (required): URL, <img>,<canvas>orImageBitmap.focus number0.5Depth that stays still 0–1 (default 0.5). from ParallaxPose— Poses of seek(0)andseek(1)(default x −1 → 1).intensity number— 0–1 (≤ 0.06 UV; default 0.5). invert boolean— Black = near (default false: white = near). maxDpr number— — pointer booleantrueFollow the pointer (default true). pointerTypes readonly ("mouse" | "pen" | "touch")[]— — reducedMotion ReducedMotion— — spring SpringOptions— — steps number8Refinement steps 1–16 (default 8). to ParallaxPose— — Also accepts the props of: React DOM attributes.
DisplacementHoverPropstypeDisplacementHoverProps
DisplacementHoverProps Prop Type Default Description channels "rg" | "r" | "g"— — children(required) ReactElement— One native <img>(or<canvas>): the content that stays accessible.controlRef RefObject<C | null>— — crossOrigin "anonymous" | "use-credentials"— — edge "clamp" | "mirror" | "fade"— — focus booleantrueAlso on :focus-visiblewithin the frame (default true).map MapSource | "noise"— URL, <img>,<canvas>,ImageBitmapor"noise"(default).maxDpr number— — pointerTypes readonly ("mouse" | "pen" | "touch")[]— — reducedMotion ReducedMotion— — scale number1Map tiling 0.25–4 (default 1). seed number1Seed of the built-in noise map (default 1). spring SpringOptions— — strength number— 0–1 (≤ 0.08 UV; default 0.5). Also accepts the props of: React DOM attributes.
GpuDebugInfotypeGpuDebugInfo
GpuDebugInfo Prop Type Default Description 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). GpuModetype"gpu" | "static" | "fallback"GpuReasontype"unsupported" | "shader" | "cors" | "texture" | "memory" | "budget" | "lost"MapSourcetypestring | HTMLImageElement | HTMLCanvasElement | ImageBitmapPageCurlPropstypePageCurlProps
PageCurlProps Prop Type Default Description back string#f1f5f9CSS colour of the page's reverse (default #f1f5f9).controlRef RefObject<C | null>— — corner Corner— — driver "auto" | "gpu" | "css"— "auto"(GPU, CSS fallback),"gpu"(static without WebGL2) or"css"(rigid turn; live HTML).duration number— ms (0–10000; default per effect). easing Easing | EasingPreset— — front(required) ReactNode— The page that turns (an <img>for the GPU driver, any element fordriver="css").maxDpr number— — 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— — progress ProgressSource— Drive from a 0–1 source instead of the own clock. radius number0.1Curl radius as a fraction of the diagonal 0.02–0.4 (default 0.1). reducedMotion ReducedMotion— — shading number0.60–1 (default 0.6). trigger "manual" | "mount"— "manual"(default) or"mount".under ReactNode— The page underneath (any accessible content). Also accepts the props of: React DOM attributes.
RipplePropstypeRippleProps
RippleProps Prop Type Default Description amplitude number— 0–1 (≤ 0.03 UV; default 0.5). children(required) ReactElement— One native <img>(or<canvas>): the content that stays accessible.controlRef RefObject<C | null>— — damping number2.50.5–6 per second (default 2.5). duration number2400ms of the seek/drivetimeline 200–10000 (default 2400).frequency number10.5–4 (default 1). maxDpr number— — maxImpacts number41–8 simultaneous impacts (default 4). reducedMotion ReducedMotion— — seed number1Integer seed of the seek/drivepattern (default 1).speed number0.450.1–1.5 UV per second (default 0.45). trigger "pointer" | "hover" | "manual"— — Also accepts the props of: React DOM attributes.