Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
a5c81d2f
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
未验证
提交
a5c81d2f
编写于
11月 08, 2018
作者:
M
Mr.doob
提交者:
GitHub
11月 08, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15224 from yomotsu/feature/cleanup-animations
Animations: clean up
上级
1a560a34
9179c9b6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
45 addition
and
46 deletion
+45
-46
src/animation/AnimationAction.js
src/animation/AnimationAction.js
+19
-17
src/animation/AnimationMixer.js
src/animation/AnimationMixer.js
+2
-2
src/animation/AnimationObjectGroup.js
src/animation/AnimationObjectGroup.js
+19
-19
src/animation/AnimationUtils.js
src/animation/AnimationUtils.js
+2
-2
src/animation/PropertyBinding.js
src/animation/PropertyBinding.js
+3
-6
未找到文件。
src/animation/AnimationAction.js
浏览文件 @
a5c81d2f
...
...
@@ -36,13 +36,13 @@ function AnimationAction( mixer, clip, localRoot ) {
this
.
_interpolantSettings
=
interpolantSettings
;
this
.
_interpolants
=
interpolants
;
// bound by the mixer
this
.
_interpolants
=
interpolants
;
// bound by the mixer
// inside: PropertyMixer (managed by the mixer)
this
.
_propertyBindings
=
new
Array
(
nTracks
);
this
.
_cacheIndex
=
null
;
// for the memory manager
this
.
_byClipCacheIndex
=
null
;
// for the memory manager
this
.
_cacheIndex
=
null
;
// for the memory manager
this
.
_byClipCacheIndex
=
null
;
// for the memory manager
this
.
_timeScaleInterpolant
=
null
;
this
.
_weightInterpolant
=
null
;
...
...
@@ -64,15 +64,15 @@ function AnimationAction( mixer, clip, localRoot ) {
this
.
weight
=
1
;
this
.
_effectiveWeight
=
1
;
this
.
repetitions
=
Infinity
;
// no. of repetitions when looping
this
.
repetitions
=
Infinity
;
// no. of repetitions when looping
this
.
paused
=
false
;
// true -> zero effective time scale
this
.
enabled
=
true
;
// false -> zero effective weight
this
.
paused
=
false
;
// true -> zero effective time scale
this
.
enabled
=
true
;
// false -> zero effective weight
this
.
clampWhenFinished
=
false
;
// keep feeding the last frame?
this
.
clampWhenFinished
=
false
;
// keep feeding the last frame?
this
.
zeroSlopeAtStart
=
true
;
// for smooth interpolation w/o separate
this
.
zeroSlopeAtEnd
=
true
;
// clips for start, loop and end
this
.
zeroSlopeAtStart
=
true
;
// for smooth interpolation w/o separate
this
.
zeroSlopeAtEnd
=
true
;
// clips for start, loop and end
}
...
...
@@ -101,9 +101,9 @@ Object.assign( AnimationAction.prototype, {
this
.
paused
=
false
;
this
.
enabled
=
true
;
this
.
time
=
0
;
// restart clip
this
.
_loopCount
=
-
1
;
// forget previous loops
this
.
_startTime
=
null
;
// forget scheduling
this
.
time
=
0
;
// restart clip
this
.
_loopCount
=
-
1
;
// forget previous loops
this
.
_startTime
=
null
;
// forget scheduling
return
this
.
stopFading
().
stopWarping
();
...
...
@@ -112,7 +112,7 @@ Object.assign( AnimationAction.prototype, {
isRunning
:
function
()
{
return
this
.
enabled
&&
!
this
.
paused
&&
this
.
timeScale
!==
0
&&
this
.
_startTime
===
null
&&
this
.
_mixer
.
_isActiveAction
(
this
);
this
.
_startTime
===
null
&&
this
.
_mixer
.
_isActiveAction
(
this
);
},
...
...
@@ -613,8 +613,8 @@ Object.assign( AnimationAction.prototype, {
if
(
pingPong
)
{
settings
.
endingStart
=
ZeroSlopeEnding
;
settings
.
endingEnd
=
ZeroSlopeEnding
;
settings
.
endingStart
=
ZeroSlopeEnding
;
settings
.
endingEnd
=
ZeroSlopeEnding
;
}
else
{
...
...
@@ -659,8 +659,10 @@ Object.assign( AnimationAction.prototype, {
var
times
=
interpolant
.
parameterPositions
,
values
=
interpolant
.
sampleValues
;
times
[
0
]
=
now
;
values
[
0
]
=
weightNow
;
times
[
1
]
=
now
+
duration
;
values
[
1
]
=
weightThen
;
times
[
0
]
=
now
;
values
[
0
]
=
weightNow
;
times
[
1
]
=
now
+
duration
;
values
[
1
]
=
weightThen
;
return
this
;
...
...
src/animation/AnimationMixer.js
浏览文件 @
a5c81d2f
...
...
@@ -176,8 +176,8 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy
this
.
_actionsByClip
=
{};
// inside:
// {
//
knownActions: Array< AnimationAction >
- used as prototypes
//
actionByRoot: AnimationAction
- lookup
//
knownActions: Array< AnimationAction >
- used as prototypes
//
actionByRoot: AnimationAction
- lookup
// }
...
...
src/animation/AnimationObjectGroup.js
浏览文件 @
a5c81d2f
...
...
@@ -7,27 +7,27 @@ import { _Math } from '../math/Math.js';
*
* Usage:
*
*
-
Add objects you would otherwise pass as 'root' to the
*
constructor or the .clipAction method of AnimationMixer.
*
-
Add objects you would otherwise pass as 'root' to the
*
constructor or the .clipAction method of AnimationMixer.
*
*
-
Instead pass this object as 'root'.
*
-
Instead pass this object as 'root'.
*
*
-
You can also add and remove objects later when the mixer
*
is running.
*
-
You can also add and remove objects later when the mixer
*
is running.
*
* Note:
*
*
Objects of this class appear as one object to the mixer,
*
so cache control of the individual objects must be done
*
on the group.
*
Objects of this class appear as one object to the mixer,
*
so cache control of the individual objects must be done
*
on the group.
*
* Limitation:
*
*
-
The animated properties must be compatible among the
*
all objects in the group.
*
-
The animated properties must be compatible among the
*
all objects in the group.
*
* -
A single property can either be controlled through a
*
target group or directly, but not both.
* -
A single property can either be controlled through a
*
target group or directly, but not both.
*
* @author tschw
*/
...
...
@@ -39,11 +39,11 @@ function AnimationObjectGroup() {
// cached objects followed by the active ones
this
.
_objects
=
Array
.
prototype
.
slice
.
call
(
arguments
);
this
.
nCachedObjects_
=
0
;
// threshold
this
.
nCachedObjects_
=
0
;
// threshold
// note: read by PropertyBinding.Composite
var
indices
=
{};
this
.
_indicesByUUID
=
indices
;
// for bookkeeping
this
.
_indicesByUUID
=
indices
;
// for bookkeeping
for
(
var
i
=
0
,
n
=
arguments
.
length
;
i
!==
n
;
++
i
)
{
...
...
@@ -51,10 +51,10 @@ function AnimationObjectGroup() {
}
this
.
_paths
=
[];
// inside: string
this
.
_parsedPaths
=
[];
// inside: { we don't care, here }
this
.
_bindings
=
[];
// inside: Array< PropertyBinding >
this
.
_bindingsIndicesByPath
=
{};
// inside: indices in these arrays
this
.
_paths
=
[];
// inside: string
this
.
_parsedPaths
=
[];
// inside: { we don't care, here }
this
.
_bindings
=
[];
// inside: Array< PropertyBinding >
this
.
_bindingsIndicesByPath
=
{};
// inside: indices in these arrays
var
scope
=
this
;
...
...
@@ -162,7 +162,7 @@ Object.assign( AnimationObjectGroup.prototype, {
}
else
if
(
objects
[
index
]
!==
knownObject
)
{
console
.
error
(
'
THREE.AnimationObjectGroup: Different objects with the same UUID
'
+
'
detected. Clean the caches or recreate your infrastructure when reloading scenes.
'
);
'
detected. Clean the caches or recreate your infrastructure when reloading scenes.
'
);
}
// else the object is already where we want it to be
...
...
src/animation/AnimationUtils.js
浏览文件 @
a5c81d2f
...
...
@@ -25,7 +25,7 @@ var AnimationUtils = {
convertArray
:
function
(
array
,
type
,
forceClone
)
{
if
(
!
array
||
// let 'undefined' and 'null' pass
!
forceClone
&&
array
.
constructor
===
type
)
return
array
;
!
forceClone
&&
array
.
constructor
===
type
)
return
array
;
if
(
typeof
type
.
BYTES_PER_ELEMENT
===
'
number
'
)
{
...
...
@@ -40,7 +40,7 @@ var AnimationUtils = {
isTypedArray
:
function
(
object
)
{
return
ArrayBuffer
.
isView
(
object
)
&&
!
(
object
instanceof
DataView
);
!
(
object
instanceof
DataView
);
},
...
...
src/animation/PropertyBinding.js
浏览文件 @
a5c81d2f
...
...
@@ -38,8 +38,7 @@ Object.assign( Composite.prototype, {
var
bindings
=
this
.
_bindings
;
for
(
var
i
=
this
.
_targetGroup
.
nCachedObjects_
,
n
=
bindings
.
length
;
i
!==
n
;
++
i
)
{
for
(
var
i
=
this
.
_targetGroup
.
nCachedObjects_
,
n
=
bindings
.
length
;
i
!==
n
;
++
i
)
{
bindings
[
i
].
setValue
(
array
,
offset
);
...
...
@@ -51,8 +50,7 @@ Object.assign( Composite.prototype, {
var
bindings
=
this
.
_bindings
;
for
(
var
i
=
this
.
_targetGroup
.
nCachedObjects_
,
n
=
bindings
.
length
;
i
!==
n
;
++
i
)
{
for
(
var
i
=
this
.
_targetGroup
.
nCachedObjects_
,
n
=
bindings
.
length
;
i
!==
n
;
++
i
)
{
bindings
[
i
].
bind
();
...
...
@@ -64,8 +62,7 @@ Object.assign( Composite.prototype, {
var
bindings
=
this
.
_bindings
;
for
(
var
i
=
this
.
_targetGroup
.
nCachedObjects_
,
n
=
bindings
.
length
;
i
!==
n
;
++
i
)
{
for
(
var
i
=
this
.
_targetGroup
.
nCachedObjects_
,
n
=
bindings
.
length
;
i
!==
n
;
++
i
)
{
bindings
[
i
].
unbind
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录