Creates a new panorama renderer.
container
HTMLElement The container element for the renderer.Initialize renderer.
_image
_imageType
_dynamic
haov
number Initial horizontal angle of view.vaov
number Initial vertical angle of view.voffset
number Initial vertical offset angle.callback
function Load callback function.params
Object? Other configuration parameters (horizonPitch
, horizonRoll
, backgroundColor
).image
(Image | Array | Object) Input image; format varies based on
imageType
. For equirectangular
, this is an image; for
cubemap
, this is an array of images for the cube faces in the
order [+z, +x, -z, -x, +y, -y]; for multires
, this is a
configuration object.imageType
string The type of the image: equirectangular
,
cubemap
, or multires
.dynamic
boolean Whether or not the image is dynamic (e.g. video).Destroy renderer.
Resize renderer (call after resizing container).
Set renderer horizon pitch and roll.
horizonPitch
horizonRoll
Render new view of panorama.
pitch
number Pitch to render at (in radians).yaw
number Yaw to render at (in radians).hfov
number Horizontal field of view to render with (in radians).params
Object? Extra configuration parameters.
Check if images are loading.
Returns boolean Whether or not images are loading.
Retrieve renderer’s canvas.
Returns HTMLElement Renderer’s canvas.
Creates a new panorama viewer.
container
(HTMLElement | string) The container (div) element for the
viewer, or its ID.initialConfig
Object Inital configuration for viewer.Checks whether or not a panorama is loaded.
Returns boolean true
if a panorama is loaded, else false
Check if a panorama is loaded.
Returns boolean True if a panorama is loaded, else false
Returns the pitch of the center of the view.
Returns number Pitch in degrees
Sets the pitch of the center of the view.
pitch
number Pitch in degreesanimated
(boolean | number) Animation duration in milliseconds or false for no animation (optional, default 1000
)callback
function? Function to call when animation finishescallbackArgs
object? Arguments to pass to callback functionReturns Viewer this
Returns the minimum and maximum allowed pitches (in degrees).
Returns Array<number> [minimum pitch, maximum pitch]
Set the minimum and maximum allowed pitches (in degrees).
Returns Viewer this
Returns the yaw of the center of the view.
Returns number Yaw in degrees
Sets the yaw of the center of the view.
yaw
number Yaw in degrees [-180, 180]animated
(boolean | number) Animation duration in milliseconds or false for no animation (optional, default 1000
)callback
function? Function to call when animation finishescallbackArgs
object? Arguments to pass to callback functionReturns Viewer this
Returns the minimum and maximum allowed pitches (in degrees).
Returns Array<number> [yaw pitch, maximum yaw]
Set the minimum and maximum allowed yaws (in degrees [-180, 180]).
Returns Viewer this
Returns the horizontal field of view.
Returns number Horizontal field of view in degrees
Sets the horizontal field of view.
hfov
number Horizontal field of view in degreesanimated
(boolean | number) Animation duration in milliseconds or false for no animation (optional, default 1000
)callback
function? Function to call when animation finishescallbackArgs
object? Arguments to pass to callback functionReturns Viewer this
Returns the minimum and maximum allowed horizontal fields of view (in degrees).
Returns Array<number> [minimum hfov, maximum hfov]
Set the minimum and maximum allowed horizontal fields of view (in degrees).
Returns Viewer this
Set a new view. Any parameters not specified remain the same.
pitch
number? Target pitchyaw
number? Target yawhfov
number? Target hfovanimated
(boolean | number) Animation duration in milliseconds or false for no animation (optional, default 1000
)callback
function? Function to call when animation finishescallbackArgs
object? Arguments to pass to callback functionReturns Viewer this
Returns the panorama’s north offset.
Returns number North offset in degrees
Sets the panorama’s north offset.
heading
number North offset in degreesReturns Viewer this
Returns the panorama’s horizon roll.
Returns number Horizon roll in degrees
Sets the panorama’s horizon roll.
roll
number Horizon roll in degrees [-90, 90]Returns Viewer this
Returns the panorama’s horizon pitch.
Returns number Horizon pitch in degrees
Sets the panorama’s horizon pitch.
pitch
number Horizon pitch in degrees [-90, 90]Returns Viewer this
Start auto rotation.
Before starting rotation, the viewer is panned to pitch
.
speed
number? Auto rotation speed / direction. If not specified, previous value is used.pitch
number? The pitch to rotate at. If not specified, inital pitch is used.Returns Viewer this
Stop auto rotation.
Returns Viewer this
Stops all movement.
Returns the panorama renderer.
Returns Renderer
Sets update flag for dynamic content.
bool
boolean Whether or not viewer should update even when stillReturns Viewer this
Calculate panorama pitch and yaw from location of mouse event.
event
MouseEvent Document mouse down event.Returns Array<number> [pitch, yaw]
Change scene being viewed.
sceneId
string Identifier of scene to switch to.pitch
number? Pitch to use with new sceneyaw
number? Yaw to use with new scenehfov
number? HFOV to use with new sceneReturns Viewer this
Get ID of current scene.
Returns string ID of current scene
Add a new scene.
Returns Viewer this
Remove a scene.
sceneId
string The ID of the sceneReturns boolean False if the scene is the current scene or if the scene doesn’t exists, else true
Toggle fullscreen.
Returns Viewer this
Get configuration of current scene.
Returns Object Configuration of current scene
Get viewer’s container element.
Returns HTMLElement Container div
element
Add a new hot spot.
hs
Object The configuration for the hot spotsceneId
string? Adds hot spot to specified scene if provided, else to current scene
Throws any Throws an error if the scene ID is provided but invalid
Returns Viewer this
Remove a hot spot.
hotSpotId
string The ID of the hot spotsceneId
string? Removes hot spot from specified scene if provided, else from current sceneReturns boolean True if deletion is successful, else false
This method should be called if the viewer’s container is resized.
Check if device orientation control is supported.
Returns boolean True if supported, else false
Stop using device orientation.
Start using device orientation (does nothing if not supported).
Check if device orientation control is currently activated.
Returns boolean True if active, else false
Subscribe listener to specified event.
type
string Type of event to subscribe to.listener
Function Listener function to subscribe to event.Returns Viewer this
Destructor.
Remove an event listener (or listeners).
type
string? Type of event to remove listeners from. If not specified, all listeners are removed.listener
Function? Listener function to remove. If not specified, all listeners of specified type are removed.Returns Viewer this
Pannellum is developed on GitHub by Matthew Petroff.
CDN via KeyCDN.