UNPKG

@motion-core/motion-gpu

Version:

Framework-agnostic WebGPU runtime for fullscreen WGSL shaders with explicit Svelte, React, and Vue adapter entrypoints.

21 lines (20 loc) 607 B
import { createContext, useContext } from "react"; //#region src/lib/react/motiongpu-context.ts /** * Internal React context container. */ var MotionGPUReactContext = createContext(null); /** * Returns active MotionGPU runtime context. * * @returns Active context. * @throws {Error} When called outside `<FragCanvas>`. */ function useMotionGPU() { const context = useContext(MotionGPUReactContext); if (!context) throw new Error("useMotionGPU must be used inside <FragCanvas>"); return context; } //#endregion export { MotionGPUReactContext, useMotionGPU }; //# sourceMappingURL=motiongpu-context.js.map