Browse Source

Added fromArray() and toArray() to Color.

Mr.doob 12 years ago
parent
commit
f7a5174e28
1 changed files with 16 additions and 0 deletions
  1. 16 0
      src/math/Color.js

+ 16 - 0
src/math/Color.js

@@ -356,6 +356,22 @@ THREE.Color.prototype = {
 
 
 	},
 	},
 
 
+	fromArray: function ( array ) {
+
+		this.r = array[ 0 ];
+		this.g = array[ 1 ];
+		this.b = array[ 2 ];
+
+		return this;
+
+	},
+
+	toArray: function () {
+
+		return [ this.r, this.g, this.b ];
+
+	},
+
 	clone: function () {
 	clone: function () {
 
 
 		return new THREE.Color().setRGB( this.r, this.g, this.b );
 		return new THREE.Color().setRGB( this.r, this.g, this.b );