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

web2vr

v1.1.1

Published

Dynamically translate HTML and CSS to A-Frame 3D world for virtual reality.

Downloads

3

Readme

Web2VR

Examples

You can view the examples with VR or Non-VR. Drag and stretch features only available for VR.

Controls for VR:

  • Use trigger button to click.
  • Use grip button to drag.
  • Use both grip buttons to stretch.

Controls for Non-VR:

  • Use WASD keys to move.
  • User can move camera (look around), by holding left mouse button and moving mouse.
  • Use left mouse button to click.

AR

DEMO

Simple use of AR.js with hiro image marker to display web2vr elements. User needs camera.

Room

DEMO

Room 3D model with lots of bootstrap examples placed everywhere. Examples are taken from Bootsnipp. Each example shows a feature of Web2VR. Low-end computers may get lower performance because of the room model and lighting.

Video platform

DEMO

This is full working web app of video platform that is entirely written with HTML, CSS and JS then translated to web2vr elements. Entire web app has dynamic elements to show that Web2VR works with dynamic elements. If the user is viewing in Non-VR then the watch will be shown in the top left corner of the window. If you click 360 video as your first video to watch it wont load because of aframe-environment-component bugs.

Tests

DEMO

Left window is normal browser HTML while right side is translated version in A-Frame.

Features

  • 90% CSS support
  • AR support
  • CSS transitions and animations
  • GIF images
  • SVG and canvas
  • CSS hover
  • Click interaction
  • Dynamic elements
  • Experimental CSS gradient
  • Normal and 360 videos
  • Scroll support
  • Drag and Stretch HTML
  • Keyboard support
  • Attach HTML to models
  • And more

Usage

Example

Browser

Install and use directly by including the browser files:

<!DOCTYPE html>
<html>

<head>
    <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web2vr.min.js"></script>
    <style>
        #html-container{
            position: absolute;
            width: 200px;
            background-color: gainsboro;
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="html-container">
        Welcome to Web2VR!
        <button id="btn">Click me!</button>
        <div id="info"></div>
    </div>
    <script>
        document.getElementById("btn").onclick = () => {
            document.getElementById("info").innerText = "Button Clicked!";
        };
        const web2vr = new Web2VR("#html-container");
        web2vr.start();
    </script>
</body>

</html>

Result of the code:

Check tests and examples for more.

npm

Install via npm:

npm install web2vr

Be sure to have aframe installed. Then import and use.

import "aframe";
import "web2vr";

Parameters

new Web2VR("css selector",{"parameters go here"});

This is the list of the available parameters. | Parameter | Default | Description | |-----------|---------|-------------| | scale | 600 | Set scale. The bigger the scale is the smaller the web2vr elements will be in the 3D world. | | position | { x: 0, y: 2, z: -1 } | Set starting position. | | rotation | { x: 0, y: 0, z: 0 } | Set starting rotation. | | layerStep | 0.0005 | Set z space between the layers. | | parentSelector | null | Attach web2vr container element to parent entity. | | interactiveTag| "vr-interactable" | Interactive class for the web2vr elements. If you are using your own custom controllers you have to tell the raycaster to react on objects with this interactive class.| | ignoreTags | ["BR", "SOURCE", "SCRIPT", "AUDIO", "NOSCRIPT"] | DOM element tags to be ignored while creating web2vr elements. | | debug | false | Show logs and stats. | | showClipping | false | Show clipping planes. | | forceClipping | false | Force clipping. | | experimental | false | Enable different method of rendering that can show css gradients but with cost of performance. Needs to have html2canvas library included. | | scroll | true | Enable scroll support if needed. | | scrollWindowHeight | 800 | Set scroll window height for the web2vr container element. | | createControllers | true |Create super hands controllers. | | raycasterFar| 5 | Maximum distance for the raycaster laser. | | skybox | true | Create default skybox if there is no skybox in the scene. | | border| true | Enable CSS border support. For now all borders width is 1 due to limitations of WebGL line width. |

Compatibility

For A-Frame 1.2.0 and newer versions use Web2VR 1.1.1 or newer version.

For A-Frame 1.0.4 and older versions use Web2VR 1.0.1 version.

Do not use A-Frame version 1.1.0 it breaks Web2VR code.

Everything has been tested on desktop VR. Desktop Chrome version 89.0.4389.82 and Firefox version 86.0 have been used for testing. I dont have Oculus Quest so i cannot confirm if everything works there.

A-Frame community components

This library uses Super hands, Super keyboard and GIF Shader A-Frame community components.

License

This program is free software and is distributed under an MIT License.