zoukankan      html  css  js  c++  java
  • 用animation实现钟表动画

    HTML部分,只需要存放三个图片就可以了

           <div class="clock">
            <div class="sec"></div>
            <div class="min"></div>
            <div class="hour"></div>
         </div>    

    CSS部分

        <style>
            @keyframes secrun{
                0%{
                    transform: rotate(180deg);
                }
                100%{
                    transform: rotate(540deg);
                }
            }
            @keyframes minrun{
                0%{
                    transform: rotate(180deg);
                }
                100%{
                    transform: rotate(540deg);
                }
            }
            .clock{
                background-image: url(clock.png);
                background-repeat: no-repeat;
                width: 512px;
                height: 512px;
                position: relative;
            }
            .sec{
                background-image: url(second.png);
                background-repeat: no-repeat;
                width: 16px;
                height: 278px;
                position: absolute;
                top: 180px;
                left: 247px;
                transform: rotate(180deg);
                transform-origin: center 76px;  
                z-index: 3;
                animation: secrun 60s steps(60,end) infinite;
            }
            .min{
                background-image: url(minute.png);
                background-repeat: no-repeat;
                width: 32px;
                height: 218px;
                position: absolute;
                top: 240px;
                left: 239px;
                transform: rotate(180deg);
                transform-origin: center 16px;  
                z-index: 2;
                animation: minrun 3600s steps(60,end) infinite;
            }
            .hour{
                background-image: url(hour.png);
                background-repeat: no-repeat;
                width: 32px;
                height: 148px;
                position: absolute;
                top: 180px;
                left: 238px;
                transform: rotate(180deg);
                transform-origin: center 46px;  
                z-index: 1;
            }
        </style>
  • 相关阅读:
    关于 下载 nfs-utils时的 gssproxy conflicts with selinux-policy-3.13.1-102.el7.noarch 错误
    SCP命令
    DHCP服务
    NFS服务
    ssh免密登录
    可见性判断
    (八)图像处理
    (八)图像处理
    (八)Grahpics之Blit
    (七)时间动画_Time
  • 原文地址:https://www.cnblogs.com/wangzheng98/p/11167831.html
Copyright © 2011-2022 走看看