Skip to content

Commit

Permalink
Listen to resize
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-herasme committed Apr 25, 2024
1 parent 23a8cdf commit 6214c24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ scene.add(pointLight);
const ambientLight = new THREE.AmbientLight(0xffffff, 0.1);
scene.add(ambientLight);

window.addEventListener("resize", function () {
effect.setSize(window.innerWidth, window.innerHeight);
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
});

function animate() {
requestAnimationFrame(animate);

Expand Down

0 comments on commit 6214c24

Please sign in to comment.