It is cool when you look at a demo and it is resized automatically when you change the dimension of the browser’s window. To switch it fullscreen or such. THREEx.WindowResize is an little piece of code. It helps you do exactly that on your own demos in a single line.
Let’s include the script
You download it from here and include it in your page like this
1
| |
Let’s use it
Now that the script is included, simply call the following line, and you are done! Your renderer will follow the window size.
1
| |
As usual you got a renderer and a camera variable, just pass
them to the function and they will be updated on window resize.
Conclusion
For more details, see the annoted source of THREEx.WindowResize.