Created
February 21, 2019 19:30
-
-
Save graphoarty/735ce51f4a105668b3bb33596d26e8ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add an event listener that fires the function onWindowResize on resize | |
window.addEventListener('resize', onWindowResize, false); | |
function onWindowResize() { | |
// Adjust the camera aspect ratio to the camera to suit the new height and width of the window | |
camera.aspect = window.innerWidth / window.innerHeight; | |
// Updates the camera's projection matrix. (docs) | |
camera.updateProjectionMatrix(); | |
// Sets the size of the rendering viewport in which the camera fit in perfectly | |
renderer.setSize(window.innerWidth, window.innerHeight); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment