Skip to content

Commit

Permalink
Examples: add resize event for webgl_postprocessing_crossfade.html (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
linbingquan authored Apr 21, 2024
1 parent 46e25b0 commit e462f0e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/webgl_postprocessing_crossfade.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@

transition = new Transition( sceneA, sceneB );

window.addEventListener( 'resize', onWindowResize );

function onWindowResize() {

sceneA.resize();
sceneB.resize();
renderer.setSize( window.innerWidth, window.innerHeight );

}

}

function animate() {
Expand Down Expand Up @@ -208,6 +218,14 @@

};

this.resize = function () {

camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
this.fbo.setSize( window.innerWidth, window.innerHeight );

};

}

function Transition( sceneA, sceneB ) {
Expand Down

0 comments on commit e462f0e

Please sign in to comment.