본문 바로가기
css/e.g.

[PC] Gradient Doughnut 2 / Loading

by by-choice 2021. 9. 25.
반응형
.loading {
  display: flex;
  height: 100px;
  width: 100px;
  animation: spin 1s infinite linear;
  position: relative;
}
.start-point {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #00dbde;
  z-index: 1;
}
.doughnut { 
  width: 50%;
  height: 100%;
  box-sizing: border-box;
  -webkit-mask:
     linear-gradient(#fff 0 0) padding-box, 
     linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  border: 20px solid transparent;
  &.left {
    border-radius: 50px 0 0 50px;
    background: linear-gradient(to bottom,#00dbde 18%,#fc00ff 87%) border-box;
    border-right: none;
  }
  &.right {
    border-radius: 0 50px 50px 0;
    background: linear-gradient(to top,#fc00ff 13%,transparent) border-box;
    border-left: none;
  }
}

@keyframes spin {
  from {
    transform:rotate(0deg);
  }
  to {
    transform:rotate(360deg);
  }
}
<div class="loading">
  <div class="start-point"></div>
  <div class="doughnut left"></div>
  <div class="doughnut right"></div>
</div>
반응형

댓글