纯CSS实现像素化圈圈的Loading特效

(27) 2023-12-06 11:12

Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说纯CSS实现像素化圈圈的Loading特效,希望能够帮助你!!!。

想要让你的网站Loading效果更加出众,不妨试试用纯CSS实现像素化圆圈的特效。这个特效利用CSS的transform和animation属性实现,让圆圈在不断的像素化和还原过程中,形成一个动态、有趣的Loading效果。用简单的CSS代码就能实现,既不用依赖图片,也不用写复杂的JavaScript代码,大大提高了网页加载速度和性能。如果你想让你的网站更具吸引力,就试试这个特效吧!

纯CSS实现像素化圈圈的Loading特效_https://bianchenghao6.com/blog__第1张

<div class="loading">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</div>

<style>
.loading,
.loading > div {
  position: relative;
  box-sizing: border-box;
}

.loading {
  display: block;
  font-size: 0;
  color: #000;
  margin: 30px;
}

.loading.la-dark {
  color: #333;
}

.loading > div {
  display: inline-block;
  float: none;
  background-color: currentColor;
  border: 0 solid currentColor;
}

.loading {
  width: 18px;
  height: 18px;
}

.loading > div {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 0;
  opacity: 0;
  transform: translate(100%, 100%);
  animation: ball-8bits 1s 0s ease infinite;
}

.loading > div:nth-child(1) {
  animation-delay: -0.9375s;
}

.loading > div:nth-child(2) {
  animation-delay: -0.875s;
}

.loading > div:nth-child(3) {
  animation-delay: -0.8125s;
}

.loading > div:nth-child(4) {
  animation-delay: -0.75s;
}

.loading > div:nth-child(5) {
  animation-delay: -0.6875s;
}

.loading > div:nth-child(6) {
  animation-delay: -0.625s;
}

.loading > div:nth-child(7) {
  animation-delay: -0.5625s;
}

.loading > div:nth-child(8) {
  animation-delay: -0.5s;
}

.loading > div:nth-child(9) {
  animation-delay: -0.4375s;
}

.loading > div:nth-child(10) {
  animation-delay: -0.375s;
}

.loading > div:nth-child(11) {
  animation-delay: -0.3125s;
}

.loading > div:nth-child(12) {
  animation-delay: -0.25s;
}

.loading > div:nth-child(13) {
  animation-delay: -0.1875s;
}

.loading > div:nth-child(14) {
  animation-delay: -0.125s;
}

.loading > div:nth-child(15) {
  animation-delay: -0.0625s;
}

.loading > div:nth-child(16) {
  animation-delay: 0s;
}

.loading > div:nth-child(1) {
  top: -100%;
  left: 0;
}

.loading > div:nth-child(2) {
  top: -100%;
  left: 33.3333333333%;
}

.loading > div:nth-child(3) {
  top: -66.6666666667%;
  left: 66.6666666667%;
}

.loading > div:nth-child(4) {
  top: -33.3333333333%;
  left: 100%;
}

.loading > div:nth-child(5) {
  top: 0;
  left: 100%;
}

.loading > div:nth-child(6) {
  top: 33.3333333333%;
  left: 100%;
}

.loading > div:nth-child(7) {
  top: 66.6666666667%;
  left: 66.6666666667%;
}

.loading > div:nth-child(8) {
  top: 100%;
  left: 33.3333333333%;
}

.loading > div:nth-child(9) {
  top: 100%;
  left: 0;
}

.loading > div:nth-child(10) {
  top: 100%;
  left: -33.3333333333%;
}

.loading > div:nth-child(11) {
  top: 66.6666666667%;
  left: -66.6666666667%;
}

.loading > div:nth-child(12) {
  top: 33.3333333333%;
  left: -100%;
}

.loading > div:nth-child(13) {
  top: 0;
  left: -100%;
}

.loading > div:nth-child(14) {
  top: -33.3333333333%;
  left: -100%;
}

.loading > div:nth-child(15) {
  top: -66.6666666667%;
  left: -66.6666666667%;
}

.loading > div:nth-child(16) {
  top: -100%;
  left: -33.3333333333%;
}

@keyframes ball-8bits {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 1;
  }

  51% {
    opacity: 0;
  }
}
</style>

今天的分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

上一篇

已是最后文章

下一篇

已是最新文章

发表回复