 	scene.add camera
 
 	cameraControls = new THREE.TrackballControls(camera)
+	window.addEventListener( 'resize', _.throttle(onWindowResize,100), false );
+		
 animate = () ->
 	requestAnimationFrame(animate)
 	dreams.update()

require('browsernizr/test/css/transforms3d');
m = require('browsernizr');

console.log m

dataLoader = require('./dataLoader.coffee')
debug = require('./debugView.coffee')

	dreams.init(dreamsData.dreams, scene, camera)
	console.log dreams
	animate()
onWindowResize = () ->
	camera.aspect = window.innerWidth / window.innerHeight;
	camera.updateProjectionMatrix();
	renderer.setSize( window.innerWidth, window.innerHeight );
createScene = () ->
	renderer = new THREE.CSS3DRenderer()
	renderer.setClearColor(0x000000,1)
