Welcome page of a website

It has background color transitions and a nice typing animation.

by academiax

HTML

<div >
  <pre id="welcome" class="welcome"></pre>
</div>



<div class = "reload" onclick="reload()" title = "Reload">
  🌀
</div>

CSS

.main-div {
  width: 100vw;
  height: 100vh;
  background: linear-gradient(to left bottom, #e41875 0%, #520ca9 100%);
  background-size: 100% 400%;
  background-position: 0 0;
  animation: animateGradient 5s ease infinite;
  animation-delay: 1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes animateGradient {
  0% {
    background-position: 0 0;
  }

  50% {
    background-position: 0 100%;
  }

  100% {
    background-position: 0 0;
  }
}

.welcome {
  font-size: 60px;
  position: relative;
  height: 60px;
  user-select: none;
}

.welcome::after {
  content: '';
  height: 120%;
  width: 2px;
  background: white;
  position: absolute;
  animation: jhapak .8s infinite;
 
}

@keyframes jhapak {
  0%{
    opacity: 0;
  }
  50%{
    opacity: 1;
  }
  100%{
    opacity: 0;
  }
}

body {
  margin: 0;
  padding: 0;
  color: white;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


.reload {
  position: fixed;
  z-index: 1;
  right: 5px;
  bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  cursor: pointer;
}

JavaScript

var str = "carpe diem";
var ele = document.getElementById('welcome');
var i = 0;

setTimeout(type, 2000);

function type() {
	while (i < str.length) {
  (
    function(i) {
      setTimeout(() => {
        ele.innerHTML += str[i];
      }, 200 * i)
    }
  )(i++);
	}
}


function reload() {
	window.location.reload(true);
}