• 时钟案例


    <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>
  • 相关阅读:
    美达飞凡16X DVD起死回生记
    vs2k5 中asp.net "Web Site Administration Tool "使用中遇到的问题
    有关sqlserver的锁
    基于dotnet2.0的联通sgip1.2协议二级网关源码
    .net winform下TreeNode在没有子结点时也显示+号的解决办法
    小胜凭智, 大胜靠德
    寄语八十年代的新一代
    PHP+APACHE+MYSQL+WINDOWS 环境配置秘笈,一定行!!!!
    JS获取当前屏幕分辨率
    godaddy免费空间安装wordpress教程之500错误的解决办法/读写权限修改
  • 原文地址:https://www.cnblogs.com/lujieting/p/10230711.html
Copyright © 2020-2023  润新知