close panorama

Gyroscope Plugin gyro.js Version 1.18
HTML5 only
Select Version:
by Aldo Hoeben - fieldofview.com
With contributions by Sjeiti and Klaus

Description

This plugin uses the device gyroscope or acceleration sensors to control the view in krpano.

Device support

  • iOS - all devices with gyroscope sensors (iPhone 4 and iPad 2 and up).
  • Windows Phone 8, Windows RT, Windows 8 - all devices with IE11 and gyro support.
  • BlackBerry - yes.
  • Android - partially:
    • Android Chrome - works when the device is providing gravity-acceleration sensor data.
    • Android Firefox - works basically very fine, but when looking up in landscape mode the rotation can be wrong in some cases (a Firefox gyroscope sensor data bug).
    • Older Stock / Webkit-based Android browsers - no.

Syntax / XML Usage Example

<plugin name="gyro" devices="html5" keep="true"
        url="gyro.js" 
        enabled="true"
        camroll="true"
        friction="0.0"
        velastic="0.0"
        vrelative="false"
        onavailable=""
        />

Plugin Attributes

  • available
    • This read-only attribute is only set to true if the browser/device is generating deviceorientation events. It can be used to determine if a ui for the gyroscope is applicable.
    • Values: true/false, read-only
  • enabled
    • Enables or disables the gyroscope for navigation.
    • Values: true/false, default: true
  • camroll
    • Determines whether or not the camera rotates around the roll axis.
    • Values: true/false, default: true
  • friction
    • Dampens the gyroscope values, making the result less "twitchy".
    • 0.0 means no dampening, 1.0 is infinite dampening (ie: no gyroscope movement)
    • Values: 0.0 - 1.0, default: 0.0
  • velastic
    • If set to a value greater than 0, the vlookat parameter returns to the device pitch after manually altering the view.
    • The higher the value, the faster the view returns to the device pitch.
    • Values: 0.0 - 1.0, default: 0.0
  • vrelative
    • When set to true, the vertical looking direction will relative to the initial device direction instead of being relative to the real-world-horizon. It makes sense to combine this setting with velastic="0".
    • Values: true/false, default: false

Plugin Events

  • onavailable
    • This event will be called when the gyroscope is available on this device.

License

CC-BY-3.0 The plugin can be used free of charge, in commercial or non-commercial applications. The source code is available under a Creative Commons Attribution license.

In a nutshell, this means you are free to use the software and its source code in your projects. If you use the source code in another software project, you are required to add attribution to the author(s). You are encouraged to share the your source code under a similar fashion, but it is not a requirement.

If you use the plugins regularly, you may consider making a donation so I can afford to continue making these plugins and making them available.