AnimationClip.html 4.7 KB

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