Panolens.js is a lightweight, event-driven, and WebGL-based JavaScript library designed for creating interactive 360-degree panorama viewers in web applications. Built on top of Three.JS, it provides robust capabilities for displaying spherical images and videos, including features like infospots, linking between panoramas, and various control mechanisms. The current stable version is 0.12.1, with releases occurring on an irregular basis, often bundling multiple fixes and new features within minor versions, and occasionally introducing significant breaking changes (e.g., the v0.10.0 ES Module refactor). Its key differentiators include its tight integration with Three.JS, emphasis on performance through WebGL, and an event-driven architecture that allows for highly customizable interactions.
npm install panolensVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a Panolens.js viewer, load an equirectangular image panorama, and add it to the viewer. It also shows how to conceptually link two panoramas, and ensures the viewer is attached to a pre-existing DOM element.
Migrate import statements to ES module syntax (`import { ... } from 'panolens'`). Update usage of deprecated classes and constants according to the migration guide. Re-evaluate build processes if relying on internal tooling that used Gulp.If using local assets, ensure you're either providing direct image URLs for panoramas or utilizing the `panolens-offline.min.js` build. Remove any references to `PANOLENS.DataImage`.
When creating `VideoPanorama` instances or working with video elements, use `<source>` child elements within the `<video>` tag to specify video sources instead of the `src` attribute directly on the `video` tag.
Always check the `package.json` dependencies for the recommended `three.js` version. If using script tags, include `three.min.js` before `panolens.min.js`. If using a bundler, ensure `three` is correctly installed and resolvable.
If using script tags, ensure `<script src="panolens.min.js"></script>` is included after `three.min.js`. If using ES modules and a bundler, ensure `import * as PANOLENS from 'panolens';` (or named imports) is used and 'panolens' is installed.
For modern module-based projects, use `import { Viewer } from 'panolens';`. If you strictly require a namespace, ensure `import * as PANOLENS from 'panolens';` is used. For script tag usage, verify the `panolens.min.js` script is loaded.Ensure `three.min.js` is loaded before `panolens.min.js` in script tag setups. If using modules, explicitly `import * as THREE from 'three';` in your file.
Verify that `panorama` is correctly instantiated as `new PANOLENS.ImagePanorama()` or `new PANOLENS.VideoPanorama()`. Check method names against current documentation, especially after major updates.