未验证 提交 b9f817e2 编写于 作者: M Mr.doob 提交者: GitHub

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

上级 7ef43fcc
......@@ -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 ###
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册