AnimationLoader.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.
  14. This 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] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
  42. Creates a new [name].
  43. </p>
  44. <h2>Properties</h2>
  45. <p>See the base [page:Loader] class for common properties.</p>
  46. <h2>Methods</h2>
  47. <p>See the base [page:Loader] class for common methods.</p>
  48. <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  49. <p>
  50. [page:String url] — the path or URL to the file. This can also be a
  51. [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
  52. [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:AnimationClip animation clips].<br />
  53. [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  54. [page:Function onError] — Will be called if load errors.<br /><br />
  55. Begin loading from url and pass the loaded animation to onLoad.
  56. </p>
  57. <h3>[method:Array parse]( [param:JSON json] )</h3>
  58. <p>
  59. [page:JSON json] — required<br /><br />
  60. Parse the JSON object and return an array of animation clips. Individual clips in the object will
  61. be parsed with [page:AnimationClip.parse].
  62. </p>
  63. <h2>Source</h2>
  64. <p>
  65. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  66. </p>
  67. </body>
  68. </html>