<!DOCTYPE html>
<html>
<head>
<style>
div {
    width: 100px;
    height: 100px;
    background: red;
    position: relative;
    -webkit-animation: mymove 5s infinite;  /* Chrome, Safari, Opera */
    animation: mymove 5s infinite;
}


/* Chrome, Safari, Opera */
@-webkit-keyframes mymove {
    from {left: 0px;}

    to {left: 200px;}
}

@keyframes mymove {
    from {left: 0px;}

    to {left: 200px;}
}
</style>
</head>
<body>

<p>Click the "Try it" button to speed up the duration of the animation.</p>
<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    document.getElementById("myDIV").style.WebkitAnimationDuration = "1s";  // Code for Chrome, Safari, and Opera
    document.getElementById("myDIV").style.animationDuration = "1s";
}
</script>

<p><strong>Note:</strong> The animationDuration property is not supported in IE and Safari.</p>
<div id="myDIV"></div>

</body>
</html>