瀏覽代碼

VideoTexture: Fixed update check.

Mr.doob 7 年之前
父節點
當前提交
5e04f7639a
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/textures/VideoTexture.js

+ 3 - 3
src/textures/VideoTexture.js

@@ -21,7 +21,7 @@ VideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {
 
 	update: ( function () {
 
-		var prevTime = 0;
+		var prevTime = Date.now();
 
 		return function () {
 
@@ -29,9 +29,9 @@ VideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {
 
 			if ( video.readyState >= video.HAVE_CURRENT_DATA ) {
 
-				var time = performance.now();
+				var time = Date.now();
 
-				if ( prevTime + ( 1 / this.frameRate ) < time ) {
+				if ( time - prevTime >= ( 1000 / this.frameRate ) ) {
 
 					this.needsUpdate = true;
 					prevTime = time;