spherical-image
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

spherical-image

Very lightweight 360deg spherical image viewer

Latest NPM release MIT License

Demos

Usage

$ npm install --save spherical-image

then

<canvas id="myCanvas" width="800" height="600"></canvas>
import SphericalImage from 'spherical-image';
 
new SphericalImage(
  document.getElementById( 'myCanvas' ),
  './img.jpg'
);

or

<script src="./js/spherical-image.js"></script>
const sphericalImage = new SphericalImage(
  document.getElementById( 'myCanvas' ),
  './img.jpg'
);

Options

The third argument is options.

const sphericalImage = new SphericalImage(
  document.getElementById( 'myCanvas' ),
  './img.jpg',
  options
);
  • options.offsetAzimuth: default horizontal rotation in radian. default is 0
  • options.offsetAltitude: default vertical rotation in radian. default is 0

Methods

  • .reset(): reset view rotation.
  • .setSize( width, height ): set canvas size.
  • .destroy(): destroy the instance. dispose WebGL. detach all events.

Package Sidebar

Install

npm i spherical-image

Weekly Downloads

119

Version

0.2.0

License

MIT

Unpacked Size

466 kB

Total Files

285

Last publish

Collaborators

  • yomotsu