How to use animation-play-state property

青灯夜游
Release: 2019-02-01 11:19:08
Original
4431 people have browsed it

The animation-play-state attribute is used to specify whether the animation is running or paused; it can be used with JavaScript to achieve the effect of pausing the animation during playback.

How to use animation-play-state property

CSS3 animation-play-state property

Function:animation- The play-state attribute specifies whether the animation is running or paused.

Syntax:

animation-play-state: paused|running;
Copy after login

paused: Specifies that the animation has been paused.

running: Specifies that the animation is playing.

Description: You can use this attribute in JavaScript to pause the animation during playback.

Note: Internet Explorer 9 and earlier versions do not support the animation-play-state attribute.

CSS3 animation-play-state attribute usage example

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 5s;
animation-play-state:running;

/* Safari and Chrome */
-webkit-animation:mymove 5s;
-webkit-animation-play-state:running;
}
div:hover{
animation-play-state:paused;
-webkit-animation-play-state:paused;
}
@keyframes mymove
{
from {left:0px;}
to {left:200px;}
}

@-webkit-keyframes mymove /* Safari and Chrome */
{
from {left:0px;}
to {left:200px;}
}
</style>
</head>
<body>

<div></div>

</body>
</html>
Copy after login

Rendering:

How to use animation-play-state property

The above is the entire content of this article, I hope it will be helpful to everyone's study. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of How to use animation-play-state property. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!