# AutorotateKeypointsPlugin

API Documentation

Replaces the standard autorotate animation by a smooth transition between multiple points.

This plugin is available in the core photo-sphere-viewer package in dist/plugins/autorotate-keypoints.js.

# Usage

The plugin is configured with keypoints which can be either a position object (either x/y or longitude/latitude) or the identifier of an existing marker.

It is also possible to configure each keypoint with a pause time and a tooltip.

const viewer = new PhotoSphereViewer.Viewer({
  plugins: [
    [PhotoSphereViewer.AutorotateKeypointsPlugin, {
      keypoints: [
         'existing-marker-id',
         
         { longitude: Math.PI / 2, latitude: 0 },
         
         {
           position: { longitude: Math.PI, latitude: Math.PI / 6 },
           pause   : 5000,
           tooltip : 'This is interesting',
         },
         
         {
           markerId: 'another-marker', // will use the marker tooltip if any
           pause   : 2500,
         },
       ],
    }],
  ],
});

The plugin reacts to the standard autorotateDelay and autorotateSpeed options and can be started with startAutorotate or the button in the navbar.

# Example

The following demo randomly generates some markers and automatically pan between them.

# Configuration

# startFromClosest

  • type: boolean
  • default: true

Start from the closest keypoint instead of the first keypoint of the array.

# keypoints

  • type: Keypoints[]

Initial keypoints, does the same thing as calling setKeypoints just after initialisation.

# Methods

# setKeypoints(keypoints)

Changes or remove the keypoints.