AnimationLoader.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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].<br /><br />
  39. Creates a new [name].
  40. </div>
  41. <h2>Properties</h2>
  42. <h3>[property:LoadingManager manager]</h3>
  43. <div>
  44. The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
  45. </div>
  46. <h2>Methods</h2>
  47. <h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
  48. <div>
  49. [page:String url] — required<br />
  50. [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Animation animation].<br />
  51. [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 />
  52. [page:Function onError] — Will be called if load errors.<br /><br />
  53. Begin loading from url and pass the loaded animation to onLoad.
  54. </div>
  55. <h3>[method:null parse]( [page:JSON json], [page:Function onLoad] )</h3>
  56. <div>
  57. [page:JSON json] — required<br />
  58. [page:Function onLoad] — Will be called when pasring completes. <br /><br />
  59. Parse the JSON object and pass the result to onLoad. Individual clips in the object will
  60. be parsed with [page:AnimationClip.parse].
  61. </div>
  62. <h2>Source</h2>
  63. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  64. </body>
  65. </html>