<div id="anime-demo">
  <div class="square blue"></div>
</div>
<div class="controls">
<button class="play-left">Animate Left</button>
<button class="play-background">Animate Background</button>
<button class="play-radius">Animate Border Radius</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: 200px;
  height: 200px;
  background-color: cornflowerblue;
  margin: 4px;
  display: inline-block;
}

.blue {
  background: blue;
}

.controls {
  margin-top: 100px;
}
var animateLeft = anime({
  targets: '.square',
  left: '50%',
  autoplay: false
});


var animateBackground = anime({
  targets: '.square',
  backgroundColor: '#f96',
  autoplay: false
});

var animateRadius = anime({
  targets: '.square',
  borderRadius: '50%',
  autoplay: false
});

var animateAll = anime({
  targets: '.square',
  backgroundColor: '#f96',
  borderRadius: '50%',
  left: '50%',
  autoplay: false
});

document.querySelector('.play-left').onclick = animateLeft.restart;

document.querySelector('.play-background').onclick = animateBackground.restart;

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