AnimationClip.html 5.1 KB

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