AnimationLoader.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Loader] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc">
  14. Class for loading [page:AnimationClip AnimationClips] in JSON format.
  15. This uses the [page:FileLoader] internally for loading files.
  16. </p>
  17. <h2>Example</h2>
  18. <code>
  19. // instantiate a loader
  20. var loader = new THREE.AnimationLoader();
  21. // load a resource
  22. loader.load(
  23. // resource URL
  24. 'animations/animation.js',
  25. // onLoad callback
  26. function ( animations ) {
  27. // animations is an array of AnimationClips
  28. },
  29. // onProgress callback
  30. function ( xhr ) {
  31. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  32. },
  33. // onError callback
  34. function ( err ) {
  35. console.log( 'An error happened' );
  36. }
  37. );
  38. </code>
  39. <h2>Constructor</h2>
  40. <h3>[name]( [param:LoadingManager manager] )</h3>
  41. <p>
  42. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] 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>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
  50. <p>
  51. [page:String url] — the path or URL to the file. This can also be a
  52. [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
  53. [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:AnimationClip animation clips].<br />
  54. [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 />
  55. [page:Function onError] — Will be called if load errors.<br /><br />
  56. Begin loading from url and pass the loaded animation to onLoad.
  57. </p>
  58. <h3>[method:Array parse]( [param:JSON json] )</h3>
  59. <p>
  60. [page:JSON json] — required<br /><br />
  61. Parse the JSON object and return an array of animation clips. Individual clips in the object will
  62. be parsed with [page:AnimationClip.parse].
  63. </p>
  64. <h2>Source</h2>
  65. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  66. </body>
  67. </html>