AnimationClip.html 4.7 KB

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