-
new Color(r, g, b, a)
-
颜色类
Name Type Default Description r
Number 1 optional g
Number 1 optional b
Number 1 optional a
Number 1 optional
Extends
Members Show Inherited
Name | Type | Default | Description |
---|---|---|---|
className
|
String | Color |
类名 |
isColor
|
Boolean | true | |
r
|
Number |
r |
|
g
|
Number |
g |
|
b
|
Number |
b |
|
a
|
Number |
a |
|
isVector4
|
Boolean | true | inherited |
elements
|
Float32Array |
inherited
数据 |
|
x
|
Number |
inherited
X component |
|
y
|
Number |
inherited
Y component |
|
z
|
Number |
inherited
Z component |
|
w
|
Number |
inherited
W component |
Methods Show Inherited
-
toRGBArray(array, offset){Array}
-
转换到数组
Name Type Default Description array
Array [] optional 转换到的数组
offset
Number 0 optional 数组偏移值
Returns:
Type Description Array -
fromUintArray(array, offset){Color}
-
从数组赋值
Name Type Default Description array
Array 数组
offset
Number 0 optional 数组偏移值
Returns:
Type Description Color -
fromHEX(hex){Color}
-
从十六进制值赋值
Name Type Description hex
String | Number 颜色的十六进制值,可以以下形式:"#ff9966", "ff9966", "#f96", "f96", 0xff9966
Returns:
Type Description Color -
toHEX(){String}
-
转16进制
Returns:
Type Description String -
Copy the values from one vec4 to this
Name Type Description m
Vector4 the source vector
Returns:
Type Description Vector4 this -
Creates a new vec4 initialized with values from this vector
Returns:
Type Description Vector4 a new Vector4 -
inherited toArray(array, offset){Array}
-
转换到数组
Name Type Default Description array
Array.<number> | TypedArray [] optional 数组
offset
Number 0 optional 数组偏移值
Returns:
Type Description Array -
inherited fromArray(array, offset){this}
-
从数组赋值
Name Type Default Description array
Array.<number> | TypedArray 数组
offset
Number 0 optional 数组偏移值
Returns:
Type Description this -
Set the components of a vec4 to the given values
Name Type Description x
Number X component
y
Number Y component
z
Number Z component
w
Number W component
Returns:
Type Description Vector4 this -
Adds two vec4's
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的和
Returns:
Type Description Vector4 this -
Subtracts vector b from vector a
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的差
Returns:
Type Description Vector4 this -
Multiplies two vec4's
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的积
Returns:
Type Description Vector4 this -
Divides two vec4's
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的商
Returns:
Type Description Vector4 this -
Returns the minimum of two vec4's
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的结果
Returns:
Type Description Vector4 this -
Returns the maximum of two vec4's
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的结果
Returns:
Type Description Vector4 this -
Scales this by a scalar number
Name Type Description scale
Number amount to scale the vector by
Returns:
Type Description Vector4 this -
Adds two vec4's after scaling the second vector by a scalar value
Name Type Description scale
Number the amount to scale the second vector by before adding
a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的结果
Returns:
Type Description Vector4 this -
inherited distance(a, b){Number}
-
Calculates the euclidian distance between two vec4's
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的结果
Returns:
Type Description Number distance between a and b -
inherited squaredDistance(a, b){Number}
-
Calculates the squared euclidian distance between two vec4's
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的结果
Returns:
Type Description Number squared distance between a and b -
inherited length(){Number}
-
Calculates the length of this
Returns:
Type Description Number length of this -
inherited squaredLength(){Number}
-
Calculates the squared length of this
Returns:
Type Description Number squared length of this -
Returns the inverse of the components of a vec4
Name Type Default Description a
Vector4 this optional Returns:
Type Description Vector4 this -
inherited dot(a, b){Number}
-
Calculates the dot product of two vec4's
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的结果
Returns:
Type Description Number product of a and b -
Performs a linear interpolation between two vec4's
Name Type Description v
Vector4 t
Number interpolation amount between the two vectors
Returns:
Type Description Vector4 this -
Generates a random vector with the given scale
Name Type Default Description scale
Number 1 optional Length of the resulting vector. If ommitted, a unit vector will be returned
Returns:
Type Description Vector4 this -
Transforms the vec4 with a mat4
Name Type Description m
Matrix4 matrix to transform with
Returns:
Type Description Vector4 this -
Transforms the vec4 with a quat
Name Type Description q
Quaternion quaternion to transform with
Returns:
Type Description Vector4 this -
inherited exactEquals(a, b){Boolean}
-
Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的结果
Returns:
Type Description Boolean True if the vectors are equal, false otherwise. -
inherited equals(a, b){Boolean}
-
Returns whether or not the vectors have approximately the same elements in the same position.
Name Type Description a
Vector4 b
Vector4 optional 如果不传,计算 this 和 a 的结果
Returns:
Type Description Boolean True if the vectors are equal, false otherwise. -
inherited sub()
-
Alias for
Vector4#subtract
-
inherited mul()
-
Alias for
Vector4#multiply
-
inherited div()
-
Alias for
Vector4#divide
-
inherited dist()
-
Alias for
Vector4#distance
-
inherited sqrDist()
-
Alias for
Vector4#squaredDistance
-
inherited len()
-
Alias for
Vector4#length
-
inherited sqrLen()
-
Alias for
Vector4#squaredLength