Class Color4
Hierarchy
- Color4
Index
Constructors
Properties
Methods
- add
- add
InPlace - as
Array - clamp
ToRef - clone
- copy
From - copy
From Floats - equals
- from
Array - get
Class Name - get
Hash Code - multiply
- multiply
ToRef - scale
- scale
And Add ToRef - scale
ToRef - set
- subtract
- subtract
ToRef - to
Array - to
Gamma Space - to
Gamma Space ToRef - to
Hex String - to
Linear Space - to
Linear Space ToRef - to
String - Check
Colors4 - From
Array - From
Array ToRef - From
Color3 - From
Hex String - From
Ints - Lerp
- Lerp
ToRef
Constructors
constructor
-
Creates a new Color4 object from red, green, blue values, all between 0 and 1
Parameters
-
Optional r: number
defines the red component (between 0 and 1, default is 0)
-
Optional g: number
defines the green component (between 0 and 1, default is 0)
-
Optional b: number
defines the blue component (between 0 and 1, default is 0)
-
Optional a: number
defines the alpha component (between 0 and 1, default is 1)
Returns Color4
-
Properties
aSearch playground for a
Defines the alpha component (between 0 and 1, default is 1)
bSearch playground for b
Defines the blue component (between 0 and 1, default is 0)
gSearch playground for g
Defines the green component (between 0 and 1, default is 0)
rSearch playground for r
Defines the red component (between 0 and 1, default is 0)
Methods
addSearch playground for add
-
Creates a new Color4 set with the added values of the current Color4 and of the given one
Parameters
-
right: DeepImmutable<Color4>
defines the second operand
Returns Color4
a new Color4 object
-
add InPlaceSearch playground for addInPlace
-
Adds in place the given Color4 values to the current Color4 object
Parameters
-
right: DeepImmutable<Color4>
defines the second operand
Returns Color4
the current updated Color4 object
-
as ArraySearch playground for asArray
-
Creates a new array populated with 4 numeric elements : red, green, blue, alpha values
Returns number[]
the new array
clamp ToRefSearch playground for clampToRef
-
Clamps the rgb values by the min and max values and stores the result into "result"
Parameters
-
min: number | undefined
defines minimum clamping value (default is 0)
-
max: number | undefined
defines maximum clamping value (default is 1)
-
result: Color4
defines color to store the result into.
Returns Color4
the cuurent Color4
-
cloneSearch playground for clone
-
Creates a new Color4 copied from the current one
Returns Color4
a new Color4 object
copy FromSearch playground for copyFrom
copy From FloatsSearch playground for copyFromFloats
-
Copies the given float values into the current one
Parameters
-
r: number
defines the red component to read from
-
g: number
defines the green component to read from
-
b: number
defines the blue component to read from
-
a: number
defines the alpha component to read from
Returns Color4
the current updated Color4 object
-
equalsSearch playground for equals
-
Determines equality between Color4 objects
Parameters
-
otherColor: DeepImmutable<Color4>
defines the second operand
Returns boolean
true if the rgba values are equal to the given ones
-
from ArraySearch playground for fromArray
-
Update the current color with values stored in an array from the starting index of the given array
Parameters
-
array: DeepImmutable<ArrayLike<number>>
defines the source array
-
Optional offset: number
defines an offset in the source array
Returns Color4
the current Color4 object
-
get Class NameSearch playground for getClassName
-
Returns the string "Color4"
Returns string
"Color4"
get Hash CodeSearch playground for getHashCode
-
Compute the Color4 hash code
Returns number
an unique number that can be used to hash Color4 objects
multiplySearch playground for multiply
multiply ToRefSearch playground for multiplyToRef
scaleSearch playground for scale
-
Creates a new Color4 with the current Color4 values multiplied by scale
Parameters
-
scale: number
defines the scaling factor to apply
Returns Color4
a new Color4 object
-
scale And Add ToRefSearch playground for scaleAndAddToRef
scale ToRefSearch playground for scaleToRef
setSearch playground for set
-
Copies the given float values into the current one
Parameters
-
r: number
defines the red component to read from
-
g: number
defines the green component to read from
-
b: number
defines the blue component to read from
-
a: number
defines the alpha component to read from
Returns Color4
the current updated Color4 object
-
subtractSearch playground for subtract
-
Creates a new Color4 set with the subtracted values of the given one from the current Color4
Parameters
-
right: DeepImmutable<Color4>
defines the second operand
Returns Color4
a new Color4 object
-
subtract ToRefSearch playground for subtractToRef
-
Subtracts the given ones from the current Color4 values and stores the results in "result"
Parameters
-
right: DeepImmutable<Color4>
defines the second operand
-
result: Color4
defines the Color4 object where to store the result
Returns Color4
the current Color4 object
-
to ArraySearch playground for toArray
-
Stores from the starting index in the given array the Color4 successive values
Parameters
-
array: number[]
defines the array where to store the r,g,b components
-
Optional index: number
defines an optional index in the target array to define where to start storing values
Returns Color4
the current Color4 object
-
to Gamma SpaceSearch playground for toGammaSpace
-
Computes a new Color4 converted from the current one to gamma space
Returns Color4
a new Color4 object
to Gamma Space ToRefSearch playground for toGammaSpaceToRef
to Hex StringSearch playground for toHexString
-
Compute the Color4 hexadecimal code as a string
Parameters
-
Optional returnAsColor3: boolean
defines if the string should only contains RGB values (off by default)
Returns string
a string containing the hexadecimal representation of the Color4 object
-
to Linear SpaceSearch playground for toLinearSpace
-
Computes a new Color4 converted from the current one to linear space
Returns Color4
a new Color4 object
to Linear Space ToRefSearch playground for toLinearSpaceToRef
to StringSearch playground for toString
-
Creates a string with the Color4 current values
Returns string
the string representation of the Color4 object
Static Check Colors4Search playground for CheckColors4
-
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
Parameters
-
colors: number[]
defines the array to check
-
count: number
defines the number of RGBA data to expect
Returns number[]
an array containing count * 4 values (RGBA)
-
Static From ArraySearch playground for FromArray
-
Creates a new Color4 from the starting index element of the given array
Parameters
-
array: DeepImmutable<ArrayLike<number>>
defines the source array to read from
-
Optional offset: number
defines the offset in the source array
Returns Color4
a new Color4 object
-
Static From Array ToRefSearch playground for FromArrayToRef
-
Creates a new Color4 from the starting index element of the given array
Parameters
-
array: DeepImmutable<ArrayLike<number>>
defines the source array to read from
-
offset: number | undefined
defines the offset in the source array
-
result: Color4
defines the target Color4 object
Returns void
-
Static From Color3Search playground for FromColor3
-
Creates a new Color4 from a Color3 and an alpha value
Parameters
-
color3: DeepImmutable<Color3>
defines the source Color3 to read from
-
Optional alpha: number
defines the alpha component (1.0 by default)
Returns Color4
a new Color4 object
-
Static From Hex StringSearch playground for FromHexString
-
Creates a new Color4 from the string containing valid hexadecimal values
Parameters
-
hex: string
defines a string containing valid hexadecimal values
Returns Color4
a new Color4 object
-
Static From IntsSearch playground for FromInts
-
Creates a new Color3 from integer values (< 256)
Parameters
-
r: number
defines the red component to read from (value between 0 and 255)
-
g: number
defines the green component to read from (value between 0 and 255)
-
b: number
defines the blue component to read from (value between 0 and 255)
-
a: number
defines the alpha component to read from (value between 0 and 255)
Returns Color4
a new Color3 object
-
Static LerpSearch playground for Lerp
-
Creates a new Color4 object set with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object
Parameters
-
left: DeepImmutable<Color4>
defines the start value
-
right: DeepImmutable<Color4>
defines the end value
-
amount: number
defines the gradient factor
Returns Color4
a new Color4 object
-
Static Lerp ToRefSearch playground for LerpToRef
-
Set the given "result" with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object
Parameters
-
left: DeepImmutable<Color4>
defines the start value
-
right: DeepImmutable<Color4>
defines the end value
-
amount: number
defines the gradient factor
-
result: Color4
defines the Color4 object where to store data
Returns void
-
Class used to hold a RBGA color