|
10 | 10 | <h1>[name]</h1> |
11 | 11 |
|
12 | 12 | <div class="desc"> |
13 | | - Represents a color. See also [page:ColorUtils]. |
| 13 | + Represents a color. |
14 | 14 | </div> |
15 | 15 |
|
16 | 16 |
|
17 | 17 | <h2>Example</h2> |
18 | | - |
| 18 | + <code>var color = new THREE.Color();</code> |
19 | 19 | <code>var color = new THREE.Color( 0xff0000 );</code> |
| 20 | + <code>var color = new THREE.Color("rgb(255,0,0)");</code> |
20 | 21 |
|
21 | 22 |
|
22 | 23 | <h2>Constructor</h2> |
23 | 24 |
|
24 | | - <h3>[name]( [page:Integer hex])</h3> |
| 25 | + <h3>[name]( value )</h3> |
25 | 26 | <div> |
26 | | - hex — initial color in hexadecimal<br /> |
| 27 | + value — optional argument that sets initial color. Can be a hexadecimal or a CSS-style string, for example, "rgb(250, 0,0)", "rgb(100%,0%,0%)", "#ff0000", "#f00", or "red" |
27 | 28 | </div> |
28 | 29 |
|
29 | 30 | <h2>Properties</h2> |
@@ -106,21 +107,75 @@ <h3>.setHex( [page:Integer hex] ) [page:this]</h3> |
106 | 107 | <div> |
107 | 108 | Sets this color from a hexadecimal value. |
108 | 109 | </div> |
109 | | - |
110 | | - <h3>.getContextStyle() [page:String]</h3> |
| 110 | + |
| 111 | + <h3>.setStyle( [page:String style] ) [page:this]</h3> |
111 | 112 | <div> |
112 | | - Returns the value of this color in CSS context style.<br /> |
113 | | - Example: rgb(r, g, b) |
| 113 | + style — color as a CSS-style string, for example, "rgb(250, 0,0)", "rgb(100%,0%,0%)", "#ff0000", "#f00", or "red" |
114 | 114 | </div> |
115 | | - |
116 | | - <h3>.setContextStyle( [page:String contextStyle] ) [page:this]</h3> |
117 | 115 | <div> |
118 | | - contextStyle — Color in CSS context style format.<br /> |
| 116 | + Sets this color from a CSS-style string. |
| 117 | + </div> |
| 118 | + |
| 119 | + <h3>.getStyle() [page:String]</h3> |
| 120 | + <div> |
| 121 | + Returns the value of this color as a CSS-style string. Example: rgb(255,0,0) |
| 122 | + </div> |
| 123 | + |
| 124 | + <h3>.setHSL( [page:Float h], [page:Float s], [page:Float l] ) [page:this]</h3> |
| 125 | + <div> |
| 126 | + h — hue value between 0.0 and 1.0 |
| 127 | + s — saturation value between 0.0 and 1.0 |
| 128 | + l — lightness value between 0.0 and 1.0 |
| 129 | + </div> |
| 130 | + <div> |
| 131 | + Sets color from hsl |
| 132 | + </div> |
| 133 | + |
| 134 | + <h3>.getHSL() [page:Object hsl]</h3> |
| 135 | + <div> |
| 136 | + Returns an object with properties h, s, and l. |
| 137 | + </div> |
| 138 | + |
| 139 | + <h3>.offsetHSL( [page:Float h], [page:Float s], [page:Float l] ) [page:this]</h3> |
| 140 | + <div> |
| 141 | + Adds given h, s, and l to this color's existing h, s, and l values. |
119 | 142 | </div> |
| 143 | + |
| 144 | + <h3>.add ( [page:Color color] ) [page:this]</h3> |
120 | 145 | <div> |
121 | | - Sets this color from a CSS context style string. |
| 146 | + Adds rgb values of given color to rgb values of this color |
| 147 | + </div> |
| 148 | + |
| 149 | + <h3>.addColors( [page:Color color1], [page:Color color2] ) [page:this]</h3> |
| 150 | + <div> |
| 151 | + Sets this color to the sum of color1 and color2 |
| 152 | + </div> |
| 153 | + |
| 154 | + <h3>.addScalar( [page:Number s] ) [page:this]</h3> |
| 155 | + <div> |
| 156 | + Adds s to the rgb values of this color |
| 157 | + </div> |
| 158 | + |
| 159 | + <h3>.multiply( [page:Color color] ) [page:this]</h3> |
| 160 | + <div> |
| 161 | + Multiplies this color's rgb values by given color's rgb values |
122 | 162 | </div> |
123 | 163 |
|
| 164 | + <h3>.multiplyScalar( [page:Number s] ) [page:this]</h3> |
| 165 | + <div> |
| 166 | + Multiplies this color's rgb values by s |
| 167 | + </div> |
| 168 | + |
| 169 | + <h3>.lerp( [page:Color color], alpha ) [page:this]</h3> |
| 170 | + <div> |
| 171 | + todo |
| 172 | + </div> |
| 173 | + |
| 174 | + <h3>.equals( [page:Color c] ) [page:this]</h3> |
| 175 | + <div> |
| 176 | + Compares this color and c and returns true if they are the same, false otherwise. |
| 177 | + </div> |
| 178 | + |
124 | 179 | <h3>.clone() [page:Color]</h3> |
125 | 180 | <div> |
126 | 181 | Clones this color. |
|
0 commit comments