<div class="box"></div>
<button class="play">Play</button>
body {
  font-family: system-ui;
  background: #252323;
  color: white;
  align-items: center;
}

.box {
  position: relative;
  top: 25vh;
  width: 50px;
  height: 50px;
  background-color: orange;
}

button {
  position: relative;
  top: 25vh;
}
import anime from "https://cdn.skypack.dev/animejs";

var animation = anime({
  targets: '.box',
  translateX: 250,
  scale: 2,
  backgroundColor: '#ff0000',
  rotate: 360,
  autoplay: false,
});

document.querySelector('.play').onclick=animation.play;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

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