All functions related to the Accelerometer and Gyroscope.
Methods
-
<static> getAccelerometerInterval() → {number}
-
Returns the update interval in seconds that is currently set for accelerometer related events.
Returns:
The update interval in seconds that is currently set for accelerometer related events.
- Type
- number
Example
console.log(Cocoon.Motion.getAccelerometerInterval());
-
<static> getGyroscopeInterval() → {number}
-
Returns the update interval in seconds that is currently set for gyroscope related events.
Returns:
The update interval in seconds that is currently set for gyroscope related events.
- Type
- number
Example
console.log(Cocoon.Motion.getGyroscopeInterval());
-
<static> setAccelerometerInterval(seconds)
-
Setups the update interval in seconds (1 second / X frames) to receive the accelerometer updates. It defines the rate at which the devicemotion events are updated.
Parameters:
Name Type Description seconds
number The update interval in seconds to be set.
Example
Cocoon.Motion.setAccelerometerInterval(2);
-
<static> setGyroscopeInterval(seconds)
-
Setups the update interval in seconds (1 second / X frames) to receive the gyroscope updates. It defines the rate at which the devicemotion and deviceorientation events are updated.
Parameters:
Name Type Description seconds
number The update interval in seconds to be set.
Example
Cocoon.Motion.setGyroscopeInterval(2);