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 🙏

© 2025 – Pkg Stats / Ryan Hefner

aframe-react-stories

v2.0.4

Published

Instagram stories like UI in A-Frame

Downloads

16

Readme

#AFrame React Stories A plug and play react UI module that lets you quickly add social media style stories into your current VR project. Click here to see the demo.

##Getting Started ###Prerequisites

  • A-Frame
  • Aframe-animation-component
  • React
  • React-Dom

Install

Using npm or yarn:

$ npm i --save aframe-react-stories
or
$ yarn add aframe-react-stories

Usage

In React:

import Stories from 'aframe-react-stories';

Setup

####Profile: Each profile should to be formatted as shown below

{
  displayName: 'John',
  img_url: 'http://yourprofileimage.com/profile.jpg'
  stories: [
    {
      type: 'image/jpeg',
      src: 'http://yourstoryimage.com/image.jpg'
    },
    {
      type: 'video/mp4',
      src: 'http://your360video.com/video.mp4'
    }
  ]
}

The aframe-react-stories component takes in a user prop and friends prop. The user prop should be a single profile and the friends prop should be a list of profiles.

####Media Type: Pictures will need to be specified with the type, 'image/jpeg', 'image/png', 'image', etc..., in order for aframe-react-stories to display the media in the img tag under assets. Otherwise, all other types will default to playing in the video tag.

####Assets Callback: The aframe-react-stories component takes in a callback function through the assetsCallback prop. Once mounted, the aframe-react-stories component will run a process that tags all the video and image assets for the stories playback logic. It will then pass the processed assets into callback function in the assetsCallback once it's done. The list of assets returned needs to be saved inside <a-assets> tag for the component to work properly.

####View Callback: This callback is invoked every time a story is played. It should take in an object that contains the current story and metadata.

Props

| Props | Description | Default Value | Type | |-------------------|--------------------------------------------------------------------------------------------------|---------------|-------------------| | autoPlayNext | Autoplay the next friend's story when current friend's stories end | false | boolean | | autoPlayStart | Autoplay the first friend's story when loaded | false | boolean | | enableAnimation | Animates icons | false | boolean | | defaultDuration | Duration for showing pictures | 7000 | number | | exitCallback | Gets called when exit button is clicked | | callback function | | assetsCallback | Gets called when initiated. A list of assets to be saved inside a-assets is passed in | | callback function | | viewCallback | Invoked when a story is played. An object with the relevant video data and metadata is passed in | | callback function | | user | This profile will show at the beginning of stories | | profile | | friends | These are list of profiles to show stories of for each user | | array of objects |

##Example

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

import 'aframe';
import 'aframe-animation-component';
import 'aframe-mouse-cursor-component';
import Stories from 'aframe-react-stories';

class App extends React.Component {
  constructor() {
    super()
    this.state({
      user: {},
      friends: [],
      storyAssets: []
    });
  }

  assetsCallback(storyAssets) {
    this.setState({ storyAssets });
  }

  return () {
    render(
      <a-scene>
        <a-assets>
          {this.state.storyAssets}
        </a-assets>
        <Stories 
          user={this.state.user}
          friends={this.state.friends}
          assetsCallback={this.assetsCallback.bind(this)}
        />
      </a-scene>
    )
  }
}

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

##Running the tests Using npm or yarn:

yarn run test
npm run test

##Contributing Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details