UNPKG

@playcanvas/react

Version:

A React renderer for PlayCanvas – build interactive 3D applications using React's declarative paradigm.

22 lines (21 loc) 792 B
import { StandardMaterial } from 'playcanvas'; import { WithCssColors } from '../utils/color'; import { PublicProps } from '../utils/types-utils'; /** * This hook is used to create a material instance and update its properties when the props change. * @param {Materialrops} props - The props to pass to the material. * @returns {StandardMaterial} material - The material instance. * @see https://api.playcanvas.com/engine/classes/StandardMaterial.html * * @example * const material = useMaterial({ * diffuse: 'red', * opacity: 0.5, * }); * * // use the material * <Render type="box" material={material} /> */ export declare const useMaterial: (props: MaterialProps) => StandardMaterial; type MaterialProps = Partial<WithCssColors<PublicProps<StandardMaterial>>>; export {};