AnimationLoader.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. <h1>[name]</h1>
  12. <div class="desc">Class for loading an animation in JSON format.</div>
  13. <h2>Example</h2>
  14. <code>
  15. // instantiate a loader
  16. var loader = new THREE.AnimationLoader();
  17. // load a resource
  18. loader.load(
  19. // resource URL
  20. 'animations/animation.js',
  21. // Function when resource is loaded
  22. function ( animation ) {
  23. // do something with the animation
  24. },
  25. // Function called when download progresses
  26. function ( xhr ) {
  27. console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
  28. },
  29. // Function called when download errors
  30. function ( xhr ) {
  31. console.log( 'An error happened' );
  32. }
  33. );
  34. </code>
  35. <h2>Constructor</h2>
  36. <h3>[name]( [page:LoadingManager manager] )</h3>
  37. <div>
  38. [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
  39. </div>
  40. <div>
  41. Creates a new [name].
  42. </div>
  43. <h2>Methods</h2>
  44. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  45. <div>
  46. [page:String url] — required<br />
  47. [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
  48. [page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
  49. [page:Function onError] — Will be called when load errors.<br />
  50. </div>
  51. <div>
  52. Begin loading from url and pass the loaded animation to onLoad.
  53. </div>
  54. <h2>Source</h2>
  55. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  56. </body>
  57. </html>