欧美性猛交xxx嘿人猛交_又色又爽又高潮免费观看_精品国产一区二区三区久久影院_青娱乐极品视觉盛宴国产视频

技術頻道導航
HTML/CSS
.NET技術
IIS技術
PHP技術
Js/JQuery
Photoshop
Fireworks
服務器技術
操作系統
網站運營

贊助商

分類目錄

贊助商

最新文章

搜索

純CSS實現的轉動的圓環加載動畫

作者:admin    時間:2022-1-23 9:52:59    瀏覽:

本文介紹一款加載動畫,是個旋轉的圓環,這個圓環動畫跟以前介紹過的旋轉圓環動畫不同之處在于,這個圓環在轉動過程中,是會更換顏色的,每轉一圈,就更換一個顏色。有喜歡這種風格的嗎?可以下載源碼到本地看看。

demodownload

HTML

<svg class="loader" viewBox="0 0 24 24">
  <circle class="loader__value" cx="12" cy="12" r="10" />
  <circle class="loader__value" cx="12" cy="12" r="10" />
  <circle class="loader__value" cx="12" cy="12" r="10" />
  <circle class="loader__value" cx="12" cy="12" r="10" />
  <circle class="loader__value" cx="12" cy="12" r="10" />
  <circle class="loader__value" cx="12" cy="12" r="10" />
</svg>

HTML使用SVG實現,class值是loader,可以通過viewBoxcycxr的屬性值來設置圓環的大小及位置。

我們看到HTML里有6個circle標簽,這代表有6個不同顏色的圓環轉動,這需要CSS作相應的設置。

CSS

.loader {
  -webkit-animation: loader-turn 1s linear infinite;
          animation: loader-turn 1s linear infinite;
  padding: 1rem;
  max-width: 60px;
  width: 100%;
}
@-webkit-keyframes loader-turn {
  50% {
    transform: rotate(180deg);
  }
  100% {
    transform: rotate(720deg);
  }
}
@keyframes loader-turn {
  50% {
    transform: rotate(180deg);
  }
  100% {
    transform: rotate(720deg);
  }
}

.loader__value {
  -webkit-animation: loader-stroke 6s linear infinite;
          animation: loader-stroke 6s linear infinite;
  fill: none;
  stroke-dasharray: 63;
  stroke-dashoffset: 63;
  stroke-linecap: round;
  stroke-width: 4;
}
.loader__value:nth-child(1) {
  stroke: dodgerblue;
}
.loader__value:nth-child(2) {
  stroke: mediumspringgreen;
  -webkit-animation-delay: 1s;
          animation-delay: 1s;
}
.loader__value:nth-child(3) {
  stroke: crimson;
  -webkit-animation-delay: 2s;
          animation-delay: 2s;
}
.loader__value:nth-child(4) {
  stroke: peachpuff;
  -webkit-animation-delay: 3s;
          animation-delay: 3s;
}
.loader__value:nth-child(5) {
  stroke: chocolate;
  -webkit-animation-delay: 4s;
          animation-delay: 4s;
}
.loader__value:nth-child(6) {
  stroke: pink;
  -webkit-animation-delay: 5s;
          animation-delay: 5s;
}
@-webkit-keyframes loader-stroke {
  8.3333333333% {
    stroke-dashoffset: 0;
  }
  16.6666666667%, 100% {
    stroke-dashoffset: 63;
  }
}
@keyframes loader-stroke {
  8.3333333333% {
    stroke-dashoffset: 0;
  }
  16.6666666667%, 100% {
    stroke-dashoffset: 63;
  }
}

.loader__value:nth-child()的數值由1到6,設置6個圓環的顏色,以及動畫延遲時間。

.loader__value設置圓環的樣式,fill: none; 表示圓環內無填充,animation: loader-stroke 6s linear infinite;表示每6s循環轉動一次。

總結

本文介紹一款加載動畫,是個旋轉的圓環,這個圓環動畫跟以前介紹過的旋轉圓環動畫不同之處在于,這個圓環在轉動過程中,是會更換顏色的,每轉一圈,就更換一個顏色。

該實例是純CSS實現的,無需用到第三方插件,也無需用到JS編程,方便使用。

您可能對以下文章也感興趣

標簽: css-loading  加載動畫  
x