--- title: animation-play-state slug: Web/CSS/animation-play-state tags: - CSS - Propriété - Reference translation_of: Web/CSS/animation-play-state ---
La propriété animation-play-state définit si une animation est en cours d'exécution ou si elle est en pause.
Lorsqu'on reprend une animation en pause, celle-ci reprendra où elle avait été interrompue (elle ne recommencera pas depuis le début de la séquence).
/* On a une seule animation */ animation-play-state: running; animation-play-state: paused; /* On gère plusieurs animations */ /* avec des valeurs respectives */ animation-play-state: paused, running, running; /* Valeurs globales */ animation-play-state: inherit; animation-play-state: initial; animation-play-state: unset;
runningpausedNote : Lorsqu'on utilise plusieurs valeurs, séparées par des virgules, pour une propriété animation-*, elles seront respectivement affectées aux animations définies par {{cssxref("animation-name")}}. Pour plus d'informations, voir : paramétrer les valeurs des propriétés pour plusieurs animations.
p {
animation-duration: 3s;
animation-name: glissement;
animation-iteration-count: infinite;
}
.arret {
animation-play-state: paused;
}
.encours {
animation-play-state: running;
}
@keyframes glissement {
from {
margin-left: 100%;
width: 200%;
}
to {
margin-left: 0%;
width: 100%;
}
}
<p class="arret"> La Chenille et Alice se considérèrent un instant en silence. Enfin la Chenille sortit le houka de sa bouche, et lui adressa la parole d’une voix endormie et traînante. </p> <p class="encours"> Alice, un peu irritée du parler bref de la Chenille, se redressa de toute sa hauteur. </p>
{{EmbedLiveSample("Exemples","300","200")}}
| Spécification | État | Commentaires |
|---|---|---|
| {{SpecName('CSS3 Animations', '#animation-play-state', 'animation-play-state')}} | {{Spec2('CSS3 Animations')}} | Définition initiale. |
{{cssinfo}}
{{Compat("css.properties.animation-play-state")}}