فهرست منبع

README: Changed frame-based animation to time-based animation.

Mr.doob 4 سال پیش
والد
کامیت
b9f817e265
1فایلهای تغییر یافته به همراه5 افزوده شده و 7 حذف شده
  1. 5 7
      README.md

+ 5 - 7
README.md

@@ -31,7 +31,6 @@ let camera, scene, renderer;
 let geometry, material, mesh;
 
 init();
-animate();
 
 function init() {
 
@@ -48,23 +47,22 @@ function init() {
 
 	renderer = new THREE.WebGLRenderer( { antialias: true } );
 	renderer.setSize( window.innerWidth, window.innerHeight );
+	renderer.setAnimationLoop( animation );
 	document.body.appendChild( renderer.domElement );
 
 }
 
-function animate() {
+function animation( time ) {
 
-	requestAnimationFrame( animate );
-
-	mesh.rotation.x += 0.01;
-	mesh.rotation.y += 0.02;
+	mesh.rotation.x = time / 2000;
+	mesh.rotation.y = time / 1000;
 
 	renderer.render( scene, camera );
 
 }
 ```
 
-If everything went well, you should see [this](https://jsfiddle.net/ruc3h17j/).
+If everything went well, you should see [this](https://jsfiddle.net/yf6nks2o/).
 
 ### Cloning this repository ###