@@ -46,32 +46,38 @@ <h2>Extensions</h2>
4646 < h2 > Example</ h2 >
4747
4848 < code >
49- // Instantiate a loader
50- var loader = new THREE.GLTFLoader();
51-
52- // Load a glTF resource
53- loader.load(
54- // resource URL
55- 'models/gltf/duck/duck.gltf',
56- // called when the resource is loaded
57- function ( gltf ) {
58- scene.add( gltf.scene );
59-
60- gltf.animations; // Array<THREE.AnimationClip>
61- gltf.scene; // THREE.Scene
62- gltf.scenes; // Array<THREE.Scene>
63- gltf.cameras; // Array<THREE.Camera>
64- },
65- // called when loading is in progresses
66- function ( xhr ) {
67- console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
68- },
69- // called when loading has errors
70- function ( error ) {
71- console.log( 'An error happened' );
72- }
73- );
74- </ code >
49+ // Instantiate a loader
50+ var loader = new THREE.GLTFLoader();
51+
52+ // Load a glTF resource
53+ loader.load(
54+ // resource URL
55+ 'models/gltf/duck/duck.gltf',
56+ // called when the resource is loaded
57+ function ( gltf ) {
58+
59+ scene.add( gltf.scene );
60+
61+ gltf.animations; // Array<THREE.AnimationClip>
62+ gltf.scene; // THREE.Scene
63+ gltf.scenes; // Array<THREE.Scene>
64+ gltf.cameras; // Array<THREE.Camera>
65+
66+ },
67+ // called when loading is in progresses
68+ function ( xhr ) {
69+
70+ console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
71+
72+ },
73+ // called when loading has errors
74+ function ( error ) {
75+
76+ console.log( 'An error happened' );
77+
78+ }
79+ );
80+ </ code >
7581
7682 [example:webgl_loader_gltf]
7783
0 commit comments