AnimationClip.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. <p 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. </p>
  17. <h2>Constructor</h2>
  18. <h3>[name]( [param:String name], [param:Number duration], [param:Array tracks] )</h3>
  19. <p>
  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. </p>
  31. <h2>Properties</h2>
  32. <h3>[property:Number duration]</h3>
  33. <p>
  34. The duration of this clip (in seconds). This can be calculated from the [page:.tracks tracks]
  35. array via [page:.resetDuration resetDuration].
  36. </p>
  37. <h3>[property:String name]</h3>
  38. <p>
  39. A name for this clip. A certain clip can be searched via [page:.findByName findByName].
  40. </p>
  41. <h3>[property:Array tracks]</h3>
  42. <p>
  43. An array containing a [page:KeyframeTrack] for each property that are animated by this clip.
  44. </p>
  45. <h3>[property:String uuid]</h3>
  46. <p>
  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. </p>
  50. <h2>Methods</h2>
  51. <h3>[method:this optimize]()</h3>
  52. <p>
  53. Optimizes each track by removing equivalent sequential keys (which are common in morph target
  54. sequences).
  55. </p>
  56. <h3>[method:this resetDuration]()</h3>
  57. <p>
  58. Sets the [page:.duration duration] of the clip to the duration of its longest
  59. [page:KeyframeTrack].
  60. </p>
  61. <h3>[method:this trim]()</h3>
  62. <p>
  63. Trims all tracks to the clip's duration.
  64. </p>
  65. <h3>[method:Boolean validate]()</h3>
  66. <p>
  67. Performs minimal validation on each track in the clip. Returns true if all tracks are valid.
  68. </p>
  69. <h2>Static Methods</h2>
  70. <h3>[method:Array CreateClipsFromMorphTargetSequences]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )</h3>
  71. <p>
  72. Returns an array of new AnimationClips created from the [page:Geometry.morphTargets morph
  73. target sequences] of a geometry, trying to sort morph target names into animation-group-based
  74. patterns like "Walk_001, Walk_002, Run_001, Run_002 ..."<br /><br />
  75. This method is called by the [page:JSONLoader] internally, and it uses
  76. [page:.CreateFromMorphTargetSequence CreateFromMorphTargetSequence].
  77. </p>
  78. <h3>[method:AnimationClip CreateFromMorphTargetSequence]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )</h3>
  79. <p>
  80. Returns a new AnimationClip from the passed [page:Geometry.morphTargets morph targets array]
  81. of a geometry, taking a name and the number of frames per second.<br /><br />
  82. Note: The fps parameter is required, but the animation speed can be overridden in an
  83. *AnimationAction* via [page:AnimationAction.setDuration animationAction.setDuration].
  84. </p>
  85. <h3>[method:AnimationClip findByName]( [param:Object objectOrClipArray], [param:String name] )</h3>
  86. <p>
  87. Searches for an AnimationClip by name, taking as its first parameter either an array of
  88. AnimationClips, or a mesh or geometry that contains an array named "animations".
  89. </p>
  90. <h3>[method:AnimationClip parse]( [param:Object json] )</h3>
  91. <p>
  92. Parses a JSON representation of a clip and returns an AnimationClip.
  93. </p>
  94. <h3>[method:AnimationClip parseAnimation]( [param:Object animation], [param:Array bones] )</h3>
  95. <p>
  96. Parses the animation.hierarchy format and returns an AnimationClip.
  97. </p>
  98. <h3>[method:Object toJSON]( [param:AnimationClip clip] )</h3>
  99. <p>
  100. Takes an AnimationClip and returns a JSON object.
  101. </p>
  102. <h2>Source</h2>
  103. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  104. </body>
  105. </html>