AnimationClip.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 [name] is a reusable set of keyframe tracks which represent an
  13. animation.<br /><br />
  14. For an overview of the different elements of the three.js animation system
  15. see the "Animation System" article in the "Next Steps" section of the
  16. manual.
  17. </p>
  18. <h2>Constructor</h2>
  19. <h3>
  20. [name]( [param:String name], [param:Number duration], [param:Array tracks], [param:Number blendMode] )
  21. </h3>
  22. <p>
  23. [page:String name] - a name for this clip.<br />
  24. [page:Number duration] - the duration of this clip (in seconds). If a
  25. negative value is passed, the duration will be calculated from the passed
  26. `tracks` array.<br />
  27. [page:Array tracks] - an array of [page:KeyframeTrack KeyframeTracks].<br />
  28. [page:Number blendMode] (optional) - defines how the animation is blended/combined
  29. when two or more animations are simultaneously played. Default is *NormalAnimationBlendMode*.<br /><br />
  30. Note: Instead of instantiating an AnimationClip directly with the
  31. constructor, you can use one of its static methods to create
  32. AnimationClips: from JSON ([page:.parse parse]), from morph target
  33. sequences ([page:.CreateFromMorphTargetSequence CreateFromMorphTargetSequence],
  34. [page:.CreateClipsFromMorphTargetSequences CreateClipsFromMorphTargetSequences]) or from animation hierarchies
  35. ([page:.parseAnimation parseAnimation]) - if your model doesn't already
  36. hold AnimationClips in its geometry's animations array.
  37. </p>
  38. <h2>Properties</h2>
  39. <h3>[property:Number blendMode]</h3>
  40. <p>
  41. Defines how the animation is blended/combined when two or more animations
  42. are simultaneously played. Valid values are *NormalAnimationBlendMode*
  43. (default) and *AdditiveAnimationBlendMode*.
  44. </p>
  45. <h3>[property:Number duration]</h3>
  46. <p>
  47. The duration of this clip (in seconds). This can be calculated from the
  48. [page:.tracks tracks] array via [page:.resetDuration resetDuration].
  49. </p>
  50. <h3>[property:String name]</h3>
  51. <p>
  52. A name for this clip. A certain clip can be searched via [page:.findByName findByName].
  53. </p>
  54. <h3>[property:Array tracks]</h3>
  55. <p>
  56. An array containing a [page:KeyframeTrack] for each property that are
  57. animated by this clip.
  58. </p>
  59. <h3>[property:String uuid]</h3>
  60. <p>
  61. The [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID]
  62. of this clip instance. It gets automatically assigned and shouldn't be
  63. edited.
  64. </p>
  65. <h3>[property:Object userData]</h3>
  66. <p>
  67. An object that can be used to store custom data about the animation clip.
  68. It should not hold references to functions as these will not be cloned.
  69. </p>
  70. <h2>Methods</h2>
  71. <h3>[method:AnimationClip clone]()</h3>
  72. <p>Returns a copy of this clip.</p>
  73. <h3>[method:this optimize]()</h3>
  74. <p>
  75. Optimizes each track by removing equivalent sequential keys (which are
  76. common in morph target sequences).
  77. </p>
  78. <h3>[method:this resetDuration]()</h3>
  79. <p>
  80. Sets the [page:.duration duration] of the clip to the duration of its
  81. longest [page:KeyframeTrack].
  82. </p>
  83. <h3>[method:Object toJSON]()</h3>
  84. <p>Returns a JSON object representing the serialized animation clip.</p>
  85. <h3>[method:this trim]()</h3>
  86. <p>Trims all tracks to the clip's duration.</p>
  87. <h3>[method:Boolean validate]()</h3>
  88. <p>
  89. Performs minimal validation on each track in the clip. Returns true if all
  90. tracks are valid.
  91. </p>
  92. <h2>Static Methods</h2>
  93. <h3>[method:Array CreateClipsFromMorphTargetSequences]( [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )</h3>
  94. <p>
  95. Returns an array of new AnimationClips created from the morph target
  96. sequences of a geometry, trying to sort morph target names into
  97. animation-group-based patterns like "Walk_001, Walk_002, Run_001, Run_002...".
  98. </p>
  99. <h3>[method:AnimationClip CreateFromMorphTargetSequence]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )
  100. </h3>
  101. <p>
  102. Returns a new AnimationClip from the passed morph targets array of a
  103. geometry, taking a name and the number of frames per second.<br /><br />
  104. Note: The fps parameter is required, but the animation speed can be
  105. overridden in an `AnimationAction` via [page:AnimationAction.setDuration animationAction.setDuration].
  106. </p>
  107. <h3>[method:AnimationClip findByName]( [param:Object objectOrClipArray], [param:String name] )
  108. </h3>
  109. <p>
  110. Searches for an AnimationClip by name, taking as its first parameter
  111. either an array of AnimationClips, or a mesh or geometry that contains an
  112. array named "animations".
  113. </p>
  114. <h3>[method:AnimationClip parse]( [param:Object json] )</h3>
  115. <p>Parses a JSON representation of a clip and returns an AnimationClip.</p>
  116. <h3>
  117. [method:AnimationClip parseAnimation]( [param:Object animation], [param:Array bones] )
  118. </h3>
  119. <p>Parses the animation.hierarchy format and returns an AnimationClip.</p>
  120. <h3>[method:Object toJSON]( [param:AnimationClip clip] )</h3>
  121. <p>Takes an AnimationClip and returns a JSON object.</p>
  122. <h2>Source</h2>
  123. <p>
  124. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  125. </p>
  126. </body>
  127. </html>
粤ICP备19079148号