捕获相对加速度计倾斜
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了捕获相对加速度计倾斜相关的知识,希望对你有一定的参考价值。
function sample() { vmax = latest.x + 0.25; vmin = latest.x - 0.25; vrange = 0.50; hmax = latest.y + 0.25; hmin = latest.y - 0.25; hrange = 0.50; } function move() { var hposition = 0; var vposition = 0; vposition = ( ( ( latest.x - vmin ) / vrange ) * BRICKS_SPACE ) + BRICKS_MAXIMUM; hposition = ( ( latest.y - hmin ) / hrange ) * LEGS_SPACE; // Keep in bounds if( vposition > BRICKS_MAXIMUM ) { vposition = BRICKS_MAXIMUM; } else if( vposition < BRICKS_MINIMUM ) { vposition = BRICKS_MINIMUM; } if( hposition < LEGS_MINIMUM ) { hposition = LEGS_MINIMUM; } else if( hposition > LEGS_MAXIMUM ) { hposition = LEGS_MAXIMUM; } $( '#background' ).css( 'top', vposition ); $( '#legs' ).css( 'left', hposition ); }
以上是关于捕获相对加速度计倾斜的主要内容,如果未能解决你的问题,请参考以下文章