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

Implemented performance.now() in Clock. Closes #2975.

上级 8fae05d3
......@@ -16,7 +16,7 @@ THREE.Clock = function ( autoStart ) {
THREE.Clock.prototype.start = function () {
this.startTime = Date.now();
this.startTime = performance.now !== undefined ? performance.now() : Date.now();
this.oldTime = this.startTime;
this.running = true;
......@@ -52,7 +52,7 @@ THREE.Clock.prototype.getDelta = function () {
if ( this.running ) {
var newTime = Date.now();
var newTime = performance.now !== undefined ? performance.now() : Date.now();
diff = 0.001 * ( newTime - this.oldTime );
this.oldTime = newTime;
......@@ -62,4 +62,4 @@ THREE.Clock.prototype.getDelta = function () {
return diff;
};
\ No newline at end of file
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册