Jump to content

Component: Motion ( Data): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
 
(3 intermediate revisions by the same user not shown)
Line 50: Line 50:


===GetAcceleration===
===GetAcceleration===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetAcceleration'''
| width="90%" class="mtx-class-macrohead" | '''GetAcceleration'''
|-
|-
| colspan="2" | Returns the device's acceleration in the specified direction 
| colspan="2" | Returns the device's acceleration in the specified direction 
Line 74: Line 74:


===GetInterval===
===GetInterval===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetInterval'''
| width="90%" class="mtx-class-macrohead" | '''GetInterval'''
|-
|-
| colspan="2" | Returns the interval at which the data is obtained from the device (in ms) 
| colspan="2" | Returns the interval at which the data is obtained from the device (in ms) 
Line 88: Line 88:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Begins monitoring of the device's orientation information.  Returns true if the device can provide orientation information. 
| colspan="2" | Begins monitoring of the device's orientation information.  Returns true if the device can provide orientation information. 
Line 103: Line 103:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-

Latest revision as of 14:23, 13 July 2026

Author MatrixTSL
Version 1.0
Category Data


Motion component

Component that provides motion data for the mobile device using its internal accelerometer

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 which can report the acceleration in each of the 3 perpendicular axes - x, y and z.

This component allows access to the data provided by this sensor (if available) and can report the data with/without the contribution of the gravity force at that time.


Examples

Graphing the accelerometer output

This example shows the acceleration in the 3 axes on a chart.

DeviceMotion.fcweb

The web app created by this example can be viewed here: DeviceMotion Example


Using the Motion component with a callback

The is a similar example to above, but this one uses a callback function to retrieve the acceleration data on a regular basis.

DeviceMotionWithCallback.fcweb

The web app created by this example can be viewed here: DeviceMotionWithCallback Example


Macro reference

GetAcceleration

GetAcceleration
Returns the device's acceleration in the specified direction 
- LONG Axis
The axis to use (0=x, 1=y, 2=z) 
- BOOL Compensate
Set true to compensate for the effects of gravity 
- FLOAT Return


GetInterval

GetInterval
Returns the interval at which the data is obtained from the device (in ms) 
- LONG Return


Initialise

Initialise
Begins monitoring of the device's orientation information. Returns true if the device can provide orientation information. 
- BOOL Return


Property reference

Properties
Use Callback
Set true to use a callback that retrieves regular updates of the device accelerometer 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_WEBEXP_Motion.fcsx

Please click here to view the component source code (Beta): FC_Comp_Source_WEBEXP_Motion.fcsx