【发布时间】:2021-07-10 05:00:22
【问题描述】:
我已经使用 react-three-fiber 设置了一个 3D 模型,并希望使其具有响应性。该模型在较小的屏幕上变得非常模糊,所以我想使用 pixelRatio = {window.devicePixelRatio}。但是,它找不到道具 pixelRatio 并且无法编译。有谁知道这是为什么?
代码:
<Canvas gl={{ antialias: true }} pixelRatio={window.devicePixelRatio}>
<PerspectiveCamera>
<axesHelper />
<gridHelper />
<OrbitControls
target={[0, 0, 0]}
enablePan={false}
autoRotate
maxDistance={1}
minDistance={0.6}
/>
<ambientLight intensity={0.5} />
<Spotlight />
<pointLight position={[0, 1, 2]} />
<Suspense fallback={null}>
<Model />
</Suspense>
</PerspectiveCamera>
</Canvas>
我只是收到消息“属性 'pixelRatio' 在类型 'IntrinsicAttributes & Props' 上不存在。”
【问题讨论】:
标签: reactjs typescript three.js react-three-fiber