Back

GetRotation

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 );
}
    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 );
}
    Copy     Copy All       Run