소스 검색

Changed Color constructor RGB support implementation.

Mr.doob 11 년 전
부모
커밋
7e21e0b652
1개의 변경된 파일8개의 추가작업 그리고 8개의 파일을 삭제
  1. 8 8
      src/math/Color.js

+ 8 - 8
src/math/Color.js

@@ -2,11 +2,15 @@
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/
  */
  */
 
 
-THREE.Color = function () {
+THREE.Color = function ( color ) {
 
 
-	if ( arguments.length ) this.set( arguments.length === 1 ? arguments[0] : arguments );
+	if ( arguments.length === 3 ) {
 
 
-	return this;
+		return this.setRGB( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ] );
+
+	}
+
+	return this.set( color )
 
 
 };
 };
 
 
@@ -30,11 +34,7 @@ THREE.Color.prototype = {
 
 
 			this.setStyle( value );
 			this.setStyle( value );
 
 
-		} else if ( value.length ) {
-
-            this.setRGB.apply( this, value );
-
-        }
+		}
 
 
 		return this;
 		return this;