Sunny-117 / js-challenges

✨✨✨ Challenge your JavaScript programming limits step by step

Home Page:https://juejin.cn/column/7244788137410560055

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

实现一个秒针绕一点转动的效果

Sunny-117 opened this issue · comments

commented
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style lang="css">
      .clock {
        width: 200px;
        height: 200px;
        border: 2px solid #000;
        border-radius: 50%;
        position: relative;
      }

      .hand {
        width: 1px;
        height: 100px;
        background-color: #000;
        position: absolute;
        top: 50%;
        left: 50%;
        transform-origin: center top;
        animation: 60s rotate linear infinite;
      }

      @keyframes rotate {
        100% {
          transform: rotate(360deg);
        }
      }
    </style>
  </head>
  <body>
    <div class="clock">
      <div class="hand"></div>
    </div>
  </body>
</html>