title: How can create a-scene programmatically using aframe
body: <p>I'm new to js and html, I would like to get into Aframe.
  I want to go from declarative form to create a scene to programmatical way using js to create it : </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;JavaScript - A-Frame School&lt;/title&gt;
      &lt;meta name="description" content="JavaScript - A-Frame School"&gt;
      &lt;script src="https://aframe.io/releases/0.8.0/aframe.min.js"&gt;&lt;/script&gt;
  
    &lt;/head&gt;
    &lt;body&gt;
      &lt;a-scene school-playground&gt;
        &lt;a-box  position="-1 0 -4.25" rotation="0 45 0"  color="red" &gt;&lt;/a-box&gt;
  
        &lt;a-sky color="#ECECEC"&gt;&lt;/a-sky&gt;
      &lt;/a-scene&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>To something like that :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;JavaScript - A-Frame School&lt;/title&gt;
      &lt;meta name="description" content="JavaScript - A-Frame School"&gt;
      &lt;script src="https://aframe.io/releases/0.8.0/aframe.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
  AFRAME.registerComponent('school-playground', {
  
  init: function () {
  
   var body = document.querySelector('body');
   var sceneEl = document.createElement("a-scene");
   var body = document.querySelector('body');
   sceneEl.setAttribute("embedded", true);
   sceneEl.style.height="700px";
   sceneEl.style.width="100%";
   sceneEl.setAttribute("school-playground", "");
  
   var myBox = document.createElement('a-box');
   myBox.setAttribute('position', {x:-1, y:0, z:-4})
   myBox.setAttribute('rotation', {x:0,y:45, z:0}
   myBox.setAttribute('color', "red");
   sceneEl.appendChild(myBox);
  body.appendChild(sceneEl);
  //I also tried document.body.appendChild(sceneEl);
  }
  });
          &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>It doesn't seem possible to do it properly. Do I need to keep the scene statically defined ?</p>
  
  <p>Thanks for your help.</p>