<div class="container">
  <h1>2021 Loading</h1>
  <h2>We are <i id="percentage">54%</i> there</h2>
  <div class="loader" id="loader">
    <span></span>
  </div>
</div>
* {
  margin: 0;
  padding: 0;
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #9b5de5;
}
.container {
  display: flex;
  height: 100vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #00bbf9;
}
.loader {
  margin-top: 25px;
  width: 200px;
  height: 25px;
  background: #efefef;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  span {
    position: absolute;
    height: 100%;
    width: 0%;
    background: #f15bb5;
    left: 0;
    top: 0;
    transition: width 5s ease-in;
  }
}
View Compiled
const now = new Date();
const start = new Date(now.getFullYear(), 0, 0);
const diff =
  now -
  start +
  (start.getTimezoneOffset() - now.getTimezoneOffset()) * 60 * 1000;
const oneDay = 1000 * 60 * 60 * 24;
const day = Math.floor(diff / oneDay);

const percentage = Math.floor((day / 365) * 100);

const loader = document.getElementById("loader");
const loaderBar = loader.querySelector("span");
const percentageText = document.getElementById("percentage");

percentageText.innerHTML = percentage + "%";

setTimeout(function () {
  loaderBar.style.width = percentage + "%";
}, 100);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.