Loading screen

by Hieu C. Nguyen

HTML

<div class="loader">
  <div class="logo">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/512px-Google_%22G%22_Logo.svg.png" height="28" />
  </div>
</div>

SCSS

.loader {
  position: fixed;
  background-color: #1e1e1e;
  height: 100vh;
  width: 100vw;
  top: 0;
  left: 0;

  .logo {
    height: 60px;
    width: 60px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    position: relative;
     /* text-shadow: 0 1px 1px rgba(#fff, 0.6); */
     backdrop-filter: dropShadow(0 1px 1px rgba(#fff, 0.6));
    &::after,
    &::before {
      position: absolute;
      display: inline-block;
      content: "";
    }
    
    &:after {
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      border-radius: inherit;
      z-index: 2;
      
    background-image: linear-gradient(0deg, #0f1013, #252730);
    box-shadow: 0 4px 4px -1px rgba(0, 0, 0, 0.6), 0 4px 6px 1px rgba(0, 0, 0, 0.3), 0 1px 2px 1px rgba(0, 0, 0, 0) inset, 0 18px 32px -2px rgba(255, 255, 255, 0.1) inset;
    }

    &::before {
      /* border: 4px solid transparent; 
      top: -4px;
      left: -4px; */
      
     border-top: 4px solid #3498db;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      z-index: 1;
      box-shadow: 0 -5px 5px  rgba(#7575f1, 0.3);

      top: -2px;
      left: -1px;
      height: calc(100% + 2px);
      width: calc(100% + 2px);
    }
    
    img {
      z-index: 3;
    }
  }
}

.logo,
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
    border-top-color: #cf3edc;
    box-shadow: 0 -5px 5px  rgba(#7575f1, 0.3);
  }

  50% {
    transform: rotate(180deg);
    border-top-color: #7575f1;
    box-shadow: 0 -5px 5px  rgba(#cf3edc, 0.3);
  }

  100% {
    transform: rotate(360deg);
    border-top-color: #cf3edc;
    box-shadow: 0 -5px 5px  rgba(#7575f1, 0.3);
  }
}