语言

Menu
Sites
Language
How to use Gravity Sensor in my application

Hi,

I have developed an application in which Gravity Sensor is required.how can i use this.I have searched on help menu but i not got it.

I am developing web application.

please help me

Mohit Kumar

响应

7 回复
Seoghyun Kang

Hello,

 

You can find the SensorBall sample application in the Tizen SDK.

The SensorBall has the code about the gravity.(js/models/gravity.js) I think it will be helpful for you.

 

The following is the core code. Please refer it.

 

window.addEventListener('devicemotion', onDeviceMotion);

/* models/ball.js */
function setMotionData(event) 
{
   motionData = event;
}


/* models/gravity.js */
function calculateGravityBallPosition() 
   {
   var x = 0,
       y = 0,
       ddx = 0,
       ddy = 0;

   if (motionData !== null) 
   {
      x = -motionData.accelerationIncludingGravity.x;
      y = -motionData.accelerationIncludingGravity.y;
   }
   ddx = x * -cdd;
   ddy = y * cdd;
   dX += ddx;
   dY += ddy;
   dX *= resistance;
   dY *= resistance;
   ballX += dX;
   ballY += dY;
} 

 

 

 

mohit kumar

Hi,

Coluld you explain more please.As per your code i have created two files ball.js and gravity.js but its not working

 

 

 

 

 

 

 

 

Thanks and regards

Mohit Kumar

Seoghyun Kang

Hello,

 

Did you test the SensorBall sample in the SDK? If it works well, there is some problem in your code. 

 

I remember that there is no problem on the Z1 target.

 

 

colin Rao

f.y.i.

   window.addEventListener("devicemotion", function(e) 
   {
      /* Data for acceleration */
      firElem.innerHTML = 'acceleration value<br><br> ' 
         + '[ x value: '+ Math.round(e.acceleration.x) + " ]<br>" 
         + '[ y value: '+ Math.round(e.acceleration.y) + " ]<br>" 
         + '[ z value: '+ Math.round(e.acceleration.z) + ']';

      /* Data for acceleration, including gravity */
      secElem.innerHTML = 'accelerationIncludingGravity value<br><br> '
         + '[ x value: ' + Math.round(e.accelerationIncludingGravity.x) + " ]<br>" 
         + '[ y value: ' + Math.round(e.accelerationIncludingGravity.y) + " ]<br>" 
         + '[ z value: ' + Math.round(e.accelerationIncludingGravity.z) + ']';

      /* Data for rotation rate */
      thirElem.innerHTML = 'rotationRate value<br><br> '
         + '[ alpha value: ' + Math.round(e.rotationRate.alpha) + " degree ]<br>" 
         + '[ beta value: ' + Math.round(e.rotationRate.beta) + " degree ]<br>"
         + '[ gamma value: ' + Math.round(e.rotationRate.gamma) + ' degree ]';
   }, true);
mohit kumar

Hi,

I have done what u told.This is my js file it is not working.Could you explain more please.

window.addEventListener("devicemotion", function(e)
   {
      /* Data for acceleration */
      firElem.innerHTML = 'acceleration value<br><br> '
         + '[ x value: '+ Math.round(e.acceleration.x) + " ]<br>"
         + '[ y value: '+ Math.round(e.acceleration.y) + " ]<br>"
         + '[ z value: '+ Math.round(e.acceleration.z) + ']';

      /* Data for acceleration, including gravity */
      secElem.innerHTML = 'accelerationIncludingGravity value<br><br> '
         + '[ x value: ' + Math.round(e.accelerationIncludingGravity.x) + " ]<br>"
         + '[ y value: ' + Math.round(e.accelerationIncludingGravity.y) + " ]<br>"
         + '[ z value: ' + Math.round(e.accelerationIncludingGravity.z) + ']';

      /* Data for rotation rate */
      thirElem.innerHTML = 'rotationRate value<br><br> '
         + '[ alpha value: ' + Math.round(e.rotationRate.alpha) + " degree ]<br>"
         + '[ beta value: ' + Math.round(e.rotationRate.beta) + " degree ]<br>"
         + '[ gamma value: ' + Math.round(e.rotationRate.gamma) + ' degree ]';
   }, true);


window.addEventListener('tizenhwkey', function onTizenHwKey(e) {
    if (e.keyName === 'back') {    
            
        try {
            
            tizen.application.getCurrentApplication().exit();
        } catch (error) {
            console.error("getCurrentApplication(): " + error.message);
        }
        
        
        //window.history.back();
        //window.exit();
        //tau.back();
        //window.close();
         //window.history.exit();
         //navigator.app.exitApp();

    }
});

function myFunction()
{
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}


if (sessionStorage.clickcount === undefined) {
    sessionStorage.clickcount = 3;
}

function music() {
    document.getElementById('myTune7').play();
}

function clickCounter1() {
    if (typeof(Storage) !== "undefined") {
        if (sessionStorage.clickcount >=1) {
            sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
        } else {
           // alert("Game Over");
            
            sessionStorage.clickcount=3;
            window.open("failed.html");
            
        }

        document.getElementById("result").innerHTML = sessionStorage.clickcount;
    } else {
        //document.getElementById("result").innerHTML = "Sorry, your browser does not support web storage...";
    }
}

function clickCounter2() {

    if (typeof(Storage) !== "undefined") {
        if (sessionStorage.clickcount >= 1) {
            sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
        } else {
            //alert("Game Over");
            sessionStorage.clickcount=3;
            window.open("failed.html");

        }

        document.getElementById("result").innerHTML = sessionStorage.clickcount;
    } else {
        document.getElementById("result").innerHTML = "Sorry, your browser does not support web storage...";
    }
}


function clickCounter3() {

    if (typeof(Storage) !== "undefined") {
        if (sessionStorage.clickcount >= 1) {
            sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
        } else {
            //alert("Game Over");
            sessionStorage.clickcount=3;
            window.open("failed.html");
        }

        document.getElementById("result").innerHTML = sessionStorage.clickcount;
    } else {
        document.getElementById("result").innerHTML = "Sorry, your browser does not support web storage...";
    }
}

/*
Question two start here
 */

function clickCounter4() {

    if (typeof(Storage) !== "undefined") {
        if (sessionStorage.clickcount > 0) {
            sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

        } else {
            //alert("Game Over");
            sessionStorage.clickcount=3;
            window.open("failed.html");
        }
        document.getElementById("result").innerHTML = sessionStorage.clickcount;
    } else {
        document.getElementById("result").innerHTML = "Sorry, your browser does not support web storage...";
    }
}

function clickCounter5() {

    if (typeof(Storage) !== "undefined") {
        if (sessionStorage.clickcount > 0) {
            sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
        } else {
            //alert("Game Over");
            sessionStorage.clickcount=3;
            window.open("failed.html");
        }
        document.getElementById("result").innerHTML = sessionStorage.clickcount;
    } else {
        document.getElementById("result").innerHTML = "Sorry, your browser does not support web storage...";
    }

}

function clickCounter6() {

    if (typeof(Storage) !== "undefined") {
        if (sessionStorage.clickcount > 0) {
            sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

        } else {
            //alert("Game Over");
            sessionStorage.clickcount=3;
            window.open("failed.html");
        }
        document.getElementById("result").innerHTML = sessionStorage.clickcount;
    } else {
        document.getElementById("result").innerHTML = "Sorry, your browser does not support web storage...";
    }
}

/*Page Three Start*/

function clickCounter7() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter8() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter9() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Forth start here */

function clickCounter10() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter11() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter12() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter13() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter14() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter15() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Five question start here*/


function clickCounter16() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter17() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter18() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}


/*Sixth start here*/

function clickCounter19() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter20() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter21() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}


/*Seventh start here*/

function clickCounter22() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter23() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
       // alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter24() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Eighth question start here*/

function clickCounter25() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter26() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter27() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Nineth Question Start Here*/
function clickCounter28() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter29() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter30() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Tenth start here*/

function clickCounter31() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter32() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter33() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Eleventh Start Here*/


function clickCounter34() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter35() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
       // alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter36() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
       // alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Twl start here*/

function clickCounter37() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter38() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter39() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Thirteen Start Here*/

function clickCounter40() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter41() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter42() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Fourteen Start here*/

function clickCounter43() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter44() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter45() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter46() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
       // alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter47() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
       // alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter48() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter49() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}


/*Fifteen Start Here*/

function clickCounter50() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter51() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;
    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter52() {

    if (sessionStorage.clickcount > 0) {
        sessionStorage.clickcount = Number(sessionStorage.clickcount) - 1;

    } else {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Sixteen Start Here*/

function clickCounter53() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter54() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter55() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
    
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

 


/*Seventeen Start Here*/

function clickCounter56() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter57() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter58() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
    
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}


/*Question Eighteen Start Here*/


function clickCounter59() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter60() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
}
else
{
//    alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter61() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
    
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Nineteen Start here*/

function clickCounter62() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter63() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter64() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
    
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Twenty Start Here*/

function clickCounter65() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter66() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
}
else
{
//    alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter67() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
    
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*twenty one start here*/

function clickCounter68() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter69() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter70() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
    
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}
function clickCounter71() {

    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
    }

 

/*twenty two start here*/

function clickCounter72() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter73() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter74() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
    
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}


/*twenty three start here*/

function clickCounter75() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter76() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter77() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
    
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

 

/*twenty four start here*/

function clickCounter78() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
        
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

/*Twenty Five start here*/
function clickCounter79() {
    
    if (sessionStorage.clickcount>0)
    {
        sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;  
    }
    else
    {
        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("failed.html");
    }
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter80() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter81() {

if (sessionStorage.clickcount>0)
{
    sessionStorage.clickcount = Number(sessionStorage.clickcount)-1;
    
}
else
{
    //alert("Game Over");
    sessionStorage.clickcount=3;
    window.open("failed.html");
}
document.getElementById("result").innerHTML = sessionStorage.clickcount;
}

function clickCounter82() {

        //alert("Game Over");
        sessionStorage.clickcount=3;
        window.open("index.html");
    document.getElementById("result").innerHTML = sessionStorage.clickcount;
    }

 

AVSukhov

Hello,

More info about gravity sensor:

https://developer.tizen.org/development/guides/native-application/system/sensor#gravity

Devicemotion event spec:

http://www.w3.org/TR/2011/WD-orientation-event-20111201/#devicemotion

Usage devicemotion api you can find in samples of SDK - SensorBall app.

Palitsyna

Hello,

as AVSukhov said, you can find the examole in SDK Samples: File -> New -> tizen Web Project -> Sample -> Sensor Ball