Skip to content

useResize

使用 ResizeObserver 监听 app.container 的尺寸变化,自动同步 renderer 尺寸和相机宽高比。

注意create3dAppautoResize 选项默认已启用此行为,仅在需要手动控制时使用此函数。

用法

ts
import { create3dApp, useResize } from '@threeuse/core'

const app = create3dApp({ autoResize: false })
app.mount('#container')
useResize(app) // 手动启用 resize 监听

Released under the MIT License.