SFColor
The SFColor object corresponds to a X3D SFColor field.
The properties of the object can be accessed via the r, g and b property as well as by the indices [0] for red, [1] for green and [2] blue.
Properties
| Type | Property | Description | Standard |
|---|---|---|---|
| number | r | The red component of the colour [read/write].
| X3D2.0 |
| number | g | The green component of the colour [read/write].
| X3D2.0 |
| number | b | The blue component of the colour [read/write].
| X3D2.0 |
Functions
| Return type | Function | Description | Standard |
|---|---|---|---|
| SFColor(number r, number g, number b) |
Constructs a new SFColor object initialized to the values of r, g, and b are the red, green, and blue values of the colour. Missing values default to 0.0. | ||
| void | setHSV(number h, number s, number v) | Sets the value of the colour by specifying the values of hue, saturation, and value.
| X3D2.0 |
| Array | getHSV() | Returns the value of the colour in a 3 element numeric array, with hue at index 0, saturation at index 1, and value at index 2.
| X3D2.0 |
| String | toString() | Returns a String containing the value of r, g and b encoded using the Classic VRML encoding (see part 2 of ISO/IEC 19776).
| X3D2.0 |