AnimationClip.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 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 />
  23. [page:Number blendMode] - defines how the animation is blended/combined when two or more animations are simultaneously played.<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 blendMode]</h3>
  33. <p>
  34. Defines how the animation is blended/combined when two or more animations are simultaneously played.
  35. Valid values are *NormalAnimationBlendMode* (default) and *AdditiveAnimationBlendMode*.
  36. </p>
  37. <h3>[property:Number duration]</h3>
  38. <p>
  39. The duration of this clip (in seconds). This can be calculated from the [page:.tracks tracks]
  40. array via [page:.resetDuration resetDuration].
  41. </p>
  42. <h3>[property:String name]</h3>
  43. <p>
  44. A name for this clip. A certain clip can be searched via [page:.findByName findByName].
  45. </p>
  46. <h3>[property:Array tracks]</h3>
  47. <p>
  48. An array containing a [page:KeyframeTrack] for each property that are animated by this clip.
  49. </p>
  50. <h3>[property:String uuid]</h3>
  51. <p>
  52. The [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this clip instance.
  53. It gets automatically assigned and shouldn't be edited.
  54. </p>
  55. <h2>Methods</h2>
  56. <h3>[method:AnimationClip clone]()</h3>
  57. <p>
  58. Returns a copy of this clip.
  59. </p>
  60. <h3>[method:this optimize]()</h3>
  61. <p>
  62. Optimizes each track by removing equivalent sequential keys (which are common in morph target
  63. sequences).
  64. </p>
  65. <h3>[method:this resetDuration]()</h3>
  66. <p>
  67. Sets the [page:.duration duration] of the clip to the duration of its longest
  68. [page:KeyframeTrack].
  69. </p>
  70. <h3>[method:Object toJSON]()</h3>
  71. <p>
  72. Returns a JSON object representing the serialized animation clip.
  73. </p>
  74. <h3>[method:this trim]()</h3>
  75. <p>
  76. Trims all tracks to the clip's duration.
  77. </p>
  78. <h3>[method:Boolean validate]()</h3>
  79. <p>
  80. Performs minimal validation on each track in the clip. Returns true if all tracks are valid.
  81. </p>
  82. <h2>Static Methods</h2>
  83. <h3>[method:Array CreateClipsFromMorphTargetSequences]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )</h3>
  84. <p>
  85. Returns an array of new AnimationClips created from the morph
  86. target sequences of a geometry, trying to sort morph target names into animation-group-based
  87. patterns like "Walk_001, Walk_002, Run_001, Run_002 ...".
  88. </p>
  89. <h3>[method:AnimationClip CreateFromMorphTargetSequence]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )</h3>
  90. <p>
  91. 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 />
  92. Note: The fps parameter is required, but the animation speed can be overridden in an
  93. `AnimationAction` via [page:AnimationAction.setDuration animationAction.setDuration].
  94. </p>
  95. <h3>[method:AnimationClip findByName]( [param:Object objectOrClipArray], [param:String name] )</h3>
  96. <p>
  97. Searches for an AnimationClip by name, taking as its first parameter either an array of
  98. AnimationClips, or a mesh or geometry that contains an array named "animations".
  99. </p>
  100. <h3>[method:AnimationClip parse]( [param:Object json] )</h3>
  101. <p>
  102. Parses a JSON representation of a clip and returns an AnimationClip.
  103. </p>
  104. <h3>[method:AnimationClip parseAnimation]( [param:Object animation], [param:Array bones] )</h3>
  105. <p>
  106. Parses the animation.hierarchy format and returns an AnimationClip.
  107. </p>
  108. <h3>[method:Object toJSON]( [param:AnimationClip clip] )</h3>
  109. <p>
  110. Takes an AnimationClip and returns a JSON object.
  111. </p>
  112. <h2>Source</h2>
  113. <p>
  114. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  115. </p>
  116. </body>
  117. </html>