Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
3b2c721f
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,发现更多精彩内容 >>
提交
3b2c721f
编写于
10月 10, 2015
作者:
T
tschw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Animation: Let KeyframeTrack not require values.
上级
f3a9598a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
32 deletion
+44
-32
src/animation/AnimationUtils.js
src/animation/AnimationUtils.js
+9
-1
src/animation/KeyframeTrack.js
src/animation/KeyframeTrack.js
+35
-31
未找到文件。
src/animation/AnimationUtils.js
浏览文件 @
3b2c721f
...
...
@@ -22,7 +22,8 @@ THREE.AnimationUtils = {
// converts an array to a specific type
convertArray
:
function
(
array
,
type
,
forceClone
)
{
if
(
!
forceClone
&&
array
.
constructor
===
type
)
return
array
;
if
(
!
array
||
!
forceClone
&&
array
.
constructor
===
type
)
return
array
;
if
(
typeof
type
.
BYTES_PER_ELEMENT
===
'
number
'
)
{
...
...
@@ -36,6 +37,13 @@ THREE.AnimationUtils = {
},
isTypedArray
:
function
(
object
)
{
return
ArrayBuffer
.
isView
(
object
)
&&
!
(
object
instanceof
DataView
);
},
// returns an array by which times and values can be sorted
getKeyframeOrder
:
function
(
times
)
{
...
...
src/animation/KeyframeTrack.js
浏览文件 @
3b2c721f
...
...
@@ -12,8 +12,7 @@ THREE.KeyframeTrack = function ( name, times, values, interpolation ) {
if
(
name
===
undefined
)
throw
new
Error
(
"
track name is undefined
"
);
if
(
times
===
undefined
||
times
.
length
===
0
||
values
===
undefined
||
values
.
length
===
0
)
{
if
(
times
===
undefined
||
times
.
length
===
0
)
{
throw
new
Error
(
"
no keyframes in track named
"
+
name
);
...
...
@@ -221,25 +220,27 @@ THREE.KeyframeTrack.prototype = {
},
// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable
// One could eventually ensure that all key.values in a track are all of the same type (otherwise interpolation makes no sense.)
validate
:
function
()
{
if
(
this
.
getValueSize
()
%
1
!==
0
)
{
var
valid
=
true
;
throw
new
Error
(
"
invalid value size for track named
"
+
this
.
name
);
var
valueSize
=
this
.
getValueSize
();
if
(
valueSize
-
Math
.
floor
(
valueSize
)
!==
0
)
{
console
.
error
(
"
invalid value size in track
"
,
this
);
valid
=
false
;
}
var
times
=
this
.
times
;
var
values
=
this
.
values
;
var
stride
=
this
.
getValueSize
();
var
times
=
this
.
times
,
values
=
this
.
values
,
var
nKeys
=
times
.
length
;
nKeys
=
times
.
length
;
if
(
nKeys
===
0
)
{
console
.
error
(
"
track is empty, no keys
"
,
this
);
return
;
console
.
error
(
"
track is empty
"
,
this
);
valid
=
false
;
}
...
...
@@ -249,46 +250,49 @@ THREE.KeyframeTrack.prototype = {
var
currTime
=
times
[
i
];
if
(
currTime
===
undefined
||
currTime
===
null
)
{
if
(
Number
.
isNaN
(
currTime
)
)
{
console
.
error
(
"
time is null in track
"
,
this
,
i
);
return
;
console
.
error
(
"
time is not a valid number
"
,
this
,
i
,
currTime
);
valid
=
false
;
break
;
}
if
(
(
typeof
currTime
)
!==
'
number
'
||
Number
.
isNaN
(
currTime
)
)
{
if
(
prevTime
!==
null
&&
prevTime
>
currTime
)
{
console
.
error
(
"
time is not a valid number
"
,
this
,
i
,
currTime
);
return
;
console
.
error
(
"
out of order keys
"
,
this
,
i
,
currTime
,
prevTime
);
valid
=
false
;
break
;
}
var
offset
=
i
*
stride
;
for
(
var
j
=
offset
,
e
=
offset
+
stride
;
j
!==
e
;
++
j
)
{
prevTime
=
currTime
;
}
var
value
=
values
[
j
];
if
(
values
!==
undefined
)
{
if
(
value
===
undefined
||
value
===
null
)
{
if
(
THREE
.
AnimationUtils
.
isTypedArray
(
values
)
)
{
console
.
error
(
"
value is null in track
"
,
this
,
j
,
value
);
return
;
for
(
var
i
=
0
,
n
=
values
.
length
;
i
!==
n
;
++
i
)
{
}
var
value
=
values
[
i
];
}
if
(
Number
.
isNaN
(
value
)
)
{
if
(
prevTime
!==
null
&&
prevTime
>
currTime
)
{
console
.
error
(
"
value is not a valid number
"
,
this
,
i
,
value
);
valid
=
false
;
break
;
console
.
error
(
"
time is less than previous key time, out of order keys
"
,
this
,
i
,
currTime
,
prevTime
);
return
;
}
}
}
prevTime
=
currTime
;
}
}
return
this
;
return
valid
;
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录