UNPKG

@threlte/extras

Version:

Utilities, abstractions and plugins for your Threlte apps

33 lines (32 loc) 701 B
import { setContext } from 'svelte'; import { injectLayersPlugin } from './plugin.svelte'; /** * ### `layers` * * This plugin allows you to set the layers of an object. * * ```svelte * <T.Mesh layers={4}> * ``` * * In contrast to the default `layers` prop that is available on all * `THREE.Object3D` instances, this plugin enables the inheritance of the * `layers` prop. * * ```svelte * <T.Group layers={4}> * <!-- This mesh will be on layer 4 --> * <T.Mesh /> * </T.Group> * ``` * * * @param options */ const layers = (options) => { setContext('threlte-layers-context', { layers: options?.defaultLayers ?? 0 }); injectLayersPlugin(); }; export { layers };