Difference between revisions of "Accelerometer"

From GiderosMobile
Line 24: Line 24:
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Methods</translate> ===
 
=== <translate>Methods</translate> ===
[[Special:MyLanguage/Accelerometer.isAvailable|Accelerometer.isAvailable]] ''<translate>does the accelerometer available?</translate>''<br/><!-- GIDEROSMTD:Accelerometer.isAvailable -->
+
[[Special:MyLanguage/Accelerometer.isAvailable|Accelerometer.isAvailable]] ''<translate>does the accelerometer available?</translate>''<br/><!-- GIDEROSMTD:Accelerometer.isAvailable() does the accelerometer available? -->
[[Special:MyLanguage/Accelerometer.new|Accelerometer.new]] ''<translate>Creates new Accelerometer instance</translate>''<br/><!-- GIDEROSMTD:Accelerometer.new -->
+
[[Special:MyLanguage/Accelerometer.new|Accelerometer.new]] ''<translate>Creates new Accelerometer instance</translate>''<br/><!-- GIDEROSMTD:Accelerometer.new() Creates new Accelerometer instance -->
[[Special:MyLanguage/Accelerometer:getAcceleration|Accelerometer:getAcceleration]] ''<translate>returns the 3-axis acceleration measured by the accelerometer</translate>''<br/><!-- GIDEROSMTD:Accelerometer:getAcceleration -->
+
[[Special:MyLanguage/Accelerometer:getAcceleration|Accelerometer:getAcceleration]] ''<translate>returns the 3-axis acceleration measured by the accelerometer</translate>''<br/><!-- GIDEROSMTD:Accelerometer:getAcceleration() returns the 3-axis acceleration measured by the accelerometer -->
[[Special:MyLanguage/Accelerometer:start|Accelerometer:start]] ''<translate>starts accelerometer updates</translate>''<br/><!-- GIDEROSMTD:Accelerometer:start -->
+
[[Special:MyLanguage/Accelerometer:start|Accelerometer:start]] ''<translate>starts accelerometer updates</translate>''<br/><!-- GIDEROSMTD:Accelerometer:start() starts accelerometer updates -->
[[Special:MyLanguage/Accelerometer:stop|Accelerometer:stop]] ''<translate>starts accelerometer updates</translate>''<br/><!-- GIDEROSMTD:Accelerometer:stop -->
+
[[Special:MyLanguage/Accelerometer:stop|Accelerometer:stop]] ''<translate>starts accelerometer updates</translate>''<br/><!-- GIDEROSMTD:Accelerometer:stop() starts accelerometer updates -->
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Events</translate> ===
 
=== <translate>Events</translate> ===
 
=== <translate>Constants</translate> ===
 
=== <translate>Constants</translate> ===
 
|}
 
|}

Revision as of 15:31, 13 September 2018


Supported platforms: Platform android.pngPlatform ios.pngPlatform winrt.png
Available since: Gideros 2012.8
Inherits from: Object

Description


The Accelerometer class is used to access accelerometer data.

Examples

Example

--create instance
local accelerometer = Accelerometer.new()
--start receiving data
accelerometer:start()
---get values for example on each enter frame event
local x, y, z = accelerometer:getAcceleration()
print(x, y, z)

--once you don't need it, stop it
accelerometer:stop()

Methods

Accelerometer.isAvailable does the accelerometer available?
Accelerometer.new Creates new Accelerometer instance
Accelerometer:getAcceleration returns the 3-axis acceleration measured by the accelerometer
Accelerometer:start starts accelerometer updates
Accelerometer:stop starts accelerometer updates

Events

Constants