@playcanvas/blocks
Version:
High level abstract 3D primitives for React
74 lines (73 loc) • 2.05 kB
TypeScript
import { AnimationTrack } from "./utils/animation.ts";
export type CameraMode = 'orbit' | 'fly';
type CameraControlsProps = {
/**
* The type of camera controls to use.
*
* - `orbit`: An orbit camera that follows the splat.
* - `fly`: A fly camera that follows the splat.
*
* @defaultValue 'orbit'
*/
mode?: CameraMode;
/**
* The default mode of the camera.
*
* @defaultValue 'orbit'
*/
defaultMode?: CameraMode;
};
type SplatViewerComponentProps = CameraControlsProps & {
/**
* The url of an image to display whilst the asset is loading.
*/
src: string | Record<string, unknown>;
/**
* The style of the camera to use.
*
* - `paris`: A warm saturated style.
* - `neutral`: A neutral style.
* - `noir`: A black/white style.
*
* @defaultValue 'neutral'
*/
variant?: "paris" | "neutral" | "noir" | 'none' | Record<string, unknown>;
/**
* The track to use for the animation
*/
track?: AnimationTrack;
/**
* Whether to automatically play the animation
* @defaultValue false
*/
autoPlay?: boolean;
/**
* A callback function for when the type of camera changes
*/
onTypeChange?: (type: 'orbit' | 'fly') => void;
/**
* A callback function for when the asset progress changes
*/
onAssetProgress?: (progress: number) => void;
};
type PosterComponentProps = {
/**
* The url of the poster image
*/
poster?: string;
};
export type SplatViewerProps = SplatViewerComponentProps & PosterComponentProps & {
/**
* The className of the container
*/
className?: string;
/**
* The children of the component
*/
children?: React.ReactNode;
};
/**
* The SplatViewer is a component that displays a Gaussian Splat.
*/
export declare function SplatViewer({ src, variant, poster, mode, defaultMode, onTypeChange, className, children }: SplatViewerProps): import("react/jsx-runtime").JSX.Element;
export {};