Skip to content

Latest commit

 

History

History
64 lines (57 loc) · 7.2 KB

decentraland-ecs.color3.md

File metadata and controls

64 lines (57 loc) · 7.2 KB

Home > decentraland-ecs > Color3

Color3 class

Class used to hold a RBG color

Properties

Property Access Modifier Type Description
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)

Methods

Method Access Modifier Returns Description
constructor(r, g, b) Creates a new Color3 object from red, green, blue values, all between 0 and 1
add(otherColor) Color3 Creates a new Color3 set with the added values of the current Color3 and of the given one
addToRef(otherColor, result) Color3 Stores the result of the addition of the current Color3 and given one rgb values into "result"
asArray() number[] Returns a new array populated with 3 numeric elements : red, green and blue values
Black() Color3 Returns a Color3 value containing a black color
Blue() Color3 Returns a Color3 value containing a blue color
clampToRef(min, max, result) Color3 Clamps the rgb values by the min and max values and stores the result into "result"
clone() Color3 Copy the current object
copyFrom(source) Color3 Copies the rgb values from the source in the current Color3
copyFromFloats(r, g, b) Color3 Updates the Color3 rgb values from the given floats
equals(otherColor) boolean Determines equality between Color3 objects
equalsFloats(r, g, b) boolean Determines equality between the current Color3 object and a set of r,b,g values
FromArray(array, offset) Color3 Creates a new Vector3 from the starting index of the given array
FromHexString(hex) Color3 Creates a new Color3 from the string containing valid hexadecimal values
FromInts(r, g, b) Color3 Creates a new Color3 from integer values (less than 256)
getClassName() string Returns the string "Color3"
getHashCode() number Compute the Color3 hash code
Gray() Color3 Returns a Color3 value containing a gray color
Green() Color3 Returns a Color3 value containing a green color
Lerp(start, end, amount) Color3 Creates a new Color3 with values linearly interpolated of "amount" between the start Color3 and the end Color3
LerpToRef(left, right, amount, result) void Creates a new Color3 with values linearly interpolated of "amount" between the start Color3 and the end Color3
Magenta() Color3 Returns a Color3 value containing a magenta color
multiply(otherColor) Color3 Multiply each Color3 rgb values by the given Color3 rgb values in a new Color3 object
multiplyToRef(otherColor, result) Color3 Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object "result"
Purple() Color3 Returns a Color3 value containing a purple color
Random() Color3 Returns a Color3 value containing a random color
Red() Color3 Returns a Color3 value containing a red color
scale(scale) Color3 Multiplies in place each rgb value by scale
scaleAndAddToRef(scale, result) Color3 Scale the current Color3 values by a factor and add the result to a given Color3
scaleToRef(scale, result) Color3 Multiplies the rgb values by scale and stores the result into "result"
set(r, g, b) Color3 Updates the Color3 rgb values from the given floats
subtract(otherColor) Color3 Returns a new Color3 set with the subtracted values of the given one from the current Color3
subtractToRef(otherColor, result) Color3 Stores the result of the subtraction of given one from the current Color3 rgb values into "result"
Teal() Color3 Returns a Color3 value containing a teal color
toArray(array, index) Color3 Stores in the given array from the given starting index the red, green, blue values as successive elements
toColor4(alpha) Color4 Returns a new Color4 object from the current Color3 and the given alpha
toGammaSpace() Color3 Computes a new Color3 converted from the current one to gamma space
toGammaSpaceToRef(convertedColor) Color3 Converts the Color3 values to gamma space and stores the result in "convertedColor"
toHexString() string Compute the Color3 hexadecimal code as a string
toJSON() string Serializes Color3
toLinearSpace() Color3 Computes a new Color3 converted from the current one to linear space
toLinearSpaceToRef(convertedColor) Color3 Converts the Color3 values to linear space and stores the result in "convertedColor"
toLuminance() number Returns the luminance value
White() Color3 Returns a Color3 value containing a white color
Yellow() Color3 Returns a Color3 value containing a yellow color