'Resize my geometric shape according to the window size with three.js
I am currently trying to make my geometric shape which is an "IcosahedronGeometry" resize according to the size of the user's window in Nuxt.js (Vue.js).
For the moment, I manage to make the camera follow the size of the window but the size of my shape is still huge and doesn't resize.
For the moment I have tried this:
cube.scale.set( window.innerWidth, window.innerHeight, 1 );
But it doesn't work as expected, the object flattens...
function onWindowResize() {
renderer.setSize(window.innerWidth, window.innerHeight);
cube.scale.set( window.innerWidth, window.innerHeight, 1 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|