Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
0cc77571
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0cc77571
编写于
9月 23, 2019
作者:
@
@pauloddr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Color: rename setStyleName() to setColorName()
上级
1aa5350b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
5 deletion
+22
-5
docs/api/en/math/Color.html
docs/api/en/math/Color.html
+1
-1
src/math/Color.d.ts
src/math/Color.d.ts
+12
-0
src/math/Color.js
src/math/Color.js
+2
-2
test/unit/src/math/Color.tests.js
test/unit/src/math/Color.tests.js
+7
-2
未找到文件。
docs/api/en/math/Color.html
浏览文件 @
0cc77571
...
...
@@ -302,7 +302,7 @@ var color = new THREE.Color( 1, 0, 0 );
Note that for X11 color names, multiple words such as Dark Orange become the string 'darkorange' (all lowercase).
</p>
<h3>
[method:Color set
Style
Name]( [param:String style] )
</h3>
<h3>
[method:Color set
Color
Name]( [param:String style] )
</h3>
<p>
[page:String style] — color name ( from [link:https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart X11 color names] ).
<br
/><br
/>
...
...
src/math/Color.d.ts
浏览文件 @
0cc77571
...
...
@@ -68,6 +68,13 @@ export class Color {
*/
setStyle
(
style
:
string
):
Color
;
/**
* Sets this color from a color name.
* Faster than {@link Color#setStyle .setStyle()} method if you don't need the other CSS-style formats.
* @param style Color name in X11 format.
*/
setColorName
(
style
:
string
):
Color
;
/**
* Clones this color.
*/
...
...
@@ -183,4 +190,9 @@ export class Color {
*/
toArray
(
xyz
:
ArrayLike
<
number
>
,
offset
?:
number
):
ArrayLike
<
number
>
;
/**
* List of X11 color names.
*/
static
NAMES
:
Record
<
string
,
number
>
;
}
src/math/Color.js
浏览文件 @
0cc77571
...
...
@@ -261,7 +261,7 @@ Object.assign( Color.prototype, {
if
(
style
&&
style
.
length
>
0
)
{
return
this
.
set
Style
Name
(
style
);
return
this
.
set
Color
Name
(
style
);
}
...
...
@@ -269,7 +269,7 @@ Object.assign( Color.prototype, {
},
set
Style
Name
:
function
(
style
)
{
set
Color
Name
:
function
(
style
)
{
// color keywords
var
hex
=
_colorKeywords
[
style
];
...
...
test/unit/src/math/Color.tests.js
浏览文件 @
0cc77571
...
...
@@ -144,12 +144,17 @@ export default QUnit.module( 'Maths', () => {
assert
.
ok
(
a
.
g
==
0xAB
/
255
,
"
Green:
"
+
a
.
g
);
assert
.
ok
(
a
.
b
==
0xC1
/
255
,
"
Blue:
"
+
a
.
b
);
a
.
setStyle
(
"
aliceblue
"
);
assert
.
ok
(
a
.
r
==
0xF0
/
255
,
"
Red:
"
+
a
.
r
);
assert
.
ok
(
a
.
g
==
0xF8
/
255
,
"
Green:
"
+
a
.
g
);
assert
.
ok
(
a
.
b
==
0xFF
/
255
,
"
Blue:
"
+
a
.
b
);
}
);
QUnit
.
test
(
"
set
Style
Name
"
,
(
assert
)
=>
{
QUnit
.
test
(
"
set
Color
Name
"
,
(
assert
)
=>
{
var
c
=
new
Color
();
var
res
=
c
.
set
Style
Name
(
"
aliceblue
"
);
var
res
=
c
.
set
Color
Name
(
"
aliceblue
"
);
assert
.
ok
(
c
.
getHex
()
==
0xF0F8FF
,
"
Hex:
"
+
c
.
getHex
()
);
assert
.
ok
(
c
==
res
,
"
Returns Self
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录