js实现获取手机gps经纬度位置和陀螺仪数据实现指南针和水平仪效果代码

代码语言:html

所属分类:其他

代码描述:js实现获取手机gps经纬度位置和陀螺仪数据实现指南针和水平仪效果代码,请在手机上预览。

代码标签: 指南针 陀螺仪 手机 位置 经纬度 水平仪

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <style>
        * {
            padding: 0px;
            margin: 0px;
            list-style: none;
        }

        :root,
        body {
            height: 100%;
        }

        body {
            height: 100%;
            display: flex;
            justify-content: center;
        }

        .show {
            height: 95%;
            width: 350px;
            transform: translate3D(0px, 20px, 0px);
        }

        .wrapper {
            position: relative;
            width: 700px;
            height: 100%;
            display: flex;
        }

        /* 第二页水平仪 */
        .wrapper .gradienter-out {
            position: relative;
            height: 100%;
            width: 350px;
        }

        .wrapper .gradienter-out span {
            position: absolute;
            left: calc(50% - 50px);
            top: calc(50% - 50px);
            height: 100px;
            width: 100px;
            border-radius: 50%;
           
        }

        .wrapper .gradienter-out span div {
            position: absolute;

            height: 50px;
            width: 100px;
            top: calc(50% - 25px);
            text-align: center;
            line-height: 50px;
            font-size: 30px;
            font-weight: bold;
            transform-origin: center center;
        }


        /* 第一页 */
        .box {
            position: relative;
            width: 350px;
            height: 100%;

        }

        /* 方向文字、经纬度 */
        .box .text {
            position: absolute;
            width: 350px;
            height: 120px;
            left: calc(50% - 175px);
            top: 20px;
            font-size: 13px;
            font-weight: bold;
        }

        .box .text .direction-angle {
            height: 50px;
            line-height: 50px;
            text-align: center;
            font-size: 30px;
            margin-bottom: 10px;
        }

        .box .text .latitude {

            float: left;
            margin-left: 50px;
            color: rgba(0, 0, 0, .5)
        }

        .box .text .longitude {
            float: right;
            margin-right: 50px;
            color: rgba(0, 0, 0, .5)
        }


        /* 指针 */
        .box .point {
            position: absolute;
            height: 25px;
            width: 2px;
            left: 50%;
            top: 165px;
            background-color: black;
            z-index: 10;
        }

       .........完整代码请登录后点击上方下载按钮下载查看

网友评论0