Loading Shimmer Effect

by TrickyUI

HTML

<div class="card animated-background">
  <div class="background-masker line-one-third"></div>
  <div class="background-masker line-full"></div>
  <div class="background-masker line-one-forth"></div>
  <div class="background-masker line-full"></div>
  <div class="background-masker line-full"></div>
  <div class="background-masker line-full"></div>
  <div class="background-masker line-full"></div>
  <div class="background-masker line-full"></div>
</div>

CSS

.card {
  border: 15px solid #fff;
  margin: 10px;
  box-shadow: 0 1px 1px 0 rgba(0,0,0,.05), 0 1px 2px 0 rgba(0,0,0,.1), 0 2px 20px 0 rgba(0,0,0,.2);
}

.animated-background {
  animation-duration: 1s;
  animation-fill-mode: forwards;
  animation-iteration-count: infinite;
  animation-name: shimmer;
  animation-timing-function: linear;
  background: #f6f7f8;
  background: linear-gradient(to right, #e5e5e5 8%, #f5f5f5 18%, #e5e5e5 33%);
  background-size: 800px 104px;
  height: 130px;
  position: relative
}

@keyframes shimmer {
  0% {
      background-position: -200px 0
  }
  100% {
      background-position: 468px 0
  }
}

.background-masker {
  height: 10px;
  background: #fff;
}
.background-masker:nth-child(n+4):not(:last-child) {
  margin-bottom: 10px;
}

.background-masker.line-one-third {
  width: 30%;
  margin-left: 70%;
}
.background-masker.line-one-forth {
  width: 20%;
  margin-left: 80%;
}
.background-masker.full {
  width: 100%;
}