Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<html>
<head>
<meta charset="utf-8">
<title>A-Frame</title>
<meta name="description" content="Hello, World! • A-Frame">
<script src="https://aframe.io/releases/0.4.0/aframe.min.js"></script>
</head>
<body>
<a-scene>
<a-sphere position="0 1.25 -1" radius="1.25" color="#EF2D5E"></a-sphere>
<a-box position="-1 0.5 1" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
<a-cylinder position="1 0.75 1" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
<a-plane rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
<a-sky color="#ECECEC"></a-sky>
<a-entity position="0 0 3.8">
<a-camera id="camera" ></a-camera>
</a-entity>
</a-scene>
<script>
const scene = document.querySelector('a-scene');
if (scene.hasLoaded) {
run();
} else {
scene.addEventListener('loaded', run);
}
function run() {
const p = document.querySelector("#camera");
p.addEventListener('componentchanged', function (evt) {
console.log(evt.detail.name);
if (evt.detail.name === 'rotation') {
console.log('Entity has rotated from', evt.detail.oldData, 'to', evt.detail.newData, '!');
}
});
}
</script>
</body>
</html>
@i3games

This comment has been minimized.

Copy link
Owner Author

i3games commented Jan 27, 2017

default scene with static camera entity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.