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

sphere-viewer

v1.1.6

Published

A simple JavaScript library for displaying spherical images on desktop and mobile browsers

Downloads

28

Readme

SphereViewer.js

Displays photo spheres created with Ricoh Theta or Google Street View App on mobile and desktop browsers.

Features

  • customizable via config
    • can hide the triopod by displaying custom logo at the sphere bottom
    • can display user instructions (PNG image)
  • works on desktop and mobile browsers
  • texture can be provided in three different formats
  • image preloading for slower connection (only in "sphere" mode)
    • displays spinner while loading images
  • advance feature support
    • conversion of spherical textures into a cubical one (equirectangular-2-rectilinear)
    • custom UV mapping
  • supports vanilla JavaScript and AMD

Live Demo

Live demo is available on CodePen.io http://codepen.io/knee-cola/pen/vxQYNL

Documentation

There is none ... you can figure it out from provided example files in the examples folder @ GitHub. The code inside the HTML files is well documented.

Four examples are provided:

Installation

NPM installation

To install it via NPM run:

npm i -D --save-dev sphere-viewer

Then just import it in your JavaScript ... for example, like this:

import SphereViewer from 'sphere-viewer'

Using CDN (vanilla JavaScript)

If you use the vanilla JavaScript, link the lib from HTML like this (the code bellow also includes dependencies):

  <script src="//code.jquery.com/jquery-3.2.1.slim.js"></script>
  <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/three.js/85/three.min.js"></script>
  <script type="text/javascript" src="//cdn.rawgit.com/knee-cola/SphereViewer/042c4c83/dist/sphereViewer.min.js"></script>

Downloading the viewer (minified)

If you want to store files localy on yout server, you can download the minified file from GitHub repository.

Dependencies

SphereViewer was build with:

Usage example

var isMobile = window.devicePixelRatio!==1;

// defining options
var config = {
  // providing multiple images for the pre-loader
  sphere: ['img/sphere/preloader.jpg', 'img/sphere/hd.jpg'],
  
  // (optional) setting up a logo, which will be displayed at the bottom
  // of the sphere, which is usefull for hiding the triopod
  logo:'img/logo.png',
  
  // (optional) defining hint, which will be displayed in the center
  // of the screen and is hidden after the user clicks/taps the screen
  hint: isMobile ? 'img/sphere-icon-mobile.png' : 'img/sphere-icon-desktop.png',
  
  // (optional) overriding the default control config
  control: {
    autoRotate: true
  },
  
  // (optional) overidding the default spinner config
  spinner: {
    groupRadius: 20
  },

  // (optional) defining what the close button should contain
  //
  // The HTML specified here will be placed inside a <div>
  // we can the style it as we wish via CSS.
  // When user clicks/taps the button, the sphere will close
  // and dispatch 'closed' event
  // If this param is ommited from config, the close button will not be displayed
  closeButton: {
    html: '<i class="cmdCloseSphere material-icons">highlight_off</i>'
  },

  // (optional) Here we could override the default THREE.js UV mapping, by providing a mapper function
  // uvMapper: (geometry) => { ... doing some custom UV mapping ...  }
};

// creating a new instance of the viewer
// ... the viewer will automaticall be appended to <body> and displayed
var viewer = new SphereViewer.Viewer(config);

// adding event handlers:
viewer.addEventListener('close', function() { console.log('sphere closed'); });

License

SphereViewer is licensed under the MIT License.