Popular Posts

Designing iOS Progress Bar Animation using HTML & CSS

In this article, we will see how to design iOS style progress bar using HTML and CSS only. To create iOS theme we have used "linear-gradient" and shadow is obtained using "background" and "skew".


HTML
<div class="container">
  <img src="https://goo.gl/jNcbdo" alt="ios_logo" />
  <div class="progress">
    <div class="progress-bar">
      <div class="shadow"></div>
    </div>
  </div>
</div>
CSS
html,body {
  height: 100%;
}
body {
  position: relative;
  margin: 0;
  background: rgb(246, 247, 248);
}
.container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.container img {
  margin-bottom: 15px;
  width: 75px;
}
.progress {
  position: relative;
  width: 24em;
  height: 0.25em;
  background-color: rgb(229, 233, 235);
}
.progress-bar {
  position: relative;
  height: 100%;
  background-image: -webkit-linear-gradient(to right, rgb(76, 217, 105), rgb(90, 200, 250), rgb(0, 132, 255), rgb(52, 170, 220), rgb(88, 86, 217), rgb(255, 45, 83));
  background-image: linear-gradient(to right, rgb(76, 217, 100), rgb(90, 200, 250), rgb(0, 122, 255), rgb(52, 170, 220), rgb(88, 86, 214), rgb(255, 45, 85));
  background-size: 24em 0.25em;
  border-radius: 10px;
  -moz-animation: iosProgress 6s ease-in;
  -webkit-animation: iosProgress 6s ease-in;
  animation: iosProgress 6s ease-in;
  animation-delay:.15s;
}
.shadow {
  position: absolute;
  top: 100%;
  width: 100%;
  height: 50px;
  background-image: -webkit-linear-gradient(to bottom, rgb(232, 235, 235), transparent);
  background-image: linear-gradient(to bottom, rgb(232, 235, 235), transparent);
  transform: skew(50deg);
  transform-origin: 0 0;
}

/* Animations */
@-moz-keyframes iosProgress {
  0%, 100% {transition-timing-function: cubic-bezier(1, 0, 0.65, 0.85);}
  0% {width: 0;}
  100% {width: 100%;}
}
@-webkit-keyframes iosProgress {
  0%, 100% {transition-timing-function: cubic-bezier(1, 0, 0.65, 0.85);}
  0% {width: 0;}
  100% {width: 100%;}
}
@keyframes iosProgress {
  0%, 100% {transition-timing-function: cubic-bezier(1, 0, 0.65, 0.85);}
  0% {width: 0;}
  100% {width: 100%;}
}