Back

GetRotation

JS Py
Hello World

Returns the current rotation of the device around it's Z-Axis in 90 degree steps.

app.GetRotation() → Number: angle in degrees (0..360): 0 or 90 or 180 or 270

The values are relative to the initial orientation of the device on startup.

See Also: GetOrientation

Example - Repeatedly Show Rotation

function OnStart()
{
    app.Animate( ShowRotation, 2 );
}

function ShowRotation()
{
    var mode = app.GetRotation();
    app.ShowPopup( mode );
}
from native import app

def OnStart():
    app.Animate(ShowRotation, 2)

def ShowRotation(time, dtime):
    mode = app.GetRotation()
    app.ShowPopup(mode)
    Copy     Copy All       Run      

Example - Show Rotation and switch Orientation

cfg.Portrait;

function OnStart()
{
    app.Animate( ShowRotation, 2 );
    setTimeout( 'app.SetOrientation("landscape")', 5000 );
}

function ShowRotation()
{
    var mode = app.GetRotation();
    app.ShowPopup( mode );
}
# cfg.Portrait

from native import app

def OnStart():
    app.Animate(ShowRotation, 2)
    app.SetTimeout('app.SetOrientation("landscape")', 5000)

def ShowRotation(time, dtime):
    mode = app.GetRotation()
    app.ShowPopup(mode)
    Copy     Copy All       Run