How to use the aframe.utils function in aframe

To help you get started, we’ve selected a few aframe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github michaltakac / mathworldvr / src / lib / components / if-no-vr-headset.js View on Github external
import AFRAME from 'aframe';

const utils = AFRAME.utils;

/**
 * Set properties if headset is not connected by checking getVRDisplays().
 */
AFRAME.registerComponent('if-no-vr-headset', {
  schema: {
    default: {},
    parse: utils.styleParser.parse
  },

  update: function () {
    var self = this;

    // Check VRDisplays to determine if headset is connected.
    navigator.getVRDisplays().then(function (displays) {
      // Special case for WebVR emulator.
github delapuente / aframe-sharedspace-component / src / positional-audio-patch.js View on Github external
import * as AFRAME from 'aframe';

var warn = AFRAME.utils.debug('components:sound:warn');

AFRAME.components.sound.schema.src.parse = function assetParse (value) {
  var el;
  var parsedUrl;

  // If an element was provided (e.g. canvas or video), just return it.
  if (typeof value !== 'string') { return value; }

  // Wrapped `url()` in case of data URI.
  parsedUrl = value.match(/\url\((.+)\)/);
  if (parsedUrl) { return parsedUrl[1]; }

  // ID.
  if (value.charAt(0) === '#') {
    el = document.getElementById(value.substring(1));
    if (el) {
github mustafasaifee42 / VR-Viz / src / AFrameComponents / PlaneFromVertices.js View on Github external
import * as AFRAME from 'aframe';

if (typeof AFRAME === 'undefined') {
  throw new Error('Component attempted to register before AFRAME was available.');
}


let coordinates = AFRAME.utils.coordinates;

AFRAME.registerComponent('plane-from-vertices', {
  schema: {
    face:{type:'boolean',default: true},
    faceColor: { type:'color',default: '#333' },
    faceOpacity: {type:'number',default: 1},
    path: {
      default: [
        { x: -0.5, y: 0, z: 0 },
        { x: 0.5, y: 0, z: 0 }
      ],
      
      parse: function (value) {
        return value.split(',').map(coordinates.parse);
      },
github matrix-org / matrix-vr-demo / src / js / components / Person.js View on Github external
dur='1000'
                from='1'
                to='0'
                begin='scene-change-in-animation'>
            

        ;

        if (!AFRAME.utils.device.isMobile() && AFRAME.utils.device.checkHeadsetConnected() && this.props.vrMode) {
            controls = ;
        }

        if (this.props.room === 'tourismDemo') {
            camera = 
                {this.props.call && (
github mustafasaifee42 / VR-Viz / src / Component / Visualization.js View on Github external
document.addEventListener('enter-vr', e => {
      if (AFRAME.utils.device.checkHeadsetConnected()) {
        this.setState({
          headset:true,
        })
        if(AFRAME.utils.device.isMobile()){
          this.setState({
            headset:false,
          })
        }
      }
      else {
        this.setState({
          headset:false,
        })
      }
    });
    document.addEventListener('exit-vr', e => {
github mustafasaifee42 / VR-Viz / src / Component / Visualization.js View on Github external
document.addEventListener('enter-vr', e => {
      if (AFRAME.utils.device.checkHeadsetConnected()) {
        this.setState({
          headset:true,
        })
        if(AFRAME.utils.device.isMobile()){
          this.setState({
            headset:false,
          })
        }
      }
      else {
        this.setState({
          headset:false,
        })
      }
    });
    document.addEventListener('exit-vr', e => {