As I delve into the world of JavaScript coding and experiment with Three.js, I've come across a function that dynamically scales my scene based on the size of the browser window:
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
I created a demo using this function: http://codepen.io/gnazoa/pen/BjoBZz. However, I'm now curious if there is a way to control how much my 3D object scales down when the browser window shrinks.
I attempted to adjust the object scale with object.scale.set -=1.5;
within the onWindowResize()
function, but it didn't yield the desired result. After scouring the threejs.org examples, I couldn't find a solution. Any suggestions?