CSS Property animation-play-state








The animation-play-state property sets whether to run or pause the animation.

Summary

Initial value
running
Inherited
no
CSS Version
CSS3
JavaScript syntax
object.style.animationPlayState="paused"
Animatable
no

CSS Syntax

animation-play-state: paused|running;

Property Values

paused
animation is paused
running
Default value. animation is running

Browser compatibility

animation-play-state 4.0 -webkit- 10.0 16.0 (5.0 -moz-) 4.0 -webkit- 15.0 -webkit- (12.0 -o-)




Example

<!DOCTYPE html>
<html>
<head>
<style> 
div {<!--  ww  w  .jav a 2s  .  c  o  m-->
    width: 100px;
    height: 100px;
    background: red;
    position: relative;
    -webkit-animation: mymove 5s;  /* Chrome, Safari, Opera */
    -webkit-animation-play-state: paused;  /* Chrome, Safari, Opera */
    animation: mymove 5s;
    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>

<div></div>

</body>
</html>

Click to view the demo