<div id="anime-demo">
  <div class="square blue"></div>
</div>
<div class="controls">
<button class="play-scale">Animate Scaling</button>
<button class="play-translate">Animate Translation</button>
<button class="play-rotate">Animate Rotation</button>
<button class="play-all">Animate All Properties</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;
}

#anime-demo {
  text-align: left;
}

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

.blue {
  background: blue;
}

.controls {
  margin-top: 100px;
}
var animateScaling = anime({
  targets: '.square',
  scale: 0.8,
  autoplay: false
});


var animateTranslation = anime({
  targets: '.square',
  translateX: window.innerWidth*0.8,
  autoplay: false
});

var animateRotation = anime({
  targets: '.square',
  rotate: '1turn',
  autoplay: false
});

var animateAll = anime({
  targets: '.square',
  scale: 0.8,
  translateX: window.innerWidth*0.8,
  rotate: '1turn',
  autoplay: false
});

document.querySelector('.play-scale').onclick = animateScaling.restart;

document.querySelector('.play-translate').onclick = animateTranslation.restart;

document.querySelector('.play-rotate').onclick = animateRotation.restart;

document.querySelector('.play-all').onclick = animateAll.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