Infinite Loader

by piiantom

HTML

<div class="content">
  <div class="loading">
    <span class="title">loading...</span>
    <div class="loading-bar">
      <span class="bar-animation"></span>
    </div>
  </div>
</div>

CSS

.content {
  width: 500px;
  height: 100vh;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    flex: 1;
}

.loading .title {
    font-size: 14px;
    color:  #A5ADBA;
    margin-bottom: 20px;
    transition: 1s all ease-out;
    animation-name: loading-text;
    animation-duration: 2s;
    animation-iteration-count: infinite;
}

.loading-bar {
    width: 100%;
    height: 3px;
    background: #EBECF0;
    position: relative;
    overflow: hidden;
}

.bar-animation {
    width: 50%;
    height: 3px;
    background: #0055D5;
    position: absolute;
    transition: 1s all ease-out;
    animation-name: loading-interminate;
    animation-duration: 2s;
    animation-iteration-count: infinite;
}

@keyframes loading-interminate {
  0% {
    left: 0;
    width: 0;
  }
  
  50% {
    left: 10%;
  }
  
  70% {
    left: 60%;
  }
  
  100% {
    left: 100%;
    right: 0;
  }
}

@keyframes loading-text {
  to {
    opacity: .5;
  }
  
  from {
    opacity: 10;
  }
}