Difference between revisions of "Component: Orientation ( Data)"
(Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | MatrixTSL |- | width="20%" style="color:gray;" | Version | 1.0 |- | width="20%" style="color:gray;...") |
|||
| Line 14: | Line 14: | ||
==Orientation component== | ==Orientation component== | ||
Component that provides orientation data for the mobile device using its internal magnetometer | Component that provides orientation data for the mobile device using its internal magnetometer | ||
| + | |||
==Version information== | ==Version information== | ||
| Line 24: | Line 25: | ||
==Detailed description== | ==Detailed description== | ||
| − | + | Many mobile devices contain an internal accelerometer and magnetometer which together can report the orientation of the device. | |
| + | |||
| + | This component allows access to this orientation data (if it is available on the device), returning with 3 angles showing the rotation of the device in the 3 axes (x, y and z). | ||
| + | |||
==Examples== | ==Examples== | ||
| − | + | ===Graphing the device orientation=== | |
| + | This example shows the orientation of the device in the 3 axes on a chart. | ||
| + | |||
| + | {{Fcfile|DeviceOrientation.fcweb|DeviceOrientation.fcweb}} | ||
| + | |||
| + | The web app created by this example can be viewed here: [https://www.flowcode.co.uk/example/WebComps/DeviceOrientation.html DeviceOrientation Example] | ||
| + | |||
| + | |||
| + | ===Using the Orientation component with a callback=== | ||
| + | The is a similar example to above, but this one uses a callback function to retrieve the orientation of the device whenever there is new data available. | ||
| + | |||
| + | {{Fcfile|DeviceOrientationWithCallback.fcweb|DeviceOrientationWithCallback.fcweb}} | ||
| + | The web app created by this example can be viewed here: [https://www.flowcode.co.uk/example/WebComps/DeviceOrientationWithCallback.html DeviceOrientationWithCallback Example] | ||
Latest revision as of 15:40, 27 April 2026
| Author | MatrixTSL |
| Version | 1.0 |
| Category | Data |
Contents
Orientation component
Component that provides orientation data for the mobile device using its internal magnetometer
Version information
Library Version, Component Version, Date, Author, Info 1, 1.0, 24-04-26, ST, Created
Detailed description
Many mobile devices contain an internal accelerometer and magnetometer which together can report the orientation of the device.
This component allows access to this orientation data (if it is available on the device), returning with 3 angles showing the rotation of the device in the 3 axes (x, y and z).
Examples
Graphing the device orientation
This example shows the orientation of the device in the 3 axes on a chart.
The web app created by this example can be viewed here: DeviceOrientation Example
Using the Orientation component with a callback
The is a similar example to above, but this one uses a callback function to retrieve the orientation of the device whenever there is new data available.
DeviceOrientationWithCallback.fcweb
The web app created by this example can be viewed here: DeviceOrientationWithCallback Example
Macro reference
GetAlpha
| GetAlpha | |
| Returns rotation around the z-axis, i.e. twisted anticlockwise around the centre of the screen (in degrees between 0 and 360) | |
| Return | |
GetBeta
| GetBeta | |
| Returns rotation around the x-axis, i.e. tilted forwards/backwards (in degrees between -180 and 180) | |
| Return | |
GetGamma
| GetGamma | |
| Returns rotation around the y-axis, i.e. tilted left/right (in degrees between -90 and 90) | |
| Return | |
Initialise
| Initialise | |
| Begins monitoring of the device's orientation information. Returns true if the device can provide orientation information. | |
| Return | |
IsAbsolute
| IsAbsolute | |
| Returns true if the device is providing absolute orientation information. Absolute data will be in reference to the Earth's coordinate frame. | |
| Return | |
Property reference
| Properties | |
| Use Callback | |
| Set true to use a callback that retrieves regular updates of the device orientation | |
Component Source Code
Please click here to download the component source project: FC_Comp_Source_WEBEXP_Orientation.fcsx
Please click here to view the component source code (Beta): FC_Comp_Source_WEBEXP_Orientation.fcsx