Works with HTC VIVE and Oculus touch in a WebVR enabled browser and desktop with aframe-mouse-cursor-component.
Basic usage
<head><title>My A-Frame Scene</title><scriptsrc="https://aframe.io/releases/0.7.0/aframe.min.js"></script><!-- Include component script into your project along with A-Frame. --><scriptsrc="https://rawgit.com/caseyyee/aframe-ui-widgets/master/dist/aframe-ui-widgets.min.js"></script></head><body><a-scene><!-- Adds hand controls --><a-entityhand-controls="left"></a-entity><a-entityhand-controls="right"></a-entity><!-- Can also be controlled used with cursor --><a-camera><a-cursor></a-cursor></a-camera><!-- Adds UI button widget --><a-entityid="mybutton" ui-button></a-entity></a-scene><script>varmybutton=document.querySelector('#mybutton');mybutton.addEventListener('pressed',function(){// do stuff here.});</script></body>
Skinnable with custom styles
Using mixins, you can define a UI component styles.
the demo code under "Basic usage" does not work:
core:schema:warn Unknown property rotationOffset for component/system windows-motion-controls.
when trying to set an event listener to a toggle-button in my own code,, like
document.querySelector('#toggleRotate').addEventListener('change', function () {
console.log("toggled");
});
i get
Uncaught TypeError: Cannot read property 'addEventListener' of null
document.querySelector('#toggleRotate') returns
as expected
But as I am just learning - may be I am doing something wrong?
Might I suggest two changes that would help with the stability of this project? It's a great effort, and I plan on using it more often in my work, so I'd love to give back to it! Two suggestions wrapped up in one "maintenance" topic:
Start using Github releases, so you can point to rawgit of tags, that way even if master changes/breaks, people can always have a reliable resource to link older versions of this file, and you don't have to worry because Github will host the file(s).
Start linking to unpkg for the distribution file. npm already supports versioning, and unpkg gives a reliable source of truth, whereas Rawgit (while historically stable) has _no guarantees about uptime & reliability. It'd mean changing the way the script gets compiled, I believe, because the current Unpkg link isn't usable by a vanilla JS project, but I've seen other A-Frame projects link to it like super-hands so it's certainly possible, and v reliable!
I am interested in using this to control different things other than the animations provided. How could I control audio volume, audio speed, and thing like audio hi, mids, and lows with this instead? Also can I control aspects of video with this too?