Giter Club home page Giter Club logo

aframe-ui-widgets's Introduction

UI widgets for A-Frame.

A-Frame UI Widgets

Works with HTC VIVE and Oculus touch in a WebVR enabled browser.

Basic usage

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.4.0/aframe.min.js"></script>

  <!-- Include component script into your project along with A-Frame. -->
  <script src="https://rawgit.com/caseyyee/aframe-ui-widgets/master/dist/ui-widgets.min.js"></script>
</head>

<body>
  <a-scene>
    <!-- Adds hand controls -->
    <a-entity hand-controls="left"></a-entity>
    <a-entity hand-controls="right"></a-entity>

    <!-- Can also be controlled used with cursor -->
    <a-camera>
      <a-cursor></a-cursor>
    </a-camera>

    <!-- Adds UI button widget -->
    <a-entity id="mybutton" ui-button></a-entity>
  </a-scene>
  <script>
  var mybutton = document.querySelector('#mybutton');
  mybutton.addEventListener('pressed', function () {
    // do stuff here.
  });
  </script>
</body>

UI Components

Button

<a-entity ui-button></a-entity>
Events
Event Description
buttondown Emitted when button is pushed down.
buttonup Emitted when button is released.
pressed Emitted when button has been has been pushed down and released.

Toggle switch

<a-entity ui-toggle></a-entity>
Properties
Property Description Default Value
value sets toggle position. 0

Events

Event Description
change Emitted when switch has been toggled.

Slider

<a-entity ui-slider></a-entity>
Properties
Property Description
min sets minimum value
max sets maximum value
value sets value
Change
Event Description
change Emitted when slider has been moved.

Rotary Knob

<a-entity ui-rotary></a-entity>
Events
Event Description
change Emitted when rotary has been turned.

npm

Install via npm:

npm install aframe-ui-widgets

Then require and use.

require('aframe');
require('aframe-ui-widgets');

aframe-ui-widgets's People

Contributors

caseyyee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.