Created
July 18, 2017 16:12
-
-
Save jamct/e70e276fd27609990c3058a887118614 to your computer and use it in GitHub Desktop.
A-Frame Demo: Teleportation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>A-Frame-Demo 5</title> | |
<meta name="description" content="Teleportation mit JavaScript"> | |
<meta charset="utf-8"> | |
<script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script> | |
</head> | |
<script> | |
function setScene2() { | |
document.querySelector('#scene1').setAttribute('visible', 'false'); | |
document.querySelector('#scene2').setAttribute('visible', 'true'); | |
} | |
function setScene1() { | |
document.querySelector('#scene2').setAttribute('visible', 'false'); | |
document.querySelector('#scene1').setAttribute('visible', 'true'); | |
} | |
</script> | |
<body> | |
<a-scene> | |
<a-camera><a-entity cursor="fuse: true; fuseTimeout: 1500" position="0 0 -1" geometry="primitive: ring; radiusInner: 0.01; radiusOuter: 0.02" material="color: #ccc; shader: flat"></a-entity></a-camera> | |
<a-entity id="scene1"> | |
<a-sky color="#ffffff"></a-sky> | |
<a-box id="test" color="green" position="1 0 -5" onclick="setScene2()"></a-box> | |
</a-entity> | |
<a-entity id="scene2" visible="false"> | |
<a-sky color="#aaaaaa"></a-sky> | |
<a-box color="yellow" position="-1 0 -5" onclick="setScene1()"></a-box> | |
</a-entity> | |
</a-scene> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment