JSFiddle - React, Tailwind, and code Playground

by marcoos

HTML

<body>
    <h1>An example of a pulsing box</h1>

    
    <div class="pulsedbox">
      <p>
        This paragraph should pulse. Pulsing is the new blink.
        You heard it here first.
      </p>
    </div>
    
  </body>

CSS

@-moz-keyframes pulse {
       0% {
         background-color: red;
         opacity: 1.0;
         -moz-transform: scale(1.0) rotate(0deg);
       }
       33% {
         background-color: blue;
         opacity: 0.75;
         -moz-transform: scale(1.1) rotate(-5deg);
       }
       67% {
         background-color: green;
         opacity: 0.5;
         -moz-transform: scale(1.1) rotate(5deg);
       }
       100% {
         background-color: red;
         opacity: 1.0;
         -moz-transform: scale(1.0) rotate(0deg);
       }
      }
      
      @-webkit-keyframes pulse {
       0% {
         background-color: red;
         opacity: 1.0;
         -webkit-transform: scale(1.0) rotate(0deg);
       }
       33% {
         background-color: blue;
         opacity: 0.75;
         -webkit-transform: scale(1.1) rotate(-5deg);
       }
       67% {
         background-color: green;
         opacity: 0.5;
         -webkit-transform: scale(1.1) rotate(5deg);
       }
       100% {
         background-color: red;
         opacity: 1.0;
         -webkit-transform: scale(1.0) rotate(0deg);
       }
      }

      .pulsedbox {
       -moz-animation-name: pulse;
       -moz-animation-duration: 4s;
       -moz-animation-iteration-count: infinite;
       -moz-animation-timing-function: ease-in-out;
       
       -webkit-animation-name: pulse;
       -webkit-animation-duration: 4s;
       -webkit-animation-iteration-count: infinite;
       -webkit-animation-timing-function: ease-in-out;
      }
      
      div {
        background-color: red;
        width: 40%;
        padding: 0.2em 1em;
        margin: 6em;
      }

JavaScript

// basically a copy of:
// http://www.webkit.org/blog-files/pulse.html
// with -moz-* stuff added to it along the -webkit-* stuff :)