Difference between revisions of "Accelerometer"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
<!-- GIDEROSOBJ:Accelerometer -->
 
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]]<br/>
 
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]]<br/>
 
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
 
'''<translate>Available since</translate>:''' Gideros 2012.8<br/>
Line 22: Line 23:
 
| 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>Accelerometer - does the accelerometer available?</translate>''<br/>
+
[[Special:MyLanguage/Accelerometer.isAvailable|Accelerometer.isAvailable]] ''<translate>does the accelerometer available?</translate>''<br/><!-- GIDEROSMTD:Accelerometer.isAvailable -->
[[Special:MyLanguage/Accelerometer.new|Accelerometer.new]] ''<translate>Creates new Accelerometer instance</translate>''<br/>
+
[[Special:MyLanguage/Accelerometer.new|Accelerometer.new]] ''<translate>Creates new Accelerometer instance</translate>''<br/><!-- GIDEROSMTD:Accelerometer.new -->
[[Special:MyLanguage/Accelerometer:getAcceleration|Accelerometer:getAcceleration]] ''<translate>Accelerometer - returns the 3-axis acceleration measured by the accelerometer</translate>''<br/>
+
[[Special:MyLanguage/Accelerometer:getAcceleration|Accelerometer:getAcceleration]] ''<translate>returns the 3-axis acceleration measured by the accelerometer</translate>''<br/><!-- GIDEROSMTD:Accelerometer:getAcceleration -->
[[Special:MyLanguage/Accelerometer:start|Accelerometer:start]] ''<translate>Accelerometer - starts accelerometer updates</translate>''<br/>
+
[[Special:MyLanguage/Accelerometer:start|Accelerometer:start]] ''<translate>starts accelerometer updates</translate>''<br/><!-- GIDEROSMTD:Accelerometer:start -->
[[Special:MyLanguage/Accelerometer:stop|Accelerometer:stop]] ''<translate>Accelerometer - starts accelerometer updates</translate>''<br/>
+
[[Special:MyLanguage/Accelerometer:stop|Accelerometer:stop]] ''<translate>starts accelerometer updates</translate>''<br/><!-- GIDEROSMTD:Accelerometer:stop -->
 
| 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 14:53, 31 August 2018

Supported platforms: Platform android.pngPlatform ios.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