浏览代码

Merge remote-tracking branch 'greyscales/master' into dev

Mr.doob 12 年之前
父节点
当前提交
45a5f8c64f
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      src/core/Color.js

+ 12 - 0
src/core/Color.js

@@ -153,6 +153,18 @@ THREE.Color.prototype = {
 
 	},
 
+	setContextStyle: function ( contextStyle ) {
+
+		var color = /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/i.exec(contextStyle);
+
+		this.r = parseInt(color[1], 10) / 255;
+		this.g = parseInt(color[2], 10) / 255;
+		this.b = parseInt(color[3], 10) / 255;
+
+		return this;
+
+	},
+
 	lerpSelf: function ( color, alpha ) {
 
 		this.r += ( color.r - this.r ) * alpha;