Methods
captureBrightness() → {number}
Captures the brightness level from the video feed.
- Source:
Returns:
The brightness level.
- Type
- number
captureColor() → {Array}
Captures the color at the center of the video feed.
- Source:
Returns:
An array containing RGB values.
- Type
- Array
captureLightLevel() → {number}
Captures the light level from the video feed.
- Source:
Returns:
The brightness level.
- Type
- number
captureSoundLevel() → {number}
Captures the current sound level.
- Source:
Returns:
The current sound level.
- Type
- number
debugMotion() → {string}
Returns a JSON string containing debug information about motion sensor data.
- Source:
Returns:
JSON string with motion sensor data
- Type
- string
enablePinch(onPinch)
Enables pinch gestures by adding event listeners for touch events.
Calls the specified callback function for pinch gestures.
Parameters:
| Name | Type | Description |
|---|---|---|
onPinch |
function | Callback function for pinch gesture. |
- Source:
enableSwipe(onSwipe)
Enables swipe gestures by adding event listeners for touch events.
Calls the specified callback function for swipe gestures.
Parameters:
| Name | Type | Description |
|---|---|---|
onSwipe |
function | Callback function for swipe gesture. |
- Source:
getAbsoluteOrientation() → {Object|null}
Retrieves the current absolute orientation data.
- Source:
Returns:
An object containing absolute orientation data or null if unavailable.
- Type
- Object | null
getAcceleration() → {Object|null}
Retrieves the current acceleration data.
- Source:
Returns:
An object containing acceleration data or null if unavailable.
- Type
- Object | null
getAccelerationWithGravity() → {Object|null}
Retrieves the current acceleration data including gravity.
- Source:
Returns:
An object containing acceleration data or null if unavailable.
- Type
- Object | null
getBrightness() → {number}
Gets the current brightness level from the video feed.
- Source:
Returns:
The brightness level.
- Type
- number
getColor() → {Array}
Gets the current color from the video feed.
- Source:
Returns:
An array containing RGB values.
- Type
- Array
getLightLevel() → {number}
Gets the current light level from the video feed.
- Source:
Returns:
The brightness level.
- Type
- number
getOrientation() → {Object|null}
Retrieves the current orientation data.
- Source:
Returns:
An object containing orientation data or null if unavailable.
- Type
- Object | null
getRotation() → {Object|null}
Retrieves the current rotation data.
- Source:
Returns:
An object containing rotation data or null if unavailable.
- Type
- Object | null
getSoundLevel() → {number}
Gets the current sound level from the microphone.
- Source:
Returns:
The current sound level.
- Type
- number
initializeCamera(selectCameraopt)
Initializes the camera with the specified orientation.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
selectCamera |
string |
<optional> |
"front" | The camera orientation, either "front" or "back". |
- Source:
isFrontCamera() → {boolean}
Returns whether the front camera is currently active.
- Source:
Returns:
True if the front camera is active, false if the back camera is active.
- Type
- boolean
isSensorPermissionGranted() → {boolean}
Checks if the sensor permission has been granted.
- Source:
Returns:
True if the sensor permission is granted, false otherwise.
- Type
- boolean
isSoundSensorStarted() → {boolean}
Checks if the sound sensor is started.
- Source:
Returns:
True if the sound sensor is started, false otherwise.
- Type
- boolean
requestGeolocation()
Requests the current geolocation of the device.
- Source:
setupCamera(selectCameraopt)
Sets up the camera with the specified orientation.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
selectCamera |
string |
<optional> |
"front" | The camera orientation, either "front" or "back". |
- Source:
setupColorSensor(selectCameraopt)
Sets up the color sensor using the camera.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
selectCamera |
string |
<optional> |
"front" | The camera orientation, either "front" or "back". |
- Source:
setupLightSensor(selectCameraopt)
Sets up the light sensor using the camera.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
selectCamera |
string |
<optional> |
"front" | The camera orientation, either "front" or "back". |
- Source:
setupMotionSensor()
Sets up motion sensors by checking for necessary permissions.
- Source:
setupSoundSensor()
Sets up the sound sensor.
- Source:
setupTouchSensor()
Sets up touch event handling by disabling default touch behaviors and preventing unwanted interactions.
This includes disabling text selection, context menus, and other default touch gestures.
- Source:
Example
function setup() {
setupTouchSensor();
}
showGeolocationError(error)
Callback function to handle geolocation errors.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
PositionError | The error object containing error code and message. |
- Source:
toggleCamera()
Toggles the camera between front and back.
- Source:
updateBrightness() → {number}
Updates the brightness level from the video feed.
- Source:
Returns:
The updated brightness level.
- Type
- number