Repository navigation
Expand file tree
/
Copy pathMorphAnimMesh.html
More file actions
181 lines (139 loc) · 4.55 KB
/
Copy pathMorphAnimMesh.html
File metadata and controls
181 lines (139 loc) · 4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:Object3D] →
<h1>[name]</h1>
<div class="desc">Play a sequence of morphs in a smooth animation sequence.</div>
<h2>Examples</h2>
<div>
[example:webgl_lights_hemisphere lights / hemisphere ]<br/>
[example:webgl_morphtargets_md2 morphtargets / md2 ]<br/>
[example:webgl_loader_json_blender loader / json / blender ]
</div>
<code>
var meshAnim;
loader.load( "models/animated/flamingo.js", function( geometry ) {
meshAnim = new THREE.MorphAnimMesh( geometry, material );
meshAnim.duration = 1000;
scene.add( meshAnim );
}
function update() {
var delta = clock.getDelta();
meshAnim.updateAnimation( 1000 * delta );
}
</code>
<h2>Constructor</h2>
<h3>[name]([page:Geometry geometry], [page:Material material])</h3>
<div>
geometry — An instance of [page:Geometry].<br />
material — An instance of [page:Material] (optional).
</div>
<h2>Properties</h2>
<h3>[property:Boolean directionBackwards]</h3>
<div>
Animation is playing backwards
</div>
<h3>[property:Float direction]</h3>
<div>
1 if playing forward, -1 if playing backwards
</div>
<h3>[property:Integer startKeyframe]</h3>
<div>
The first keyframe (morph) of the sequence
</div>
<h3>[property:Integer endKeyframe]</h3>
<div>
The last keyframe (morph) of the sequence
</div>
<h3>[property:Boolean mirroredLoop]</h3>
<div>
Loop animation back and forth
</div>
<h3>[property:Integer lastKeyframe]</h3>
<div>
The index of the last keyframe played.
</div>
<h3>[property:Integer currentKeyframe]</h3>
<div>
The index of the current frame being played.
</div>
<h3>[property:Integer length]</h3>
<div>
The number of frames (morphs)
</div>
<h3>[property:Float time]</h3>
<div>
The current playback position of the animation in milliseconds.
</div>
<h3>[property:Float duration]</h3>
<div>
The length of the animation in milliseconds.
</div>
<h2>Methods</h2>
<h3>[method:null setDirectionForward]()</h3>
<div>
Sets the animation to play forwards
</div>
<h3>[method:null setDirectionBackward]()</h3>
<div>
Set the animation to play backwards.
</div>
<h3>[method:null playAnimation]([page:String label], [page:Float fps])</h3>
<div>
label -- The label of the animation <br />
fps -- The frames per second (in seconds)
</div>
<div>
Starts playing a labeled animation. Animations are defined by calling [page:MorphAnimMesh.parseAnimations parseAnimations].
</div>
<h3>[method:null setFrameRange]([page:Integer start], [page:Integer end])</h3>
<div>
start -- The starting frame (morph) index <br />
end -- The ending frame (morph) index
</div>
<div>
Sets the range of morphs to be played
</div>
<h3>[method:null parseAnimations]()</h3>
<div>
Goes through the geometry's morphTargets and generates animations based on the morphTargets' names (morph.name). Names
are of the form "walk_01", "walk_02", "walk_03", etc or "run001", "run002", "run003". The animation label is then
the part before the underscore and number, so "walk" or "run" in the examples.<br/><br/>
This function changes the underlying geometry object by adding the animations property to it. This property
is set to an object of key/pair values, with the key being the label and the value being an object with
a start and end property that represents the frame index.
</div>
<h3>[method:null updateAnimation]([page:Float delta])</h3>
<div>
delta -- The change in time in milliseconds
</div>
<div>
Update the morphTargetInfluences array on the MorphAnimMesh.
</div>
<h3>[method:null setAnimationLabel]([page:String label], [page:Integer start], [page:Integer end])</h3>
<div>
label -- The name of the animation <br />
start -- The starting frame index <br />
end -- The ending frame index
</div>
<div>
Defines an animation. Sets the geometry.animations[label] to be an object with the start and end properties.
</div>
<h3>[method:Object3D clone]([page:Object3D object])</h3>
<div>
object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned MorphAnimMesh Object.
</div>
<div>
Clone a MorphAnimMesh Object.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>