AnimationLoader.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. [page:Loader] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. Class for loading [page:AnimationClip AnimationClips] in JSON format. This
  14. uses the [page:FileLoader] internally for loading files.
  15. </p>
  16. <h2>Code Example</h2>
  17. <code>
  18. // instantiate a loader
  19. const loader = new THREE.AnimationLoader();
  20. // load a resource
  21. loader.load(
  22. // resource URL
  23. 'animations/animation.js',
  24. // onLoad callback
  25. function ( animations ) {
  26. // animations is an array of AnimationClips
  27. },
  28. // onProgress callback
  29. function ( xhr ) {
  30. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  31. },
  32. // onError callback
  33. function ( err ) {
  34. console.log( 'An error happened' );
  35. }
  36. );
  37. </code>
  38. <h2>Constructor</h2>
  39. <h3>[name]( [param:LoadingManager manager] )</h3>
  40. <p>
  41. [page:LoadingManager manager] — The [page:LoadingManager loadingManager]
  42. for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
  43. Creates a new [name].
  44. </p>
  45. <h2>Properties</h2>
  46. <p>See the base [page:Loader] class for common properties.</p>
  47. <h2>Methods</h2>
  48. <p>See the base [page:Loader] class for common methods.</p>
  49. <h3>
  50. [method:undefined load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
  51. </h3>
  52. <p>
  53. [page:String url] — the path or URL to the file. This can also be a
  54. [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
  55. [page:Function onLoad] — Will be called when load completes. The argument
  56. will be the loaded [page:AnimationClip animation clips].<br />
  57. [page:Function onProgress] (optional) — Will be called while load
  58. progresses. The argument will be the ProgressEvent instance, which
  59. contains .[page:Boolean lengthComputable], .[page:Integer total] and
  60. .[page:Integer loaded]. If the server does not set the Content-Length
  61. header; .[page:Integer total] will be 0.<br />
  62. [page:Function onError] (optional) — Will be called if load errors.<br /><br />
  63. Begin loading from url and pass the loaded animation to onLoad.
  64. </p>
  65. <h3>[method:Array parse]( [param:JSON json] )</h3>
  66. <p>
  67. [page:JSON json] — required<br /><br />
  68. Parse the JSON object and return an array of animation clips. Individual
  69. clips in the object will be parsed with [page:AnimationClip.parse].
  70. </p>
  71. <h2>Source</h2>
  72. <p>
  73. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  74. </p>
  75. </body>
  76. </html>