<div id="anime-demo">
  <div class="line">
    <div class="square blue"></div>
    <div class="square red"></div>
    <div class="square" id="special"></div>
    <div class="square blue"></div>
    <div class="square red"></div>
    <div class="square black"></div>
    <div class="square blue"></div>
    <div class="square red"></div>
    <div class="square black"></div>
  </div>
</div>
<div class="controls">
<button class="play-scan">Replay All Animations</button></div>
body {
  margin: 20px;
  font-family: 'Lato';
  font-weight: 300;
  font-size: 1.2em;
  text-align: center;
}

button {
  background: orange;
  color: white;
  margin: 5px;
  padding: 10px;
  border-radius: 4px;
  font-family: 'Lato';
  cursor: pointer;
  border: none;
  outline: none;
}

button:hover {
  background: blue;
}

.square {
  pointer-events: none;
  position: relative;
  width: 50px;
  height: 50px;
  background-color: cornflowerblue;
  margin: 4px;
  display: inline-block;
}

.blue {
  background: blue;
}

.red {
  background: red;
}

.black {
  background: black;
}

#special {
  background: orange;
}

.controls {
  margin-top: 300px;
}
var multipleAnimations = anime({
  targets: [document.querySelectorAll('.blue'), '.red, #special'],
  translateY: 250,
  autoplay: false
});


document.querySelector('.play-scan').onclick = multipleAnimations.restart;

External CSS

  1. https://fonts.googleapis.com/css?family=Lato:300

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/animejs/2.0.2/anime.min.js