AnimationClip.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. <div class="desc">
  13. An AnimationClip is a reusable set of keyframe tracks which represent an animation.<br /><br />
  14. For an overview of the different elements of the three.js animation system see the
  15. "Animation System" article in the "Next Steps" section of the manual.
  16. </div>
  17. <h2>Constructor</h2>
  18. <h3>[name]( [param:String name], [param:Number duration], [param:Array tracks] )</h3>
  19. <div>
  20. [page:String name] - a name for this clip.<br />
  21. [page:Number duration] - the duration of this clip (in seconds). If a negative value is passed,
  22. the duration will be calculated from the passed *tracks* array.<br />
  23. [page:Array tracks] - an array of [page:KeyframeTrack KeyframeTracks].<br /><br />
  24. Note: Instead of instantiating an AnimationClip directly with the constructor, you can use one
  25. of its static methods to create AnimationClips: from JSON ([page:.parse parse]), from morph
  26. target sequences ([page:.CreateFromMorphTargetSequence CreateFromMorphTargetSequence],
  27. [page:.CreateClipsFromMorphTargetSequences CreateClipsFromMorphTargetSequences]) or from
  28. animation hierarchies ([page:.parseAnimation parseAnimation]) - if your model doesn't already
  29. hold AnimationClips in its geometry's animations array.
  30. </div>
  31. <h2>Properties</h2>
  32. <h3>[property:Number duration]</h3>
  33. <div>
  34. The duration of this clip (in seconds). This can be calculated from the [page:.tracks tracks]
  35. array via [page:.resetDuration resetDuration].
  36. </div>
  37. <h3>[property:String name]</h3>
  38. <div>
  39. A name for this clip. A certain clip can be searched via [page:.findByName findByName].
  40. </div>
  41. <h3>[property:Array tracks]</h3>
  42. <div>
  43. An array containing a [page:KeyframeTrack] for each property that are animated by this clip.
  44. </div>
  45. <h3>[property:String uuid]</h3>
  46. <div>
  47. The [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this clip instance.
  48. It gets automatically assigned and shouldn't be edited.
  49. </div>
  50. <h2>Methods</h2>
  51. <h3>[method:AnimationClip optimize]()</h3>
  52. <div>
  53. Optimizes each track by removing equivalent sequential keys (which are common in morph target
  54. sequences).
  55. </div>
  56. <h3>[method:null resetDuration]()</h3>
  57. <div>
  58. Sets the [page:.duration duration] of the clip to the duration of its longest
  59. [page:KeyframeTrack].
  60. </div>
  61. <h3>[method:AnimationClip trim]()</h3>
  62. <div>
  63. Trims all tracks to the clip's duration.
  64. </div>
  65. <h2>Static Methods</h2>
  66. <h3>[method:Array CreateClipsFromMorphTargetSequences]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )</h3>
  67. <div>
  68. Returns an array of new AnimationClips created from the [page:Geometry.morphTargets morph
  69. target sequences] of a geometry, trying to sort morph target names into animation-group-based
  70. patterns like "Walk_001, Walk_002, Run_001, Run_002 ..."<br /><br />
  71. This method is called by the [page:JSONLoader] internally, and it uses
  72. [page:.CreateFromMorphTargetSequence CreateFromMorphTargetSequence].
  73. </div>
  74. <h3>[method:AnimationClip CreateFromMorphTargetSequence]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )</h3>
  75. <div>
  76. Returns a new AnimationClip from the passed [page:Geometry.morphTargets morph targets array]
  77. of a geometry, taking a name and the number of frames per second.<br /><br />
  78. Note: The fps parameter is required, but the animation speed can be overridden in an
  79. *AnimationAction* via [page:AnimationAction.setDuration animationAction.setDuration].
  80. </div>
  81. <h3>[method:AnimationClip findByName]( [param:Object objectOrClipArray], [param:String name] )</h3>
  82. <div>
  83. Searches for an AnimationClip by name, taking as its first parameter either an array of
  84. AnimationClips, or a mesh or geometry that contains an array named "animations".
  85. </div>
  86. <h3>[method:AnimationClip parse]( [param:Object json] )</h3>
  87. <div>
  88. Parses a JSON representation of a clip and returns an AnimationClip.
  89. </div>
  90. <h3>[method:AnimationClip parseAnimation]( [param:Object animation], [param:Array bones] )</h3>
  91. <div>
  92. Parses the animation.hierarchy format and returns an AnimationClip.
  93. </div>
  94. <h3>[method:Object toJSON]( [param:AnimationClip clip] )</h3>
  95. <div>
  96. Takes an AnimationClip and returns a JSON object.
  97. </div>
  98. <h2>Source</h2>
  99. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  100. </body>
  101. </html>