I am experiencing an issue with the typing animation where it stops at a specific character count every time. If I make the statement longer, it gets cut off; if I make it shorter, it continues until reaching that set character count. Although I know I need to adjust the number of steps (currently set at 50), the actual stopping point is at 28 characters.
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime&family=Source+Code+Pro:wght@200&display=swap');
html {
min-height: 100%;
overflow: hidden;
}
body {
height: calc(100vh - 8em);
padding: 0;
margin: 0;
color: #FFF;
font-family: 'Courier Prime', monospace;
background-color: rgb(0, 0, 0);
}
.video-bg {
position: absolute;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
opacity: .5;
}
.line {
position: relative;
top: 75%;
width: 24em;
margin: auto;
border-right: 2px solid #FFF;
font-size: 18px;
text-align: center;
white-space: nowrap;
overflow: hidden;
transform: translateY(-50);
}
.anim-typewriter {
animation: typewriter 5s steps(50) 1s 1 normal both, blinkTextCursor 750ms steps(40) infinite normal;
}
@keyframes typewriter {
from {
width: 0;
}
to {
width: 16em;
}
}
@keyframes blinkTextCursor {
from {
border-right-color: transparent;
}
to {
border-right-color: rgb(155, 211, 71);
}
}
<p class="line anim-typewriter">Under construction...</p>