Skip to content

Commit

Permalink
Examples: Switched to FileLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Jan 11, 2019
1 parent 0987a3e commit 6d57321
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions examples/svg_sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,20 @@

// CUSTOM FROM FILE

fetch( 'models/svg/hexagon.svg' )
.then( response => response.text() )
.then( svg => {
var fileLoader = new THREE.FileLoader();
fileLoader.load( 'models/svg/hexagon.svg', function ( svg ) {

var node = document.createElementNS( 'http://www.w3.org/2000/svg', 'g' );
var parser = new DOMParser();
var doc = parser.parseFromString( svg, 'image/svg+xml' );
var node = document.createElementNS( 'http://www.w3.org/2000/svg', 'g' );
var parser = new DOMParser();
var doc = parser.parseFromString( svg, 'image/svg+xml' );

node.appendChild( doc.documentElement );
node.appendChild( doc.documentElement );

var object = new THREE.SVGObject( node );
object.position.x = 500;
scene.add( object );
var object = new THREE.SVGObject( node );
object.position.x = 500;
scene.add( object );

} );
} );

// LIGHTS

Expand Down

0 comments on commit 6d57321

Please sign in to comment.