AnimationLoader.js 907 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { AnimationClip } from '../animation/AnimationClip.js';
  2. import { FileLoader } from './FileLoader.js';
  3. import { Loader } from './Loader.js';
  4. /**
  5. * @author bhouston / http://clara.io/
  6. */
  7. function AnimationLoader( manager ) {
  8. Loader.call( this, manager );
  9. }
  10. AnimationLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
  11. constructor: AnimationLoader,
  12. load: function ( url, onLoad, onProgress, onError ) {
  13. var scope = this;
  14. var loader = new FileLoader( scope.manager );
  15. loader.setPath( scope.path );
  16. loader.load( url, function ( text ) {
  17. onLoad( scope.parse( JSON.parse( text ) ) );
  18. }, onProgress, onError );
  19. },
  20. parse: function ( json ) {
  21. var animations = [];
  22. for ( var i = 0; i < json.length; i ++ ) {
  23. var clip = AnimationClip.parse( json[ i ] );
  24. animations.push( clip );
  25. }
  26. return animations;
  27. }
  28. } );
  29. export { AnimationLoader };
粤ICP备19079148号