Repository

Color

Extends:

three~THREE_Color → Color

Represents a RGB color to be used in materials applied on Meshes.

This class extends the one from Three.js, API available here : https://threejs.org/docs/#api/en/math/Color

Static Method Summary

Static Public Methods
public static

Create(r: Number, g: Number, b: Number): *

Creates a color based on [0;1] float RGB values

public static

Creates a random color

Member Summary

Public Members
public

b: *

public

g: *

public

r: *

Method Summary

Public Methods
public

copy(): *

Copies this color.

public

Build a HTML color string with the given alpha.

public

Creates a color based on [0;255] RGB values

Private Methods
private

setTo(val: Float): Color

Sets the rgb components of this color to the [0;1] based given value

Static Public Methods

public static Create(r: Number, g: Number, b: Number): * source

Creates a color based on [0;1] float RGB values

Params:

NameTypeAttributeDescription
rNumber

The red component [0;1].

gNumber

The green component [0;1].

bNumber

The blue component [0;1].

Return:

*

public static random(): Color source

Creates a random color

Return:

Color

the created random color

Public Members

public b: * source

public g: * source

public r: * source

Public Methods

public copy(): * source

Copies this color.

Return:

*

Color

public makeRGBAStringWithAlpha(a: Number): String source

Build a HTML color string with the given alpha.

Params:

NameTypeAttributeDescription
aNumber

The alpha component [0;255].

Return:

String

a string representation of the color with alpha

public setRGB32(r: Number, g: Number, b: Number) source

Creates a color based on [0;255] RGB values

Params:

NameTypeAttributeDescription
rNumber

The red component [0;255].

gNumber

The green component [0;255].

bNumber

The blue component [0;255].

Private Methods

private setTo(val: Float): Color source

Sets the rgb components of this color to the [0;1] based given value

Params:

NameTypeAttributeDescription
valFloat

float number

Return:

Color

this color with the given value