All Projects → belivvr → aframe-react

belivvr / aframe-react

Licence: MIT license
React library for A-frame

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to aframe-react

Ideaspace
😎 Create interactive 3D and VR web experiences for desktop, mobile & VR devices
Stars: ✭ 344 (+493.1%)
Mutual labels:  vr, webvr, aframe, webxr
Superframe
📦 A super collection of A-Frame components.
Stars: ✭ 1,061 (+1729.31%)
Mutual labels:  vr, webvr, aframe
Aframe
🅰️ web framework for building virtual reality experiences.
Stars: ✭ 13,428 (+23051.72%)
Mutual labels:  vr, webvr, aframe
Webar Article
WebAR-Article is a responsive and information rich website that is progressively enhanced with Augmented Reality content exposed through experimental web technologies.
Stars: ✭ 225 (+287.93%)
Mutual labels:  vr, webvr, webxr
A Painter
🎨 Paint in VR in your browser.
Stars: ✭ 539 (+829.31%)
Mutual labels:  vr, webvr, aframe
Aframe Particle System Component
Particle systems for A-Frame.
Stars: ✭ 156 (+168.97%)
Mutual labels:  vr, webvr, aframe
Remixvr
RemixVR is a tool for collaboratively building customisable VR experiences.
Stars: ✭ 129 (+122.41%)
Mutual labels:  vr, webvr, webxr
3dio Js
JavaScript toolkit for interior apps
Stars: ✭ 255 (+339.66%)
Mutual labels:  vr, webvr, aframe
Aframe React
:atom: Build virtual reality experiences with A-Frame and React.
Stars: ✭ 1,199 (+1967.24%)
Mutual labels:  vr, webvr, aframe
Webxr Polyfill
Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard
Stars: ✭ 251 (+332.76%)
Mutual labels:  vr, webvr, webxr
Awesome Aframe
[DISCONTINUED] Collection of awesome resources for the A-Frame WebVR framework.
Stars: ✭ 1,310 (+2158.62%)
Mutual labels:  vr, webvr, aframe
a-blast
💥 Save the World From the Cutest Creatures in the Universe!
Stars: ✭ 116 (+100%)
Mutual labels:  vr, webvr, aframe
Aframe Inspector
🔍 Visual inspector tool for A-Frame. Hit *<ctrl> + <alt> + i* on any A-Frame scene.
Stars: ✭ 469 (+708.62%)
Mutual labels:  vr, webvr, aframe
Aframe Effects
A VR Ready Post processing framework for Three.js and/or A-Frame
Stars: ✭ 176 (+203.45%)
Mutual labels:  vr, webvr, aframe
lvr
👓 Augmented Reality for everyone - Out of the world experiences
Stars: ✭ 92 (+58.62%)
Mutual labels:  vr, webvr, aframe
Aframe Vimeo Component
Stream Vimeo videos into WebVR.
Stars: ✭ 62 (+6.9%)
Mutual labels:  vr, webvr, aframe
aframe-registry
[DISCONTINUED] Curated collection of community A-Frame components.
Stars: ✭ 76 (+31.03%)
Mutual labels:  vr, webvr, aframe
pacman
Pacman WebVR using Aframe
Stars: ✭ 20 (-65.52%)
Mutual labels:  vr, webvr, aframe
A Mmd
A-Frame MMD component
Stars: ✭ 74 (+27.59%)
Mutual labels:  vr, webvr, aframe
Webxr Handtracking
👐 WebXR hand tracking examples
Stars: ✭ 116 (+100%)
Mutual labels:  vr, aframe, webxr

aframe-react

React library for A-frame

Belivvr Logo

React TypeScript

codecov

Languages

한국어 | English


Introduce

It was regrettable that the aframe-react library only supported a-scene and a-entity.
A-Frame has many tags such as a-camera, a-box, etc...
but it was not available in aframe-react, so we made it ourselves.

Support [email protected].

Install

# yarn
yarn add github:aframevr/aframe#480a303b3c1932170552a3e4f9287298c1039c27 @belivvr/aframe-react

# npm
npm install github:aframevr/aframe#480a303b3c1932170552a3e4f9287298c1039c27 @belivvr/aframe-react

Why directly get commit?

A-Frame doesn't release minor patch. But, they constantly commit.
When just install [email protected] install, causes hand tracking mesh broken issue.
But, install latest commit, this issue is solved.

Usage

React

import React from 'react';
import ReactDOM from 'react-dom';
import 'aframe';

import {
  Scene,
  Box,
  Sphere,
  Cylinder,
  Plane,
  Sky,
} from '@belivvr/aframe-react';

ReactDOM.render(
  (
    <Scene>
      <Box
        position={{ x: -1, y: 0.5, z: -3 }}
        rotation={{ x: 0, y: 45, z: 0 }}
        color="#4CC3D9"
      />
      <Sphere
        position={{ x: 0, y: 1.25, z: -5 }}
        radius={1.25}
        color="#EF2D5E"
      />
      <Cylinder
        position={{ x: 1, y: 0.75, z: -3 }}
        radius={0.5}
        height={1.5}
        color="#FFC65D"
      />
      <Plane
        position={{ x: 0, y: 0, z: -4 }}
        rotation={{ x: -90, y: 0, z: 0 }}
        width={4}
        height={4}
        color="#7BC8A4"
      />
      <Sky color="#ECECEC" />
    </Scene>
  ),
  document.getElementById('root'),
);

Next.JS

Can't using import AFRAME from 'aframe'; in Next.JS.
Inevitably, we have no choice but to use require, and we have to check the completion of ssr through useEffect and then rendering.

Since aframe uses the window object, check the window object through typeof window !== 'undefined' and call aframe.

import type { NextPage } from 'next';

import React, { useEffect, useState } from 'react';
import {
  Scene,
  Box,
  Sphere,
  Cylinder,
  Plane,
  Sky,
} from '@belivvr/aframe-react';

const Home: NextPage = () => {
  const [rendered, setRendered] = useState<boolean>(false);

  useEffect(() => {
    setRendered(true);

    if (typeof window !== 'undefined') {
      require('aframe'); // eslint-disable-line global-require
    }
  }, [setRendered]);

  if (!rendered) {
    return <>loading</>;
  }

  return (
    <Scene>
      <Box
        position={{ x: -1, y: 0.5, z: -3 }}
        rotation={{ x: 0, y: 45, z: 0 }}
        color="#4CC3D9"
      />
      <Sphere
        position={{ x: 0, y: 1.25, z: -5 }}
        radius={1.25}
        color="#EF2D5E"
      />
      <Cylinder
        position={{ x: 1, y: 0.75, z: -3 }}
        radius={0.5}
        height={1.5}
        color="#FFC65D"
      />
      <Plane
        position={{ x: 0, y: 0, z: -4 }}
        rotation={{ x: -90, y: 0, z: 0 }}
        width={4}
        height={4}
        color="#7BC8A4"
      />
      <Sky color="#ECECEC" />
    </Scene>
  );
};

export default Home;

Using custom component

  • 0.4.0 Updated: When using AFRAME.registerComponent, supports type.

example

AFRAME.registerComponent('spinner', {
  schema: {
    dur: { type: 'number' },
    startEvent: { type: 'array' },
    position: { type: 'vec3' },
    spin: { type: 'boolean' },
  },

  init() {
    // ...
  },
});

// <a-box spinner="dur: 2000; startEvent: click, mouseenter; position: 0 0 -1; spin: true;>
<Box
  spinner={{
    dur: 2000,
    startEvent: ['click', 'mouseenter'],
    position: { x: 0, y: 0, z: -1 },
    spin: true,
  }}
>

Difference from aframe-react

aframe-react @belivvr/aframe-react
Support Tags Entity, Scene The entire A-Frame tag
Custom Property
Support TypeScript
Type Check
(Properties of all components provided by A-Frame by default.)
jsdoc image image
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].