{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/14387","repository_url":"https://api.github.com/repos/mrdoob/three.js","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/14387/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/14387/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/14387/events","html_url":"https://github.com/mrdoob/three.js/issues/14387","id":336323938,"node_id":"MDU6SXNzdWUzMzYzMjM5Mzg=","number":14387,"title":"SVGLoader and SVGObject: uncaught TypeError: node.setAttribute is not a function","user":{"login":"arrchyy","id":10269911,"node_id":"MDQ6VXNlcjEwMjY5OTEx","avatar_url":"https://avatars1.githubusercontent.com/u/10269911?v=4","gravatar_id":"","url":"https://api.github.com/users/arrchyy","html_url":"https://github.com/arrchyy","followers_url":"https://api.github.com/users/arrchyy/followers","following_url":"https://api.github.com/users/arrchyy/following{/other_user}","gists_url":"https://api.github.com/users/arrchyy/gists{/gist_id}","starred_url":"https://api.github.com/users/arrchyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arrchyy/subscriptions","organizations_url":"https://api.github.com/users/arrchyy/orgs","repos_url":"https://api.github.com/users/arrchyy/repos","events_url":"https://api.github.com/users/arrchyy/events{/privacy}","received_events_url":"https://api.github.com/users/arrchyy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-27T17:37:12Z","updated_at":"2018-09-13T06:27:45Z","closed_at":"2018-06-28T04:38:08Z","author_association":"NONE","body":"##### Description of the problem\r\n\r\nI'm trying to load a .svg file into three.js using SVGLoader and SVGObject. What I have is fairly straightforward:\r\n\r\n```js\r\nvar loader = new THREE.SVGLoader();\r\nloader.load( 'https://upload.wikimedia.org/wikipedia/commons/b/b0/NewTux.svg', function ( paths ) {\r\n\tvar obj = new THREE.SVGObject(paths)\r\n\tscene.add( obj );\r\n});\r\n```\r\n\r\nand then have it rendered with `new THREE.SVGRenderer()`.\r\n\r\n```js\r\nfunction animate() {\r\n\trequestAnimationFrame( animate );\r\n\trender();\r\n}\r\n\r\nfunction render() {\r\n\trenderer.render( scene, camera );\r\n}\r\n```\r\n\r\nBut I get `uncaught TypeError: node.setAttribute is not a function` error repeatedly when I try to have it `animate()`. \r\n\r\n<img width=\"1251\" alt=\"screen shot 2018-06-28 at 2 00 40 am\" src=\"https://user-images.githubusercontent.com/10269911/41991186-2b6fdfa4-7a77-11e8-91f4-c953c5bdb3ac.png\">\r\n\r\nLooks like something is broken internally. \r\n\r\nThis is what I have:\r\n\r\n```js\r\nvar container = document.getElementById( 'container' );\r\n//\r\nscene = new THREE.Scene();\r\nscene.background = new THREE.Color( 0xffffff );\r\n//\r\ncamera = new THREE.PerspectiveCamera( 1, window.innerWidth / window.innerHeight, 0.1, 100 );\r\ncamera.position.set( 0, 0, 0 );\r\n\r\nvar loader = new THREE.SVGLoader();\r\nloader.load( 'https://upload.wikimedia.org/wikipedia/commons/b/b0/NewTux.svg', function ( paths ) {\r\n\tvar obj = new THREE.SVGObject(paths)\r\n\tscene.add( obj );\r\n\tanimate();\r\n},\r\n// called when loading is in progresses\r\nfunction ( xhr ) {\r\n\tconsole.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );\r\n},\r\n// called when loading has errors\r\nfunction ( error ) {\r\n\tconsole.log( 'An error happened' );\r\n});\r\n\r\nrenderer = new THREE.SVGRenderer();\r\nrenderer.setPixelRatio( window.devicePixelRatio );\r\nrenderer.setSize( window.innerWidth, window.innerHeight );\r\ncontainer.appendChild( renderer.domElement );\r\n\r\nfunction animate() {\r\n\trequestAnimationFrame( animate );\r\n\trender();\r\n}\r\n\r\nfunction render() {\r\n\trenderer.render( scene, camera );\r\n}\r\n```\r\n\r\nAnother code snippet (doing basically the same thing as I did) from [a StackOverflow accepted answer back in 2015](https://stackoverflow.com/questions/33140342/how-to-load-svg-file-into-svgrenderer-in-three-js/33194449) gives the same error too. That means it worked 3 years ago.\r\n\r\nA live demo can be found on the StackOverflow post.\r\n\r\n##### Three.js version\r\n\r\n- [x ] Dev\r\n- [ ] r94\r\n- [ ] ...\r\n\r\n##### Browser\r\n\r\n- [x] All of them\r\n- [ ] Chrome\r\n- [ ] Firefox\r\n- [ ] Internet Explorer\r\n\r\n##### OS\r\n\r\n- [] All of them\r\n- [ ] Windows\r\n- [x] macOS\r\n- [ ] Linux\r\n- [ ] Android\r\n- [ ] iOS\r\n\r\n(Haven't tested it in other OS)\r\n"},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/420898005","html_url":"https://github.com/mrdoob/three.js/issues/14387#issuecomment-420898005","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/14387","id":420898005,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMDg5ODAwNQ==","user":{"login":"Igna07","id":43231003,"node_id":"MDQ6VXNlcjQzMjMxMDAz","avatar_url":"https://avatars0.githubusercontent.com/u/43231003?v=4","gravatar_id":"","url":"https://api.github.com/users/Igna07","html_url":"https://github.com/Igna07","followers_url":"https://api.github.com/users/Igna07/followers","following_url":"https://api.github.com/users/Igna07/following{/other_user}","gists_url":"https://api.github.com/users/Igna07/gists{/gist_id}","starred_url":"https://api.github.com/users/Igna07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Igna07/subscriptions","organizations_url":"https://api.github.com/users/Igna07/orgs","repos_url":"https://api.github.com/users/Igna07/repos","events_url":"https://api.github.com/users/Igna07/events{/privacy}","received_events_url":"https://api.github.com/users/Igna07/received_events","type":"User","site_admin":false},"created_at":"2018-09-13T06:27:45Z","updated_at":"2018-09-13T06:27:45Z","author_association":"NONE","body":"can you share your solution with your problem? i'm also dealing with the same issue. i wish you can teach me what did you do to load a svg file in three js and add it to your scene."}}
{"actor":{"display_login":"Igna07"}}