Skip to content

Commit fc38b8c

Browse files
committed
Add MMDAnimationHelper documentation
1 parent 83ed893 commit fc38b8c

File tree

1 file changed

+162
-0
lines changed

1 file changed

+162
-0
lines changed
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<base href="../../" />
6+
<script src="list.js"></script>
7+
<script src="page.js"></script>
8+
<link type="text/css" rel="stylesheet" href="page.css" />
9+
</head>
10+
<body>
11+
<h1>[name]</h1>
12+
13+
<p class="desc"> A animation helper for <a href="http://www.geocities.jp/higuchuu4/index_e.htm"><em>MMD</em></a> resources. <br /><br />
14+
[name] handles animation of MMD assets loaded by [page:MMDLoader] with MMD special features as IK, Grant, and Physics.
15+
</p>
16+
17+
<h2>Example</h2>
18+
19+
<code>
20+
// Instantiate a helper
21+
var helper = new THREE.MMDAnimationHelper();
22+
23+
// Load MMD resources and add to helper
24+
new THREE.MMDLoader().loadWithAnimation(
25+
'models/mmd/miku.pmd',
26+
'models/mmd/dance.vmd',
27+
function ( mmd ) {
28+
29+
helper.add( mmd.mesh, {
30+
animation: mmd.animation,
31+
physics: true
32+
} );
33+
34+
scene.add( mesh );
35+
36+
new THREE.AudioLoader().load(
37+
'audios/mmd/song.mp3',
38+
function ( buffer ) {
39+
40+
var listener = new THREE.AudioListener();
41+
var audio = new THREE.Audio( listener )
42+
.setBuffer( buffer );
43+
44+
listener.position.z = 1;
45+
46+
scene.add( audio );
47+
scene.add( listener );
48+
49+
}
50+
51+
);
52+
53+
}
54+
);
55+
56+
function render() {
57+
58+
helper.update( clock.getDelta() );
59+
renderer.render( scene, camera );
60+
61+
}
62+
</code>
63+
64+
[example:webgl_loader_mmd]<br />
65+
[example:webgl_loader_mmd_pose]<br />
66+
[example:webgl_loader_mmd_audio]<br />
67+
68+
<br />
69+
<hr>
70+
71+
<h2>Constructor</h2>
72+
73+
<h3>[name]( [param:Object params] )</h3>
74+
<p>
75+
[page:Object params] — (optional)<br />
76+
<ul>
77+
<li> [page:Boolean sync] - Whether animation durations of added objects are synched. Default is true.</li>
78+
<li> [page:Number afterglow] - Default is 0.0.</li>
79+
<li> [page:Boolean resetPhysicsOnLoop] - Default is true.</li>
80+
</ul>
81+
</p>
82+
<p>
83+
Creates a new [name].
84+
</p>
85+
86+
<h2>Properties</h2>
87+
88+
<h3>[property:Audio audio]</h3>
89+
<p>An [page:Audio] added to helper.</p>
90+
91+
<h3>[property:Camera camera]</h3>
92+
<p>An [page:Camera] added to helper.</p>
93+
94+
<h3>[property:Array meshes]</h3>
95+
<p>An array of [page:SkinnedMesh] added to helper.</p>
96+
97+
<h3>[property:WeakMap objects]</h3>
98+
<p>A [page:WeakMap] which holds animation stuffs used in helper for objects added to helper. For example, you can access [page:AnimationMixer] for an added [page:SkinnedMesh] with "helper.objects.get( mesh ).mixer"</p>
99+
100+
101+
<h2>Methods</h2>
102+
103+
<h3>[method:MMDAnimationHelper add]( [param:Object3D object], [param:Object params] )</h3>
104+
<p>
105+
[page:Object3D object] — [page:SkinnedMesh], [page:Camera], or [page:Audio]<br />
106+
[page:Object params] — (optional)<br />
107+
<ul>
108+
<li>[page:AnimationClip animation] - an [page:AnimationClip] or an array of [page:AnimationClip] set to object. Only for [page:SkinnedMesh] and [page:Camera]. Default is undefined.</li>
109+
<li>[page:Boolean physics] - Only for [page:SkinnedMesh]. A flag whether turn on physics. Default is true.</li>
110+
<li>[page:Number delayTime] - Only for [page:Audio]. Default is 0.0.</li>
111+
</ul>
112+
</p>
113+
<p>
114+
Add an [page:SkinnedMesh], [page:Camera], or [page:Audio] to helper and setup animation. The anmation durations of added objects are synched.
115+
If camera/audio has already been added, it'll be replaced with a new one.
116+
</p>
117+
118+
<h3>[method:MMDAnimationHelper enable]( [param:string key], [param:Boolean enabled] )</h3>
119+
<p>
120+
[page:string key] — Allowed strings are 'animation', 'ik', 'grant', 'physics', and 'cameraAnimation'.<br />
121+
[page:Boolean enabled] — true is enable, false is disable<br />
122+
</p>
123+
<p>
124+
Enable/Disable an animation feature
125+
</p>
126+
127+
<h3>[method:MMDAnimationHelper pose]( [param:SkinnedMesh mesh], [param:Object vpd], [param:Object params] )</h3>
128+
<p>
129+
[page:SkinnedMesh mesh] — [page:SkinnedMesh] which changes the posing. It doesn't need to be added to helper.<br />
130+
[page:Object vpd] — VPD content obtained by [page:MMDLoader].loadVPD<br />
131+
[page:Object params] — (optional)<br />
132+
<ul>
133+
<li>[page:Boolean resetPose] - Default is true.</li>
134+
<li>[page:Boolean ik] - Default is true.</li>
135+
<li>[page:Boolean grant] - Default is true.</li>
136+
</ul>
137+
</p>
138+
<p>
139+
Changes the posing of [page:SkinnedMesh] as VPD content specifies.
140+
</p>
141+
142+
<h3>[method:MMDAnimationHelper remove]( [param:Object3D object] )</h3>
143+
<p>
144+
[page:Object3D object] — [page:SkinnedMesh], [page:Camera], or [page:Audio]<br />
145+
</p>
146+
<p>
147+
Remove an [page:SkinnedMesh], [page:Camera], or [page:Audio] from helper.
148+
</p>
149+
150+
<h3>[method:MMDAnimationHelper update]( [param:Nummber delta] )</h3>
151+
<p>
152+
[page:Number delta] — number in second<br />
153+
</p>
154+
<p>
155+
Advance mixer time and update the animations of objects added to helper
156+
</p>
157+
158+
<h2>Source</h2>
159+
160+
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/animation/MMDAnimationHelper.js examples/js/animation/MMDAnimationHelper.js]
161+
</body>
162+
</html>

0 commit comments

Comments
 (0)