JSFiddle - React, Tailwind, and code Playground

by mauricederegt

HTML

<div class="cover">

  <p>Sliding Doors!</p>
</div>

<div id="x">Doors are open</div>

CSS

@-webkit-keyframes move {
    30% {
        right: 50%;  
    }
    40% {
        right: 95%;   
    }
    60% {
        right: 95%;   
    }
    70% {
        right: 50%;   
    }
}
@-webkit-keyframes move2 {
    30% {
        left: 50%;  
    }
    40% {
        left: 95%;   
    }
    60% {
        left: 95%;   
    }
    70% {
        left: 50%;   
    }
}

body {
  font-family: Tahoma, sans-serif;
  font-size: 12px;
  color: #333;
  line-height: 1.5em;
}

.cover {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 20px auto;
  background-color: #eee;
  z-index: 1;
  overflow: hidden;
  
  -webkit-box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  -mox-box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.cover p {
  text-align: center;
  margin: 0;
}

.cover::before {
  content: "";
  position: absolute;
  background: #41B5F0;
  bottom: 0; right: 50%; left: 0; top: 0;
  -webkit-animation: move 3s linear infinite;
}

.cover::after {
  content: "";
  position: absolute;
  background: #0C5CA3;
  bottom: 0;
  left: 50%;
  right: 0;
  top: 0;
   -webkit-animation: move2 3s linear infinite; 
}