@motion-core/motion-gpu
Version:
Framework-agnostic WebGPU runtime for fullscreen WGSL shaders with explicit Svelte, React, and Vue adapter entrypoints.
41 lines • 1.43 kB
TypeScript
import { type CurrentReadable } from '../core/current-value.js';
import { type LoadedTexture, type TextureLoadOptions } from '../core/texture-loader.js';
import { type MotionGPUErrorReport } from '../core/error-report.js';
/**
* Reactive state returned by `useTexture`.
*/
export interface UseTextureResult {
/**
* Loaded textures or `null` when unavailable/failed.
*/
textures: CurrentReadable<LoadedTexture[] | null>;
/**
* `true` while an active load request is running.
*/
loading: CurrentReadable<boolean>;
/**
* Last loading error.
*/
error: CurrentReadable<Error | null>;
/**
* Last loading error normalized to MotionGPU diagnostics report shape.
*/
errorReport: CurrentReadable<MotionGPUErrorReport | null>;
/**
* Reloads all textures using current URL input.
*/
reload: () => Promise<void>;
}
/**
* Supported URL input variants for `useTexture`.
*/
export type TextureUrlInput = string[] | (() => string[]);
/**
* Loads textures from URLs and exposes reactive loading/error state.
*
* @param urlInput - URLs array or lazy URL provider.
* @param options - Loader options passed to URL fetch/decode pipeline.
* @returns Reactive texture loading state with reload support.
*/
export declare function useTexture(urlInput: TextureUrlInput, options?: TextureLoadOptions): UseTextureResult;
//# sourceMappingURL=use-texture.d.ts.map