|
@@ -5,93 +5,128 @@ Color - Represents a color
|
|
|
|
|
|
**class**:: Color(*hex*)
|
|
**class**:: Color(*hex*)
|
|
|
|
|
|
- Represents a color
|
|
|
|
-
|
|
|
|
- :param integer hex: Hex value to intialize the color
|
|
|
|
|
|
++------------+------------+------------------------------------+
|
|
|
|
+| Parameter | Type | Description |
|
|
|
|
++============+============+====================================+
|
|
|
|
+| *hex* | integer | Hex value to intialize the color |
|
|
|
|
++------------+------------+------------------------------------+
|
|
|
|
|
|
.. rubric:: Attributes
|
|
.. rubric:: Attributes
|
|
|
|
|
|
-**attribute**:: Color.r
|
|
|
|
-
|
|
|
|
- Red channel (*float* between 0 and 1)
|
|
|
|
-
|
|
|
|
-**attribute**:: Color.g
|
|
|
|
-
|
|
|
|
- Green channel (*float* between 0 and 1)
|
|
|
|
-
|
|
|
|
-**attribute**:: Color.b
|
|
|
|
-
|
|
|
|
- Blue channel (*float* between 0 and 1)
|
|
|
|
|
|
++------------+------------+------------------------------------+
|
|
|
|
+| Attribute | Type | Description |
|
|
|
|
++============+============+====================================+
|
|
|
|
+| Color.r | float | Red channel (between 0 and 1) |
|
|
|
|
++------------+------------+------------------------------------+
|
|
|
|
+| Color.g | float | Green channel (between 0 and 1) |
|
|
|
|
++------------+------------+------------------------------------+
|
|
|
|
+| Color.b | float | Blue channel (between 0 and 1) |
|
|
|
|
++------------+------------+------------------------------------+
|
|
|
|
|
|
.. rubric:: Methods
|
|
.. rubric:: Methods
|
|
|
|
|
|
**function**:: Color.copy(*color*)
|
|
**function**:: Color.copy(*color*)
|
|
|
|
|
|
- Copies the given color into this color
|
|
|
|
-
|
|
|
|
- :param THREE.Color color: Color to copy
|
|
|
|
-
|
|
|
|
|
|
+Copies the given color into this color
|
|
|
|
+
|
|
|
|
++------------+------------+----------------+
|
|
|
|
+| Parameter | Type | Description |
|
|
|
|
++============+============+================+
|
|
|
|
+| *color* | THREE.Color| Color to copy |
|
|
|
|
++------------+------------+----------------+
|
|
|
|
+
|
|
**function**:: Color.copyGammaToLinear(*color*)
|
|
**function**:: Color.copyGammaToLinear(*color*)
|
|
|
|
|
|
- Creates a gamma color from a linear color
|
|
|
|
|
|
+Creates a gamma color from a linear color
|
|
|
|
|
|
- :param THREE.Color color: Color to copy
|
|
|
|
- :returns: Linear color
|
|
|
|
- :rtype: THREE.Color
|
|
|
|
|
|
++------------+------------+----------------+
|
|
|
|
+| Parameter | Type | Description |
|
|
|
|
++============+============+================+
|
|
|
|
+| *color* | THREE.Color| Color to copy |
|
|
|
|
++------------+------------+----------------+
|
|
|
|
+| returns | THREE.Color| Linear color |
|
|
|
|
++------------+------------+----------------+
|
|
|
|
|
|
**function**:: Color.copyLinearToGamma(*color*)
|
|
**function**:: Color.copyLinearToGamma(*color*)
|
|
|
|
|
|
- Creates a linear color from a gamma color
|
|
|
|
|
|
+Creates a linear color from a gamma color
|
|
|
|
|
|
- :param THREE.Color color: Color to copy
|
|
|
|
- :returns: Gamma color
|
|
|
|
- :rtype: THREE.Color
|
|
|
|
|
|
++------------+------------+----------------+
|
|
|
|
+| Parameter | Type | Description |
|
|
|
|
++============+============+================+
|
|
|
|
+| *color* | THREE.Color| Color to copy |
|
|
|
|
++------------+------------+----------------+
|
|
|
|
+| returns | THREE.Color| Gamma color |
|
|
|
|
++------------+------------+----------------+
|
|
|
|
|
|
**function**:: Color.setRGB(*r*, *g*, *b*)
|
|
**function**:: Color.setRGB(*r*, *g*, *b*)
|
|
|
|
|
|
- Sets the RGB value of this color
|
|
|
|
|
|
+Sets the RGB value of this color
|
|
|
|
|
|
- :param float r: Red channel value (between 0 and 1)
|
|
|
|
- :param float g: Green channel value (between 0 and 1)
|
|
|
|
- :param float b: Blue channel value (between 0 and 1)
|
|
|
|
|
|
++-----------+-------+--------------------------------------+
|
|
|
|
+| Parameter | Type | Description |
|
|
|
|
++===========+=======+======================================+
|
|
|
|
+| *r* | float | Red channel value (between 0 and 1) |
|
|
|
|
++-----------+-------+--------------------------------------+
|
|
|
|
+| *g* | float | Green channel value (between 0 and 1)|
|
|
|
|
++-----------+-------+--------------------------------------+
|
|
|
|
+| *b* | float | Blue channel value (between 0 and 1) |
|
|
|
|
++-----------+-------+--------------------------------------+
|
|
|
|
|
|
**function**:: Color.setHSV(*h*, *s*, *v*)
|
|
**function**:: Color.setHSV(*h*, *s*, *v*)
|
|
|
|
|
|
- Sets the HSV value of this color. Based on MochiKit implementation by
|
|
|
|
- Bob Ippolito.
|
|
|
|
|
|
+Sets the HSV value of this color. Based on MochiKit implementation by
|
|
|
|
+Bob Ippolito.
|
|
|
|
|
|
- :param float h: Hue channel (between 0 and 1)
|
|
|
|
- :param float s: Saturation channel (between 0 and 1)
|
|
|
|
- :param float v: Value channel (between 0 and 1)
|
|
|
|
|
|
++-----------+-------+--------------------------------------+
|
|
|
|
+| Parameter | Type | Description |
|
|
|
|
++===========+=======+======================================+
|
|
|
|
+| *h* | float | Hue channel (between 0 and 1) |
|
|
|
|
++-----------+-------+--------------------------------------+
|
|
|
|
+| *s* | float | Saturation channel (between 0 and 1)|
|
|
|
|
++-----------+-------+--------------------------------------+
|
|
|
|
+| *v* | float | Value channel (between 0 and 1) |
|
|
|
|
++-----------+-------+--------------------------------------+
|
|
|
|
|
|
**function**:: Color.setHex(*hex*)
|
|
**function**:: Color.setHex(*hex*)
|
|
|
|
|
|
- Sets the value of this color from a hex value
|
|
|
|
-
|
|
|
|
- :param integer hex: Value of the color in hex
|
|
|
|
|
|
+Sets the value of this color from a hex value
|
|
|
|
+
|
|
|
|
++-----------+---------+---------------------------+
|
|
|
|
+| Parameter | Type | Description |
|
|
|
|
++===========+=========+===========================+
|
|
|
|
+| *hex* | integer | Value of the color in hex |
|
|
|
|
++-----------+---------+---------------------------+
|
|
|
|
|
|
**function**:: Color.getHex()
|
|
**function**:: Color.getHex()
|
|
|
|
|
|
- Gets the value of this color in hex
|
|
|
|
-
|
|
|
|
- :returns: The color value in hex
|
|
|
|
- :rtype: integer
|
|
|
|
|
|
+Gets the value of this color in hex
|
|
|
|
|
|
|
|
++-----------+---------+------------------------+
|
|
|
|
+| Parameter | Type | Description |
|
|
|
|
++===========+=========+========================+
|
|
|
|
+| returns | integer | The color value in hex |
|
|
|
|
++-----------+---------+------------------------+
|
|
|
|
+
|
|
**function**:: Color.getContextStyle()
|
|
**function**:: Color.getContextStyle()
|
|
|
|
|
|
- Returns the value of this color in CSS context style.
|
|
|
|
-
|
|
|
|
- Example: ``rgb(r,g,b)``
|
|
|
|
|
|
+Returns the value of this color in CSS context style.
|
|
|
|
|
|
- :returns: A CSS-formatted color value
|
|
|
|
- :rtype: string
|
|
|
|
|
|
++-----------+--------+-----------------------------+--------------+
|
|
|
|
+| Parameter | Type | Description | Example |
|
|
|
|
++===========+========+=============================+==============+
|
|
|
|
+| returns | string | A CSS-formatted color value | "rgb(r,g,b)" |
|
|
|
|
++-----------+--------+-----------------------------+--------------+
|
|
|
|
|
|
**function**:: Color.clone()
|
|
**function**:: Color.clone()
|
|
|
|
|
|
- Clones this color
|
|
|
|
|
|
+Clones this color
|
|
|
|
|
|
- :returns: New instance identical to this color
|
|
|
|
- :rtype: Color
|
|
|
|
|
|
++-----------+-------------+--------------------------------------+
|
|
|
|
+| Parameter | Type | Description |
|
|
|
|
++===========+=============+======================================+
|
|
|
|
+| returns | THREE.Color | New instance identical to this color |
|
|
|
|
++-----------+-------------+--------------------------------------+
|
|
|
|
|
|
.. rubric:: Example
|
|
.. rubric:: Example
|
|
|
|
|