提交 650775f4 编写于 作者: M Mr.doob

Editor/App: Use renderer animation loop.

上级 1ec7c355
......@@ -175,12 +175,10 @@ var APP = {
}
var prevTime, request;
var prevTime;
function animate( time ) {
request = requestAnimationFrame( animate );
try {
dispatch( events.update, { time: time, delta: time - prevTime } );
......@@ -199,6 +197,8 @@ var APP = {
this.play = function () {
prevTime = performance.now();
document.addEventListener( 'keydown', onDocumentKeyDown );
document.addEventListener( 'keyup', onDocumentKeyUp );
document.addEventListener( 'mousedown', onDocumentMouseDown );
......@@ -210,8 +210,7 @@ var APP = {
dispatch( events.start, arguments );
request = requestAnimationFrame( animate );
prevTime = performance.now();
renderer.animate( animate );
};
......@@ -228,7 +227,7 @@ var APP = {
dispatch( events.stop, arguments );
cancelAnimationFrame( request );
renderer.animate( null );
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册