华为太空人表盘-全部代码

华为太空人表盘-全部代码

简介

为装修 本站 于是乎去找了一下  太空人表盘,然后找到了(超级不开心)于是我就当了网络裁缝,给他扒了下来(内衣都搞到手那种)

图片[1]-华为太空人表盘-全部代码-小白资源博客-个人技术分享
图片[2]-华为太空人表盘-全部代码-小白资源博客-个人技术分享

代码

index

<html>
<head>
    <title>太空人表盘</title>
    <meta charset="UTF-8">
    <link href="index.css" rel="stylesheet">
    <script src="index.js"></script>
</head>
<body>
<div class="jun-meter">
    <div class="jun-time-h-h" id="hh"></div>
    <div class="jun-time-h-l" id="hl"></div>
    <div class="jun-time-rect"></div>
    <div class="jun-human"></div>
    <div class="jun-time-m-h" id="mh"></div>
    <div class="jun-time-m-l" id="ml"></div>
    <div class="jun-time-s-h" id="sh"></div>
    <div class="jun-time-s-l" id="sl"></div>
    <div class="jun-date" id="date"></div>
    <div class="jun-calendar-date" id="calendarDate"></div>
</div>
</body>

<script>

    function WatchMeter() {
        // 初始化dom
        this._initDom()
        // 更新
        this.update()

        this.date = new TimeGeneration()

    }

    // 修改原型
    WatchMeter.prototype = {
        constructor: WatchMeter,
        // 初始化Dom
        _initDom: function () {
            this.elem = {}
            this.elem.hh = document.getElementById('hh')
            this.elem.hl = document.getElementById('hl')
            this.elem.mh = document.getElementById('mh')
            this.elem.ml = document.getElementById('ml')
            this.elem.sh = document.getElementById('sh')
            this.elem.sl = document.getElementById('sl')
            this.elem.date = document.getElementById('date')
            this.elem.calendarDate = document.getElementById('calendarDate')
        },

        // 更新
        update: function () {
            var _this = this
            setInterval(function () {
                _this._render(_this.date.getDate(), _this.date.getCalendarDate(), _this.date.getTime())
            }, 1000)
        },

        // 渲染
        _render: function (date, calendarDate, time) {
            this._setNumberImage(this.elem.hh, time[0])
            this._setNumberImage(this.elem.hl, time[1])
            this._setNumberImage(this.elem.mh, time[2])
            this._setNumberImage(this.elem.ml, time[3])
            this._setNumberImage(this.elem.sh, time[4])
            this._setNumberImage(this.elem.sl, time[5])
            this.elem.date.innerText = date[2] + " " +date[0] + "-" +date[1]
            this.elem.calendarDate.innerText = calendarDate
        },

        // 设置数字图片
        _setNumberImage: function (elem, value) {
            elem.style.backgroundImage = "url(img/" + value + ".svg)";
        }
    }

    var myWatchMeter = new WatchMeter()


</script>

</html>

后端就不发了,自己去下载吧

下载

蓝奏云 :https://yxyp.lanzouy.com/i5J2B0beaa9a


小白资源博客-个人技术分享,原文地址: https://www.yxyp.cc/107
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片