CLASSES
TagsA - Z

Color4

Objects

Description

class Color4

Color defined by Red Green Blue, plus the Alpha.

Constructor

new Color4(r, g, b, a)

Creates a new RGBA Color4

Parameters

Name Type Description
r number The red value (0<r<1)
g number The green value (0<g<1)
b number The blue value (0<b<1)
a number The alpha value (0<a<1)

Members

r : number

The red value

g : number

The green value

b : number

The blue value

a : number

The alpha value

Methods

addInPlace(right) → Color4

Adds another Color4

Parameters

Name Type Description
right any second color

asArray() → number[]

Returns an array representation of the color

toArray(array, index) → Color4

Fills an array from a given index with the color's values

Parameters

Name Type Description
array number[] The given array
optional index number default : 0 The given index

add(right) → Color4

Adds another color and returns the result

Parameters

Name Type Description
right Color4 second color

subtract(right) → Color4

Substracts another color and returns the result

Parameters

Name Type Description
right Color4 second color

subtractToRef(right, result) → Color4

Substracts another color into a third color

Parameters

Name Type Description
right Color4 second color
result Color4 The Color4 (RGBA) to fill the result in The color which hold the result color

scale(scale) → Color4

Scales a Color4

Parameters

Name Type Description
scale number The scaling factor

scaleToRef(scale, result) → Color4

Scales a Color4 into an existing Color4

Parameters

Name Type Description
scale number The scaling factor
result Color4 The Color4 (RGBA) to fill the result in The color which hold the result color

multiply(color) → Color4

Multipy an RGBA Color4 value by another and return a new Color4 object

@returns A new Color4.

Parameters

Name Type Description
color Color4 The Color4 (RGBA) value to multiply by The Color4 (RGBA) value to multiply by

multiplyToRef(color, result) → Color4

Multipy an RGBA Color4 value by another and push the result in a reference value

@returns the result Color4.

Parameters

Name Type Description
color Color4 The Color4 (RGBA) value to multiply by The Color4 (RGBA) value to multiply by
result Color4 The Color4 (RGBA) to fill the result in The Color4 (RGBA) to fill the result in The color which hold the result color

toString() → string

Returns a string representation of the color

getClassName() → string

getHashCode() → number

clone() → Color4

Clones the color into a new Color4

copyFrom(source) → Color4

Parameters

Name Type Description
source Color4

toHexString() → string

static FromHexString(hex) → Color4

Parameters

Name Type Description
hex string

static Lerp(left, right, amount) → Color4

Linear interpolation of a color 4

Parameters

Name Type Description
left Color4 first color
right Color4 second color
amount number Weighting factor.

static LerpToRef(left, right, amount, result) → void

Linear interpolation of a color 4 into an existing Color4

Parameters

Name Type Description
left Color4 first color
right Color4 second color
amount number Weighting factor.

static FromArray(array, offset) → Color4

Creates new Color4 from the given array

Parameters

Name Type Description
array number[] The given array
optional offset number The first index of the array to look at

static FromInts(r, g, b, a) → Color4

Parameters

Name Type Description
r number The red value (0<r<1)
g number The green value (0<g<1)
b number The blue value (0<b<1)

static CheckColors4(colors, count) → number[]

Parameters

Name Type Description
colors number[]
count number