Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
74c2898d
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,发现更多精彩内容 >>
提交
74c2898d
编写于
7月 26, 2015
作者:
B
Ben Houston
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make morph target animation clips work.
上级
e6aad57c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
19 deletion
+29
-19
examples/webgl_animation_track_clip_mixer.html
examples/webgl_animation_track_clip_mixer.html
+12
-10
src/animation/AnimationClip.js
src/animation/AnimationClip.js
+6
-5
src/animation/PropertyBinding.js
src/animation/PropertyBinding.js
+11
-4
未找到文件。
examples/webgl_animation_track_clip_mixer.html
浏览文件 @
74c2898d
...
...
@@ -258,19 +258,21 @@
mixer
=
new
THREE
.
AnimationMixer
(
mesh
);
var
clip1
=
THREE
.
AnimationClip
.
CreateShakeAnimation
(
10
,
new
THREE
.
Vector3
(
10
,
10
,
10
)
);
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clip1
,
0
,
1
,
1
,
true
)
);
//
mixer.addAction( new THREE.AnimationAction( clip1, 0, 1, 1, true ) );
var
clip2
=
THREE
.
AnimationClip
.
CreatePulsationAnimation
(
10
,
100
);
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clip2
,
0
,
1
,
1
,
true
)
);
//
mixer.addAction( new THREE.AnimationAction( clip2, 0, 1, 1, true ) );
var
clip3
=
THREE
.
AnimationClip
.
CreateRotationAnimation
(
100
,
'
y
'
);
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clip3
,
0
,
1
,
1
,
true
)
);
//
mixer.addAction( new THREE.AnimationAction( clip3, 0, 1, 1, true ) );
var
clip4
=
THREE
.
AnimationClip
.
CreateScaleAxisAnimation
(
10
,
'
x
'
);
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clip4
,
0
,
1
,
1
,
true
)
);
//
mixer.addAction( new THREE.AnimationAction( clip4, 0, 1, 1, true ) );
var
clip5
=
THREE
.
AnimationClip
.
CreateMaterialColorAnimation
(
10
,
[
new
THREE
.
Color
(
0xffffff
),
new
THREE
.
Color
(
0xff0000
),
new
THREE
.
Color
(
0xff00ff
)
]
);
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clip5
,
0
,
1
,
1
,
true
)
);
var
clip6
=
THREE
.
AnimationClip
.
CreateVisibilityAnimation
(
10
);
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clip6
,
0
,
1
,
1
,
true
)
);
//mixer.addAction( new THREE.AnimationAction( clip5, 0, 1, 1, true ) );
//var clip6 = THREE.AnimationClip.CreateVisibilityAnimation( 10 );
//mixer.addAction( new THREE.AnimationAction( clip6, 0, 1, 1, true ) );
var
clip7
=
THREE
.
AnimationClip
.
CreateMorphAnimation
(
mesh
.
geometry
.
morphTargets
,
3
);
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clip7
,
0
,
1
,
1
,
true
)
);
}
function
initGUI
()
{
...
...
@@ -326,7 +328,7 @@
//if ( helper !== undefined ) helper.update();
// update morphs
/*
if ( mesh ) {
var time = Date.now() * 0.001;
...
...
@@ -343,7 +345,7 @@
mesh.morphTargetInfluences[ 3 ] = ( 1 + Math.cos( 4 * time ) ) / 2;
}
}
*/
renderer
.
render
(
scene
,
camera
);
...
...
src/animation/AnimationClip.js
浏览文件 @
74c2898d
...
...
@@ -160,12 +160,12 @@ THREE.AnimationClip.prototype = {
// TODO: Fix this for loops.
// TODO: Test this
THREE
.
AnimationClip
.
CreateMorphAnimation
=
function
(
morphTarget
Name
s
,
duration
)
{
THREE
.
AnimationClip
.
CreateMorphAnimation
=
function
(
morphTargets
,
duration
)
{
var
tracks
=
[];
var
frameStep
=
duration
/
morphTarget
Names
;
var
frameStep
=
duration
/
morphTarget
s
.
length
;
for
(
var
i
=
0
;
i
<
morphTarget
Name
s
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
morphTargets
.
length
;
i
++
)
{
var
keys
=
[];
...
...
@@ -177,13 +177,13 @@ THREE.AnimationClip.CreateMorphAnimation = function( morphTargetNames, duration
keys
.
push
(
{
time
:
i
*
frameStep
,
value
:
1
}
);
if
(
(
i
+
1
)
<=
morphTarget
Name
s
.
length
)
{
if
(
(
i
+
1
)
<=
morphTargets
.
length
)
{
keys
.
push
(
{
time
:
(
i
+
1
)
*
frameStep
,
value
:
0
}
);
}
var
morphName
=
morphTarget
Names
[
i
]
;
var
morphName
=
morphTarget
s
[
i
].
name
;
var
trackName
=
'
.morphTargetInfluences[
'
+
morphName
+
'
]
'
;
var
track
=
new
THREE
.
KeyframeTrack
(
trackName
,
keys
);
...
...
@@ -323,3 +323,4 @@ THREE.AnimationClip.CreateMaterialColorAnimation = function( duration, colors, l
return
clip
;
};
src/animation/PropertyBinding.js
浏览文件 @
74c2898d
...
...
@@ -119,10 +119,17 @@ THREE.PropertyBinding.prototype = {
// TODO/OPTIMIZE, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.
// support resolving morphTarget names into indices.
console
.
log
(
"
resolving morphTargetInfluence name:
"
,
this
.
propertyIndex
);
for
(
var
i
=
0
;
i
<
this
.
node
.
morphTargets
.
length
;
i
++
)
{
if
(
this
.
node
.
morphTargets
[
i
].
name
===
this
.
propertyIndex
)
{
console
.
log
(
"
resolved to index:
"
,
i
);
//console.log( " resolving morphTargetInfluence name: ", this.propertyIndex );
if
(
this
.
node
.
geometry
)
{
console
.
error
(
'
can not bind to morphTargetInfluences becasuse node does not have a geometry
'
,
this
);
}
if
(
this
.
node
.
geometry
.
morphTargets
)
{
console
.
error
(
'
can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets
'
,
this
);
}
for
(
var
i
=
0
;
i
<
this
.
node
.
geometry
.
morphTargets
.
length
;
i
++
)
{
if
(
this
.
node
.
geometry
.
morphTargets
[
i
].
name
===
this
.
propertyIndex
)
{
//console.log( " resolved to index: ", i );
this
.
propertyIndex
=
i
;
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录