I´m building an aframe application, which can dynamically load s from a webservice based on user interaction. These entities are available in text-form. What I need is a way to inject these into the aframe DOM, so that the entities are immediately visible. Is there a way to accomplish this? Neither Google nor the Aframe documentation could help me yet.
0
votes
1 Answers
2
votes
You can create and configure the entities individually using document.createElement / setAttribute / appendChild. There's a section in the docs devoted to it.
You can also manipulate the innerHTML value directly:
el.innerHMTL = "<a-entity> <a-sphere></a-sphere> <a-light></a-light> </a-entity>"
None of the above it is A-Frame specific, you just use the regular DOM APIs to compose your scene
document.createElement/setAttribute/appendChildThere’s a section in the docs devoted to it aframe.io/docs/0.7.0/introduction/… - Diego Marcos<a-entity> <a-sphere></a-sphere> <a-light></a-light> </a-entity>is there a way to handle this without parsing it, and creating the DOM elements seperately? - blckwngdel.innerHMTL = “<a-entity> <a-sphere></a-sphere> <a-light></a-light> </a-entity>“That’s how regular DOM works not specific to A-Frame - Diego Marcos