278 of 313 menu

Propiedad animation-play-state

La propiedad animation-play-state permite establecer el estado de la animación: se reproduce o está en pausa.

Sintaxis

selector { animation-play-state: paused | running; }

Valores

Valor Descripción
paused La animación está en pausa.
running La animación se reproduce.

Valor por defecto: running.

Ejemplo

En este ejemplo, la animación se iniciará al pasar el ratón sobre el elemento, y se detendrá cuando el ratón se retire del elemento:

<div id="elem"></div> @keyframes move { from { width: 200px; } to { width: 400px; } } #elem { animation-play-state: paused; animation-duration: 1s; animation-name: move; animation-iteration-count: infinite; animation-timing-function: linear; border: 1px solid black; height: 50px; } #elem:hover { animation-play-state: running; }

:

Ejemplo . Pasar el ratón sobre otro elemento

Y ahora la animación se iniciará al pasar el ratón sobre otro elemento, y al retirar el ratón de él, se detendrá:

<div id="target"></div> <div id="elem"></div> @keyframes move { from { margin-left: 0; } to { margin-left: 400px; } } #target { border: 1px solid red; margin-bottom: 10px; width: 50px; height: 50px; } #elem { animation-play-state: paused; animation-duration: 3s; animation-name: move; animation-iteration-count: infinite; animation-timing-function: linear; border: 1px solid black; width: 50px; height: 50px; } #target:hover + #elem { animation-play-state: running; border: 1px solid green; }

:

Véase también

Español
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEnglishEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
Usamos cookies para el funcionamiento del sitio, análisis y personalización. El procesamiento de datos se realiza de acuerdo con la Política de privacidad.
aceptar todas configurar rechazar