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


/* 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 buttons to Play/Pause the animation:</p>
<button onclick="myPlayFunction()">Play</button>
<button onclick="myPauseFunction()">Pause</button>

<script>
function myPlayFunction() {
    document.getElementById("myDIV").style.WebkitAnimationPlayState = "running"; // Code for Chrome, Safari, and Opera
    document.getElementById("myDIV").style.animationPlayState = "running";
}

function myPauseFunction() {
    document.getElementById("myDIV").style.WebkitAnimationPlayState = "paused"; // Code for Chrome, Safari, and Opera
    document.getElementById("myDIV").style.animationPlayState = "paused";
}
</script>

<p><strong>Note:</strong> The animationPlayState property is not supported in Internet Explorer 9 and earlier versions.</p>
<div id="myDIV"></div>

</body>
</html>