new RGB( [red] [, green] [, blue])
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
red |
number |
<optional> |
0 | The red color value. A number between 0 and 1. |
green |
number |
<optional> |
0 | The green color value. A number between 0 and 1. |
blue |
number |
<optional> |
0 | The blue color value. A number between 0 and 1. |
- Since: 3.50.0
- Source: src/display/RGB.js (Line 10)
Members
-
b :number
-
The blue color value. Between 0 and 1.
Changing this property will flag this RGB object as being dirty and invoke the
onChangeCallback
, if set.Type:
- number
- Since: 3.50.0
- Source: src/display/RGB.js (Line 176)
-
dirty :boolean
-
Is this color dirty?
Type:
- boolean
- Since: 3.50.0
- Source: src/display/RGB.js (Line 51)
-
g :number
-
The green color value. Between 0 and 1.
Changing this property will flag this RGB object as being dirty and invoke the
onChangeCallback
, if set.Type:
- number
- Since: 3.50.0
- Source: src/display/RGB.js (Line 151)
-
onChangeCallback :function
-
This callback will be invoked each time one of the RGB color values change.
The callback is sent the new color values as the parameters.
Type:
- function
- Since: 3.50.0
- Source: src/display/RGB.js (Line 40)
-
r :number
-
The red color value. Between 0 and 1.
Changing this property will flag this RGB object as being dirty and invoke the
onChangeCallback
, if set.Type:
- number
- Since: 3.50.0
- Source: src/display/RGB.js (Line 126)
Methods
-
destroy()
-
Nulls any external references this object contains.
- Since: 3.50.0
- Source: src/display/RGB.js (Line 201)
-
equals(red, green, blue)
-
Compares the given rgb parameters with those in this object and returns a boolean
true
value if they are equal, otherwise it returnsfalse
.Parameters:
Name Type Description red
number The red value to compare with this object.
green
number The green value to compare with this object.
blue
number The blue value to compare with this object.
- Since: 3.50.0
- Source: src/display/RGB.js (Line 89)
Returns:
true
if the given values match those in this object, otherwisefalse
.- Type
- boolean
-
onChange()
-
Internal on change handler. Sets this object as being dirty and then invokes the
onChangeCallback
, if set, passing in the new RGB values.- Since: 3.50.0
- Source: src/display/RGB.js (Line 109)
-
set( [red] [, green] [, blue])
-
Sets the red, green and blue values of this RGB object, flags it as being dirty and then invokes the
onChangeCallback
, if set.Parameters:
Name Type Argument Default Description red
number <optional>
0 The red color value. A number between 0 and 1.
green
number <optional>
0 The green color value. A number between 0 and 1.
blue
number <optional>
0 The blue color value. A number between 0 and 1.
- Since: 3.50.0
- Source: src/display/RGB.js (Line 63)
Returns:
This RGB instance.
- Type
- Phaser.Display.RGB