Initial project import
This commit is contained in:
10
node_modules/@react-three/drei/core/useAspect.js
generated
vendored
Normal file
10
node_modules/@react-three/drei/core/useAspect.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { useThree } from '@react-three/fiber';
|
||||
|
||||
function useAspect(width, height, factor = 1) {
|
||||
const v = useThree(state => state.viewport);
|
||||
const adaptedHeight = height * (v.aspect > width / height ? v.width / width : v.height / height);
|
||||
const adaptedWidth = width * (v.aspect > width / height ? v.width / width : v.height / height);
|
||||
return [adaptedWidth * factor, adaptedHeight * factor, 1];
|
||||
}
|
||||
|
||||
export { useAspect };
|
||||
Reference in New Issue
Block a user