OrientationSensor Component


Properties

angle
  Returns an angle that tells the direction in which the device is tiled. That is, it tells the direction of the force that would be felt by a ball rolling on the surface of the device.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = orientationsensorName.angle

available
  Indicates whether the orientation sensor is present on the device.
Data type: boolean
Designer Writable false
Code Writeable false
Code Readable true let variable = orientationsensorName.available

azimuth
  Returns the azimuth angle of the device. To return meaningful values the sensor must be enabled.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = orientationsensorName.azimuth

enabled
  Specifies whether the orientation sensor is enabled.
Data type: boolean
Designer Writable true <orientationsensor name="orientationsensorName" enabled="true">
Code Writeable true orientationsensorName.enabled = true
Code Readable true let variable = orientationsensorName.enabled

magnitude
  Returns a number between 0 and 1 indicating how much the device is tilted. It gives the magnitude of the force that would be felt by a ball rolling on the surface of the device. For the angle of tilt, use Angle.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = orientationsensorName.magnitude

pitch
  Returns the pitch angle of the device. To return meaningful values the sensor must be enabled.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = orientationsensorName.pitch

roll
  Returns the roll angle of the device. To return meaningful values the sensor must be enabled.
Data type: number
Designer Writable false
Code Writeable false
Code Readable true let variable = orientationsensorName.roll

class
  The styling class of the the component
Data type: string
Designer Writable true <orientationsensor name="orientationsensorName" class="Test class">
Code Writeable false
Code Readable false

id
  The styling id of the the component
Data type: string
Designer Writable true <orientationsensor name="orientationsensorName" id="Test id">
Code Writeable false
Code Readable false

name
  The name of the component that will be used to refer to it in code.
Data type: string
Designer Writable true <orientationsensor name="orientationsensorName" name="testComponent">
Code Writeable false
Code Readable false

Methods

Method name Description Parameters
addEventListener Method used to create event listeners.
See Events below for samples.
eventName string
eventCallbackFunction callback

Events

Event name Description Parameters
orientationChanged The OrientationChanged event handler is run when the orientation has changed.
orientationsensorName.addEventListener(
    "orientationChanged",
    function (azimuth, pitch, roll) {
        //Your code here
    }
)
azimuth number
pitch number
roll number