1.0.0 • Published 5 years ago

aframe-cubemenu v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Credits

Justin Slud created this repository. This component uses many ideas from Paul Armstrong's host-menu cube and Roland DuBois' A-GUI components.

ComponentWhat it isWhere it goes
a-cube-menumenu itselfinside of controller or anywhere
a-sideone side of the cube, manually or automatically generatedinside of a-cube-menu
a-buttonbutton on a sideinside of a-side

a-cube-menu

NameActionDefaultOptions
colorcolor of each side, unless specified in a-side'black'
opacityopacity of each side1
heightheight.1
widthwidth.1
depthdepth.1
showis cube small or full sizetrue
showinwebhow to display menu in webVR'''cube', 'flat'
rotationaxiswhich axis to rotate around'y''x', 'y', 'z'
vrrotateeventevent to trigger rotation in VR'axismove'any from oculus-touch-controls, vive-controls, raycaster, etc
webrotateventevent to trigger rotation in webVR''
toggleeventevent to trigger expand / shrink of cube''

a-side

NameActionDefaultOptions
colorcolor of each side, overrides cube color''
opacityopacity1
facewhich face on the cube'front''front', 'top', 'right', 'bottom', 'back', 'top'
flexdirectionwhich way the buttons should be arranged on the face'column''column', 'row'
marginspacing between buttons 'top right bottom left''0 0 0 0'
distancez-distance of buttons from face.05

a-button

NameActionDefaultOptions
typeKind of button'toggle''toggle', 'radio'
hovercolorcolor of button onhover or raycaster-intersected event''
colorcolor of button when not hovered'black'
onclickfunction to perform on click or triggerdown or ... event''
heightheight of button1
widthwidth of button1

Custom Events

NameAction
switchhandschanges which hand holds the cube and which has the raycaster

No text component. You can add your own to the button as or child.

Sample Usage

<html>
  <head>
    <script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>
    <script src="cube"></script>
  </head>
  
  <body>
    <a-scene>
      <a-entity id="right-hand" oculus-touch-controls="hand: right">
        <a-cube-menu height=".2" depth=".5" vrrotatevent="bbuttondown">
          <a-side face="front" color="blue" >
            <a-button width=".2" height=".3"></a-button>
          </a-side>
          <a-side face="back" opacity=".5" ></a-side>
        </a-cube-menu>
      </a-entity>
    </a-scene>
  </body>
</html>  

Download