Skip to content

Instantly share code, notes, and snippets.

@sounisi5011
Last active October 29, 2018 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sounisi5011/a7e9dc6928e784a6f4305c2994ee1db0 to your computer and use it in GitHub Desktop.
Save sounisi5011/a7e9dc6928e784a6f4305c2994ee1db0 to your computer and use it in GitHub Desktop.
A-Frame Async Test
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1">
<meta name=format-detection content="telephone=no,email=no,address=no">
<title>A-Frame Async Test</title>
<script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
<body>
<script src="./main.js"></script>
function init(evt) {
var startButtonElem = evt.currentTarget;
startButtonElem.hidden = true;
var aSceneElem = document.createElement('a-scene');
var aBoxElem = document.createElement('a-box');
var aSphereElem = document.createElement('a-sphere');
var aCylinderElem = document.createElement('a-cylinder');
var aPlaneElem = document.createElement('a-plane');
var aSkyElem = document.createElement('a-sky');
aBoxElem.setAttribute('position', '-1 0.5 -3');
aBoxElem.setAttribute('rotation', '0 45 0');
aBoxElem.setAttribute('color', '#4CC3D9');
aSceneElem.appendChild(aBoxElem);
aSphereElem.setAttribute('position', '0 1.25 -5');
aSphereElem.setAttribute('radius', '1.25');
aSphereElem.setAttribute('color', '#EF2D5E');
aSceneElem.appendChild(aSphereElem);
aCylinderElem.setAttribute('position', '1 0.75 -3');
aCylinderElem.setAttribute('radius', '0.5');
aCylinderElem.setAttribute('height', '1.5');
aCylinderElem.setAttribute('color', '#FFC65D');
aSceneElem.appendChild(aCylinderElem);
aPlaneElem.setAttribute('position', '0 0 -4');
aPlaneElem.setAttribute('rotation', '-90 0 0');
aPlaneElem.setAttribute('width', '4');
aPlaneElem.setAttribute('height', '4');
aPlaneElem.setAttribute('color', '#7BC8A4');
aSceneElem.appendChild(aPlaneElem);
aSkyElem.setAttribute('color', '#ECECEC');
aSceneElem.appendChild(aSkyElem);
document.body.appendChild(aSceneElem);
}
var startButtonElem = document.createElement('button');
startButtonElem.type = 'button';
startButtonElem.textContent = 'Start!';
startButtonElem.addEventListener('click', init, false);
document.body.appendChild(startButtonElem);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment