AnimationLoader.js 875 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. load: function ( url, onLoad, onProgress, onError ) {
  12. var scope = this;
  13. var loader = new FileLoader( scope.manager );
  14. loader.setPath( scope.path );
  15. loader.load( url, function ( text ) {
  16. onLoad( scope.parse( JSON.parse( text ) ) );
  17. }, onProgress, onError );
  18. },
  19. parse: function ( json ) {
  20. var animations = [];
  21. for ( var i = 0; i < json.length; i ++ ) {
  22. var clip = AnimationClip.parse( json[ i ] );
  23. animations.push( clip );
  24. }
  25. return animations;
  26. }
  27. } );
  28. export { AnimationLoader };
粤ICP备19079148号