three-scene
Version:
3D 场景
57 lines (48 loc) • 1.56 kB
TypeScript
import type { Scene as TScene } from 'three'
import type { Ref } from 'vue/dist/vue.js'
import type { Scene } from '../../types/index'
type SceneType = InstanceType<typeof Scene>
type SceneTypes = SceneType | TScene
interface UseBackground<T> {
/**
* 当前索引
*/
index: Ref<number>
/**
* 切换天空背景
* @param { SceneTypes } scene 场景对象
*/
change: (scene: SceneTypes) => void
/**
* 切换天空背景
* @param { SceneTypes } scene 场景对象
*/
changeBackground: (scene: SceneTypes) => void
/**
* 获取背地址景组
* @param { string } code 天空背景 code
* @param { string } suffix 图片后缀(jpeg、jpg、png)
* @returns { string[] } 背景地址组
*/
getBgGroup: (code: T, suffix?: string) => string[]
/**
* 加载天空背景
* @param { SceneTypes } scene 场景对象
* @param { string } code 天空背景 code
* @param { string } suffix 图片后缀(jpeg、jpg、png)
*/
load: (scene: SceneTypes, code: T, suffix?: string) => void
/**
* 加载天空背景
* @param { SceneTypes } scene 场景对象
* @param { string } code 天空背景 code
* @param { string } suffix 图片后缀(jpeg、jpg、png)
*/
backgroundLoad: (scene: SceneTypes, code: T, suffix?: string) => void
}
/**
* 背景
* @param baseUrl 基础地址(背景图地址)默认 ‘/oss/sky/’
* @param skys 天空背景列表(图片 6 个一组)
*/
export declare function useBackground<T>(baseUrl?: string, skys?: T[]): UseBackground<T>