CSS3 自定义 loader 加载

<div class="myloader">
    <div class="loader">
        <div class="dot dot1"></div>
        <div class="dot dot2"></div>
        <div class="dot dot3"></div>
    </div>
</div>

 

.myloader {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.9);
}
.loader {
    width: 8%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
}
.loader .dot {
    width: 0.16rem;
    height: 0.16rem;
    background: #4cbbff;
    border-radius: 50%;
    position: absolute;
    top: calc(50% - 5px);
}

.loader .dot1 {
    left: 0px;
    -webkit-animation: dot-jump 0.5s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate infinite;
    animation: dot-jump 0.5s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate infinite;
}

.loader .dot2 {
    left: 0.4rem;
    -webkit-animation: dot-jump 0.5s 0.2s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate infinite;
    animation: dot-jump 0.5s 0.2s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate infinite;
}

.loader .dot3 {
    left: 0.8rem;
    -webkit-animation: dot-jump 0.5s 0.4s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate infinite;
    animation: dot-jump 0.5s 0.4s cubic-bezier(0.77, 0.47, 0.64, 0.28) alternate infinite;
}

 @-webkit-keyframes dot-jump {
     0% {
         -webkit-transform: translateY(0);
         transform: translateY(0);
     }

     100% {
         -webkit-transform: translateY(-0.3rem);
         transform: translateY(-0.3rem);
     }
 }

 @-moz-keyframes dot-jump {
     0% {
         -webkit-transform: translateY(0);
         -moz-transform: translateY(0);
         transform: translateY(0);
     }

     100% {
         -webkit-transform: translateY(-0.3rem);
         -moz-transform: translateY(-0.3rem);
         transform: translateY(-0.3rem);
     }
 }

 @keyframes dot-jump {
     0% {
         -webkit-transform: translateY(0);
         -moz-transform: translateY(0);
         transform: translateY(0);
     }

     100% {
         -webkit-transform: translateY(-0.3rem);
         -moz-transform: translateY(-0.3rem);
         transform: translateY(-0.3rem);
     }
 }

 

posted @ 2019-04-16 14:31  格鲁特baby  阅读(100)  评论(0编辑  收藏  举报