<div class="container">
  <div class="effect-wrap">
    <div>
      <h1 class="effect-block">
          <span>Simple Reveal Effect</span>
     </h1>
     <h1 class="effect-block" id="another">
          <span>Using HTML And CSS</span>
     </h1>
    </div>
  </div>
</div>
@import url("https://fonts.googleapis.com/css?family=Barriecito&display=swap");

$primary-color: #f9ff57;
$secondary-color: #9933ab;

* {
  box-sizing: border-box;

  &:before,
  &:after {
    box-sizing: border-box;
  }
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  width: 100%;
  height: 100vh;
  font-family: "Barriecito", cursive;
  background-color: #1c1c1c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='105' viewBox='0 0 80 105'%3E%3Cg fill-rule='evenodd'%3E%3Cg id='death-star' fill='%23404040' fill-opacity='0.37'%3E%3Cpath d='M20 10a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V10zm15 35a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V45zM20 75a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V75zm30-65a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V10zm0 65a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V75zM35 10a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V10zM5 45a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V45zm0-35a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V10zm60 35a5 5 0 0 1 10 0v50a5 5 0 0 1-10 0V45zm0-35a5 5 0 0 1 10 0v20a5 5 0 0 1-10 0V10z' /%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.container {
  padding: 0 10px;
}

h1 {
  color: #fff;
  font-size: 30px;
  text-transform: uppercase;
  margin: 0;
  width: 100%;
  position: relative;
  padding: 10px;
  
  @media only screen and (min-width: 768px) {
    font-size: 40px;
    padding: 10px 20px; 
  }
  
  @media only screen and (min-width: 992px) {
    font-size: 50px;
  }
  
  @media only screen and (min-width: 1170px) {
    font-size: 72px;
  }
  
}

.effect-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  height: 100vh;
}

.effect-block {
  span {
    opacity: 0;
    animation: text-visible 0.0001s linear forwards;
    animation-delay: 1.5s;
  }

  &:after {
    content: "";
    top: 0;
    left: 0;
    position: absolute;
    width: 0%;
    height: 100%;
    background: $primary-color;
    animation: effect-block 2s cubic-bezier(0.19, 1, 0.22, 1) infinite;
    animation-delay: 1s;
  }
}

#another {
  top: 30px;
  
  @media only screen and (min-width: 992px) {
    left: 100px;
  }

  span {
    animation-delay: 2s;
  }

  &.effect-block:after {
    background: $secondary-color;
    animation-delay: 1.4s;
  }
}

@keyframes effect-block {
  0% {
    left: 0;
    width: 0%;
  }
  50% {
    left: 0;
    width: 100%;
  }
  100% {
    left: 100%;
    width: 0%;
  }
}

@keyframes text-visible {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
View Compiled
// No js is harmed

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.