npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@real2u/react-ar-components

v3.0.0

Published

React components for Augmented Reality on the web.

Downloads

42

Readme

React AR Components

React components for Augmented Reality on the web.

Components

  • ModelViewer: used to interact with a 3D model on the browser (desktop)
  • ARLink: similar to an anchor tag (mobile)
  • ARButton: similar to a button tag (mobile)
  • ARImage: similar to an img tag (mobile)
  • ARCarousel: similar to a carousel component to interact with multiple 3D models (mobile, desktop)
ModelViewer

| param | description | default | | ----- | ----------- | ------- | | style | object containing custom CSS classes to customize this component | { modelViewerSmall: '', modelViewerBig: '', modelViewerBackground: '' } | | onClick | function to handle click event | () => undefined | | componentDidMount | funciton to handle mount event | () => undefined | | name | model name | '' | | progressBarPosition | progress bar position ('top', 'middle' or 'bottom') | 'top' | | progressBarColor | progress bar color ('gray', 'rgba(89, 84, 84, 0.6)', '#c5c5c5') | null | | exposure | controls the exposure of both the model and skybox | '0.5' | | shadowIntensity | opacity of the shadow | '1' | | shadowSoftness | blurriness of the shadow | '0' | | poster | image url displayed before loading the model | null | | glb | url of the GLB file for desktop devices | '' | | autoRotate | determines if the model will rotate automatically | true | | cameraControls | determines if the user will control the camera | true | | popup | determines if the viewer will be able to open a popup window | true | | onToggle | function to handle popup toggle event | '' |

ARLink

| param | description | default | | ----- | ----------- | ------- | | style | object containing custom CSS classes to customize this component | { link : '' } | | onClick | function to handle click event | () => undefined | | componentDidMount | funciton to handle mount event | () => undefined | | usdz | url of the USDZ file for iOS devices | '' | | glb | url of the GLB file for Android devices | '' | | name | model name | '' | | resize | determines if model allows rescale | false |

ARButton

| param | description | default | | ----- | ----------- | ------- | | style | object containing custom CSS classes to customize this component | { container : '', text: '' } | | ...rest | same as ARLink | |

ARImage

| param | description | default | | ----- | ----------- | ------- | | ...rest | same as ARLink | |

The ARImage component adds a transparent overlay on top of an existing img, which is why it should be mounted as a child of an enclosing container.

ARCarousel

| param | description | default | | ----- | ----------- | ------- | | glbs | array of GLB urls for desktop devices | [] | | ...rest | same as ModelViewer | |

Example

import React, { Component } from 'react'
import ReactDOM from 'react-dom'

import '@google/model-viewer'
import {
  ARImage,
  ModelViewer,
  ARButton,
  ARCarousel,
  ARLink
} from '@real2u/react-ar-components'

import style from './style.module.css'
const usdz = 'http://localhost:8080/mesh_01000.usdz'
const glb = 'http://localhost:8080/mesh_01000.glb'
const imageUrl = 'https://via.placeholder.com/150'

const App = () => (
  <div>
    <div>
      <h1>ARLink</h1>
      <ARLink glb={glb} usdz={usdz}>
        View in 3D
      </ARLink>
    </div>
    <div>
      <h1>ARImage</h1>
      <div style={{ width: '200px' }}>
        <img src={imageUrl} alt="3D model" style={{ width: '100%' }}/>
        <ARImage glb={glb} usdz={usdz} style={style} />
      </div>
    </div>
    <div>
      <h1>ModelViewer</h1>
      <ModelViewer glb={glb} name="3D model" style={style}/>
    </div>
    <div>
      <h1>ARButton</h1>
      <ARButton glb={glb} usdz={usdz} text="View in 3D" style={style} />
    </div>
    <div>
      <h1>ARCarousel</h1>
      <ARCarousel glbs={[glb, glb, glb]} style={style}/>
    </div>
  </div>
)

ReactDOM.render(<App/>, document.getElementById('root'))