浏览代码

Merge branch 'smoother_orbit_controls' of https://github.com/lpsinger/three.js into dev

Conflicts:
	examples/js/controls/OrbitControls.js
Mr.doob 11 年之前
父节点
当前提交
9493db5fe4
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      examples/misc_controls_orbit.html

+ 11 - 0
examples/misc_controls_orbit.html

@@ -55,12 +55,20 @@
 			init();
 			render();
 
+			function animate() {
+
+				requestAnimationFrame(animate);
+				controls.update();
+
+			}
+
 			function init() {
 
 				camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
 				camera.position.z = 500;
 
 				controls = new THREE.OrbitControls( camera );
+				controls.damping = 0.2;
 				controls.addEventListener( 'change', render );
 
 				scene = new THREE.Scene();
@@ -117,6 +125,9 @@
 
 				window.addEventListener( 'resize', onWindowResize, false );
 
+				controls.addEventListener('change', render);
+				animate();
+
 			}
 
 			function onWindowResize() {