Class threedee.Color
A color
Defined in: Color.js.
Constructor Attributes | Constructor Name and Description |
---|---|
threedee.Color(red, green, blue)
Constructs a new color.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
threedee.Color.BLACK
Black color.
|
<static> |
threedee.Color.BLUE
Blue color.
|
<static> |
threedee.Color.DARK_GRAY
Dark gray color.
|
<static> |
threedee.Color.GREEN
Green color.
|
<static> |
threedee.Color.RED
Red color.
|
<static> |
threedee.Color.WHITE
White color.
|
<static> |
threedee.Color.YELLOW
Yellow color.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
threedee.Color.count()
Returns and resets the current instance counter.
|
<static> |
threedee.Color.fromJSON(data)
Creates a new color instance with the color components read from the
specified JSON object (with keys 'r', 'g' and 'b').
|
getBlue()
Returns the blue component (0.0-1.0).
|
|
getComponent(component)
Returns a color component.
|
|
Returns the three color components as an array.
|
|
getGreen()
Returns the green component (0.0-1.0).
|
|
getRed()
Returns the red component.
|
|
toCSS()
Returns the CSS representation of the color (0.0-1.0).
|
|
toJSON()
Converts the color into a JSON object with keys 'r', 'g' and 'b' and
returns it.
|
Class Detail
threedee.Color(red, green, blue)
Constructs a new color.
- Parameters:
- {number} red
- The red component (0.0 - 1.0)
- {number} green
- The green component (0.0 - 1.0)
- {number} blue
- The blue component (0.0 - 1.0)
Field Detail
<static>
threedee.Color.BLACK
Black color.
<static>
threedee.Color.BLUE
Blue color.
<static>
threedee.Color.DARK_GRAY
Dark gray color.
<static>
threedee.Color.GREEN
Green color.
<static>
threedee.Color.RED
Red color.
<static>
threedee.Color.WHITE
White color.
<static>
threedee.Color.YELLOW
Yellow color.
Method Detail
<static>
{number}
threedee.Color.count()
Returns and resets the current instance counter.
- Returns:
- {number} The number of created instances since the last call.
<static>
{threedee.Color}
threedee.Color.fromJSON(data)
Creates a new color instance with the color components read from the
specified JSON object (with keys 'r', 'g' and 'b'). Returns null if
data was empty
- Parameters:
- {Object} data
- The color as JSON object
- Returns:
- {threedee.Color} The color object or null if data was empty
{number}
getBlue()
Returns the blue component (0.0-1.0).
- Returns:
- {number} The blue component.
{number}
getComponent(component)
Returns a color component. 0=red, 1=green, 2=blue.
- Parameters:
- {number} component
- The component index
- Returns:
- {number} The color component (0-1)
{!Array.}
getComponents()
Returns the three color components as an array. The entries are in the
range from 0.0 to 1.0.
- Returns:
- {!Array.
} The three color components as an array
{number}
getGreen()
Returns the green component (0.0-1.0).
- Returns:
- {number} The green component.
{number}
getRed()
Returns the red component.
- Returns:
- {number} The red component.
{string}
toCSS()
Returns the CSS representation of the color (0.0-1.0).
- Returns:
- {string} The CSS representation of the color.
{Object}
toJSON()
Converts the color into a JSON object with keys 'r', 'g' and 'b' and
returns it.
- Returns:
- {Object} The color as a JSON object