widgets: gyroscope widget 1st draft

This commit is contained in:
jean-emmanuel 2018-08-26 19:49:29 +02:00
parent a278ddd638
commit 1ceacb23d7
5 changed files with 213 additions and 1 deletions

View file

@ -100,3 +100,57 @@
#### `set(id, value)`
- `id` (`string`): a widget's id
- `value`: the widget's new value
## Gyroscope
```js
{
type:'gyroscope',
// etc
}
```
The gyroscope's value is an object containing multiple values, which can be used by other widgets via the [property maths syntax](../extras/advanced-property-syntax.md) :
```
// value.do.alpha ( deviceorientation event alpha value )
// value.do.beta ( deviceorientation event beta value )
// value.do.gamma ( deviceorientation event gamma value )
// value.do.absolute ( deviceorientation event absolute value )
// value.dm.x ( devicemotion event acceleration x value )
// value.dm.y ( devicemotion event acceleration y value )
// value.dm.z ( devicemotion event acceleration z value )
// value.dm.gx ( devicemotion event accelerationIncludingGravity x value )
// value.dm.gy ( devicemotion event accelerationIncludingGravity y value )
// value.dm.gz ( devicemotion event accelerationIncludingGravity z value )
// value.dm.alpha ( devicemotion event rotationRate alpha value )
// value.dm.beta ( devicemotion event rotationRate beta value )
// value.dm.gamma ( devicemotion event rotationRate gamma value )
```
### `frequency`
- type: `number`
- default: `30`
- usage: update frequency in Hz (value updates per seconds)
### `normalize`
- type: `boolean`
- default: `true`
- usage: normalize gravity related values
### `compass`
- type: `boolean`
- default: `false`
- usage: set to `true` to return the orientation values with respect to the actual north direction of the world instead of the head direction of the device
### `screenAdjusted`
- type: `boolean`
- default: `false`
- usage: set to `true` to return screen adjusted values