forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColor.d.ts
159 lines (131 loc) · 3.62 KB
/
Color.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/**
* @author Joe Pea / http://github.com/trusktr
*/
export interface HSL {
h: number;
s: number;
l: number;
}
/**
* Represents a color. See also {@link ColorUtils}.
*
* @example
* var color = new THREE.Color( 0xff0000 );
*
* @see <a href="https://github.com/mrdoob/three.js/blob/master/src/math/Color.js">src/math/Color.js</a>
*/
export class Color {
constructor( color?: Color | string | number );
constructor( r: number, g: number, b: number );
isColor: boolean;
/**
* Red channel value between 0 and 1. Default is 1.
*/
r: number;
/**
* Green channel value between 0 and 1. Default is 1.
*/
g: number;
/**
* Blue channel value between 0 and 1. Default is 1.
*/
b: number;
set( color: Color ): Color;
set( color: number ): Color;
set( color: string ): Color;
setScalar( scalar: number ): Color;
setHex( hex: number ): Color;
/**
* Sets this color from RGB values.
* @param r Red channel value between 0 and 1.
* @param g Green channel value between 0 and 1.
* @param b Blue channel value between 0 and 1.
*/
setRGB( r: number, g: number, b: number ): Color;
/**
* Sets this color from HSL values.
* Based on MochiKit implementation by Bob Ippolito.
*
* @param h Hue channel value between 0 and 1.
* @param s Saturation value channel between 0 and 1.
* @param l Value channel value between 0 and 1.
*/
setHSL( h: number, s: number, l: number ): Color;
/**
* Sets this color from a CSS context style string.
* @param contextStyle Color in CSS context style format.
*/
setStyle( style: string ): Color;
/**
* Clones this color.
*/
clone(): this;
/**
* Copies given color.
* @param color Color to copy.
*/
copy( color: Color ): this;
/**
* Copies given color making conversion from gamma to linear space.
* @param color Color to copy.
*/
copyGammaToLinear( color: Color, gammaFactor?: number ): Color;
/**
* Copies given color making conversion from linear to gamma space.
* @param color Color to copy.
*/
copyLinearToGamma( color: Color, gammaFactor?: number ): Color;
/**
* Converts this color from gamma to linear space.
*/
convertGammaToLinear( gammaFactor?: number ): Color;
/**
* Converts this color from linear to gamma space.
*/
convertLinearToGamma( gammaFactor?: number ): Color;
/**
* Copies given color making conversion from sRGB to linear space.
* @param color Color to copy.
*/
copySRGBToLinear( color: Color ): Color;
/**
* Copies given color making conversion from linear to sRGB space.
* @param color Color to copy.
*/
copyLinearToSRGB( color: Color ): Color;
/**
* Converts this color from sRGB to linear space.
*/
convertSRGBToLinear(): Color;
/**
* Converts this color from linear to sRGB space.
*/
convertLinearToSRGB(): Color;
/**
* Returns the hexadecimal value of this color.
*/
getHex(): number;
/**
* Returns the string formated hexadecimal value of this color.
*/
getHexString(): string;
getHSL( target: HSL ): HSL;
/**
* Returns the value of this color in CSS context style.
* Example: rgb(r, g, b)
*/
getStyle(): string;
offsetHSL( h: number, s: number, l: number ): this;
add( color: Color ): this;
addColors( color1: Color, color2: Color ): this;
addScalar( s: number ): this;
sub( color: Color ): this;
multiply( color: Color ): this;
multiplyScalar( s: number ): this;
lerp( color: Color, alpha: number ): this;
lerpHSL( color: Color, alpha: number ): this;
equals( color: Color ): boolean;
fromArray( rgb: number[], offset?: number ): this;
toArray( array?: number[], offset?: number ): number[];
toArray( xyz: ArrayLike<number>, offset?: number ): ArrayLike<number>;
}