All Projects → googlearchive → Webvr Ui

googlearchive / Webvr Ui

Licence: apache-2.0
WebVR-UI Javascript library making it easy to create a button for entering VR mode

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Webvr Ui

Aframe Vimeo Component
Stream Vimeo videos into WebVR.
Stars: ✭ 62 (-74.59%)
Mutual labels:  threejs, webvr
Konterball
Konterball is a single or 2-player virtual reality game, built for the web as a Google VR Chrome Experiment.
Stars: ✭ 112 (-54.1%)
Mutual labels:  threejs, webvr
Vimeo Depth Player
A WebVR volumetric video renderer that uses color-depth based videos hosted on Vimeo.
Stars: ✭ 65 (-73.36%)
Mutual labels:  threejs, webvr
Aframe Extras
Add-ons and helpers for A-Frame VR.
Stars: ✭ 722 (+195.9%)
Mutual labels:  threejs, webvr
Tweetscape
A WebVR experience displaying tweets in real-time along a 3D timeline
Stars: ✭ 132 (-45.9%)
Mutual labels:  threejs, webvr
Worlds2
Building Virtual Reality Worlds using Three.js
Stars: ✭ 34 (-86.07%)
Mutual labels:  threejs, webvr
Awesome Aframe
[DISCONTINUED] Collection of awesome resources for the A-Frame WebVR framework.
Stars: ✭ 1,310 (+436.89%)
Mutual labels:  threejs, webvr
Aframe Physics System
Physics system for A-Frame VR, built on CANNON.js.
Stars: ✭ 371 (+52.05%)
Mutual labels:  threejs, webvr
Three.vrcontroller
Support hand controllers for Oculus, Vive, Windows Mixed Reality, Daydream, GearVR, and more by adding VRController to your existing Three.js-based WebVR project.
Stars: ✭ 213 (-12.7%)
Mutual labels:  threejs, webvr
Remixvr
RemixVR is a tool for collaboratively building customisable VR experiences.
Stars: ✭ 129 (-47.13%)
Mutual labels:  threejs, webvr
Forgejs
ForgeJS is a javascript framework that unleashes immersive WebVR experiences.
Stars: ✭ 207 (-15.16%)
Mutual labels:  threejs, webvr
Aframe Effects
A VR Ready Post processing framework for Three.js and/or A-Frame
Stars: ✭ 176 (-27.87%)
Mutual labels:  threejs, webvr
A Painter
🎨 Paint in VR in your browser.
Stars: ✭ 539 (+120.9%)
Mutual labels:  threejs, webvr
Aframe Camera Transform Controls Component
Camera transform controls component for A-Frame
Stars: ✭ 47 (-80.74%)
Mutual labels:  threejs, webvr
Aframe Inspector
🔍 Visual inspector tool for A-Frame. Hit *<ctrl> + <alt> + i* on any A-Frame scene.
Stars: ✭ 469 (+92.21%)
Mutual labels:  threejs, webvr
A Mmd
A-Frame MMD component
Stars: ✭ 74 (-69.67%)
Mutual labels:  threejs, webvr
Three Mesh Bvh
A BVH implementation to speed up raycasting against three.js meshes.
Stars: ✭ 302 (+23.77%)
Mutual labels:  threejs, webvr
Ideaspace
😎 Create interactive 3D and VR web experiences for desktop, mobile & VR devices
Stars: ✭ 344 (+40.98%)
Mutual labels:  threejs, webvr
Thehallaframe
WebVR demo that displays art
Stars: ✭ 120 (-50.82%)
Mutual labels:  threejs, webvr
Patches
Patches is a visual programming editor for building WebVR and WebGL experiences.
Stars: ✭ 164 (-32.79%)
Mutual labels:  threejs, webvr

WebVR UI

A javascript library allowing easily to create the Enter VR button a WebVR site. It will automatically detect the support in the browser and show correct messages to the user. The intention for the library is to create an easy way to make a button solving as many of the common use cases of WebVR as possible, and show some best practices for how to work with WebVR.

The library also supports adding a Enter Fullscreen link that allows entering a mode where on desktop you can use the mouse to drag around, and on mobile rotate the camera based on the gyroscope without rendering in stereoscopic mode (also known as Magic Window)

Examples

Library Usage

Include WebVR UI

Get the library either by cloning, downloading or installing through npm npm install webvr-ui

Include the ES5 transpiled library in a script tag

<script src="/webvr-ui/build/webvr-ui.min.js"></script>

or include it in your ES2015 code

import * as webvrui from 'webvr-ui';

The constructor for the button needs the dom element of the WebGL canvas. To use it together with the THREE.WebGLRenderer, do something like this

var renderer = new THREE.WebGLRenderer();

var options = {}
var enterVR = new webvrui.EnterVRButton(renderer.domElement, options);
document.body.appendChild(enterVR.domElement);

A-Frame

To use the button in A-Frame, include the library as above, and add webvr-ui to the scene.

<a-scene webvr-ui>
    ...
</a-scene>

This will disable the default UI and add a Enter VR button to the document DOM. All the styling and text options bellow are also available.

Options

These are the supported options in EnterVRButton. All options are optional.

Styling

  • color: Set the text and icon color (default: rgb(80,168,252))
  • background: Set the background color, set to false for no background (default: false)
  • corners: Choose the corner radius. Can either be 'square' or 'round' or a number representing pixel radius (default: 'square')
  • disabledOpacity: The opacity of the button when disabled (default: 0.5)
  • domElement: Provide a DOM element to use instead of default build in DOM. See Custom DOM example for more details how to use.
  • injectCSS: Set to false to disable CSS injection of button style (default: true)

Text

  • textEnterVRTitle: The text in the button prompting to begin presenting (default: 'ENTER VR')
  • textExitVRTitle: The text in the button prompting to begin presenting (default: 'EXIT VR')
  • textVRNotFoundTitle: The text in the button when there is no VR headset found (default: 'VR NOT FOUND')

Function Hooks

  • beforeEnter():Promise: Function called right before entering VR. Must return a Promise. Gives the opportunity to provide custom messaging or other changes before the experience is presented.
  • beforeExit():Promise: Function called right before exiting VR. Must return a promise. Gives the opportunity to update UI or other changes before the presentation is exited.
  • onRequestStateChange(state):boolean: A function called before state is changed, use to intercept entering or exiting VR for example. Return true to continue with default behavior, or false to stop the default behavior.

Events

The following events will be broadcasted by EnterVRButton, and can be subscribed to using the function .on([event]) on the button.

  • ready Event called when VR support is first detected, the VRDisplay is provided as the first parameter.
  • enter Event called when user enters VR, the VRDisplay is provided as the first parameter.
  • exit Event called when user exits VR, the VRDisplay is provided as the first parameter.
  • error Event called when an error occurs, i.e. VR is not supported, an Error is provided as the first parameter.
  • hide Event called when button is hidden
  • show Event called when button is shown

Functions

These are some of the functions that can be called on the EnterVRButton

  • setTitle(title) Change the text in the button.
  • setTooltip(tooltip) Change the hover tooltip of the button.
  • show() / hide() Change the visibility of the button.
  • disable() / enable() Change the disabled state of the button.
  • getVRDisplay():Promise Returns a Promise returning the VRDisplay associated to the button.
  • isPresenting():boolean: Returns true if the canvas associated to the button is presenting in fullscreen or VR mode.
  • requestEnterVR():Promise: Requests to start presenting. Must be called from a user action (read more)
  • requestEnterFullscreen():Promise: Requests to enter fullscreen mode if its supported in the browser.
  • requestExit():Promise: Request exiting presentation mode.

Development

To run the example, install dependencies

npm install

and start the watcher and server (available on localhost:3000/examples/basic.html)

npm start

To build the transpiled es5 version of the library, run

npm run build

and the library will be build to build/webvr-ui.js

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].