Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<style> 
#myDIV {
  width: 100%;
  height: 50px;
  padding: 16px;
  background: orange;
  position: relative;
  font-size: 20px;
  text-align: center;
  animation: mymove 4s infinite;
}
@keyframes mymove {
  from {top: 0px;}
  to {top: 200px;}
}
</style>
<body>
<h1>Animation Events</h1>
<h2>The elapsedTime Property</h2>
<p>This example uses the addEventListener() method to attach an "animationstart" and "animationiteration" event to a DIV element.</p>
<p>The elapsedTime property returns the number of seconds the animation has been running:</p>
<div id="myDIV">The animation has started</div>
<script>
const div = document.getElementById("myDIV");
div.addEventListener("animationiteration", myRepeatFunction);
function myRepeatFunction(event) {
  this.style.backgroundColor = "lightblue";
  this.innerHTML = "Elapsed time: " + event.elapsedTime + " seconds";
}
</script>
</body>
</html>