zoukankan      html  css  js  c++  java
  • 时钟案例

    <style>
    *{
    margin: 0;
    padding: 0;
    }
    .clock{
    300px;
    height: 300px;
    border: 10px solid #ccc;
    margin: 100px auto;
    border-radius: 50%;
    position: relative;
    }
    .line{
    8px;
    height: 300px;
    background-color: #cccccc;
    position: absolute;
    left: 50%;
    top:0;
    transform: translate(-50%,0);
    }
    .line1,.line4{
    10px;

    }
    .line2{
    transform: translate(-50%,0) rotate(30deg);
    }
    .line3{
    transform: translate(-50%,0) rotate(60deg);
    }
    .line4{
    transform: translate(-50%,0) rotate(90deg);
    }
    .line5{
    transform: translate(-50%,0) rotate(120deg);
    }
    .line6{
    transform: translate(-50%,0) rotate(150deg);
    }
    .cover{
    250px;
    height: 250px;
    background-color: #fff;
    position: absolute;
    left: 50%;
    top:50%;
    transform: translate(-50%,-50%);
    border-radius: 50%;
    }
    .hour,
    .minute,
    .second{
    position: absolute;
    left: 50%;
    top:50%;
    transform: translate(-50%,-100%);
    }
    .hour{
    8px;
    height: 80px;
    background-color: red;
    transform-origin: center bottom;
    animation: clockAnimation 43200s linear infinite;
    }
    .minute{
    5px;
    height: 100px;
    background-color: green;
    transform-origin: center bottom;
    animation: clockAnimation 3600s linear infinite;
    }
    .second{
    2px;
    height: 120px;
    background-color: blue;
    /*设置旋转轴心*/
    transform-origin: center bottom;
    /*添加动画*/
    animation: clockAnimation 60s infinite steps(60);
    /*steps(60)与animation-timing-function的其它属性冲突*/
    /*animation-timing-function: steps(60);*/
    }
    .center{
    20px;
    height: 20px;
    background-color: #cccccc;
    position: absolute;
    left: 50%;
    top:50%;
    transform: translate(-50%,-50%);
    border-radius: 50%;
    }
    @keyframes clockAnimation{
    from{
    transform: translate(-50%,-100%) rotate(0deg);
    }
    to{
    transform: translate(-50%,-100%)rotate(360deg);
    }
    }
    </style>
    </head>
    <body>
    <div class="clock">
    <div class="line line1"></div>
    <div class="line line2"></div>
    <div class="line line3"></div>
    <div class="line line4"></div>
    <div class="line line5"></div>
    <div class="line line6"></div>
    <div class="cover"></div>
    <div class="hour"></div>
    <div class="minute"></div>
    <div class="second"></div>
    <div class="center"></div>
    </div>
  • 相关阅读:
    Linux时间子系统之一:clock source(时钟源)【转】
    浅谈linux的死锁检测 【转】
    Linux内核死锁检测机制【转】
    spin_lock、spin_lock_irq、spin_lock_irqsave区别【转】
    Microsoft Security Essential: 微软安全软件
    Linux内核同步机制之(三):memory barrier【转】
    ftrace的使用【转】
    Linux下安装Python-3.3.2【转】
    Linux驱动修炼之道-RTC子系统框架与源码分析【转】
    Python应用与实践【转】
  • 原文地址:https://www.cnblogs.com/lujieting/p/10230711.html
Copyright © 2011-2022 走看看