Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
251ebc87
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,发现更多精彩内容 >>
未验证
提交
251ebc87
编写于
7月 30, 2018
作者:
M
Mr.doob
提交者:
GitHub
7月 30, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14385 from donmccurdy/animation-optimize-optout-v3
Animation: Do not validate/optimize by default.
上级
0b340e7e
63e3a854
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
63 addition
and
26 deletion
+63
-26
docs/api/animation/AnimationClip.html
docs/api/animation/AnimationClip.html
+8
-3
docs/api/animation/AnimationMixer.html
docs/api/animation/AnimationMixer.html
+3
-4
docs/api/animation/KeyframeTrack.html
docs/api/animation/KeyframeTrack.html
+11
-9
src/animation/AnimationClip.js
src/animation/AnimationClip.js
+16
-2
src/animation/KeyframeTrack.js
src/animation/KeyframeTrack.js
+3
-4
test/unit/src/animation/AnimationClip.tests.js
test/unit/src/animation/AnimationClip.tests.js
+6
-0
test/unit/src/animation/KeyframeTrack.tests.js
test/unit/src/animation/KeyframeTrack.tests.js
+16
-4
未找到文件。
docs/api/animation/AnimationClip.html
浏览文件 @
251ebc87
...
...
@@ -66,23 +66,28 @@
<h2>
Methods
</h2>
<h3>
[method:
AnimationClip
optimize]()
</h3>
<h3>
[method:
this
optimize]()
</h3>
<p>
Optimizes each track by removing equivalent sequential keys (which are common in morph target
sequences).
</p>
<h3>
[method:
null
resetDuration]()
</h3>
<h3>
[method:
this
resetDuration]()
</h3>
<p>
Sets the [page:.duration duration] of the clip to the duration of its longest
[page:KeyframeTrack].
</p>
<h3>
[method:
AnimationClip
trim]()
</h3>
<h3>
[method:
this
trim]()
</h3>
<p>
Trims all tracks to the clip's duration.
</p>
<h3>
[method:Boolean validate]()
</h3>
<p>
Performs minimal validation on each track in the clip. Returns true if all tracks are valid.
</p>
<h2>
Static Methods
</h2>
...
...
docs/api/animation/AnimationMixer.html
浏览文件 @
251ebc87
...
...
@@ -55,10 +55,9 @@
from the mixer's default root. The first parameter can be either an [page:AnimationClip] object
or the name of an AnimationClip.
<br
/><br
/>
If an action fitting these parameters doesn't yet exist, it will be created by this method.
<br
/><br
/>
Note: Calling this method several times with the same parameters returns always the same clip
instance.
If an action fitting the clip and root parameters doesn't yet exist, it will be created by
this method. Calling this method several times with the same clip and root parameters always
returns the same clip instance.
</p>
<h3>
[method:AnimationAction existingAction]([param:AnimationClip clip], [param:Object3D optionalRoot])
</h3>
...
...
docs/api/animation/KeyframeTrack.html
浏览文件 @
251ebc87
...
...
@@ -202,13 +202,12 @@
created automatically.
</p>
<h3>
[method:
null
optimize]()
</h3>
<h3>
[method:
this
optimize]()
</h3>
<p>
Removes equivalent sequential keys, which are common in morph target sequences. Called
automatically by the constructor.
Removes equivalent sequential keys, which are common in morph target sequences.
</p>
<h3>
[method:
null
scale]()
</h3>
<h3>
[method:
this
scale]()
</h3>
<p>
Scales all keyframe times by a factor.
<br
/><br
/>
...
...
@@ -217,26 +216,29 @@
[page:AnimationClip.CreateFromMorphTargetSequence animationClip.CreateFromMorphTargetSequence]).
</p>
<h3>
[method:
null
setInterpolation]( [param:Constant interpolationType] )
</h3>
<h3>
[method:
this
setInterpolation]( [param:Constant interpolationType] )
</h3>
<p>
Sets the interpolation type. See [page:Animation Animation Constants] for choices.
</p>
<h3>
[method:
null
shift]( [param:Number timeOffsetInSeconds] )
</h3>
<h3>
[method:
this
shift]( [param:Number timeOffsetInSeconds] )
</h3>
<p>
Moves all keyframes either forward or backward in time.
</p>
<h3>
[method:
null
trim]( [param:Number startTimeInSeconds], [param:Number endTimeInSeconds] )
</h3>
<h3>
[method:
this
trim]( [param:Number startTimeInSeconds], [param:Number endTimeInSeconds] )
</h3>
<p>
Removes keyframes before *startTime* and after *endTime*,
without changing any values within the range [*startTime*, *endTime*].
</p>
<h3>
[method:null validate]()
</h3>
<h3>
[method:Boolean validate]()
</h3>
<p>
Performs minimal validation on the tracks. Returns true if valid.
</p>
<p>
Performs minimal validation on the tracks. Called automatically by the constructor.
<br
/><br
/>
This method logs errors to the console, if a track is empty, if the [page:.valueSize value size] is not valid, if an item
in the [page:.times times] or [page:.values values] array is not a valid number or if the items in the *times* array are out of order.
</p>
...
...
src/animation/AnimationClip.js
浏览文件 @
251ebc87
...
...
@@ -31,8 +31,6 @@ function AnimationClip( name, duration, tracks ) {
}
this
.
optimize
();
}
function
getTrackTypeForValueTypeName
(
typeName
)
{
...
...
@@ -407,6 +405,8 @@ Object.assign( AnimationClip.prototype, {
this
.
duration
=
duration
;
return
this
;
},
trim
:
function
()
{
...
...
@@ -421,6 +421,20 @@ Object.assign( AnimationClip.prototype, {
},
validate
:
function
()
{
var
valid
=
true
;
for
(
var
i
=
0
;
i
<
this
.
tracks
.
length
;
i
++
)
{
valid
=
valid
&&
this
.
tracks
[
i
].
validate
();
}
return
valid
;
},
optimize
:
function
()
{
for
(
var
i
=
0
;
i
<
this
.
tracks
.
length
;
i
++
)
{
...
...
src/animation/KeyframeTrack.js
浏览文件 @
251ebc87
...
...
@@ -30,9 +30,6 @@ function KeyframeTrack( name, times, values, interpolation ) {
this
.
setInterpolation
(
interpolation
||
this
.
DefaultInterpolation
);
this
.
validate
();
this
.
optimize
();
}
// Static methods
...
...
@@ -157,12 +154,14 @@ Object.assign( KeyframeTrack.prototype, {
}
console
.
warn
(
'
THREE.KeyframeTrack:
'
,
message
);
return
;
return
this
;
}
this
.
createInterpolant
=
factoryMethod
;
return
this
;
},
getInterpolation
:
function
()
{
...
...
test/unit/src/animation/AnimationClip.tests.js
浏览文件 @
251ebc87
...
...
@@ -72,6 +72,12 @@ export default QUnit.module( 'Animation', () => {
}
);
QUnit
.
todo
(
"
validate
"
,
(
assert
)
=>
{
assert
.
ok
(
false
,
"
everything's gonna be alright
"
);
}
);
}
);
}
);
test/unit/src/animation/KeyframeTrack.tests.js
浏览文件 @
251ebc87
...
...
@@ -4,6 +4,7 @@
/* global QUnit */
import
{
KeyframeTrack
}
from
'
../../../../src/animation/KeyframeTrack
'
;
import
{
NumberKeyframeTrack
}
from
'
../../../../src/animation/tracks/NumberKeyframeTrack
'
;
export
default
QUnit
.
module
(
'
Animation
'
,
()
=>
{
...
...
@@ -96,15 +97,26 @@ export default QUnit.module( 'Animation', () => {
}
);
QUnit
.
t
odo
(
"
validate
"
,
(
assert
)
=>
{
QUnit
.
t
est
(
'
validate
'
,
(
assert
)
=>
{
assert
.
ok
(
false
,
"
everything's gonna be alright
"
);
var
validTrack
=
new
NumberKeyframeTrack
(
'
.material.opacity
'
,
[
0
,
1
],
[
0
,
0.5
]
);
var
invalidTrack
=
new
NumberKeyframeTrack
(
'
.material.opacity
'
,
[
0
,
1
],
[
0
,
NaN
]
);
assert
.
ok
(
validTrack
.
validate
()
);
assert
.
notOk
(
invalidTrack
.
validate
()
);
}
);
QUnit
.
t
odo
(
"
optimize
"
,
(
assert
)
=>
{
QUnit
.
t
est
(
'
optimize
'
,
(
assert
)
=>
{
assert
.
ok
(
false
,
"
everything's gonna be alright
"
);
var
track
=
new
NumberKeyframeTrack
(
'
.material.opacity
'
,
[
0
,
1
,
2
,
3
,
4
],
[
0
,
0
,
0
,
0
,
1
]
);
assert
.
equal
(
track
.
values
.
length
,
5
);
track
.
optimize
();
assert
.
smartEqual
(
Array
.
from
(
track
.
times
),
[
0
,
3
,
4
]
);
assert
.
smartEqual
(
Array
.
from
(
track
.
values
),
[
0
,
0
,
1
]
);
}
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录