MorphAnimMesh.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. [page:Object3D] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">Play a sequence of morphs in a smooth animation sequence.</div>
  14. <h2>Examples</h2>
  15. <div>
  16. [example:webgl_lights_hemisphere lights / hemisphere ]<br/>
  17. [example:webgl_morphtargets_md2 morphtargets / md2 ]<br/>
  18. [example:webgl_loader_json_blender loader / json / blender ]
  19. </div>
  20. <code>
  21. var meshAnim;
  22. loader.load( "models/animated/flamingo.js", function( geometry ) {
  23. meshAnim = new THREE.MorphAnimMesh( geometry, material );
  24. meshAnim.duration = 1000;
  25. scene.add( meshAnim );
  26. }
  27. function update() {
  28. var delta = clock.getDelta();
  29. meshAnim.updateAnimation( 1000 * delta );
  30. }
  31. </code>
  32. <h2>Constructor</h2>
  33. <h3>[name]([page:Geometry geometry], [page:Material material])</h3>
  34. <div>
  35. geometry — An instance of [page:Geometry].<br />
  36. material — An instance of [page:Material] (optional).
  37. </div>
  38. <h2>Properties</h2>
  39. <h3>[property:Boolean directionBackwards]</h3>
  40. <div>
  41. Animation is playing backwards
  42. </div>
  43. <h3>[property:Float direction]</h3>
  44. <div>
  45. 1 if playing forward, -1 if playing backwards
  46. </div>
  47. <h3>[property:Integer startKeyframe]</h3>
  48. <div>
  49. The first keyframe (morph) of the sequence
  50. </div>
  51. <h3>[property:Integer endKeyframe]</h3>
  52. <div>
  53. The last keyframe (morph) of the sequence
  54. </div>
  55. <h3>[property:Boolean mirroredLoop]</h3>
  56. <div>
  57. Loop animation back and forth
  58. </div>
  59. <h3>[property:Integer lastKeyframe]</h3>
  60. <div>
  61. The index of the last keyframe played.
  62. </div>
  63. <h3>[property:Integer currentKeyframe]</h3>
  64. <div>
  65. The index of the current frame being played.
  66. </div>
  67. <h3>[property:Integer length]</h3>
  68. <div>
  69. The number of frames (morphs)
  70. </div>
  71. <h3>[property:Float time]</h3>
  72. <div>
  73. The current playback position of the animation in milliseconds.
  74. </div>
  75. <h3>[property:Float duration]</h3>
  76. <div>
  77. The length of the animation in milliseconds.
  78. </div>
  79. <h2>Methods</h2>
  80. <h3>[method:null setDirectionForward]()</h3>
  81. <div>
  82. Sets the animation to play forwards
  83. </div>
  84. <h3>[method:null setDirectionBackward]()</h3>
  85. <div>
  86. Set the animation to play backwards.
  87. </div>
  88. <h3>[method:null playAnimation]([page:String label], [page:Float fps])</h3>
  89. <div>
  90. label -- The label of the animation <br />
  91. fps -- The frames per second (in seconds)
  92. </div>
  93. <div>
  94. Starts playing a labeled animation. Animations are defined by calling [page:MorphAnimMesh.parseAnimations parseAnimations].
  95. </div>
  96. <h3>[method:null setFrameRange]([page:Integer start], [page:Integer end])</h3>
  97. <div>
  98. start -- The starting frame (morph) index <br />
  99. end -- The ending frame (morph) index
  100. </div>
  101. <div>
  102. Sets the range of morphs to be played
  103. </div>
  104. <h3>[method:null parseAnimations]()</h3>
  105. <div>
  106. Goes through the geometry's morphTargets and generates animations based on the morphTargets' names (morph.name). Names
  107. are of the form "walk_01", "walk_02", "walk_03", etc or "run001", "run002", "run003". The animation label is then
  108. the part before the underscore and number, so "walk" or "run" in the examples.<br/><br/>
  109. This function changes the underlying geometry object by adding the animations property to it. This property
  110. is set to an object of key/pair values, with the key being the label and the value being an object with
  111. a start and end property that represents the frame index.
  112. </div>
  113. <h3>[method:null updateAnimation]([page:Float delta])</h3>
  114. <div>
  115. delta -- The change in time in milliseconds
  116. </div>
  117. <div>
  118. Update the morphTargetInfluences array on the MorphAnimMesh.
  119. </div>
  120. <h3>[method:null setAnimationLabel]([page:String label], [page:Integer start], [page:Integer end])</h3>
  121. <div>
  122. label -- The name of the animation <br />
  123. start -- The starting frame index <br />
  124. end -- The ending frame index
  125. </div>
  126. <div>
  127. Defines an animation. Sets the geometry.animations[label] to be an object with the start and end properties.
  128. </div>
  129. <h3>[method:Object3D clone]([page:Object3D object])</h3>
  130. <div>
  131. object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned MorphAnimMesh Object.
  132. </div>
  133. <div>
  134. Clone a MorphAnimMesh Object.
  135. </div>
  136. <h2>Source</h2>
  137. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  138. </body>
  139. </html>