fovplugins

This is the staging area for the fieldOfView plugins for krpano. A copy of these pages is included on krpano.com. The pages in this staging area may be newer than the respective pages on krpano.com.

Gyroscope Plugin gyro.js for HTML5
by Aldo Hoeben - fieldofview.com
With contributions by Sjeiti and Klaus

Description

This plugin uses the gyroscope in iOS devices such as the iPhone 4 and iPad 2 to control the view in krpanoJS.

Download

gyro.js  (plugin only)

The gyro sources and examples are available as part of the fovplugins package

fovplugins.zip  (plugin, source code & examples)

Syntax / XML Usage Example

<plugin name="gyro" 
        url="gyro.js" 
        keep="true"
        enabled="true"
        onavailable="trace('Gyroscope is available')"
        camroll="true"
        friction="0.5"
        velastic="0.2"
        vrelative="false"
        />

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
onavailable
Actions / functions that will be called when the plugin detects the gyroscope device.
values: function or action-name
enabled
Enables and/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: false
friction
Dampens the gyroscope values, making the result less "twitchy". 0 means no dampening, 1 is infinite dampening (ie: no gyroscope movement)
values: 0-1, default: 0.5
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-1, default: 0
vrelative
When set to true, the vertical movement is set relative to the initial view when the gyro plugin is enabled. In combination with velastic="0", this prevents the view from "nosediving" if the device is flat on a table.
values: true/false, default: false

Example

CLICK TO VIEW EXAMPLE

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.