UNPKG

@playcanvas/blocks

Version:

High level abstract 3D primitives for React

87 lines (86 loc) 2.55 kB
import { ReactNode } from "react"; import { CameraMode } from "./splat-viewer.tsx"; type AssetViewerContextValue = { /** * Whether the viewer is in fullscreen mode. */ isFullscreen: boolean; /** * Toggles the fullscreen mode. */ toggleFullscreen: () => void; /** * Triggers a download of the asset. */ triggerDownload: () => void; /** * The source of the asset. */ src: string | Record<string, unknown>; /** * Whether the viewer is interacting with the asset. */ isInteracting: boolean; /** * The type of camera to use. */ mode: CameraMode; /** * The type of camera to use. */ setMode: (mode: CameraMode) => void; /** * The overlay to display. * @defaultValue null */ overlay: "help" | "settings" | null; /** * Toggles the overlay. */ setOverlay: (overlay: "help" | "settings" | null) => void; /** * Whether the auto rotate is enabled. */ autoRotate: boolean; /** * Toggles the auto rotate. */ setAutoRotate: (autoRotate: boolean) => void; /** * Subscribes to the asset progress. */ subscribe: (fn: (progress: number) => void) => () => void; /** * Subscribes to the camera reset. */ subscribeCameraReset: (fn: () => void) => () => void; /** * Resets the camera. */ resetCamera: () => void; }; export declare const AssetViewerContext: import("react").Context<AssetViewerContextValue | undefined>; export declare function useAssetViewer(): AssetViewerContextValue; export declare function AssetViewerProvider({ children, autoPlay, targetRef, mode, setMode, src, subscribe }: { children: React.ReactNode; autoPlay?: boolean; targetRef: React.RefObject<HTMLElement>; src: string | Record<string, unknown>; mode: CameraMode; setMode: (mode: CameraMode) => void; subscribe: (fn: (progress: number) => void) => () => void; }): import("react/jsx-runtime").JSX.Element; type TimelineContextValue = { getTime: () => number; setTime: (value: number) => void; onCommit?: (value: number) => void; subscribe: (fn: (value: number) => void) => () => void; isPlaying: boolean; setIsPlaying: (value: boolean) => void; }; export declare function useTimeline(): TimelineContextValue; export declare function TimelineProvider({ children, autoPlay, }: { children: ReactNode; autoPlay?: boolean; }): import("react/jsx-runtime").JSX.Element; export {};