-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeviceMotionEvent.cljs
129 lines (91 loc) · 4.38 KB
/
DeviceMotionEvent.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
(ns web.mobile.DeviceMotionEvent
"The DeviceMotionEvent provides web developers with information
the speed of changes for the device's position and orientation."
(:refer-clojure :exclude []))
(def constructor
"Constructor.
The DeviceMotionEvent constructor creates a new `web.mobile.DeviceMotionEvent`.
type
Must be \\\"devicemotion\\\".
optionsOptional
Options are as follows:
acceleration: An object giving the acceleration of the device on the three axis X, Y and Z. Acceleration is expressed in m/s2.
accelerationIncludingGravity: An object giving the acceleration of the device on the three axis X, Y and Z with the effect of gravity. Acceleration is expressed in m/s2.
rotationRate: An object giving the rate of change of the device's orientation on the three orientation axis alpha, beta and gamma. Rotation rate is express in degrees per seconds.
interval: A number representing the interval of time, in milliseconds, at which data is obtained from the device.
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent`"
js/DeviceMotionEvent)
(defn acceleration
"Property.
The acceleration property returns the amount of acceleration
by the device, in meters per second squared (m/s2).
`var acceleration = deviceMotionEvent.acceleration;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/acceleration`"
[this]
(-> this (.-acceleration)))
(defn set-acceleration!
"Property.
The acceleration property returns the amount of acceleration
by the device, in meters per second squared (m/s2).
`var acceleration = deviceMotionEvent.acceleration;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/acceleration`"
[this val]
(aset this "acceleration" val))
(defn acceleration-including-gravity
"Property.
The accelerationIncludingGravity property returns the amount
acceleration recorded by the device, in meters per second squared
Unlike `DeviceMotionEvent.acceleration` which compensates for
influence of gravity, its value is the sum of the acceleration
the device as induced by the user and the acceleration caused
gravity.
`var acceleration = deviceMotionEvent.accelerationIncludingGravity;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/accelerationIncludingGravity`"
[this]
(-> this (.-accelerationIncludingGravity)))
(defn set-acceleration-including-gravity!
"Property.
The accelerationIncludingGravity property returns the amount
acceleration recorded by the device, in meters per second squared
Unlike `DeviceMotionEvent.acceleration` which compensates for
influence of gravity, its value is the sum of the acceleration
the device as induced by the user and the acceleration caused
gravity.
`var acceleration = deviceMotionEvent.accelerationIncludingGravity;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/accelerationIncludingGravity`"
[this val]
(aset this "accelerationIncludingGravity" val))
(defn rotation-rate
"Property.
Returns the rate at which the device is rotating around each
its axes in degrees per second.
`var rotationRate = deviceMotionEvent.rotationRate;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/rotationRate`"
[this]
(-> this (.-rotationRate)))
(defn set-rotation-rate!
"Property.
Returns the rate at which the device is rotating around each
its axes in degrees per second.
`var rotationRate = deviceMotionEvent.rotationRate;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/rotationRate`"
[this val]
(aset this "rotationRate" val))
(defn interval
"Property.
Returns the interval, in milliseconds, at which data is obtained
the underlaying hardware. You can use this to determine the granularity
motion events.
`var interval = deviceMotionEvent.interval;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/interval`"
[this]
(-> this (.-interval)))
(defn set-interval!
"Property.
Returns the interval, in milliseconds, at which data is obtained
the underlaying hardware. You can use this to determine the granularity
motion events.
`var interval = deviceMotionEvent.interval;`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent/interval`"
[this val]
(aset this "interval" val))