Skip to content

Instantly share code, notes, and snippets.

@binzume
Last active May 1, 2020 15:32
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 binzume/8f81e06fb719bd9dede70e75673cfa63 to your computer and use it in GitHub Desktop.
Save binzume/8f81e06fb719bd9dede70e75673cfa63 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Click</title>
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@v1.0.4/dist/aframe-master.min.js"></script>
<script>
window.addEventListener('DOMContentLoaded', (ev) => {
let count = 0;
document.querySelector('#button').addEventListener('click', (ev) => {
count++;
document.querySelector('#button').setAttribute('text', 'value', "Count:" + count)
});
});
</script>
</head>
<body style="background: black; color: white">
<a-scene>
<a-entity cursor="rayOrigin: mouse; fuse:false" raycaster="objects:.collidable"></a-entity>
<a-entity id="camera-rig">
<a-camera position="0 1.5 0" look-controls="enabled:false"></a-camera>
<a-entity laser-controls="hand: right" raycaster="objects:.collidable"></a-entity>
<a-entity laser-controls="hand: left" raycaster="objects:.collidable"></a-entity>
</a-entity>
<a-plane class="collidable" id="button" width="0.2" height="0.2" position="0 1 -1" color="blue" text="value:click here;wrapCount: 10"></a-plane>
</a-scene>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment