Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sphere-viewer

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sphere-viewer

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

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
Maintainers
1
Weekly downloads
 
Created
Source

SphereViewer.js

Displays photo spheres created with Ricoh Theta or Google Photosphere app on mobile and desktop browsers.

Features

  • customizable through config
  • image preloading for slower connection
  • displays spinner while loading images
  • can hide the triopod by displaying custom logo at the sphere bottom
  • can display user instructions (PNG image)
  • configurable
  • supports vanilla JavaScript and AMD
  • supports UV mapping customization

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 example provided below and live example at CodePen

Installation

NPM installation

To install it via NPM run:

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

Old school linking from HTML

If you use the Vanilla JavaScript, link the lib in from HTML like this (the code bellow includes links to 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/84/three.min.js"></script>
  <script type="text/javascript" src="//cdn.rawgit.com/knee-cola/SphereViewer/13f4e3aa/dist/sphereViewer.min.js"></script>

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

// defining spinner config
var config = {
  // (if set) the logo will be displayed at the bottom
  // of the sphere, which is usefull for hiding the triopod
  logo:'img/logo.png',
  // (if set) the usage hint is 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',
  
  // overriding the default control config
  control: {
    autoRotate: true
  },
  
  // overidding the default spinner config
  spinner: {
    groupRadius: 20
  },

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

var picUrls = ['img/sphere/preloader.jpg', 'img/sphere/hd.jpg']

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

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

License

SphereViewer is licensed under the MIT License.

Keywords

FAQs

Package last updated on 07 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc