Home > decentraland-ecs > Color4
Class used to hold a RBGA color
Property | Access Modifier | Type | Description |
---|---|---|---|
a |
number |
Defines the alpha component (between 0 and 1, default is 1) | |
b |
number |
Defines the blue component (between 0 and 1, default is 0) | |
g |
number |
Defines the green component (between 0 and 1, default is 0) | |
r |
number |
Defines the red component (between 0 and 1, default is 0) |
Method | Access Modifier | Returns | Description |
---|---|---|---|
constructor(r, g, b, a) |
Creates a new Color4 object from red, green, blue values, all between 0 and 1 | ||
add(right) |
Color4 |
Creates a new Color4 set with the added values of the current Color4 and of the given one | |
addInPlace(right) |
Color4 |
Adds in place the given Color4 values to the current Color4 object | |
asArray() |
number[] |
Creates a new array populated with 4 numeric elements : red, green, blue, alpha values | |
CheckColors4(colors, count) |
number[] |
Check the content of a given array and convert it to an array containing RGBA data If the original array was already containing count * 4 values then it is returned directly | |
clampToRef(min, max, result) |
Color4 |
Clamps the rgb values by the min and max values and stores the result into "result" | |
clone() |
Color4 |
Creates a new Color4 copied from the current one | |
copyFrom(source) |
Color4 |
Copies the given Color4 values into the current one | |
copyFromFloats(r, g, b, a) |
Color4 |
Copies the given float values into the current one | |
FromArray(array, offset) |
Color4 |
Creates a new Color4 from the starting index element of the given array | |
FromColor3(color3, alpha) |
Color4 |
Creates a new Color4 from a Color3 and an alpha value | |
FromHexString(hex) |
Color4 |
Creates a new Color4 from the string containing valid hexadecimal values | |
FromInts(r, g, b, a) |
Color4 |
Creates a new Color3 from integer values (less than 256) | |
getClassName() |
string |
Returns the string "Color4" | |
getHashCode() |
number |
Compute the Color4 hash code | |
Lerp(left, right, amount) |
Color4 |
Creates a new Color4 object set with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object | |
LerpToRef(left, right, amount, result) |
void |
Set the given "result" with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object | |
multiply(color) |
Color4 |
Multipy an Color4 value by another and return a new Color4 object | |
multiplyToRef(color, result) |
Color4 |
Multipy a Color4 value by another and push the result in a reference value | |
scale(scale) |
Color4 |
Creates a new Color4 with the current Color4 values multiplied by scale | |
scaleAndAddToRef(scale, result) |
Color4 |
Scale the current Color4 values by a factor and add the result to a given Color4 | |
scaleToRef(scale, result) |
Color4 |
Multiplies the current Color4 values by scale and stores the result in "result" | |
set(r, g, b, a) |
Color4 |
Copies the given float values into the current one | |
subtract(right) |
Color4 |
Creates a new Color4 set with the subtracted values of the given one from the current Color4 | |
subtractToRef(right, result) |
Color4 |
Subtracts the given ones from the current Color4 values and stores the results in "result" | |
toArray(array, index) |
Color4 |
Stores from the starting index in the given array the Color4 successive values | |
toGammaSpace() |
Color4 |
Computes a new Color4 converted from the current one to gamma space | |
toGammaSpaceToRef(convertedColor) |
Color4 |
Converts the Color4 values to gamma space and stores the result in "convertedColor" | |
toHexString() |
string |
Compute the Color4 hexadecimal code as a string | |
toLinearSpace() |
Color4 |
Computes a new Color4 converted from the current one to linear space | |
toLinearSpaceToRef(convertedColor) |
Color4 |
Converts the Color4 values to linear space and stores the result in "convertedColor" |