JSFiddle - React, Tailwind, and code Playground

by anthonylevings

HTML

<body onload="setup()">
<body>
<div id="block">
<h1 id="heading">SketchyTech</h1>
</div>
</body>

CSS

body {
  margin: 0;
  background-color: lightgray;
  } 
#block{
-moz-animation-play-state: paused;
/* duration set to required length in seconds */
-webkit-animation-duration: 3s; 
-moz-animation-duration: 3s; 
/* name of keyframe animation sequence */
-webkit-animation-name: slidedown; 
-moz-animation-name: slidedown; 
/* fill-mode can be set to backwards or both in order to prevent display of contents before animation has begun */
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
 /* position and size at the end of the animation */
margin-top: 25%;
padding-bottom: 100%;
/* other attributes that will be true throughout sequence and following it */
z-index:-1;
background-color: black;
 }
  #heading { 
/* duration set to required length in seconds */
 -webkit-animation-duration: 6s;
  -moz-animation-duration: 6s;
/* name of keyframe animation sequence */
 -webkit-animation-name: slidein; 
  -moz-animation-name: slidein;

/* position at the end of the animation */
margin-left: 50%; 
/* other attributes that will be true throughout sequence and following it */
background-color: lightgray;
      padding: 10px;
      padding-top: 400px;
      color: white;
      opacity: 0.6;
  }
/* beginning of named keyframes corresponding with those named above */
/* assign a name to the keyframes sequence named slidein */
  @-webkit-keyframes slidein { 
/* set starting properties for animation sequence */
from { 
      margin-left: 100%; 
      width: 150% 
    } 
/* set ending properties for animation sequence */     
    to { 
      margin-left: 50%; 
      width: 150%; 
    } 
  } 
  @-moz-keyframes slidein { 
/* set starting properties for animation sequence */
from { 
      margin-left: 100%; 
      width: 150% 
    } 
/* set ending properties for animation sequence */     
    to { 
      margin-left: 50%; 
      width: 150%; 
    } 
  } 

/* assign a name to the keyframes sequence called slidedown */
  @-webkit-keyframes slidedown { 
/* set starting...

JavaScript

var e;
      function setup() {
     e = document.getElementById('heading');     e.addEventListener("webkitAnimationStart", listener, false);
            e.addEventListener("animationstart", listener, false);
      e.addEventListener("webkitAnimationEnd", listener, false);
      e.addEventListener("animationend", listener, false);   
    }
     function listener(e) {
    
      switch(e.type) {
        case "webkitAnimationStart":
          document.getElementById('block').style.webkitAnimationPlayState='paused';
          break;
        case "animationstart":
          document.getElementById('block').style.MozAnimationPlayState='paused';
          break;
        case "webkitAnimationEnd":
         document.getElementById('block').style.webkitAnimationPlayState='running';
          break;
          case "animationend":
       document.getElementById('block').style.MozAnimationPlayState='running';
          break;
      }
    }