<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
background: red;
position: relative;
animation: mymove 2s 2;
}
@keyframes mymove {
from {left: 0px;}
to {left: 200px;}
}
</style>
</head>
<body>
<p>Click the "Try it" button to make animation play forever!</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.getElementById("myDIV").style.animationIterationCount = "infinite";
}
</script>
<p><strong>Note:</strong> The animationIterationCount property is not supported in Safari.</p>
<div id="myDIV"></div>
</body>
</html>