js add animation to element

JavaScript
let rotate360 = [
  { transform: 'rotate(360deg)' }
];document.getElementById("tunnel").animate([
  // keyframes
  { transform: 'translateY(0px)' },
  { transform: 'translateY(-300px)' }
], {
  // timing options
  duration: 1000,
  iterations: Infinity
});
document.getElementById('test').style.animation = 'fading 2s infinite'
var animation = element.animate(keyframes, options); #test {
    background-color: blue;
    width: 100px;
    height: 100px;
    position: relative;
    -webkit-animation: fading 5s infinite;
    animation: fading 5s infinite;
}

/* Here is the animation (keyframes) */
@keyframes fading {
    0% { opacity: 1; }
    100% { opacity: 0; }
}< script  src = ' /path/to/jquery.keyframes [.min ] .js ' > </ script >
Source

Also in JavaScript: