La propriété animation-play-state permet de préciser si l'animation est en cours d'exécution ou en pause.
Remarque : utilisez cette propriété dans un JavaScript pour mettre en pause une animation au milieu d'un cycle.
La Syntaxe CSSanimation-play-state: paused|running|initial|inherit;
Valeurs par défaut | Running |
---|---|
Inherited: | non |
Animable : | non En savoir plus sur l'animable |
Version: | CSS3 |
Syntaxe JavaScript: | object.style.animationPlayState="paused" |
Explorateur | ![]() | ![]() | ![]() | ![]() | ![]() | |
---|---|---|---|---|---|---|
Verssion | 43 4 -webkit- | 10 | 16 5 -moz- | 9 4 -webkit- | 30 15 -webkit- 12 -o- |
Exemple Copier le code
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <title> CSS propriété animation-play-state </title> <style> body { text-align:center; width:80%; } h1 { color:green; } .oujood1 { width: 50px; height: 50px; background: green; border-radius:50%; position: relative; -webkit-animation: mymove 10s; -webkit-animation-play-state: play; animation: mymove 5s; animation-play-state: play; } .oujood2 { width: 50px; height: 50px; background: red; border-radius:50%; position: relative; -webkit-animation: mymove 10s; -webkit-animation-play-state: paused; animation: mymove 5s; animation-play-state: paused; } @-webkit-keyframes mymove { from { left: 0%; } to { left: 80%; } } @keyframes mymove { from { left: 0%; } to { left: 80%; } } </style> </head> <body> <h1>oujood.com</h1> <h2>propriété css animation-play-state </h2> <div class = "oujood1"></div><br> <p>L'élément rouge est en pause</p><br> <div class = "oujood2" ></div> </body> </html>
Exemple Copier le code
<div class = "oujood2" onclick='this.style.animationPlayState="running"'></div> <p>Cliquer sur l'élément rouge avant la fin de l'animation, pour lancer son animation</p>
Livre numérique court pour comprendre la méthode secrète permettant d'obtenir des likes sans fin sur Facebook.
GAGNER DE L'ARGENT