溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何使用HTML5實(shí)現(xiàn)一個時鐘動畫

發(fā)布時間:2022-03-01 10:08:48 來源:億速云 閱讀:116 作者:小新 欄目:web開發(fā)

這篇文章主要為大家展示了“如何使用HTML5實(shí)現(xiàn)一個時鐘動畫”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“如何使用HTML5實(shí)現(xiàn)一個時鐘動畫”這篇文章吧。

  具體細(xì)節(jié)注意見代碼:

  時鐘

  *{

  padding: 0;

  margin: 0;

  }

  .clock{

  width: 300px;

  height: 300px;

  border: 10px solid #ccc;

  border-radius: 50%;

  margin: 20px auto;

  position: relative;

  }

  .line{

  width: 8px;

  height: 300px;

  background-color: #ccc;

  position: absolute;

  left: 50%;

  top: 0;

  transform: translate(-50%,0);

  }

  .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{

  width: 250px;

  height: 250px;

  border-radius: 50%;

  background-color: #fff;

  position: absolute;

  left: 50%;

  top: 50%;

  transform: translate(-50%,-50%);

  }

  .hour{

  width: 6px;

  height: 80px;

  background-color: red;

  position: absolute;

  left: 50%;

  top: 50%;

  transform: translate(-50%,-100%);

  transform-origin: center bottom;

  -webkit-animation: move 43200s linear infinite;

  }

  .minute{

  width: 4px;

  height: 90px;

  background-color: green;

  position: absolute;

  left: 50%;

  top: 50%;

  transform: translate(-50%,-100%);

  transform-origin: center bottom;

  -webkit-animation: move 3600s linear infinite;

  }

  .second{

  width: 2px;

  height: 100px;

  background-color: blue;

  position: absolute;

  left: 50%;

  top: 50%;

  transform: translate(-50%,-100%);

  transform-origin: center bottom;

  -webkit-animation: move 60s infinite steps(60);

  }

  .center{

  width:20px;

  height:20px;

  background-color: #ccc;

  border-radius: 50%;

  position: absolute;

  left: 50%;

  top: 50%;

  transform: translate(-50%,-50%);

  }

  @keyframes move{

  0%{

  transform: translate(-50%,-100%) rotate(0deg);

  }

  100%{

  transform: translate(-50%,-100%) rotate(360deg);

  }

  }

以上是“如何使用HTML5實(shí)現(xiàn)一個時鐘動畫”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI