Download node_modules/three/src/loaders/AnimationLoader.js from SimWorld-AI/industrial-harbor-viewer: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/loaders/AnimationLoader.js
- Command line
-
hf download hf://spaces/SimWorld-AI/industrial-harbor-viewer/node_modules/three/src/loaders/AnimationLoader.js
-
curl -L -o AnimationLoader.js https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/loaders/AnimationLoader.js
1.01 kB
| import { AnimationClip } from '../animation/AnimationClip.js'; | |
| import { FileLoader } from './FileLoader.js'; | |
| import { Loader } from './Loader.js'; | |
| class AnimationLoader extends Loader { | |
| constructor( manager ) { | |
| super( manager ); | |
| } | |
| load( url, onLoad, onProgress, onError ) { | |
| const scope = this; | |
| const loader = new FileLoader( this.manager ); | |
| loader.setPath( this.path ); | |
| loader.setRequestHeader( this.requestHeader ); | |
| loader.setWithCredentials( this.withCredentials ); | |
| loader.load( url, function ( text ) { | |
| try { | |
| onLoad( scope.parse( JSON.parse( text ) ) ); | |
| } catch ( e ) { | |
| if ( onError ) { | |
| onError( e ); | |
| } else { | |
| console.error( e ); | |
| } | |
| scope.manager.itemError( url ); | |
| } | |
| }, onProgress, onError ); | |
| } | |
| parse( json ) { | |
| const animations = []; | |
| for ( let i = 0; i < json.length; i ++ ) { | |
| const clip = AnimationClip.parse( json[ i ] ); | |
| animations.push( clip ); | |
| } | |
| return animations; | |
| } | |
| } | |
| export { AnimationLoader }; | |