SebastianNette / threex.windowresize

three.js extension to help you handle window resize

Home Page:http://jeromeetienne.github.io/threex.windowresize/examples/basic.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

threex.windowresize

threex.windowresize is a three.js extension to help you handle window resize.

Here is a basic example and its source. Another example with devicePixelRatio and its source

How To Install It

You can install it manually. Just do

<script src='threex.windowresize.js'></script>

You can install with bower.

bower install threex.windowresize

then you add that in your html

<script src="bower_components/threex.windowresize/threex.windowresize.js"></script>

How To Use

You just have to instanciate the object. Then whenever you resize the window, it will resize the renderer canvas and adjust the camera accordingly.

var winResize	= new THREEx.WindowResize(renderer, camera)

If you need to destroy it at one point, just do winResize.destroy();. It fit well with devicePixelRatio, see an example below

renderer.devicePixelRatio	= 1/4
winResize.trigger()

About

three.js extension to help you handle window resize

http://jeromeetienne.github.io/threex.windowresize/examples/basic.html

License:MIT License


Languages

Language:JavaScript 100.0%